repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
amaembo/streamex | src/main/java/one/util/streamex/LongStreamEx.java | LongStreamEx.pairMap | public LongStreamEx pairMap(LongBinaryOperator mapper) {
"""
Returns a stream consisting of the results of applying the given function
to the every adjacent pair of elements of this stream.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
<p>
The output stream will contain one element less than this stream. If this
stream contains zero or one element the output stream will be empty.
@param mapper a non-interfering, stateless function to apply to each
adjacent pair of this stream elements.
@return the new stream
@since 0.2.1
"""
return delegate(new PairSpliterator.PSOfLong(mapper, null, spliterator(), PairSpliterator.MODE_PAIRS));
} | java | public LongStreamEx pairMap(LongBinaryOperator mapper) {
return delegate(new PairSpliterator.PSOfLong(mapper, null, spliterator(), PairSpliterator.MODE_PAIRS));
} | [
"public",
"LongStreamEx",
"pairMap",
"(",
"LongBinaryOperator",
"mapper",
")",
"{",
"return",
"delegate",
"(",
"new",
"PairSpliterator",
".",
"PSOfLong",
"(",
"mapper",
",",
"null",
",",
"spliterator",
"(",
")",
",",
"PairSpliterator",
".",
"MODE_PAIRS",
")",
")",
";",
"}"
] | Returns a stream consisting of the results of applying the given function
to the every adjacent pair of elements of this stream.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
<p>
The output stream will contain one element less than this stream. If this
stream contains zero or one element the output stream will be empty.
@param mapper a non-interfering, stateless function to apply to each
adjacent pair of this stream elements.
@return the new stream
@since 0.2.1 | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"results",
"of",
"applying",
"the",
"given",
"function",
"to",
"the",
"every",
"adjacent",
"pair",
"of",
"elements",
"of",
"this",
"stream",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L1383-L1385 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Graphics.java | Graphics.scale | public void scale(float sx, float sy) {
"""
Apply a scaling factor to everything drawn on the graphics context
@param sx
The scaling factor to apply to the x axis
@param sy
The scaling factor to apply to the y axis
"""
this.sx = this.sx * sx;
this.sy = this.sy * sy;
checkPush();
predraw();
GL.glScalef(sx, sy, 1);
postdraw();
} | java | public void scale(float sx, float sy) {
this.sx = this.sx * sx;
this.sy = this.sy * sy;
checkPush();
predraw();
GL.glScalef(sx, sy, 1);
postdraw();
} | [
"public",
"void",
"scale",
"(",
"float",
"sx",
",",
"float",
"sy",
")",
"{",
"this",
".",
"sx",
"=",
"this",
".",
"sx",
"*",
"sx",
";",
"this",
".",
"sy",
"=",
"this",
".",
"sy",
"*",
"sy",
";",
"checkPush",
"(",
")",
";",
"predraw",
"(",
")",
";",
"GL",
".",
"glScalef",
"(",
"sx",
",",
"sy",
",",
"1",
")",
";",
"postdraw",
"(",
")",
";",
"}"
] | Apply a scaling factor to everything drawn on the graphics context
@param sx
The scaling factor to apply to the x axis
@param sy
The scaling factor to apply to the y axis | [
"Apply",
"a",
"scaling",
"factor",
"to",
"everything",
"drawn",
"on",
"the",
"graphics",
"context"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L350-L359 |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/ManifestClassPathUtils.java | ManifestClassPathUtils.addCompleteJarEntryUrls | public static void addCompleteJarEntryUrls(List<ContainerInfo> containers, Entry jarEntry, Collection<String> resolved) throws UnableToAdaptException {
"""
Add the jar entry URLs and its class path URLs.
We need deal with all the thrown exceptions so that it won't interrupt the caller's processing.
@param urls
@param jarEntry
"""
String entryIdentity = createEntryIdentity(jarEntry);
if (!entryIdentity.isEmpty() && !resolved.contains(entryIdentity)) {
resolved.add(entryIdentity);
processMFClasspath(jarEntry, containers, resolved);
}
} | java | public static void addCompleteJarEntryUrls(List<ContainerInfo> containers, Entry jarEntry, Collection<String> resolved) throws UnableToAdaptException {
String entryIdentity = createEntryIdentity(jarEntry);
if (!entryIdentity.isEmpty() && !resolved.contains(entryIdentity)) {
resolved.add(entryIdentity);
processMFClasspath(jarEntry, containers, resolved);
}
} | [
"public",
"static",
"void",
"addCompleteJarEntryUrls",
"(",
"List",
"<",
"ContainerInfo",
">",
"containers",
",",
"Entry",
"jarEntry",
",",
"Collection",
"<",
"String",
">",
"resolved",
")",
"throws",
"UnableToAdaptException",
"{",
"String",
"entryIdentity",
"=",
"createEntryIdentity",
"(",
"jarEntry",
")",
";",
"if",
"(",
"!",
"entryIdentity",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"resolved",
".",
"contains",
"(",
"entryIdentity",
")",
")",
"{",
"resolved",
".",
"add",
"(",
"entryIdentity",
")",
";",
"processMFClasspath",
"(",
"jarEntry",
",",
"containers",
",",
"resolved",
")",
";",
"}",
"}"
] | Add the jar entry URLs and its class path URLs.
We need deal with all the thrown exceptions so that it won't interrupt the caller's processing.
@param urls
@param jarEntry | [
"Add",
"the",
"jar",
"entry",
"URLs",
"and",
"its",
"class",
"path",
"URLs",
".",
"We",
"need",
"deal",
"with",
"all",
"the",
"thrown",
"exceptions",
"so",
"that",
"it",
"won",
"t",
"interrupt",
"the",
"caller",
"s",
"processing",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/ManifestClassPathUtils.java#L177-L183 |
ologolo/streamline-engine | src/org/daisy/streamline/engine/PathTools.java | PathTools.deleteRecursive | public static void deleteRecursive(Path start, boolean deleteStart) throws IOException {
"""
Deletes files and folders at the specified path.
@param start the path
@param deleteStart true if the start path should also be deleted, false if only the contents should be deleted
@throws IOException if an I/O error occurs
"""
Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
if (e == null) {
if (deleteStart || !Files.isSameFile(dir, start)) {
Files.delete(dir);
}
return FileVisitResult.CONTINUE;
} else {
// directory iteration failed
throw e;
}
}
});
} | java | public static void deleteRecursive(Path start, boolean deleteStart) throws IOException {
Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
if (e == null) {
if (deleteStart || !Files.isSameFile(dir, start)) {
Files.delete(dir);
}
return FileVisitResult.CONTINUE;
} else {
// directory iteration failed
throw e;
}
}
});
} | [
"public",
"static",
"void",
"deleteRecursive",
"(",
"Path",
"start",
",",
"boolean",
"deleteStart",
")",
"throws",
"IOException",
"{",
"Files",
".",
"walkFileTree",
"(",
"start",
",",
"new",
"SimpleFileVisitor",
"<",
"Path",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FileVisitResult",
"visitFile",
"(",
"Path",
"file",
",",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"Files",
".",
"delete",
"(",
"file",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"postVisitDirectory",
"(",
"Path",
"dir",
",",
"IOException",
"e",
")",
"throws",
"IOException",
"{",
"if",
"(",
"e",
"==",
"null",
")",
"{",
"if",
"(",
"deleteStart",
"||",
"!",
"Files",
".",
"isSameFile",
"(",
"dir",
",",
"start",
")",
")",
"{",
"Files",
".",
"delete",
"(",
"dir",
")",
";",
"}",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"else",
"{",
"// directory iteration failed",
"throw",
"e",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Deletes files and folders at the specified path.
@param start the path
@param deleteStart true if the start path should also be deleted, false if only the contents should be deleted
@throws IOException if an I/O error occurs | [
"Deletes",
"files",
"and",
"folders",
"at",
"the",
"specified",
"path",
"."
] | train | https://github.com/ologolo/streamline-engine/blob/04b7adc85d84d91dc5f0eaaa401d2738f9401b17/src/org/daisy/streamline/engine/PathTools.java#L70-L90 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/LogQueryBean.java | LogQueryBean.setLevels | public void setLevels(Level minLevel, Level maxLevel) throws IllegalArgumentException {
"""
sets the current value for the minimum and maximum levels
@param minLevel minimum level
@throws IllegalArgumentException if minLevel is bigger than maxLevel
"""
if (minLevel != null && maxLevel != null && minLevel.intValue() > maxLevel.intValue()) {
throw new IllegalArgumentException("Value of the minLevel parameter should specify level not larger than the value of the maxLevel parametere.");
}
this.minLevel = minLevel;
this.maxLevel = maxLevel;
} | java | public void setLevels(Level minLevel, Level maxLevel) throws IllegalArgumentException {
if (minLevel != null && maxLevel != null && minLevel.intValue() > maxLevel.intValue()) {
throw new IllegalArgumentException("Value of the minLevel parameter should specify level not larger than the value of the maxLevel parametere.");
}
this.minLevel = minLevel;
this.maxLevel = maxLevel;
} | [
"public",
"void",
"setLevels",
"(",
"Level",
"minLevel",
",",
"Level",
"maxLevel",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"minLevel",
"!=",
"null",
"&&",
"maxLevel",
"!=",
"null",
"&&",
"minLevel",
".",
"intValue",
"(",
")",
">",
"maxLevel",
".",
"intValue",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Value of the minLevel parameter should specify level not larger than the value of the maxLevel parametere.\"",
")",
";",
"}",
"this",
".",
"minLevel",
"=",
"minLevel",
";",
"this",
".",
"maxLevel",
"=",
"maxLevel",
";",
"}"
] | sets the current value for the minimum and maximum levels
@param minLevel minimum level
@throws IllegalArgumentException if minLevel is bigger than maxLevel | [
"sets",
"the",
"current",
"value",
"for",
"the",
"minimum",
"and",
"maximum",
"levels"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/LogQueryBean.java#L102-L108 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/asm/AsmUtils.java | AsmUtils.insnEqual | public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) {
"""
Checks if two {@link AbstractInsnNode} are equals.
@param node1 the node1
@param node2 the node2
@return true, if equal
"""
if (node1 == null || node2 == null || node1.getOpcode() != node2.getOpcode())
return false;
switch (node2.getType())
{
case VAR_INSN:
return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2);
case TYPE_INSN:
return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2);
case FIELD_INSN:
return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2);
case METHOD_INSN:
return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2);
case LDC_INSN:
return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2);
case IINC_INSN:
return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2);
case INT_INSN:
return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2);
default:
return true;
}
} | java | public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2)
{
if (node1 == null || node2 == null || node1.getOpcode() != node2.getOpcode())
return false;
switch (node2.getType())
{
case VAR_INSN:
return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2);
case TYPE_INSN:
return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2);
case FIELD_INSN:
return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2);
case METHOD_INSN:
return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2);
case LDC_INSN:
return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2);
case IINC_INSN:
return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2);
case INT_INSN:
return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2);
default:
return true;
}
} | [
"public",
"static",
"boolean",
"insnEqual",
"(",
"AbstractInsnNode",
"node1",
",",
"AbstractInsnNode",
"node2",
")",
"{",
"if",
"(",
"node1",
"==",
"null",
"||",
"node2",
"==",
"null",
"||",
"node1",
".",
"getOpcode",
"(",
")",
"!=",
"node2",
".",
"getOpcode",
"(",
")",
")",
"return",
"false",
";",
"switch",
"(",
"node2",
".",
"getType",
"(",
")",
")",
"{",
"case",
"VAR_INSN",
":",
"return",
"varInsnEqual",
"(",
"(",
"VarInsnNode",
")",
"node1",
",",
"(",
"VarInsnNode",
")",
"node2",
")",
";",
"case",
"TYPE_INSN",
":",
"return",
"typeInsnEqual",
"(",
"(",
"TypeInsnNode",
")",
"node1",
",",
"(",
"TypeInsnNode",
")",
"node2",
")",
";",
"case",
"FIELD_INSN",
":",
"return",
"fieldInsnEqual",
"(",
"(",
"FieldInsnNode",
")",
"node1",
",",
"(",
"FieldInsnNode",
")",
"node2",
")",
";",
"case",
"METHOD_INSN",
":",
"return",
"methodInsnEqual",
"(",
"(",
"MethodInsnNode",
")",
"node1",
",",
"(",
"MethodInsnNode",
")",
"node2",
")",
";",
"case",
"LDC_INSN",
":",
"return",
"ldcInsnEqual",
"(",
"(",
"LdcInsnNode",
")",
"node1",
",",
"(",
"LdcInsnNode",
")",
"node2",
")",
";",
"case",
"IINC_INSN",
":",
"return",
"iincInsnEqual",
"(",
"(",
"IincInsnNode",
")",
"node1",
",",
"(",
"IincInsnNode",
")",
"node2",
")",
";",
"case",
"INT_INSN",
":",
"return",
"intInsnEqual",
"(",
"(",
"IntInsnNode",
")",
"node1",
",",
"(",
"IntInsnNode",
")",
"node2",
")",
";",
"default",
":",
"return",
"true",
";",
"}",
"}"
] | Checks if two {@link AbstractInsnNode} are equals.
@param node1 the node1
@param node2 the node2
@return true, if equal | [
"Checks",
"if",
"two",
"{",
"@link",
"AbstractInsnNode",
"}",
"are",
"equals",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/asm/AsmUtils.java#L147-L171 |
ecclesia/kipeto | kipeto-tools/src/main/java/de/ecclesia/kipeto/tools/blueprint/BlueprintFactory.java | BlueprintFactory.fromDir | public Blueprint fromDir(String programId, String description, File rootDir) {
"""
Erstellt einen Blueprint aus dem übergebenen RootDir. Blobs und Directorys werden sofort im übergebenen
Repository gespeichert. Der Blueprint selbst wird <b>nicht</b> von gepeichert.<br/>
<br/>
Alle Dateien werden GZIP komprimiert
@param programId
Name
@param description
Beschreibung
@param rootDir
Einstiegsverzeichnis
@return
"""
return new Blueprint(programId, description, processDir(rootDir), null);
} | java | public Blueprint fromDir(String programId, String description, File rootDir) {
return new Blueprint(programId, description, processDir(rootDir), null);
} | [
"public",
"Blueprint",
"fromDir",
"(",
"String",
"programId",
",",
"String",
"description",
",",
"File",
"rootDir",
")",
"{",
"return",
"new",
"Blueprint",
"(",
"programId",
",",
"description",
",",
"processDir",
"(",
"rootDir",
")",
",",
"null",
")",
";",
"}"
] | Erstellt einen Blueprint aus dem übergebenen RootDir. Blobs und Directorys werden sofort im übergebenen
Repository gespeichert. Der Blueprint selbst wird <b>nicht</b> von gepeichert.<br/>
<br/>
Alle Dateien werden GZIP komprimiert
@param programId
Name
@param description
Beschreibung
@param rootDir
Einstiegsverzeichnis
@return | [
"Erstellt",
"einen",
"Blueprint",
"aus",
"dem",
"übergebenen",
"RootDir",
".",
"Blobs",
"und",
"Directorys",
"werden",
"sofort",
"im",
"übergebenen",
"Repository",
"gespeichert",
".",
"Der",
"Blueprint",
"selbst",
"wird",
"<b",
">",
"nicht<",
"/",
"b",
">",
"von",
"gepeichert",
".",
"<br",
"/",
">",
"<br",
"/",
">",
"Alle",
"Dateien",
"werden",
"GZIP",
"komprimiert"
] | train | https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-tools/src/main/java/de/ecclesia/kipeto/tools/blueprint/BlueprintFactory.java#L71-L73 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/Rational.java | Rational.toFString | public String toFString(int digits) {
"""
Return a string in floating point format.
@param digits The precision (number of digits)
@return The human-readable version in base 10.
"""
if (b.compareTo(BigInteger.ONE) != 0) {
MathContext mc = new MathContext(digits, RoundingMode.DOWN);
BigDecimal f = (new BigDecimal(a)).divide(new BigDecimal(b), mc);
return (f.toString());
} else {
return a.toString();
}
} | java | public String toFString(int digits) {
if (b.compareTo(BigInteger.ONE) != 0) {
MathContext mc = new MathContext(digits, RoundingMode.DOWN);
BigDecimal f = (new BigDecimal(a)).divide(new BigDecimal(b), mc);
return (f.toString());
} else {
return a.toString();
}
} | [
"public",
"String",
"toFString",
"(",
"int",
"digits",
")",
"{",
"if",
"(",
"b",
".",
"compareTo",
"(",
"BigInteger",
".",
"ONE",
")",
"!=",
"0",
")",
"{",
"MathContext",
"mc",
"=",
"new",
"MathContext",
"(",
"digits",
",",
"RoundingMode",
".",
"DOWN",
")",
";",
"BigDecimal",
"f",
"=",
"(",
"new",
"BigDecimal",
"(",
"a",
")",
")",
".",
"divide",
"(",
"new",
"BigDecimal",
"(",
"b",
")",
",",
"mc",
")",
";",
"return",
"(",
"f",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"a",
".",
"toString",
"(",
")",
";",
"}",
"}"
] | Return a string in floating point format.
@param digits The precision (number of digits)
@return The human-readable version in base 10. | [
"Return",
"a",
"string",
"in",
"floating",
"point",
"format",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/Rational.java#L510-L518 |
Alluxio/alluxio | job/server/src/main/java/alluxio/worker/JobWorkerIdRegistry.java | JobWorkerIdRegistry.registerWorker | public static void registerWorker(JobMasterClient jobMasterClient, WorkerNetAddress workerAddress)
throws IOException, ConnectionFailedException {
"""
Registers with {@link JobMaster} to get a new job worker id.
@param jobMasterClient the job master client to be used for RPC
@param workerAddress current worker address
@throws IOException when fails to get a new worker id
@throws ConnectionFailedException if network connection failed
"""
sWorkerId.set(jobMasterClient.registerWorker(workerAddress));
} | java | public static void registerWorker(JobMasterClient jobMasterClient, WorkerNetAddress workerAddress)
throws IOException, ConnectionFailedException {
sWorkerId.set(jobMasterClient.registerWorker(workerAddress));
} | [
"public",
"static",
"void",
"registerWorker",
"(",
"JobMasterClient",
"jobMasterClient",
",",
"WorkerNetAddress",
"workerAddress",
")",
"throws",
"IOException",
",",
"ConnectionFailedException",
"{",
"sWorkerId",
".",
"set",
"(",
"jobMasterClient",
".",
"registerWorker",
"(",
"workerAddress",
")",
")",
";",
"}"
] | Registers with {@link JobMaster} to get a new job worker id.
@param jobMasterClient the job master client to be used for RPC
@param workerAddress current worker address
@throws IOException when fails to get a new worker id
@throws ConnectionFailedException if network connection failed | [
"Registers",
"with",
"{",
"@link",
"JobMaster",
"}",
"to",
"get",
"a",
"new",
"job",
"worker",
"id",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/worker/JobWorkerIdRegistry.java#L48-L51 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java | EntityMetadata.updateMasterPropertyMetadataMap | public void updateMasterPropertyMetadataMap(String mappedName, String qualifiedName) {
"""
Updates the master property metadata map with the given property metadata.
@param mappedName
the mapped name (or property name in the datastore)
@param qualifiedName
the qualified name of the field
@throws EntityManagerException
if a property with the same mapped name already exists.
"""
String old = masterPropertyMetadataMap.put(mappedName, qualifiedName);
if (old != null) {
String message = "Duplicate property %s in entity %s. Check fields %s and %s";
throw new EntityManagerException(
String.format(message, mappedName, entityClass.getName(), old, qualifiedName));
}
} | java | public void updateMasterPropertyMetadataMap(String mappedName, String qualifiedName) {
String old = masterPropertyMetadataMap.put(mappedName, qualifiedName);
if (old != null) {
String message = "Duplicate property %s in entity %s. Check fields %s and %s";
throw new EntityManagerException(
String.format(message, mappedName, entityClass.getName(), old, qualifiedName));
}
} | [
"public",
"void",
"updateMasterPropertyMetadataMap",
"(",
"String",
"mappedName",
",",
"String",
"qualifiedName",
")",
"{",
"String",
"old",
"=",
"masterPropertyMetadataMap",
".",
"put",
"(",
"mappedName",
",",
"qualifiedName",
")",
";",
"if",
"(",
"old",
"!=",
"null",
")",
"{",
"String",
"message",
"=",
"\"Duplicate property %s in entity %s. Check fields %s and %s\"",
";",
"throw",
"new",
"EntityManagerException",
"(",
"String",
".",
"format",
"(",
"message",
",",
"mappedName",
",",
"entityClass",
".",
"getName",
"(",
")",
",",
"old",
",",
"qualifiedName",
")",
")",
";",
"}",
"}"
] | Updates the master property metadata map with the given property metadata.
@param mappedName
the mapped name (or property name in the datastore)
@param qualifiedName
the qualified name of the field
@throws EntityManagerException
if a property with the same mapped name already exists. | [
"Updates",
"the",
"master",
"property",
"metadata",
"map",
"with",
"the",
"given",
"property",
"metadata",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityMetadata.java#L352-L360 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java | Blob.copyTo | public CopyWriter copyTo(String targetBucket, BlobSourceOption... options) {
"""
Sends a copy request for the current blob to the target bucket, preserving its name. Possibly
copying also some of the metadata (e.g. content-type).
<p>Example of copying the blob to a different bucket, keeping the original name.
<pre>{@code
String bucketName = "my_unique_bucket";
CopyWriter copyWriter = blob.copyTo(bucketName);
Blob copiedBlob = copyWriter.getResult();
}</pre>
@param targetBucket target bucket's name
@param options source blob options
@return a {@link CopyWriter} object that can be used to get information on the newly created
blob or to complete the copy if more than one RPC request is needed
@throws StorageException upon failure
"""
return copyTo(targetBucket, getName(), options);
} | java | public CopyWriter copyTo(String targetBucket, BlobSourceOption... options) {
return copyTo(targetBucket, getName(), options);
} | [
"public",
"CopyWriter",
"copyTo",
"(",
"String",
"targetBucket",
",",
"BlobSourceOption",
"...",
"options",
")",
"{",
"return",
"copyTo",
"(",
"targetBucket",
",",
"getName",
"(",
")",
",",
"options",
")",
";",
"}"
] | Sends a copy request for the current blob to the target bucket, preserving its name. Possibly
copying also some of the metadata (e.g. content-type).
<p>Example of copying the blob to a different bucket, keeping the original name.
<pre>{@code
String bucketName = "my_unique_bucket";
CopyWriter copyWriter = blob.copyTo(bucketName);
Blob copiedBlob = copyWriter.getResult();
}</pre>
@param targetBucket target bucket's name
@param options source blob options
@return a {@link CopyWriter} object that can be used to get information on the newly created
blob or to complete the copy if more than one RPC request is needed
@throws StorageException upon failure | [
"Sends",
"a",
"copy",
"request",
"for",
"the",
"current",
"blob",
"to",
"the",
"target",
"bucket",
"preserving",
"its",
"name",
".",
"Possibly",
"copying",
"also",
"some",
"of",
"the",
"metadata",
"(",
"e",
".",
"g",
".",
"content",
"-",
"type",
")",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java#L606-L608 |
groupon/odo | client/src/main/java/com/groupon/odo/client/Client.java | Client.exportConfigurationAndProfile | public JSONObject exportConfigurationAndProfile(String oldExport) {
"""
Export the odo overrides setup and odo configuration
@param oldExport Whether this is a backup from scratch or backing up because user will upload after (matches API)
@return The odo configuration and overrides in JSON format, can be written to a file after
"""
try {
BasicNameValuePair[] params = {
new BasicNameValuePair("oldExport", oldExport)
};
String url = BASE_BACKUP_PROFILE + "/" + uriEncode(this._profileName) + "/" + this._clientId;
return new JSONObject(doGet(url, new BasicNameValuePair[]{}));
} catch (Exception e) {
return new JSONObject();
}
} | java | public JSONObject exportConfigurationAndProfile(String oldExport) {
try {
BasicNameValuePair[] params = {
new BasicNameValuePair("oldExport", oldExport)
};
String url = BASE_BACKUP_PROFILE + "/" + uriEncode(this._profileName) + "/" + this._clientId;
return new JSONObject(doGet(url, new BasicNameValuePair[]{}));
} catch (Exception e) {
return new JSONObject();
}
} | [
"public",
"JSONObject",
"exportConfigurationAndProfile",
"(",
"String",
"oldExport",
")",
"{",
"try",
"{",
"BasicNameValuePair",
"[",
"]",
"params",
"=",
"{",
"new",
"BasicNameValuePair",
"(",
"\"oldExport\"",
",",
"oldExport",
")",
"}",
";",
"String",
"url",
"=",
"BASE_BACKUP_PROFILE",
"+",
"\"/\"",
"+",
"uriEncode",
"(",
"this",
".",
"_profileName",
")",
"+",
"\"/\"",
"+",
"this",
".",
"_clientId",
";",
"return",
"new",
"JSONObject",
"(",
"doGet",
"(",
"url",
",",
"new",
"BasicNameValuePair",
"[",
"]",
"{",
"}",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"new",
"JSONObject",
"(",
")",
";",
"}",
"}"
] | Export the odo overrides setup and odo configuration
@param oldExport Whether this is a backup from scratch or backing up because user will upload after (matches API)
@return The odo configuration and overrides in JSON format, can be written to a file after | [
"Export",
"the",
"odo",
"overrides",
"setup",
"and",
"odo",
"configuration"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L1372-L1382 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java | Currency.getName | public String getName(ULocale locale, int nameStyle, boolean[] isChoiceFormat) {
"""
Returns the display name for the given currency in the
given locale. For example, the display name for the USD
currency object in the en_US locale is "$".
@param locale locale in which to display currency
@param nameStyle selector for which kind of name to return.
The nameStyle should be either SYMBOL_NAME or
LONG_NAME. Otherwise, throw IllegalArgumentException.
@param isChoiceFormat fill-in; isChoiceFormat[0] is set to true
if the returned value is a ChoiceFormat pattern; otherwise it
is set to false
@return display string for this currency. If the resource data
contains no entry for this currency, then the ISO 4217 code is
returned. If isChoiceFormat[0] is true, then the result is a
ChoiceFormat pattern. Otherwise it is a static string. <b>Note:</b>
as of ICU 4.4, choice formats are not used, and the value returned
in isChoiceFormat is always false.
<p>
@throws IllegalArgumentException if the nameStyle is not SYMBOL_NAME
or LONG_NAME.
@see #getName(ULocale, int, String, boolean[])
"""
if (!(nameStyle == SYMBOL_NAME || nameStyle == LONG_NAME)) {
throw new IllegalArgumentException("bad name style: " + nameStyle);
}
// We no longer support choice format data in names. Data should not contain
// choice patterns.
if (isChoiceFormat != null) {
isChoiceFormat[0] = false;
}
CurrencyDisplayNames names = CurrencyDisplayNames.getInstance(locale);
return nameStyle == SYMBOL_NAME ? names.getSymbol(subType) : names.getName(subType);
} | java | public String getName(ULocale locale, int nameStyle, boolean[] isChoiceFormat) {
if (!(nameStyle == SYMBOL_NAME || nameStyle == LONG_NAME)) {
throw new IllegalArgumentException("bad name style: " + nameStyle);
}
// We no longer support choice format data in names. Data should not contain
// choice patterns.
if (isChoiceFormat != null) {
isChoiceFormat[0] = false;
}
CurrencyDisplayNames names = CurrencyDisplayNames.getInstance(locale);
return nameStyle == SYMBOL_NAME ? names.getSymbol(subType) : names.getName(subType);
} | [
"public",
"String",
"getName",
"(",
"ULocale",
"locale",
",",
"int",
"nameStyle",
",",
"boolean",
"[",
"]",
"isChoiceFormat",
")",
"{",
"if",
"(",
"!",
"(",
"nameStyle",
"==",
"SYMBOL_NAME",
"||",
"nameStyle",
"==",
"LONG_NAME",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"bad name style: \"",
"+",
"nameStyle",
")",
";",
"}",
"// We no longer support choice format data in names. Data should not contain",
"// choice patterns.",
"if",
"(",
"isChoiceFormat",
"!=",
"null",
")",
"{",
"isChoiceFormat",
"[",
"0",
"]",
"=",
"false",
";",
"}",
"CurrencyDisplayNames",
"names",
"=",
"CurrencyDisplayNames",
".",
"getInstance",
"(",
"locale",
")",
";",
"return",
"nameStyle",
"==",
"SYMBOL_NAME",
"?",
"names",
".",
"getSymbol",
"(",
"subType",
")",
":",
"names",
".",
"getName",
"(",
"subType",
")",
";",
"}"
] | Returns the display name for the given currency in the
given locale. For example, the display name for the USD
currency object in the en_US locale is "$".
@param locale locale in which to display currency
@param nameStyle selector for which kind of name to return.
The nameStyle should be either SYMBOL_NAME or
LONG_NAME. Otherwise, throw IllegalArgumentException.
@param isChoiceFormat fill-in; isChoiceFormat[0] is set to true
if the returned value is a ChoiceFormat pattern; otherwise it
is set to false
@return display string for this currency. If the resource data
contains no entry for this currency, then the ISO 4217 code is
returned. If isChoiceFormat[0] is true, then the result is a
ChoiceFormat pattern. Otherwise it is a static string. <b>Note:</b>
as of ICU 4.4, choice formats are not used, and the value returned
in isChoiceFormat is always false.
<p>
@throws IllegalArgumentException if the nameStyle is not SYMBOL_NAME
or LONG_NAME.
@see #getName(ULocale, int, String, boolean[]) | [
"Returns",
"the",
"display",
"name",
"for",
"the",
"given",
"currency",
"in",
"the",
"given",
"locale",
".",
"For",
"example",
"the",
"display",
"name",
"for",
"the",
"USD",
"currency",
"object",
"in",
"the",
"en_US",
"locale",
"is",
"$",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L528-L541 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java | BootstrapConfig.addMissingProperties | protected void addMissingProperties(Properties source, Map<String, String> target) {
"""
Add properties from source to target if the target map does not
already contain a property with that value. When a new attribute
is discovered, System properties are checked to see if an override
has been specified. If the property is present as a System property
(from the command line or jvm.options), that value is used instead
of bootstrap.properties.
@param source The source properties file (bootstrap.properties or include)
@param target The target map
"""
if (source == null || source.isEmpty() || target == null)
return;
// only add "new" properties (first value wins)
for (String key : source.stringPropertyNames()) {
if (!target.containsKey(key) && key.length() > 0) {
// Check for a System property override first.
String value = System.getProperty(key);
if (value == null) {
value = source.getProperty(key);
}
// store the value in the target map
target.put(key, value);
}
}
} | java | protected void addMissingProperties(Properties source, Map<String, String> target) {
if (source == null || source.isEmpty() || target == null)
return;
// only add "new" properties (first value wins)
for (String key : source.stringPropertyNames()) {
if (!target.containsKey(key) && key.length() > 0) {
// Check for a System property override first.
String value = System.getProperty(key);
if (value == null) {
value = source.getProperty(key);
}
// store the value in the target map
target.put(key, value);
}
}
} | [
"protected",
"void",
"addMissingProperties",
"(",
"Properties",
"source",
",",
"Map",
"<",
"String",
",",
"String",
">",
"target",
")",
"{",
"if",
"(",
"source",
"==",
"null",
"||",
"source",
".",
"isEmpty",
"(",
")",
"||",
"target",
"==",
"null",
")",
"return",
";",
"// only add \"new\" properties (first value wins)",
"for",
"(",
"String",
"key",
":",
"source",
".",
"stringPropertyNames",
"(",
")",
")",
"{",
"if",
"(",
"!",
"target",
".",
"containsKey",
"(",
"key",
")",
"&&",
"key",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"// Check for a System property override first.",
"String",
"value",
"=",
"System",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"source",
".",
"getProperty",
"(",
"key",
")",
";",
"}",
"// store the value in the target map",
"target",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"}",
"}"
] | Add properties from source to target if the target map does not
already contain a property with that value. When a new attribute
is discovered, System properties are checked to see if an override
has been specified. If the property is present as a System property
(from the command line or jvm.options), that value is used instead
of bootstrap.properties.
@param source The source properties file (bootstrap.properties or include)
@param target The target map | [
"Add",
"properties",
"from",
"source",
"to",
"target",
"if",
"the",
"target",
"map",
"does",
"not",
"already",
"contain",
"a",
"property",
"with",
"that",
"value",
".",
"When",
"a",
"new",
"attribute",
"is",
"discovered",
"System",
"properties",
"are",
"checked",
"to",
"see",
"if",
"an",
"override",
"has",
"been",
"specified",
".",
"If",
"the",
"property",
"is",
"present",
"as",
"a",
"System",
"property",
"(",
"from",
"the",
"command",
"line",
"or",
"jvm",
".",
"options",
")",
"that",
"value",
"is",
"used",
"instead",
"of",
"bootstrap",
".",
"properties",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L706-L722 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/context/ContextManager.java | ContextManager.destroySubcontext | public void destroySubcontext(String name) throws EntityHasDescendantsException, EntityNotFoundException, WIMSystemException {
"""
Delete the given name from the LDAP tree.
@param name The distinguished name to delete.
@throws EntityHasDescendantsException The context being destroyed is not empty.
@throws EntityNotFoundException If part of the name cannot be found to destroy the entity.
@throws WIMSystemException If any other {@link NamingException} occurs or the context cannot be released.
"""
TimedDirContext ctx = getDirContext();
// checkWritePermission(ctx); // TODO Why are we not checking permissions here?
try {
try {
ctx.destroySubcontext(new LdapName(name));
} catch (NamingException e) {
if (!isConnectionException(e)) {
throw e;
}
ctx = reCreateDirContext(ctx, e.toString());
ctx.destroySubcontext(new LdapName(name));
}
} catch (ContextNotEmptyException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.ENTITY_HAS_DESCENDENTS, WIMMessageHelper.generateMsgParms(name));
throw new EntityHasDescendantsException(WIMMessageKey.ENTITY_HAS_DESCENDENTS, msg, e);
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.LDAP_ENTRY_NOT_FOUND, WIMMessageHelper.generateMsgParms(name, e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.LDAP_ENTRY_NOT_FOUND, msg, e);
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
releaseDirContext(ctx);
}
} | java | public void destroySubcontext(String name) throws EntityHasDescendantsException, EntityNotFoundException, WIMSystemException {
TimedDirContext ctx = getDirContext();
// checkWritePermission(ctx); // TODO Why are we not checking permissions here?
try {
try {
ctx.destroySubcontext(new LdapName(name));
} catch (NamingException e) {
if (!isConnectionException(e)) {
throw e;
}
ctx = reCreateDirContext(ctx, e.toString());
ctx.destroySubcontext(new LdapName(name));
}
} catch (ContextNotEmptyException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.ENTITY_HAS_DESCENDENTS, WIMMessageHelper.generateMsgParms(name));
throw new EntityHasDescendantsException(WIMMessageKey.ENTITY_HAS_DESCENDENTS, msg, e);
} catch (NameNotFoundException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.LDAP_ENTRY_NOT_FOUND, WIMMessageHelper.generateMsgParms(name, e.toString(true)));
throw new EntityNotFoundException(WIMMessageKey.LDAP_ENTRY_NOT_FOUND, msg, e);
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
} finally {
releaseDirContext(ctx);
}
} | [
"public",
"void",
"destroySubcontext",
"(",
"String",
"name",
")",
"throws",
"EntityHasDescendantsException",
",",
"EntityNotFoundException",
",",
"WIMSystemException",
"{",
"TimedDirContext",
"ctx",
"=",
"getDirContext",
"(",
")",
";",
"// checkWritePermission(ctx); // TODO Why are we not checking permissions here?",
"try",
"{",
"try",
"{",
"ctx",
".",
"destroySubcontext",
"(",
"new",
"LdapName",
"(",
"name",
")",
")",
";",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"if",
"(",
"!",
"isConnectionException",
"(",
"e",
")",
")",
"{",
"throw",
"e",
";",
"}",
"ctx",
"=",
"reCreateDirContext",
"(",
"ctx",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"ctx",
".",
"destroySubcontext",
"(",
"new",
"LdapName",
"(",
"name",
")",
")",
";",
"}",
"}",
"catch",
"(",
"ContextNotEmptyException",
"e",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"ENTITY_HAS_DESCENDENTS",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"name",
")",
")",
";",
"throw",
"new",
"EntityHasDescendantsException",
"(",
"WIMMessageKey",
".",
"ENTITY_HAS_DESCENDENTS",
",",
"msg",
",",
"e",
")",
";",
"}",
"catch",
"(",
"NameNotFoundException",
"e",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"LDAP_ENTRY_NOT_FOUND",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"name",
",",
"e",
".",
"toString",
"(",
"true",
")",
")",
")",
";",
"throw",
"new",
"EntityNotFoundException",
"(",
"WIMMessageKey",
".",
"LDAP_ENTRY_NOT_FOUND",
",",
"msg",
",",
"e",
")",
";",
"}",
"catch",
"(",
"NamingException",
"e",
")",
"{",
"String",
"msg",
"=",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"WIMMessageHelper",
".",
"generateMsgParms",
"(",
"e",
".",
"toString",
"(",
"true",
")",
")",
")",
";",
"throw",
"new",
"WIMSystemException",
"(",
"WIMMessageKey",
".",
"NAMING_EXCEPTION",
",",
"msg",
",",
"e",
")",
";",
"}",
"finally",
"{",
"releaseDirContext",
"(",
"ctx",
")",
";",
"}",
"}"
] | Delete the given name from the LDAP tree.
@param name The distinguished name to delete.
@throws EntityHasDescendantsException The context being destroyed is not empty.
@throws EntityNotFoundException If part of the name cannot be found to destroy the entity.
@throws WIMSystemException If any other {@link NamingException} occurs or the context cannot be released. | [
"Delete",
"the",
"given",
"name",
"from",
"the",
"LDAP",
"tree",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/context/ContextManager.java#L579-L604 |
zandero/rest.vertx | src/main/java/com/zandero/rest/RestBuilder.java | RestBuilder.addProvider | public <T> RestBuilder addProvider(Class<T> clazz, Class<? extends ContextProvider<T>> provider) {
"""
Creates a provider that delivers type when needed
@param provider to be executed when needed
@param <T> provided object as argument
@return builder
"""
Assert.notNull(clazz, "Missing provided class type!");
Assert.notNull(provider, "Missing context provider!");
registeredProviders.put(clazz, provider);
return this;
} | java | public <T> RestBuilder addProvider(Class<T> clazz, Class<? extends ContextProvider<T>> provider) {
Assert.notNull(clazz, "Missing provided class type!");
Assert.notNull(provider, "Missing context provider!");
registeredProviders.put(clazz, provider);
return this;
} | [
"public",
"<",
"T",
">",
"RestBuilder",
"addProvider",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Class",
"<",
"?",
"extends",
"ContextProvider",
"<",
"T",
">",
">",
"provider",
")",
"{",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Missing provided class type!\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"provider",
",",
"\"Missing context provider!\"",
")",
";",
"registeredProviders",
".",
"put",
"(",
"clazz",
",",
"provider",
")",
";",
"return",
"this",
";",
"}"
] | Creates a provider that delivers type when needed
@param provider to be executed when needed
@param <T> provided object as argument
@return builder | [
"Creates",
"a",
"provider",
"that",
"delivers",
"type",
"when",
"needed"
] | train | https://github.com/zandero/rest.vertx/blob/ba458720cf59e076953eab9dac7227eeaf9e58ce/src/main/java/com/zandero/rest/RestBuilder.java#L353-L359 |
meltmedia/cadmium | email/src/main/java/com/meltmedia/cadmium/email/EmailUtil.java | EmailUtil.newHtmlAttachmentBodyPart | public static MimeBodyPart newHtmlAttachmentBodyPart( URL contentUrl, String contentId )
throws MessagingException {
"""
Creates a body part for an attachment that is used by an html body part.
"""
MimeBodyPart mimeBodyPart = new MimeBodyPart();
mimeBodyPart.setDataHandler(new DataHandler(contentUrl));
if( contentId != null ) {
mimeBodyPart.setHeader("Content-ID", contentId);
}
return mimeBodyPart;
} | java | public static MimeBodyPart newHtmlAttachmentBodyPart( URL contentUrl, String contentId )
throws MessagingException
{
MimeBodyPart mimeBodyPart = new MimeBodyPart();
mimeBodyPart.setDataHandler(new DataHandler(contentUrl));
if( contentId != null ) {
mimeBodyPart.setHeader("Content-ID", contentId);
}
return mimeBodyPart;
} | [
"public",
"static",
"MimeBodyPart",
"newHtmlAttachmentBodyPart",
"(",
"URL",
"contentUrl",
",",
"String",
"contentId",
")",
"throws",
"MessagingException",
"{",
"MimeBodyPart",
"mimeBodyPart",
"=",
"new",
"MimeBodyPart",
"(",
")",
";",
"mimeBodyPart",
".",
"setDataHandler",
"(",
"new",
"DataHandler",
"(",
"contentUrl",
")",
")",
";",
"if",
"(",
"contentId",
"!=",
"null",
")",
"{",
"mimeBodyPart",
".",
"setHeader",
"(",
"\"Content-ID\"",
",",
"contentId",
")",
";",
"}",
"return",
"mimeBodyPart",
";",
"}"
] | Creates a body part for an attachment that is used by an html body part. | [
"Creates",
"a",
"body",
"part",
"for",
"an",
"attachment",
"that",
"is",
"used",
"by",
"an",
"html",
"body",
"part",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/email/src/main/java/com/meltmedia/cadmium/email/EmailUtil.java#L102-L111 |
rampo/UpdateChecker | library/src/main/java/com/rampo/updatechecker/Comparator.java | Comparator.isVersionDownloadableNewer | public static boolean isVersionDownloadableNewer(Activity mActivity, String versionDownloadable) {
"""
Compare the string versionDownloadable to the version installed of the app.
@param versionDownloadable String to compare to the version installed of the app.
"""
String versionInstalled = null;
try {
versionInstalled = mActivity.getPackageManager().getPackageInfo(mActivity.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException ignored) {
}
if (versionInstalled.equals(versionDownloadable)) { // If it is equal, no new version downloadable
return false;
} else {
return versionCompareNumerically(versionDownloadable, versionInstalled) > 0; // Return if the versionDownloadble is newer than the installed
}
} | java | public static boolean isVersionDownloadableNewer(Activity mActivity, String versionDownloadable) {
String versionInstalled = null;
try {
versionInstalled = mActivity.getPackageManager().getPackageInfo(mActivity.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException ignored) {
}
if (versionInstalled.equals(versionDownloadable)) { // If it is equal, no new version downloadable
return false;
} else {
return versionCompareNumerically(versionDownloadable, versionInstalled) > 0; // Return if the versionDownloadble is newer than the installed
}
} | [
"public",
"static",
"boolean",
"isVersionDownloadableNewer",
"(",
"Activity",
"mActivity",
",",
"String",
"versionDownloadable",
")",
"{",
"String",
"versionInstalled",
"=",
"null",
";",
"try",
"{",
"versionInstalled",
"=",
"mActivity",
".",
"getPackageManager",
"(",
")",
".",
"getPackageInfo",
"(",
"mActivity",
".",
"getPackageName",
"(",
")",
",",
"0",
")",
".",
"versionName",
";",
"}",
"catch",
"(",
"PackageManager",
".",
"NameNotFoundException",
"ignored",
")",
"{",
"}",
"if",
"(",
"versionInstalled",
".",
"equals",
"(",
"versionDownloadable",
")",
")",
"{",
"// If it is equal, no new version downloadable",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"versionCompareNumerically",
"(",
"versionDownloadable",
",",
"versionInstalled",
")",
">",
"0",
";",
"// Return if the versionDownloadble is newer than the installed",
"}",
"}"
] | Compare the string versionDownloadable to the version installed of the app.
@param versionDownloadable String to compare to the version installed of the app. | [
"Compare",
"the",
"string",
"versionDownloadable",
"to",
"the",
"version",
"installed",
"of",
"the",
"app",
"."
] | train | https://github.com/rampo/UpdateChecker/blob/738da234d46396b6396e15e7261f38b0cabf9913/library/src/main/java/com/rampo/updatechecker/Comparator.java#L27-L38 |
aws/aws-sdk-java | aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/Rule.java | Rule.withParameters | public Rule withParameters(java.util.Map<String, String> parameters) {
"""
<p>
The minimum and maximum parameters that are associated with the rule.
</p>
@param parameters
The minimum and maximum parameters that are associated with the rule.
@return Returns a reference to this object so that method calls can be chained together.
"""
setParameters(parameters);
return this;
} | java | public Rule withParameters(java.util.Map<String, String> parameters) {
setParameters(parameters);
return this;
} | [
"public",
"Rule",
"withParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"setParameters",
"(",
"parameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The minimum and maximum parameters that are associated with the rule.
</p>
@param parameters
The minimum and maximum parameters that are associated with the rule.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"minimum",
"and",
"maximum",
"parameters",
"that",
"are",
"associated",
"with",
"the",
"rule",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/Rule.java#L152-L155 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.invalidateAttributes | public void invalidateAttributes(String DN, String extId, String uniqueName) {
"""
Method to invalidate the specified entry from the attributes cache. One or all
parameters can be set in a single call. If all parameters are null, then this
operation no-ops.
@param DN The distinguished name of the entity to invalidate attributes on.
@param extId The external ID of the entity to invalidate attributes on.
@param uniqueName The unique name of the entity to invalidate attributes on.
"""
final String METHODNAME = "invalidateAttributes(String, String, String)";
if (getAttributesCache() != null) {
if (DN != null) {
getAttributesCache().invalidate(toKey(DN));
}
if (extId != null) {
getAttributesCache().invalidate(extId);
}
if (uniqueName != null) {
getAttributesCache().invalidate(toKey(uniqueName));
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " " + iAttrsCacheName + " size: " + getAttributesCache().size());
}
}
} | java | public void invalidateAttributes(String DN, String extId, String uniqueName) {
final String METHODNAME = "invalidateAttributes(String, String, String)";
if (getAttributesCache() != null) {
if (DN != null) {
getAttributesCache().invalidate(toKey(DN));
}
if (extId != null) {
getAttributesCache().invalidate(extId);
}
if (uniqueName != null) {
getAttributesCache().invalidate(toKey(uniqueName));
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, METHODNAME + " " + iAttrsCacheName + " size: " + getAttributesCache().size());
}
}
} | [
"public",
"void",
"invalidateAttributes",
"(",
"String",
"DN",
",",
"String",
"extId",
",",
"String",
"uniqueName",
")",
"{",
"final",
"String",
"METHODNAME",
"=",
"\"invalidateAttributes(String, String, String)\"",
";",
"if",
"(",
"getAttributesCache",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"DN",
"!=",
"null",
")",
"{",
"getAttributesCache",
"(",
")",
".",
"invalidate",
"(",
"toKey",
"(",
"DN",
")",
")",
";",
"}",
"if",
"(",
"extId",
"!=",
"null",
")",
"{",
"getAttributesCache",
"(",
")",
".",
"invalidate",
"(",
"extId",
")",
";",
"}",
"if",
"(",
"uniqueName",
"!=",
"null",
")",
"{",
"getAttributesCache",
"(",
")",
".",
"invalidate",
"(",
"toKey",
"(",
"uniqueName",
")",
")",
";",
"}",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"METHODNAME",
"+",
"\" \"",
"+",
"iAttrsCacheName",
"+",
"\" size: \"",
"+",
"getAttributesCache",
"(",
")",
".",
"size",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Method to invalidate the specified entry from the attributes cache. One or all
parameters can be set in a single call. If all parameters are null, then this
operation no-ops.
@param DN The distinguished name of the entity to invalidate attributes on.
@param extId The external ID of the entity to invalidate attributes on.
@param uniqueName The unique name of the entity to invalidate attributes on. | [
"Method",
"to",
"invalidate",
"the",
"specified",
"entry",
"from",
"the",
"attributes",
"cache",
".",
"One",
"or",
"all",
"parameters",
"can",
"be",
"set",
"in",
"a",
"single",
"call",
".",
"If",
"all",
"parameters",
"are",
"null",
"then",
"this",
"operation",
"no",
"-",
"ops",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L683-L703 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/StringUtilities.java | StringUtilities.joinStrings | public static String joinStrings( String separator, String... strings ) {
"""
Join strings through {@link StringBuilder}.
@param separator separator to use or <code>null</code>.
@param strings strings to join.
@return the joined string.
"""
if (separator == null) {
separator = "";
}
StringBuilder sb = new StringBuilder();
for( int i = 0; i < strings.length; i++ ) {
sb.append(strings[i]);
if (i < strings.length - 1) {
sb.append(separator);
}
}
return sb.toString();
} | java | public static String joinStrings( String separator, String... strings ) {
if (separator == null) {
separator = "";
}
StringBuilder sb = new StringBuilder();
for( int i = 0; i < strings.length; i++ ) {
sb.append(strings[i]);
if (i < strings.length - 1) {
sb.append(separator);
}
}
return sb.toString();
} | [
"public",
"static",
"String",
"joinStrings",
"(",
"String",
"separator",
",",
"String",
"...",
"strings",
")",
"{",
"if",
"(",
"separator",
"==",
"null",
")",
"{",
"separator",
"=",
"\"\"",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strings",
".",
"length",
";",
"i",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"strings",
"[",
"i",
"]",
")",
";",
"if",
"(",
"i",
"<",
"strings",
".",
"length",
"-",
"1",
")",
"{",
"sb",
".",
"append",
"(",
"separator",
")",
";",
"}",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Join strings through {@link StringBuilder}.
@param separator separator to use or <code>null</code>.
@param strings strings to join.
@return the joined string. | [
"Join",
"strings",
"through",
"{",
"@link",
"StringBuilder",
"}",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/StringUtilities.java#L77-L89 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java | AiMaterial.setDefault | public void setDefault(PropertyKey key, Object defaultValue) {
"""
Sets a default value.<p>
The passed in Object must match the type of the key as returned by
the corresponding <code>getXXX()</code> method.
@param key the key
@param defaultValue the new default, may not be null
@throws IllegalArgumentException if defaultValue is null or has a wrong
type
"""
if (null == defaultValue) {
throw new IllegalArgumentException("defaultValue may not be null");
}
if (key.m_type != defaultValue.getClass()) {
throw new IllegalArgumentException(
"defaultValue has wrong type, " +
"expected: " + key.m_type + ", found: " +
defaultValue.getClass());
}
m_defaults.put(key, defaultValue);
} | java | public void setDefault(PropertyKey key, Object defaultValue) {
if (null == defaultValue) {
throw new IllegalArgumentException("defaultValue may not be null");
}
if (key.m_type != defaultValue.getClass()) {
throw new IllegalArgumentException(
"defaultValue has wrong type, " +
"expected: " + key.m_type + ", found: " +
defaultValue.getClass());
}
m_defaults.put(key, defaultValue);
} | [
"public",
"void",
"setDefault",
"(",
"PropertyKey",
"key",
",",
"Object",
"defaultValue",
")",
"{",
"if",
"(",
"null",
"==",
"defaultValue",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"defaultValue may not be null\"",
")",
";",
"}",
"if",
"(",
"key",
".",
"m_type",
"!=",
"defaultValue",
".",
"getClass",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"defaultValue has wrong type, \"",
"+",
"\"expected: \"",
"+",
"key",
".",
"m_type",
"+",
"\", found: \"",
"+",
"defaultValue",
".",
"getClass",
"(",
")",
")",
";",
"}",
"m_defaults",
".",
"put",
"(",
"key",
",",
"defaultValue",
")",
";",
"}"
] | Sets a default value.<p>
The passed in Object must match the type of the key as returned by
the corresponding <code>getXXX()</code> method.
@param key the key
@param defaultValue the new default, may not be null
@throws IllegalArgumentException if defaultValue is null or has a wrong
type | [
"Sets",
"a",
"default",
"value",
".",
"<p",
">"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L521-L533 |
apache/incubator-gobblin | gobblin-core-base/src/main/java/org/apache/gobblin/crypto/CredentialStoreFactory.java | CredentialStoreFactory.buildCredentialStore | @Synchronized
public static CredentialStore buildCredentialStore(Map<String, Object> parameters) {
"""
Build a CredentialStore with the given config parameters. The type will be extracted from the parameters.
See {@link EncryptionConfigParser} for a set of standard configuration parameters, although
each encryption provider may have its own arbitrary set.
@return A CredentialStore for the given parameters
@throws IllegalArgumentException If no provider exists that can build the requested encryption codec
"""
String credType = EncryptionConfigParser.getKeystoreType(parameters);
for (CredentialStoreProvider provider : credentialStoreProviderLoader) {
log.debug("Looking for cred store type {} in provider {}", credType, provider.getClass().getName());
CredentialStore credStore = provider.buildCredentialStore(parameters);
if (credStore != null) {
log.debug("Found cred store type {} in provider {}", credType, provider.getClass().getName());
return credStore;
}
}
throw new IllegalArgumentException("Could not find a provider to build algorithm " + credType + " - is gobblin-crypto-provider in classpath?");
} | java | @Synchronized
public static CredentialStore buildCredentialStore(Map<String, Object> parameters) {
String credType = EncryptionConfigParser.getKeystoreType(parameters);
for (CredentialStoreProvider provider : credentialStoreProviderLoader) {
log.debug("Looking for cred store type {} in provider {}", credType, provider.getClass().getName());
CredentialStore credStore = provider.buildCredentialStore(parameters);
if (credStore != null) {
log.debug("Found cred store type {} in provider {}", credType, provider.getClass().getName());
return credStore;
}
}
throw new IllegalArgumentException("Could not find a provider to build algorithm " + credType + " - is gobblin-crypto-provider in classpath?");
} | [
"@",
"Synchronized",
"public",
"static",
"CredentialStore",
"buildCredentialStore",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"{",
"String",
"credType",
"=",
"EncryptionConfigParser",
".",
"getKeystoreType",
"(",
"parameters",
")",
";",
"for",
"(",
"CredentialStoreProvider",
"provider",
":",
"credentialStoreProviderLoader",
")",
"{",
"log",
".",
"debug",
"(",
"\"Looking for cred store type {} in provider {}\"",
",",
"credType",
",",
"provider",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"CredentialStore",
"credStore",
"=",
"provider",
".",
"buildCredentialStore",
"(",
"parameters",
")",
";",
"if",
"(",
"credStore",
"!=",
"null",
")",
"{",
"log",
".",
"debug",
"(",
"\"Found cred store type {} in provider {}\"",
",",
"credType",
",",
"provider",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"return",
"credStore",
";",
"}",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Could not find a provider to build algorithm \"",
"+",
"credType",
"+",
"\" - is gobblin-crypto-provider in classpath?\"",
")",
";",
"}"
] | Build a CredentialStore with the given config parameters. The type will be extracted from the parameters.
See {@link EncryptionConfigParser} for a set of standard configuration parameters, although
each encryption provider may have its own arbitrary set.
@return A CredentialStore for the given parameters
@throws IllegalArgumentException If no provider exists that can build the requested encryption codec | [
"Build",
"a",
"CredentialStore",
"with",
"the",
"given",
"config",
"parameters",
".",
"The",
"type",
"will",
"be",
"extracted",
"from",
"the",
"parameters",
".",
"See",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/crypto/CredentialStoreFactory.java#L45-L59 |
tvesalainen/util | util/src/main/java/org/vesalainen/math/AbstractLine.java | AbstractLine.crossPoint | public static Point crossPoint(Line l1, Line l2) {
"""
Returns the crosspoint of lines l1 and l2. If lines don't cross returns null.
<p>Note returns null if lines are parallel and also when lines ate equal.!
@param l1
@param l2
@return
"""
return crossPoint(l1, l2, null);
} | java | public static Point crossPoint(Line l1, Line l2)
{
return crossPoint(l1, l2, null);
} | [
"public",
"static",
"Point",
"crossPoint",
"(",
"Line",
"l1",
",",
"Line",
"l2",
")",
"{",
"return",
"crossPoint",
"(",
"l1",
",",
"l2",
",",
"null",
")",
";",
"}"
] | Returns the crosspoint of lines l1 and l2. If lines don't cross returns null.
<p>Note returns null if lines are parallel and also when lines ate equal.!
@param l1
@param l2
@return | [
"Returns",
"the",
"crosspoint",
"of",
"lines",
"l1",
"and",
"l2",
".",
"If",
"lines",
"don",
"t",
"cross",
"returns",
"null",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractLine.java#L157-L160 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_mitigationProfiles_ipMitigationProfile_PUT | public void ip_mitigationProfiles_ipMitigationProfile_PUT(String ip, String ipMitigationProfile, OvhMitigationProfile body) throws IOException {
"""
Alter this object properties
REST: PUT /ip/{ip}/mitigationProfiles/{ipMitigationProfile}
@param body [required] New object properties
@param ip [required]
@param ipMitigationProfile [required]
"""
String qPath = "/ip/{ip}/mitigationProfiles/{ipMitigationProfile}";
StringBuilder sb = path(qPath, ip, ipMitigationProfile);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void ip_mitigationProfiles_ipMitigationProfile_PUT(String ip, String ipMitigationProfile, OvhMitigationProfile body) throws IOException {
String qPath = "/ip/{ip}/mitigationProfiles/{ipMitigationProfile}";
StringBuilder sb = path(qPath, ip, ipMitigationProfile);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"ip_mitigationProfiles_ipMitigationProfile_PUT",
"(",
"String",
"ip",
",",
"String",
"ipMitigationProfile",
",",
"OvhMitigationProfile",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/mitigationProfiles/{ipMitigationProfile}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"ip",
",",
"ipMitigationProfile",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
] | Alter this object properties
REST: PUT /ip/{ip}/mitigationProfiles/{ipMitigationProfile}
@param body [required] New object properties
@param ip [required]
@param ipMitigationProfile [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L915-L919 |
xm-online/xm-commons | xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java | LogObjectPrinter.joinUrlPaths | @SafeVarargs
public static <T> String joinUrlPaths(final T[] arr, final T... arr2) {
"""
Join URL path into one string.
@param arr first url paths
@param arr2 other url paths
@param <T> url part path type
@return URL representation string
"""
try {
T[] url = ArrayUtils.addAll(arr, arr2);
String res = StringUtils.join(url);
return (res == null) ? "" : res;
} catch (IndexOutOfBoundsException | IllegalArgumentException | ArrayStoreException e) {
log.warn("Error while join URL paths from: {}, {}", arr, arr2);
return "printerror:" + e;
}
} | java | @SafeVarargs
public static <T> String joinUrlPaths(final T[] arr, final T... arr2) {
try {
T[] url = ArrayUtils.addAll(arr, arr2);
String res = StringUtils.join(url);
return (res == null) ? "" : res;
} catch (IndexOutOfBoundsException | IllegalArgumentException | ArrayStoreException e) {
log.warn("Error while join URL paths from: {}, {}", arr, arr2);
return "printerror:" + e;
}
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"String",
"joinUrlPaths",
"(",
"final",
"T",
"[",
"]",
"arr",
",",
"final",
"T",
"...",
"arr2",
")",
"{",
"try",
"{",
"T",
"[",
"]",
"url",
"=",
"ArrayUtils",
".",
"addAll",
"(",
"arr",
",",
"arr2",
")",
";",
"String",
"res",
"=",
"StringUtils",
".",
"join",
"(",
"url",
")",
";",
"return",
"(",
"res",
"==",
"null",
")",
"?",
"\"\"",
":",
"res",
";",
"}",
"catch",
"(",
"IndexOutOfBoundsException",
"|",
"IllegalArgumentException",
"|",
"ArrayStoreException",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"\"Error while join URL paths from: {}, {}\"",
",",
"arr",
",",
"arr2",
")",
";",
"return",
"\"printerror:\"",
"+",
"e",
";",
"}",
"}"
] | Join URL path into one string.
@param arr first url paths
@param arr2 other url paths
@param <T> url part path type
@return URL representation string | [
"Join",
"URL",
"path",
"into",
"one",
"string",
"."
] | train | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/LogObjectPrinter.java#L110-L120 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fs/command/CpCommand.java | CpCommand.copyFileToLocal | private void copyFileToLocal(AlluxioURI srcPath, AlluxioURI dstPath)
throws AlluxioException, IOException {
"""
Copies a file specified by argv from the filesystem to the local filesystem. This is the
utility function.
@param srcPath The source {@link AlluxioURI} (has to be a file)
@param dstPath The {@link AlluxioURI} of the destination in the local filesystem
"""
File dstFile = new File(dstPath.getPath());
String randomSuffix =
String.format(".%s_copyToLocal_", RandomStringUtils.randomAlphanumeric(8));
File outputFile;
if (dstFile.isDirectory()) {
outputFile = new File(PathUtils.concatPath(dstFile.getAbsolutePath(), srcPath.getName()));
} else {
outputFile = dstFile;
}
File tmpDst = new File(outputFile.getPath() + randomSuffix);
try (Closer closer = Closer.create()) {
FileInStream is = closer.register(mFileSystem.openFile(srcPath));
FileOutputStream out = closer.register(new FileOutputStream(tmpDst));
byte[] buf = new byte[mCopyToLocalBufferSize];
int t = is.read(buf);
while (t != -1) {
out.write(buf, 0, t);
t = is.read(buf);
}
if (!tmpDst.renameTo(outputFile)) {
throw new IOException(
"Failed to rename " + tmpDst.getPath() + " to destination " + outputFile.getPath());
}
System.out.println("Copied " + srcPath + " to " + "file://" + outputFile.getPath());
} finally {
tmpDst.delete();
}
} | java | private void copyFileToLocal(AlluxioURI srcPath, AlluxioURI dstPath)
throws AlluxioException, IOException {
File dstFile = new File(dstPath.getPath());
String randomSuffix =
String.format(".%s_copyToLocal_", RandomStringUtils.randomAlphanumeric(8));
File outputFile;
if (dstFile.isDirectory()) {
outputFile = new File(PathUtils.concatPath(dstFile.getAbsolutePath(), srcPath.getName()));
} else {
outputFile = dstFile;
}
File tmpDst = new File(outputFile.getPath() + randomSuffix);
try (Closer closer = Closer.create()) {
FileInStream is = closer.register(mFileSystem.openFile(srcPath));
FileOutputStream out = closer.register(new FileOutputStream(tmpDst));
byte[] buf = new byte[mCopyToLocalBufferSize];
int t = is.read(buf);
while (t != -1) {
out.write(buf, 0, t);
t = is.read(buf);
}
if (!tmpDst.renameTo(outputFile)) {
throw new IOException(
"Failed to rename " + tmpDst.getPath() + " to destination " + outputFile.getPath());
}
System.out.println("Copied " + srcPath + " to " + "file://" + outputFile.getPath());
} finally {
tmpDst.delete();
}
} | [
"private",
"void",
"copyFileToLocal",
"(",
"AlluxioURI",
"srcPath",
",",
"AlluxioURI",
"dstPath",
")",
"throws",
"AlluxioException",
",",
"IOException",
"{",
"File",
"dstFile",
"=",
"new",
"File",
"(",
"dstPath",
".",
"getPath",
"(",
")",
")",
";",
"String",
"randomSuffix",
"=",
"String",
".",
"format",
"(",
"\".%s_copyToLocal_\"",
",",
"RandomStringUtils",
".",
"randomAlphanumeric",
"(",
"8",
")",
")",
";",
"File",
"outputFile",
";",
"if",
"(",
"dstFile",
".",
"isDirectory",
"(",
")",
")",
"{",
"outputFile",
"=",
"new",
"File",
"(",
"PathUtils",
".",
"concatPath",
"(",
"dstFile",
".",
"getAbsolutePath",
"(",
")",
",",
"srcPath",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"outputFile",
"=",
"dstFile",
";",
"}",
"File",
"tmpDst",
"=",
"new",
"File",
"(",
"outputFile",
".",
"getPath",
"(",
")",
"+",
"randomSuffix",
")",
";",
"try",
"(",
"Closer",
"closer",
"=",
"Closer",
".",
"create",
"(",
")",
")",
"{",
"FileInStream",
"is",
"=",
"closer",
".",
"register",
"(",
"mFileSystem",
".",
"openFile",
"(",
"srcPath",
")",
")",
";",
"FileOutputStream",
"out",
"=",
"closer",
".",
"register",
"(",
"new",
"FileOutputStream",
"(",
"tmpDst",
")",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"mCopyToLocalBufferSize",
"]",
";",
"int",
"t",
"=",
"is",
".",
"read",
"(",
"buf",
")",
";",
"while",
"(",
"t",
"!=",
"-",
"1",
")",
"{",
"out",
".",
"write",
"(",
"buf",
",",
"0",
",",
"t",
")",
";",
"t",
"=",
"is",
".",
"read",
"(",
"buf",
")",
";",
"}",
"if",
"(",
"!",
"tmpDst",
".",
"renameTo",
"(",
"outputFile",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Failed to rename \"",
"+",
"tmpDst",
".",
"getPath",
"(",
")",
"+",
"\" to destination \"",
"+",
"outputFile",
".",
"getPath",
"(",
")",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"Copied \"",
"+",
"srcPath",
"+",
"\" to \"",
"+",
"\"file://\"",
"+",
"outputFile",
".",
"getPath",
"(",
")",
")",
";",
"}",
"finally",
"{",
"tmpDst",
".",
"delete",
"(",
")",
";",
"}",
"}"
] | Copies a file specified by argv from the filesystem to the local filesystem. This is the
utility function.
@param srcPath The source {@link AlluxioURI} (has to be a file)
@param dstPath The {@link AlluxioURI} of the destination in the local filesystem | [
"Copies",
"a",
"file",
"specified",
"by",
"argv",
"from",
"the",
"filesystem",
"to",
"the",
"local",
"filesystem",
".",
"This",
"is",
"the",
"utility",
"function",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/command/CpCommand.java#L756-L786 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicatedCloud_serviceName_additionalBandwidth_duration_POST | public OvhOrder dedicatedCloud_serviceName_additionalBandwidth_duration_POST(String serviceName, String duration, OvhAdditionalBandwidthEnum bandwidth) throws IOException {
"""
Create order
REST: POST /order/dedicatedCloud/{serviceName}/additionalBandwidth/{duration}
@param bandwidth [required] How much additional bandwidth do you want ?
@param serviceName [required]
@param duration [required] Duration
"""
String qPath = "/order/dedicatedCloud/{serviceName}/additionalBandwidth/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "bandwidth", bandwidth);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicatedCloud_serviceName_additionalBandwidth_duration_POST(String serviceName, String duration, OvhAdditionalBandwidthEnum bandwidth) throws IOException {
String qPath = "/order/dedicatedCloud/{serviceName}/additionalBandwidth/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "bandwidth", bandwidth);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicatedCloud_serviceName_additionalBandwidth_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhAdditionalBandwidthEnum",
"bandwidth",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicatedCloud/{serviceName}/additionalBandwidth/{duration}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"duration",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"bandwidth\"",
",",
"bandwidth",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhOrder",
".",
"class",
")",
";",
"}"
] | Create order
REST: POST /order/dedicatedCloud/{serviceName}/additionalBandwidth/{duration}
@param bandwidth [required] How much additional bandwidth do you want ?
@param serviceName [required]
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5702-L5709 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/reader/impl/BasicModelUtils.java | BasicModelUtils.wordsNearestSum | @Override
public Collection<String> wordsNearestSum(Collection<String> positive, Collection<String> negative, int top) {
"""
Words nearest based on positive and negative words
@param positive the positive words
@param negative the negative words
@param top the top n words
@return the words nearest the mean of the words
"""
INDArray words = Nd4j.create(lookupTable.layerSize());
// Set<String> union = SetUtils.union(new HashSet<>(positive), new HashSet<>(negative));
for (String s : positive)
words.addi(lookupTable.vector(s));
for (String s : negative)
words.addi(lookupTable.vector(s).mul(-1));
return wordsNearestSum(words, top);
} | java | @Override
public Collection<String> wordsNearestSum(Collection<String> positive, Collection<String> negative, int top) {
INDArray words = Nd4j.create(lookupTable.layerSize());
// Set<String> union = SetUtils.union(new HashSet<>(positive), new HashSet<>(negative));
for (String s : positive)
words.addi(lookupTable.vector(s));
for (String s : negative)
words.addi(lookupTable.vector(s).mul(-1));
return wordsNearestSum(words, top);
} | [
"@",
"Override",
"public",
"Collection",
"<",
"String",
">",
"wordsNearestSum",
"(",
"Collection",
"<",
"String",
">",
"positive",
",",
"Collection",
"<",
"String",
">",
"negative",
",",
"int",
"top",
")",
"{",
"INDArray",
"words",
"=",
"Nd4j",
".",
"create",
"(",
"lookupTable",
".",
"layerSize",
"(",
")",
")",
";",
"// Set<String> union = SetUtils.union(new HashSet<>(positive), new HashSet<>(negative));",
"for",
"(",
"String",
"s",
":",
"positive",
")",
"words",
".",
"addi",
"(",
"lookupTable",
".",
"vector",
"(",
"s",
")",
")",
";",
"for",
"(",
"String",
"s",
":",
"negative",
")",
"words",
".",
"addi",
"(",
"lookupTable",
".",
"vector",
"(",
"s",
")",
".",
"mul",
"(",
"-",
"1",
")",
")",
";",
"return",
"wordsNearestSum",
"(",
"words",
",",
"top",
")",
";",
"}"
] | Words nearest based on positive and negative words
@param positive the positive words
@param negative the negative words
@param top the top n words
@return the words nearest the mean of the words | [
"Words",
"nearest",
"based",
"on",
"positive",
"and",
"negative",
"words"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/reader/impl/BasicModelUtils.java#L379-L391 |
morfologik/morfologik-stemming | morfologik-stemming/src/main/java/morfologik/stemming/DictionaryLookup.java | DictionaryLookup.applyReplacements | public static String applyReplacements(CharSequence word, LinkedHashMap<String, String> replacements) {
"""
Apply partial string replacements from a given map.
Useful if the word needs to be normalized somehow (i.e., ligatures,
apostrophes and such).
@param word The word to apply replacements to.
@param replacements A map of replacements (from->to).
@return new string with all replacements applied.
"""
// quite horrible from performance point of view; this should really be a transducer.
StringBuilder sb = new StringBuilder(word);
for (final Map.Entry<String, String> e : replacements.entrySet()) {
String key = e.getKey();
int index = sb.indexOf(e.getKey());
while (index != -1) {
sb.replace(index, index + key.length(), e.getValue());
index = sb.indexOf(key, index + key.length());
}
}
return sb.toString();
} | java | public static String applyReplacements(CharSequence word, LinkedHashMap<String, String> replacements) {
// quite horrible from performance point of view; this should really be a transducer.
StringBuilder sb = new StringBuilder(word);
for (final Map.Entry<String, String> e : replacements.entrySet()) {
String key = e.getKey();
int index = sb.indexOf(e.getKey());
while (index != -1) {
sb.replace(index, index + key.length(), e.getValue());
index = sb.indexOf(key, index + key.length());
}
}
return sb.toString();
} | [
"public",
"static",
"String",
"applyReplacements",
"(",
"CharSequence",
"word",
",",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"replacements",
")",
"{",
"// quite horrible from performance point of view; this should really be a transducer.\r",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"word",
")",
";",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"e",
":",
"replacements",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"e",
".",
"getKey",
"(",
")",
";",
"int",
"index",
"=",
"sb",
".",
"indexOf",
"(",
"e",
".",
"getKey",
"(",
")",
")",
";",
"while",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"sb",
".",
"replace",
"(",
"index",
",",
"index",
"+",
"key",
".",
"length",
"(",
")",
",",
"e",
".",
"getValue",
"(",
")",
")",
";",
"index",
"=",
"sb",
".",
"indexOf",
"(",
"key",
",",
"index",
"+",
"key",
".",
"length",
"(",
")",
")",
";",
"}",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | Apply partial string replacements from a given map.
Useful if the word needs to be normalized somehow (i.e., ligatures,
apostrophes and such).
@param word The word to apply replacements to.
@param replacements A map of replacements (from->to).
@return new string with all replacements applied. | [
"Apply",
"partial",
"string",
"replacements",
"from",
"a",
"given",
"map",
"."
] | train | https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-stemming/src/main/java/morfologik/stemming/DictionaryLookup.java#L259-L271 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java | AbstractBpmnActivityBehavior.propagateException | protected void propagateException(ActivityExecution execution, Exception ex) throws Exception {
"""
Decides how to propagate the exception properly, e.g. as bpmn error or "normal" error.
@param execution the current execution
@param ex the exception to propagate
@throws Exception if no error handler could be found
"""
BpmnError bpmnError = checkIfCauseOfExceptionIsBpmnError(ex);
if (bpmnError != null) {
propagateBpmnError(bpmnError, execution);
} else {
propagateExceptionAsError(ex, execution);
}
} | java | protected void propagateException(ActivityExecution execution, Exception ex) throws Exception {
BpmnError bpmnError = checkIfCauseOfExceptionIsBpmnError(ex);
if (bpmnError != null) {
propagateBpmnError(bpmnError, execution);
} else {
propagateExceptionAsError(ex, execution);
}
} | [
"protected",
"void",
"propagateException",
"(",
"ActivityExecution",
"execution",
",",
"Exception",
"ex",
")",
"throws",
"Exception",
"{",
"BpmnError",
"bpmnError",
"=",
"checkIfCauseOfExceptionIsBpmnError",
"(",
"ex",
")",
";",
"if",
"(",
"bpmnError",
"!=",
"null",
")",
"{",
"propagateBpmnError",
"(",
"bpmnError",
",",
"execution",
")",
";",
"}",
"else",
"{",
"propagateExceptionAsError",
"(",
"ex",
",",
"execution",
")",
";",
"}",
"}"
] | Decides how to propagate the exception properly, e.g. as bpmn error or "normal" error.
@param execution the current execution
@param ex the exception to propagate
@throws Exception if no error handler could be found | [
"Decides",
"how",
"to",
"propagate",
"the",
"exception",
"properly",
"e",
".",
"g",
".",
"as",
"bpmn",
"error",
"or",
"normal",
"error",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java#L138-L145 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/ThreadedServer.java | ThreadedServer.newServerSocket | protected ServerSocket newServerSocket(InetAddrPort address, int acceptQueueSize)
throws java.io.IOException {
"""
New server socket. Creates a new servers socket. May be overriden by derived class to create
specialist serversockets (eg SSL).
@param address Address and port
@param acceptQueueSize Accept queue size
@return The new ServerSocket
@exception java.io.IOException
"""
if (address == null) return new ServerSocket(0, acceptQueueSize);
return new ServerSocket(address.getPort(), acceptQueueSize, address.getInetAddress());
} | java | protected ServerSocket newServerSocket(InetAddrPort address, int acceptQueueSize)
throws java.io.IOException
{
if (address == null) return new ServerSocket(0, acceptQueueSize);
return new ServerSocket(address.getPort(), acceptQueueSize, address.getInetAddress());
} | [
"protected",
"ServerSocket",
"newServerSocket",
"(",
"InetAddrPort",
"address",
",",
"int",
"acceptQueueSize",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"if",
"(",
"address",
"==",
"null",
")",
"return",
"new",
"ServerSocket",
"(",
"0",
",",
"acceptQueueSize",
")",
";",
"return",
"new",
"ServerSocket",
"(",
"address",
".",
"getPort",
"(",
")",
",",
"acceptQueueSize",
",",
"address",
".",
"getInetAddress",
"(",
")",
")",
";",
"}"
] | New server socket. Creates a new servers socket. May be overriden by derived class to create
specialist serversockets (eg SSL).
@param address Address and port
@param acceptQueueSize Accept queue size
@return The new ServerSocket
@exception java.io.IOException | [
"New",
"server",
"socket",
".",
"Creates",
"a",
"new",
"servers",
"socket",
".",
"May",
"be",
"overriden",
"by",
"derived",
"class",
"to",
"create",
"specialist",
"serversockets",
"(",
"eg",
"SSL",
")",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/ThreadedServer.java#L386-L392 |
vkostyukov/la4j | src/main/java/org/la4j/Matrices.java | Matrices.asMulFunction | public static MatrixFunction asMulFunction(final double arg) {
"""
Creates a mul function that multiplies given {@code value} by it's argument.
@param arg a value to be multiplied by function's argument
@return a closure that does {@code _ * _}
"""
return new MatrixFunction() {
@Override
public double evaluate(int i, int j, double value) {
return value * arg;
}
};
} | java | public static MatrixFunction asMulFunction(final double arg) {
return new MatrixFunction() {
@Override
public double evaluate(int i, int j, double value) {
return value * arg;
}
};
} | [
"public",
"static",
"MatrixFunction",
"asMulFunction",
"(",
"final",
"double",
"arg",
")",
"{",
"return",
"new",
"MatrixFunction",
"(",
")",
"{",
"@",
"Override",
"public",
"double",
"evaluate",
"(",
"int",
"i",
",",
"int",
"j",
",",
"double",
"value",
")",
"{",
"return",
"value",
"*",
"arg",
";",
"}",
"}",
";",
"}"
] | Creates a mul function that multiplies given {@code value} by it's argument.
@param arg a value to be multiplied by function's argument
@return a closure that does {@code _ * _} | [
"Creates",
"a",
"mul",
"function",
"that",
"multiplies",
"given",
"{",
"@code",
"value",
"}",
"by",
"it",
"s",
"argument",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L471-L478 |
soi-toolkit/soi-toolkit-mule | commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java | MonitorEndpointHelper.pingJmsEndpoint | public static String pingJmsEndpoint(MuleContext muleContext, String queueName) {
"""
Verify access to a JMS endpoint by browsing a specified queue for messages.
"""
return pingJmsEndpoint(muleContext, DEFAULT_MULE_JMS_CONNECTOR, queueName);
} | java | public static String pingJmsEndpoint(MuleContext muleContext, String queueName) {
return pingJmsEndpoint(muleContext, DEFAULT_MULE_JMS_CONNECTOR, queueName);
} | [
"public",
"static",
"String",
"pingJmsEndpoint",
"(",
"MuleContext",
"muleContext",
",",
"String",
"queueName",
")",
"{",
"return",
"pingJmsEndpoint",
"(",
"muleContext",
",",
"DEFAULT_MULE_JMS_CONNECTOR",
",",
"queueName",
")",
";",
"}"
] | Verify access to a JMS endpoint by browsing a specified queue for messages. | [
"Verify",
"access",
"to",
"a",
"JMS",
"endpoint",
"by",
"browsing",
"a",
"specified",
"queue",
"for",
"messages",
"."
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java#L117-L119 |
pushtorefresh/storio | storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/operations/put/PutResult.java | PutResult.newInsertResult | @NonNull
public static PutResult newInsertResult(
long insertedId,
@NonNull String affectedTable,
@Nullable Collection<String> affectedTags
) {
"""
Creates {@link PutResult} of insert.
@param insertedId id of new row.
@param affectedTable table that was affected.
@param affectedTags notification tags that were affected.
@return new {@link PutResult} instance.
"""
checkNotNull(affectedTable, "Please specify affected table");
return new PutResult(insertedId, null, singleton(affectedTable), nonNullSet(affectedTags));
} | java | @NonNull
public static PutResult newInsertResult(
long insertedId,
@NonNull String affectedTable,
@Nullable Collection<String> affectedTags
) {
checkNotNull(affectedTable, "Please specify affected table");
return new PutResult(insertedId, null, singleton(affectedTable), nonNullSet(affectedTags));
} | [
"@",
"NonNull",
"public",
"static",
"PutResult",
"newInsertResult",
"(",
"long",
"insertedId",
",",
"@",
"NonNull",
"String",
"affectedTable",
",",
"@",
"Nullable",
"Collection",
"<",
"String",
">",
"affectedTags",
")",
"{",
"checkNotNull",
"(",
"affectedTable",
",",
"\"Please specify affected table\"",
")",
";",
"return",
"new",
"PutResult",
"(",
"insertedId",
",",
"null",
",",
"singleton",
"(",
"affectedTable",
")",
",",
"nonNullSet",
"(",
"affectedTags",
")",
")",
";",
"}"
] | Creates {@link PutResult} of insert.
@param insertedId id of new row.
@param affectedTable table that was affected.
@param affectedTags notification tags that were affected.
@return new {@link PutResult} instance. | [
"Creates",
"{",
"@link",
"PutResult",
"}",
"of",
"insert",
"."
] | train | https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/operations/put/PutResult.java#L106-L114 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java | ImportScope.finalizeScope | public void finalizeScope() {
"""
Finalize the content of the ImportScope to speed-up future lookups.
No further changes to class hierarchy or class content will be reflected.
"""
for (List<Scope> scopes = this.subScopes; scopes.nonEmpty(); scopes = scopes.tail) {
Scope impScope = scopes.head;
if (impScope instanceof FilterImportScope && impScope.owner.kind == Kind.TYP) {
WriteableScope finalized = WriteableScope.create(impScope.owner);
for (Symbol sym : impScope.getSymbols()) {
finalized.enter(sym);
}
finalized.listeners.add(new ScopeListener() {
@Override
public void symbolAdded(Symbol sym, Scope s) {
Assert.error("The scope is sealed.");
}
@Override
public void symbolRemoved(Symbol sym, Scope s) {
Assert.error("The scope is sealed.");
}
});
scopes.head = finalized;
}
}
} | java | public void finalizeScope() {
for (List<Scope> scopes = this.subScopes; scopes.nonEmpty(); scopes = scopes.tail) {
Scope impScope = scopes.head;
if (impScope instanceof FilterImportScope && impScope.owner.kind == Kind.TYP) {
WriteableScope finalized = WriteableScope.create(impScope.owner);
for (Symbol sym : impScope.getSymbols()) {
finalized.enter(sym);
}
finalized.listeners.add(new ScopeListener() {
@Override
public void symbolAdded(Symbol sym, Scope s) {
Assert.error("The scope is sealed.");
}
@Override
public void symbolRemoved(Symbol sym, Scope s) {
Assert.error("The scope is sealed.");
}
});
scopes.head = finalized;
}
}
} | [
"public",
"void",
"finalizeScope",
"(",
")",
"{",
"for",
"(",
"List",
"<",
"Scope",
">",
"scopes",
"=",
"this",
".",
"subScopes",
";",
"scopes",
".",
"nonEmpty",
"(",
")",
";",
"scopes",
"=",
"scopes",
".",
"tail",
")",
"{",
"Scope",
"impScope",
"=",
"scopes",
".",
"head",
";",
"if",
"(",
"impScope",
"instanceof",
"FilterImportScope",
"&&",
"impScope",
".",
"owner",
".",
"kind",
"==",
"Kind",
".",
"TYP",
")",
"{",
"WriteableScope",
"finalized",
"=",
"WriteableScope",
".",
"create",
"(",
"impScope",
".",
"owner",
")",
";",
"for",
"(",
"Symbol",
"sym",
":",
"impScope",
".",
"getSymbols",
"(",
")",
")",
"{",
"finalized",
".",
"enter",
"(",
"sym",
")",
";",
"}",
"finalized",
".",
"listeners",
".",
"add",
"(",
"new",
"ScopeListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"symbolAdded",
"(",
"Symbol",
"sym",
",",
"Scope",
"s",
")",
"{",
"Assert",
".",
"error",
"(",
"\"The scope is sealed.\"",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"symbolRemoved",
"(",
"Symbol",
"sym",
",",
"Scope",
"s",
")",
"{",
"Assert",
".",
"error",
"(",
"\"The scope is sealed.\"",
")",
";",
"}",
"}",
")",
";",
"scopes",
".",
"head",
"=",
"finalized",
";",
"}",
"}",
"}"
] | Finalize the content of the ImportScope to speed-up future lookups.
No further changes to class hierarchy or class content will be reflected. | [
"Finalize",
"the",
"content",
"of",
"the",
"ImportScope",
"to",
"speed",
"-",
"up",
"future",
"lookups",
".",
"No",
"further",
"changes",
"to",
"class",
"hierarchy",
"or",
"class",
"content",
"will",
"be",
"reflected",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java#L742-L768 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java | CheckClassAdapter.getChar | private static char getChar(final String signature, int pos) {
"""
Returns the signature car at the given index.
@param signature
a signature.
@param pos
an index in signature.
@return the character at the given index, or 0 if there is no such
character.
"""
return pos < signature.length() ? signature.charAt(pos) : (char) 0;
} | java | private static char getChar(final String signature, int pos) {
return pos < signature.length() ? signature.charAt(pos) : (char) 0;
} | [
"private",
"static",
"char",
"getChar",
"(",
"final",
"String",
"signature",
",",
"int",
"pos",
")",
"{",
"return",
"pos",
"<",
"signature",
".",
"length",
"(",
")",
"?",
"signature",
".",
"charAt",
"(",
"pos",
")",
":",
"(",
"char",
")",
"0",
";",
"}"
] | Returns the signature car at the given index.
@param signature
a signature.
@param pos
an index in signature.
@return the character at the given index, or 0 if there is no such
character. | [
"Returns",
"the",
"signature",
"car",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L1006-L1008 |
VoltDB/voltdb | src/frontend/org/voltdb/client/ClientConfig.java | ClientConfig.setTrustStoreConfigFromPropertyFile | public void setTrustStoreConfigFromPropertyFile(String propFN) {
"""
Configure trust store
@param propFN property file name containing trust store properties:
<ul>
<li>{@code trustStore} trust store file specification
<li>{@code trustStorePassword} trust store password
</ul>
"""
File propFD = new File(propFN != null && !propFN.trim().isEmpty() ? propFN : "");
if (!propFD.exists() || !propFD.isFile() || !propFD.canRead()) {
throw new IllegalArgumentException("Properties file " + propFN + " is not a read accessible file");
}
Properties props = new Properties();
try (FileReader fr = new FileReader(propFD)) {
props.load(fr);
} catch (IOException e) {
throw new IllegalArgumentException("Failed to read properties file " + propFN, e);
}
String trustStore = props.getProperty(SSLConfiguration.TRUSTSTORE_CONFIG_PROP);
String trustStorePassword = props.getProperty(SSLConfiguration.TRUSTSTORE_PASSWORD_CONFIG_PROP);
m_sslConfig = new SSLConfiguration.SslConfig(null, null, trustStore, trustStorePassword);
} | java | public void setTrustStoreConfigFromPropertyFile(String propFN) {
File propFD = new File(propFN != null && !propFN.trim().isEmpty() ? propFN : "");
if (!propFD.exists() || !propFD.isFile() || !propFD.canRead()) {
throw new IllegalArgumentException("Properties file " + propFN + " is not a read accessible file");
}
Properties props = new Properties();
try (FileReader fr = new FileReader(propFD)) {
props.load(fr);
} catch (IOException e) {
throw new IllegalArgumentException("Failed to read properties file " + propFN, e);
}
String trustStore = props.getProperty(SSLConfiguration.TRUSTSTORE_CONFIG_PROP);
String trustStorePassword = props.getProperty(SSLConfiguration.TRUSTSTORE_PASSWORD_CONFIG_PROP);
m_sslConfig = new SSLConfiguration.SslConfig(null, null, trustStore, trustStorePassword);
} | [
"public",
"void",
"setTrustStoreConfigFromPropertyFile",
"(",
"String",
"propFN",
")",
"{",
"File",
"propFD",
"=",
"new",
"File",
"(",
"propFN",
"!=",
"null",
"&&",
"!",
"propFN",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
"?",
"propFN",
":",
"\"\"",
")",
";",
"if",
"(",
"!",
"propFD",
".",
"exists",
"(",
")",
"||",
"!",
"propFD",
".",
"isFile",
"(",
")",
"||",
"!",
"propFD",
".",
"canRead",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Properties file \"",
"+",
"propFN",
"+",
"\" is not a read accessible file\"",
")",
";",
"}",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"(",
"FileReader",
"fr",
"=",
"new",
"FileReader",
"(",
"propFD",
")",
")",
"{",
"props",
".",
"load",
"(",
"fr",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Failed to read properties file \"",
"+",
"propFN",
",",
"e",
")",
";",
"}",
"String",
"trustStore",
"=",
"props",
".",
"getProperty",
"(",
"SSLConfiguration",
".",
"TRUSTSTORE_CONFIG_PROP",
")",
";",
"String",
"trustStorePassword",
"=",
"props",
".",
"getProperty",
"(",
"SSLConfiguration",
".",
"TRUSTSTORE_PASSWORD_CONFIG_PROP",
")",
";",
"m_sslConfig",
"=",
"new",
"SSLConfiguration",
".",
"SslConfig",
"(",
"null",
",",
"null",
",",
"trustStore",
",",
"trustStorePassword",
")",
";",
"}"
] | Configure trust store
@param propFN property file name containing trust store properties:
<ul>
<li>{@code trustStore} trust store file specification
<li>{@code trustStorePassword} trust store password
</ul> | [
"Configure",
"trust",
"store"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/ClientConfig.java#L484-L499 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/structures/BuildDatabase.java | BuildDatabase.getAllSpecNodes | public List<SpecNode> getAllSpecNodes() {
"""
Get a List of all the SpecNodes in the Database.
@return A list of Level objects.
"""
final ArrayList<SpecNode> retValue = new ArrayList<SpecNode>();
// Add all the levels
retValue.addAll(levels);
// Add all the topics
for (final Entry<Integer, List<ITopicNode>> topicEntry : topics.entrySet()) {
for (final ITopicNode topic : topicEntry.getValue()) {
if (topic instanceof SpecNode) {
retValue.add((SpecNode) topic);
}
}
}
return retValue;
} | java | public List<SpecNode> getAllSpecNodes() {
final ArrayList<SpecNode> retValue = new ArrayList<SpecNode>();
// Add all the levels
retValue.addAll(levels);
// Add all the topics
for (final Entry<Integer, List<ITopicNode>> topicEntry : topics.entrySet()) {
for (final ITopicNode topic : topicEntry.getValue()) {
if (topic instanceof SpecNode) {
retValue.add((SpecNode) topic);
}
}
}
return retValue;
} | [
"public",
"List",
"<",
"SpecNode",
">",
"getAllSpecNodes",
"(",
")",
"{",
"final",
"ArrayList",
"<",
"SpecNode",
">",
"retValue",
"=",
"new",
"ArrayList",
"<",
"SpecNode",
">",
"(",
")",
";",
"// Add all the levels",
"retValue",
".",
"addAll",
"(",
"levels",
")",
";",
"// Add all the topics",
"for",
"(",
"final",
"Entry",
"<",
"Integer",
",",
"List",
"<",
"ITopicNode",
">",
">",
"topicEntry",
":",
"topics",
".",
"entrySet",
"(",
")",
")",
"{",
"for",
"(",
"final",
"ITopicNode",
"topic",
":",
"topicEntry",
".",
"getValue",
"(",
")",
")",
"{",
"if",
"(",
"topic",
"instanceof",
"SpecNode",
")",
"{",
"retValue",
".",
"add",
"(",
"(",
"SpecNode",
")",
"topic",
")",
";",
"}",
"}",
"}",
"return",
"retValue",
";",
"}"
] | Get a List of all the SpecNodes in the Database.
@return A list of Level objects. | [
"Get",
"a",
"List",
"of",
"all",
"the",
"SpecNodes",
"in",
"the",
"Database",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/structures/BuildDatabase.java#L186-L202 |
VoltDB/voltdb | src/frontend/org/voltdb/iv2/MpProcedureTask.java | MpProcedureTask.updateMasters | public void updateMasters(List<Long> masters, Map<Integer, Long> partitionMasters) {
"""
Update the list of partition masters in the event of a failure/promotion.
Currently only thread-"safe" by virtue of only calling this on
MpProcedureTasks which are not at the head of the MPI's TransactionTaskQueue.
"""
m_initiatorHSIds.clear();
m_initiatorHSIds.addAll(masters);
((MpTransactionState)getTransactionState()).updateMasters(masters, partitionMasters);
} | java | public void updateMasters(List<Long> masters, Map<Integer, Long> partitionMasters)
{
m_initiatorHSIds.clear();
m_initiatorHSIds.addAll(masters);
((MpTransactionState)getTransactionState()).updateMasters(masters, partitionMasters);
} | [
"public",
"void",
"updateMasters",
"(",
"List",
"<",
"Long",
">",
"masters",
",",
"Map",
"<",
"Integer",
",",
"Long",
">",
"partitionMasters",
")",
"{",
"m_initiatorHSIds",
".",
"clear",
"(",
")",
";",
"m_initiatorHSIds",
".",
"addAll",
"(",
"masters",
")",
";",
"(",
"(",
"MpTransactionState",
")",
"getTransactionState",
"(",
")",
")",
".",
"updateMasters",
"(",
"masters",
",",
"partitionMasters",
")",
";",
"}"
] | Update the list of partition masters in the event of a failure/promotion.
Currently only thread-"safe" by virtue of only calling this on
MpProcedureTasks which are not at the head of the MPI's TransactionTaskQueue. | [
"Update",
"the",
"list",
"of",
"partition",
"masters",
"in",
"the",
"event",
"of",
"a",
"failure",
"/",
"promotion",
".",
"Currently",
"only",
"thread",
"-",
"safe",
"by",
"virtue",
"of",
"only",
"calling",
"this",
"on",
"MpProcedureTasks",
"which",
"are",
"not",
"at",
"the",
"head",
"of",
"the",
"MPI",
"s",
"TransactionTaskQueue",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/MpProcedureTask.java#L85-L90 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.extractElementType | public SemanticType extractElementType(SemanticType.Array type, SyntacticItem item) {
"""
Extract the element type from an array. The array type can be null if some
earlier part of type checking generated an error message and we are just
continuing after that.
@param type
@param item
@return
"""
if (type == null) {
return null;
} else {
return type.getElement();
}
} | java | public SemanticType extractElementType(SemanticType.Array type, SyntacticItem item) {
if (type == null) {
return null;
} else {
return type.getElement();
}
} | [
"public",
"SemanticType",
"extractElementType",
"(",
"SemanticType",
".",
"Array",
"type",
",",
"SyntacticItem",
"item",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"type",
".",
"getElement",
"(",
")",
";",
"}",
"}"
] | Extract the element type from an array. The array type can be null if some
earlier part of type checking generated an error message and we are just
continuing after that.
@param type
@param item
@return | [
"Extract",
"the",
"element",
"type",
"from",
"an",
"array",
".",
"The",
"array",
"type",
"can",
"be",
"null",
"if",
"some",
"earlier",
"part",
"of",
"type",
"checking",
"generated",
"an",
"error",
"message",
"and",
"we",
"are",
"just",
"continuing",
"after",
"that",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1896-L1902 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_voicemail_serviceName_directories_id_move_POST | public void billingAccount_voicemail_serviceName_directories_id_move_POST(String billingAccount, String serviceName, Long id, OvhVoicemailMessageFolderDirectoryEnum dir) throws IOException {
"""
Move the message to another directory
REST: POST /telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/move
@param dir [required] Greeting voicemail directory
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param id [required] Id of the object
"""
String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/move";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "dir", dir);
exec(qPath, "POST", sb.toString(), o);
} | java | public void billingAccount_voicemail_serviceName_directories_id_move_POST(String billingAccount, String serviceName, Long id, OvhVoicemailMessageFolderDirectoryEnum dir) throws IOException {
String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/move";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "dir", dir);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"billingAccount_voicemail_serviceName_directories_id_move_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"id",
",",
"OvhVoicemailMessageFolderDirectoryEnum",
"dir",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/move\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"billingAccount",
",",
"serviceName",
",",
"id",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"dir\"",
",",
"dir",
")",
";",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"}"
] | Move the message to another directory
REST: POST /telephony/{billingAccount}/voicemail/{serviceName}/directories/{id}/move
@param dir [required] Greeting voicemail directory
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param id [required] Id of the object | [
"Move",
"the",
"message",
"to",
"another",
"directory"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7909-L7915 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Flowable.java | Flowable.onBackpressureBuffer | @CheckReturnValue
@BackpressureSupport(BackpressureKind.SPECIAL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded) {
"""
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to
a given amount of items until they can be emitted. The resulting Publisher will signal
a {@code BufferOverflowException} via {@code onError} as soon as the buffer's capacity is exceeded, dropping all undelivered
items, and canceling the source.
<p>
<img width="640" height="300" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/bp.obp.buffer.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator honors backpressure from downstream and consumes the source {@code Publisher} in an unbounded
manner (i.e., not applying backpressure to it).</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code onBackpressureBuffer} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param capacity number of slots available in the buffer.
@param delayError
if true, an exception from the current Flowable is delayed until all buffered elements have been
consumed by the downstream; if false, an exception is immediately signaled to the downstream, skipping
any buffered element
@param unbounded
if true, the capacity value is interpreted as the internal "island" size of the unbounded buffer
@return the source {@code Publisher} modified to buffer items up to the given capacity.
@see <a href="http://reactivex.io/documentation/operators/backpressure.html">ReactiveX operators documentation: backpressure operators</a>
@since 1.1.0
"""
ObjectHelper.verifyPositive(capacity, "bufferSize");
return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBuffer<T>(this, capacity, unbounded, delayError, Functions.EMPTY_ACTION));
} | java | @CheckReturnValue
@BackpressureSupport(BackpressureKind.SPECIAL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded) {
ObjectHelper.verifyPositive(capacity, "bufferSize");
return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBuffer<T>(this, capacity, unbounded, delayError, Functions.EMPTY_ACTION));
} | [
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"SPECIAL",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Flowable",
"<",
"T",
">",
"onBackpressureBuffer",
"(",
"int",
"capacity",
",",
"boolean",
"delayError",
",",
"boolean",
"unbounded",
")",
"{",
"ObjectHelper",
".",
"verifyPositive",
"(",
"capacity",
",",
"\"bufferSize\"",
")",
";",
"return",
"RxJavaPlugins",
".",
"onAssembly",
"(",
"new",
"FlowableOnBackpressureBuffer",
"<",
"T",
">",
"(",
"this",
",",
"capacity",
",",
"unbounded",
",",
"delayError",
",",
"Functions",
".",
"EMPTY_ACTION",
")",
")",
";",
"}"
] | Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to
a given amount of items until they can be emitted. The resulting Publisher will signal
a {@code BufferOverflowException} via {@code onError} as soon as the buffer's capacity is exceeded, dropping all undelivered
items, and canceling the source.
<p>
<img width="640" height="300" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/bp.obp.buffer.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator honors backpressure from downstream and consumes the source {@code Publisher} in an unbounded
manner (i.e., not applying backpressure to it).</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code onBackpressureBuffer} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param capacity number of slots available in the buffer.
@param delayError
if true, an exception from the current Flowable is delayed until all buffered elements have been
consumed by the downstream; if false, an exception is immediately signaled to the downstream, skipping
any buffered element
@param unbounded
if true, the capacity value is interpreted as the internal "island" size of the unbounded buffer
@return the source {@code Publisher} modified to buffer items up to the given capacity.
@see <a href="http://reactivex.io/documentation/operators/backpressure.html">ReactiveX operators documentation: backpressure operators</a>
@since 1.1.0 | [
"Instructs",
"a",
"Publisher",
"that",
"is",
"emitting",
"items",
"faster",
"than",
"its",
"Subscriber",
"can",
"consume",
"them",
"to",
"buffer",
"up",
"to",
"a",
"given",
"amount",
"of",
"items",
"until",
"they",
"can",
"be",
"emitted",
".",
"The",
"resulting",
"Publisher",
"will",
"signal",
"a",
"{",
"@code",
"BufferOverflowException",
"}",
"via",
"{",
"@code",
"onError",
"}",
"as",
"soon",
"as",
"the",
"buffer",
"s",
"capacity",
"is",
"exceeded",
"dropping",
"all",
"undelivered",
"items",
"and",
"canceling",
"the",
"source",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"300",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
"/",
"images",
"/",
"rx",
"-",
"operators",
"/",
"bp",
".",
"obp",
".",
"buffer",
".",
"png",
"alt",
"=",
">",
"<dl",
">",
"<dt",
">",
"<b",
">",
"Backpressure",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"The",
"operator",
"honors",
"backpressure",
"from",
"downstream",
"and",
"consumes",
"the",
"source",
"{",
"@code",
"Publisher",
"}",
"in",
"an",
"unbounded",
"manner",
"(",
"i",
".",
"e",
".",
"not",
"applying",
"backpressure",
"to",
"it",
")",
".",
"<",
"/",
"dd",
">",
"<dt",
">",
"<b",
">",
"Scheduler",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"{",
"@code",
"onBackpressureBuffer",
"}",
"does",
"not",
"operate",
"by",
"default",
"on",
"a",
"particular",
"{",
"@link",
"Scheduler",
"}",
".",
"<",
"/",
"dd",
">",
"<",
"/",
"dl",
">"
] | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L11461-L11467 |
JadiraOrg/jadira | cloning/src/main/java/org/jadira/reflection/cloning/implementor/AbstractCloneStrategy.java | AbstractCloneStrategy.performCloneForCloneableMethod | protected <T> T performCloneForCloneableMethod(T object, CloneDriver context) {
"""
Helper method for performing cloning for objects of classes implementing java.lang.Cloneable
@param object The object to be cloned.
@param context The CloneDriver to be used
@param <T> The type being copied
@return The cloned object
"""
Class<?> clazz = object.getClass();
final T result;
try {
MethodHandle handle = context.getCloneMethod(clazz);
result = (T) handle.invoke(object);
} catch (Throwable e) {
throw new IllegalStateException("Could not invoke clone() for instance of: " + clazz.getName(), e);
}
return result;
} | java | protected <T> T performCloneForCloneableMethod(T object, CloneDriver context) {
Class<?> clazz = object.getClass();
final T result;
try {
MethodHandle handle = context.getCloneMethod(clazz);
result = (T) handle.invoke(object);
} catch (Throwable e) {
throw new IllegalStateException("Could not invoke clone() for instance of: " + clazz.getName(), e);
}
return result;
} | [
"protected",
"<",
"T",
">",
"T",
"performCloneForCloneableMethod",
"(",
"T",
"object",
",",
"CloneDriver",
"context",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"object",
".",
"getClass",
"(",
")",
";",
"final",
"T",
"result",
";",
"try",
"{",
"MethodHandle",
"handle",
"=",
"context",
".",
"getCloneMethod",
"(",
"clazz",
")",
";",
"result",
"=",
"(",
"T",
")",
"handle",
".",
"invoke",
"(",
"object",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Could not invoke clone() for instance of: \"",
"+",
"clazz",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Helper method for performing cloning for objects of classes implementing java.lang.Cloneable
@param object The object to be cloned.
@param context The CloneDriver to be used
@param <T> The type being copied
@return The cloned object | [
"Helper",
"method",
"for",
"performing",
"cloning",
"for",
"objects",
"of",
"classes",
"implementing",
"java",
".",
"lang",
".",
"Cloneable"
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/cloning/implementor/AbstractCloneStrategy.java#L271-L283 |
kiegroup/drools | drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSource.java | LeftTupleSource.addTupleSink | public void addTupleSink(final LeftTupleSink tupleSink, final BuildContext context) {
"""
Adds the <code>TupleSink</code> so that it may receive
<code>Tuples</code> propagated from this <code>TupleSource</code>.
@param tupleSink
The <code>TupleSink</code> to receive propagated
<code>Tuples</code>.
"""
this.sink = addTupleSink(this.sink, tupleSink, context);
} | java | public void addTupleSink(final LeftTupleSink tupleSink, final BuildContext context) {
this.sink = addTupleSink(this.sink, tupleSink, context);
} | [
"public",
"void",
"addTupleSink",
"(",
"final",
"LeftTupleSink",
"tupleSink",
",",
"final",
"BuildContext",
"context",
")",
"{",
"this",
".",
"sink",
"=",
"addTupleSink",
"(",
"this",
".",
"sink",
",",
"tupleSink",
",",
"context",
")",
";",
"}"
] | Adds the <code>TupleSink</code> so that it may receive
<code>Tuples</code> propagated from this <code>TupleSource</code>.
@param tupleSink
The <code>TupleSink</code> to receive propagated
<code>Tuples</code>. | [
"Adds",
"the",
"<code",
">",
"TupleSink<",
"/",
"code",
">",
"so",
"that",
"it",
"may",
"receive",
"<code",
">",
"Tuples<",
"/",
"code",
">",
"propagated",
"from",
"this",
"<code",
">",
"TupleSource<",
"/",
"code",
">",
"."
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSource.java#L146-L148 |
UrielCh/ovh-java-sdk | ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java | ApiOvhPrice.xdsl_offers_offersName_GET | public OvhPrice xdsl_offers_offersName_GET(net.minidev.ovh.api.price.xdsl.OvhOffersEnum offersName) throws IOException {
"""
Get the price of xdsl offers
REST: GET /price/xdsl/offers/{offersName}
@param offersName [required] The name of the offer
"""
String qPath = "/price/xdsl/offers/{offersName}";
StringBuilder sb = path(qPath, offersName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | java | public OvhPrice xdsl_offers_offersName_GET(net.minidev.ovh.api.price.xdsl.OvhOffersEnum offersName) throws IOException {
String qPath = "/price/xdsl/offers/{offersName}";
StringBuilder sb = path(qPath, offersName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | [
"public",
"OvhPrice",
"xdsl_offers_offersName_GET",
"(",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"price",
".",
"xdsl",
".",
"OvhOffersEnum",
"offersName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/price/xdsl/offers/{offersName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"offersName",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhPrice",
".",
"class",
")",
";",
"}"
] | Get the price of xdsl offers
REST: GET /price/xdsl/offers/{offersName}
@param offersName [required] The name of the offer | [
"Get",
"the",
"price",
"of",
"xdsl",
"offers"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L24-L29 |
windup/windup | decompiler/api/src/main/java/org/jboss/windup/decompiler/decompiler/AbstractDecompiler.java | AbstractDecompiler.decompileArchive | @Override
public DecompilationResult decompileArchive(Path archive, Path outputDir, DecompilationListener listener) throws DecompilationException {
"""
Decompiles all .class files and nested archives in the given archive.
<p>
Nested archives will be decompiled into directories matching the name of the archive, e.g.
<code>foo.ear/bar.jar/src/com/foo/bar/Baz.java</code>.
<p>
Required directories will be created as needed.
@param archive The archive containing source files and archives.
@param outputDir The directory where decompiled .java files will be placed.
@returns Result with all decompilation failures. Never throws.
"""
return decompileArchive(archive, outputDir, null, listener);
} | java | @Override
public DecompilationResult decompileArchive(Path archive, Path outputDir, DecompilationListener listener) throws DecompilationException
{
return decompileArchive(archive, outputDir, null, listener);
} | [
"@",
"Override",
"public",
"DecompilationResult",
"decompileArchive",
"(",
"Path",
"archive",
",",
"Path",
"outputDir",
",",
"DecompilationListener",
"listener",
")",
"throws",
"DecompilationException",
"{",
"return",
"decompileArchive",
"(",
"archive",
",",
"outputDir",
",",
"null",
",",
"listener",
")",
";",
"}"
] | Decompiles all .class files and nested archives in the given archive.
<p>
Nested archives will be decompiled into directories matching the name of the archive, e.g.
<code>foo.ear/bar.jar/src/com/foo/bar/Baz.java</code>.
<p>
Required directories will be created as needed.
@param archive The archive containing source files and archives.
@param outputDir The directory where decompiled .java files will be placed.
@returns Result with all decompilation failures. Never throws. | [
"Decompiles",
"all",
".",
"class",
"files",
"and",
"nested",
"archives",
"in",
"the",
"given",
"archive",
".",
"<p",
">",
"Nested",
"archives",
"will",
"be",
"decompiled",
"into",
"directories",
"matching",
"the",
"name",
"of",
"the",
"archive",
"e",
".",
"g",
".",
"<code",
">",
"foo",
".",
"ear",
"/",
"bar",
".",
"jar",
"/",
"src",
"/",
"com",
"/",
"foo",
"/",
"bar",
"/",
"Baz",
".",
"java<",
"/",
"code",
">",
".",
"<p",
">",
"Required",
"directories",
"will",
"be",
"created",
"as",
"needed",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/decompiler/api/src/main/java/org/jboss/windup/decompiler/decompiler/AbstractDecompiler.java#L149-L153 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/DevicesManagementApi.java | DevicesManagementApi.createTasksAsync | public com.squareup.okhttp.Call createTasksAsync(TaskRequest taskPayload, final ApiCallback<TaskEnvelope> callback) throws ApiException {
"""
Create a new task for one or more devices (asynchronously)
Create a new task for one or more devices
@param taskPayload Task object to be created (required)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object
"""
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = createTasksValidateBeforeCall(taskPayload, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<TaskEnvelope>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call createTasksAsync(TaskRequest taskPayload, final ApiCallback<TaskEnvelope> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = createTasksValidateBeforeCall(taskPayload, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<TaskEnvelope>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"createTasksAsync",
"(",
"TaskRequest",
"taskPayload",
",",
"final",
"ApiCallback",
"<",
"TaskEnvelope",
">",
"callback",
")",
"throws",
"ApiException",
"{",
"ProgressResponseBody",
".",
"ProgressListener",
"progressListener",
"=",
"null",
";",
"ProgressRequestBody",
".",
"ProgressRequestListener",
"progressRequestListener",
"=",
"null",
";",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"progressListener",
"=",
"new",
"ProgressResponseBody",
".",
"ProgressListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"update",
"(",
"long",
"bytesRead",
",",
"long",
"contentLength",
",",
"boolean",
"done",
")",
"{",
"callback",
".",
"onDownloadProgress",
"(",
"bytesRead",
",",
"contentLength",
",",
"done",
")",
";",
"}",
"}",
";",
"progressRequestListener",
"=",
"new",
"ProgressRequestBody",
".",
"ProgressRequestListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onRequestProgress",
"(",
"long",
"bytesWritten",
",",
"long",
"contentLength",
",",
"boolean",
"done",
")",
"{",
"callback",
".",
"onUploadProgress",
"(",
"bytesWritten",
",",
"contentLength",
",",
"done",
")",
";",
"}",
"}",
";",
"}",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"createTasksValidateBeforeCall",
"(",
"taskPayload",
",",
"progressListener",
",",
"progressRequestListener",
")",
";",
"Type",
"localVarReturnType",
"=",
"new",
"TypeToken",
"<",
"TaskEnvelope",
">",
"(",
")",
"{",
"}",
".",
"getType",
"(",
")",
";",
"apiClient",
".",
"executeAsync",
"(",
"call",
",",
"localVarReturnType",
",",
"callback",
")",
";",
"return",
"call",
";",
"}"
] | Create a new task for one or more devices (asynchronously)
Create a new task for one or more devices
@param taskPayload Task object to be created (required)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"Create",
"a",
"new",
"task",
"for",
"one",
"or",
"more",
"devices",
"(",
"asynchronously",
")",
"Create",
"a",
"new",
"task",
"for",
"one",
"or",
"more",
"devices"
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesManagementApi.java#L163-L188 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/utility/CoordinatesUtils.java | CoordinatesUtils.contains3D | public static boolean contains3D(Coordinate[] coords, Coordinate coord) {
"""
Check if a coordinate array contains a specific coordinate.
The equality is done in 3D (z values ARE checked).
@param coords
@param coord
@return
"""
for (Coordinate coordinate : coords) {
if (coordinate.equals3D(coord)) {
return true;
}
}
return false;
} | java | public static boolean contains3D(Coordinate[] coords, Coordinate coord) {
for (Coordinate coordinate : coords) {
if (coordinate.equals3D(coord)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"contains3D",
"(",
"Coordinate",
"[",
"]",
"coords",
",",
"Coordinate",
"coord",
")",
"{",
"for",
"(",
"Coordinate",
"coordinate",
":",
"coords",
")",
"{",
"if",
"(",
"coordinate",
".",
"equals3D",
"(",
"coord",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Check if a coordinate array contains a specific coordinate.
The equality is done in 3D (z values ARE checked).
@param coords
@param coord
@return | [
"Check",
"if",
"a",
"coordinate",
"array",
"contains",
"a",
"specific",
"coordinate",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/utility/CoordinatesUtils.java#L89-L96 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/signer/internal/cms/BcStoreUtils.java | BcStoreUtils.getCertificateProvider | public static CertificateProvider getCertificateProvider(ComponentManager manager, Store store,
CertificateProvider certificateProvider) throws GeneralSecurityException {
"""
Get a certificate provider for a given store and an additional certificate provider.
@param manager the component manager.
@param store the store to wrap.
@param certificateProvider provider of additional certificate to proceed to the verification.
@return a certificate provider wrapping the store.
@throws GeneralSecurityException if unable to initialize the provider.
"""
CertificateProvider provider = newCertificateProvider(manager, store);
if (certificateProvider == null) {
return provider;
}
return new ChainingCertificateProvider(provider, certificateProvider);
} | java | public static CertificateProvider getCertificateProvider(ComponentManager manager, Store store,
CertificateProvider certificateProvider) throws GeneralSecurityException
{
CertificateProvider provider = newCertificateProvider(manager, store);
if (certificateProvider == null) {
return provider;
}
return new ChainingCertificateProvider(provider, certificateProvider);
} | [
"public",
"static",
"CertificateProvider",
"getCertificateProvider",
"(",
"ComponentManager",
"manager",
",",
"Store",
"store",
",",
"CertificateProvider",
"certificateProvider",
")",
"throws",
"GeneralSecurityException",
"{",
"CertificateProvider",
"provider",
"=",
"newCertificateProvider",
"(",
"manager",
",",
"store",
")",
";",
"if",
"(",
"certificateProvider",
"==",
"null",
")",
"{",
"return",
"provider",
";",
"}",
"return",
"new",
"ChainingCertificateProvider",
"(",
"provider",
",",
"certificateProvider",
")",
";",
"}"
] | Get a certificate provider for a given store and an additional certificate provider.
@param manager the component manager.
@param store the store to wrap.
@param certificateProvider provider of additional certificate to proceed to the verification.
@return a certificate provider wrapping the store.
@throws GeneralSecurityException if unable to initialize the provider. | [
"Get",
"a",
"certificate",
"provider",
"for",
"a",
"given",
"store",
"and",
"an",
"additional",
"certificate",
"provider",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/signer/internal/cms/BcStoreUtils.java#L67-L77 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java | Messenger.bindRawUploadFile | @ObjectiveCName("bindRawUploadFileWithRid:withCallback:")
public void bindRawUploadFile(long rid, UploadFileCallback callback) {
"""
Raw Bind Upload File
@param rid randomId of uploading file
@param callback file state callback
"""
modules.getFilesModule().bindUploadFile(rid, callback);
} | java | @ObjectiveCName("bindRawUploadFileWithRid:withCallback:")
public void bindRawUploadFile(long rid, UploadFileCallback callback) {
modules.getFilesModule().bindUploadFile(rid, callback);
} | [
"@",
"ObjectiveCName",
"(",
"\"bindRawUploadFileWithRid:withCallback:\"",
")",
"public",
"void",
"bindRawUploadFile",
"(",
"long",
"rid",
",",
"UploadFileCallback",
"callback",
")",
"{",
"modules",
".",
"getFilesModule",
"(",
")",
".",
"bindUploadFile",
"(",
"rid",
",",
"callback",
")",
";",
"}"
] | Raw Bind Upload File
@param rid randomId of uploading file
@param callback file state callback | [
"Raw",
"Bind",
"Upload",
"File"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L1953-L1956 |
liferay/com-liferay-commerce | commerce-payment-service/src/main/java/com/liferay/commerce/payment/service/persistence/impl/CommercePaymentMethodGroupRelPersistenceImpl.java | CommercePaymentMethodGroupRelPersistenceImpl.fetchByG_E | @Override
public CommercePaymentMethodGroupRel fetchByG_E(long groupId,
String engineKey) {
"""
Returns the commerce payment method group rel where groupId = ? and engineKey = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param groupId the group ID
@param engineKey the engine key
@return the matching commerce payment method group rel, or <code>null</code> if a matching commerce payment method group rel could not be found
"""
return fetchByG_E(groupId, engineKey, true);
} | java | @Override
public CommercePaymentMethodGroupRel fetchByG_E(long groupId,
String engineKey) {
return fetchByG_E(groupId, engineKey, true);
} | [
"@",
"Override",
"public",
"CommercePaymentMethodGroupRel",
"fetchByG_E",
"(",
"long",
"groupId",
",",
"String",
"engineKey",
")",
"{",
"return",
"fetchByG_E",
"(",
"groupId",
",",
"engineKey",
",",
"true",
")",
";",
"}"
] | Returns the commerce payment method group rel where groupId = ? and engineKey = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param groupId the group ID
@param engineKey the engine key
@return the matching commerce payment method group rel, or <code>null</code> if a matching commerce payment method group rel could not be found | [
"Returns",
"the",
"commerce",
"payment",
"method",
"group",
"rel",
"where",
"groupId",
"=",
"?",
";",
"and",
"engineKey",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder",
"cache",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-payment-service/src/main/java/com/liferay/commerce/payment/service/persistence/impl/CommercePaymentMethodGroupRelPersistenceImpl.java#L670-L674 |
auth0/auth0-java | src/main/java/com/auth0/client/auth/AuthAPI.java | AuthAPI.renewAuth | public AuthRequest renewAuth(String refreshToken) {
"""
Creates a request to renew the authentication and get fresh new credentials using a valid Refresh Token and the 'refresh_token' grant.
<pre>
{@code
AuthAPI auth = new AuthAPI("me.auth0.com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr-yWfkaBne");
try {
TokenHolder result = auth.renewAuth("ej2E8zNEzjrcSD2edjaE")
.execute();
} catch (Auth0Exception e) {
//Something happened
}
}
</pre>
@param refreshToken the refresh token to use to get fresh new credentials.
@return a Request to configure and execute.
"""
Asserts.assertNotNull(refreshToken, "refresh token");
String url = baseUrl
.newBuilder()
.addPathSegment(PATH_OAUTH)
.addPathSegment(PATH_TOKEN)
.build()
.toString();
TokenRequest request = new TokenRequest(client, url);
request.addParameter(KEY_CLIENT_ID, clientId);
request.addParameter(KEY_CLIENT_SECRET, clientSecret);
request.addParameter(KEY_GRANT_TYPE, "refresh_token");
request.addParameter(KEY_REFRESH_TOKEN, refreshToken);
return request;
} | java | public AuthRequest renewAuth(String refreshToken) {
Asserts.assertNotNull(refreshToken, "refresh token");
String url = baseUrl
.newBuilder()
.addPathSegment(PATH_OAUTH)
.addPathSegment(PATH_TOKEN)
.build()
.toString();
TokenRequest request = new TokenRequest(client, url);
request.addParameter(KEY_CLIENT_ID, clientId);
request.addParameter(KEY_CLIENT_SECRET, clientSecret);
request.addParameter(KEY_GRANT_TYPE, "refresh_token");
request.addParameter(KEY_REFRESH_TOKEN, refreshToken);
return request;
} | [
"public",
"AuthRequest",
"renewAuth",
"(",
"String",
"refreshToken",
")",
"{",
"Asserts",
".",
"assertNotNull",
"(",
"refreshToken",
",",
"\"refresh token\"",
")",
";",
"String",
"url",
"=",
"baseUrl",
".",
"newBuilder",
"(",
")",
".",
"addPathSegment",
"(",
"PATH_OAUTH",
")",
".",
"addPathSegment",
"(",
"PATH_TOKEN",
")",
".",
"build",
"(",
")",
".",
"toString",
"(",
")",
";",
"TokenRequest",
"request",
"=",
"new",
"TokenRequest",
"(",
"client",
",",
"url",
")",
";",
"request",
".",
"addParameter",
"(",
"KEY_CLIENT_ID",
",",
"clientId",
")",
";",
"request",
".",
"addParameter",
"(",
"KEY_CLIENT_SECRET",
",",
"clientSecret",
")",
";",
"request",
".",
"addParameter",
"(",
"KEY_GRANT_TYPE",
",",
"\"refresh_token\"",
")",
";",
"request",
".",
"addParameter",
"(",
"KEY_REFRESH_TOKEN",
",",
"refreshToken",
")",
";",
"return",
"request",
";",
"}"
] | Creates a request to renew the authentication and get fresh new credentials using a valid Refresh Token and the 'refresh_token' grant.
<pre>
{@code
AuthAPI auth = new AuthAPI("me.auth0.com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr-yWfkaBne");
try {
TokenHolder result = auth.renewAuth("ej2E8zNEzjrcSD2edjaE")
.execute();
} catch (Auth0Exception e) {
//Something happened
}
}
</pre>
@param refreshToken the refresh token to use to get fresh new credentials.
@return a Request to configure and execute. | [
"Creates",
"a",
"request",
"to",
"renew",
"the",
"authentication",
"and",
"get",
"fresh",
"new",
"credentials",
"using",
"a",
"valid",
"Refresh",
"Token",
"and",
"the",
"refresh_token",
"grant",
".",
"<pre",
">",
"{",
"@code",
"AuthAPI",
"auth",
"=",
"new",
"AuthAPI",
"(",
"me",
".",
"auth0",
".",
"com",
"B3c6RYhk1v9SbIJcRIOwu62gIUGsnze",
"2679NfkaBn62e6w5E8zNEzjr",
"-",
"yWfkaBne",
")",
";",
"try",
"{",
"TokenHolder",
"result",
"=",
"auth",
".",
"renewAuth",
"(",
"ej2E8zNEzjrcSD2edjaE",
")",
".",
"execute",
"()",
";",
"}",
"catch",
"(",
"Auth0Exception",
"e",
")",
"{",
"//",
"Something",
"happened",
"}",
"}",
"<",
"/",
"pre",
">"
] | train | https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/auth/AuthAPI.java#L472-L487 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/AnimationConfig.java | AnimationConfig.createAnimation | public static Animation createAnimation(XmlReader node) {
"""
Create animation data from node.
@param node The animation node (must not be <code>null</code>).
@return The animation instance.
@throws LionEngineException If error when reading animation data.
"""
Check.notNull(node);
final String name = node.readString(ANIMATION_NAME);
final int start = node.readInteger(ANIMATION_START);
final int end = node.readInteger(ANIMATION_END);
final double speed = node.readDouble(ANIMATION_SPEED);
final boolean reversed = node.readBoolean(ANIMATION_REVERSED);
final boolean repeat = node.readBoolean(ANIMATION_REPEAT);
return new Animation(name, start, end, speed, reversed, repeat);
} | java | public static Animation createAnimation(XmlReader node)
{
Check.notNull(node);
final String name = node.readString(ANIMATION_NAME);
final int start = node.readInteger(ANIMATION_START);
final int end = node.readInteger(ANIMATION_END);
final double speed = node.readDouble(ANIMATION_SPEED);
final boolean reversed = node.readBoolean(ANIMATION_REVERSED);
final boolean repeat = node.readBoolean(ANIMATION_REPEAT);
return new Animation(name, start, end, speed, reversed, repeat);
} | [
"public",
"static",
"Animation",
"createAnimation",
"(",
"XmlReader",
"node",
")",
"{",
"Check",
".",
"notNull",
"(",
"node",
")",
";",
"final",
"String",
"name",
"=",
"node",
".",
"readString",
"(",
"ANIMATION_NAME",
")",
";",
"final",
"int",
"start",
"=",
"node",
".",
"readInteger",
"(",
"ANIMATION_START",
")",
";",
"final",
"int",
"end",
"=",
"node",
".",
"readInteger",
"(",
"ANIMATION_END",
")",
";",
"final",
"double",
"speed",
"=",
"node",
".",
"readDouble",
"(",
"ANIMATION_SPEED",
")",
";",
"final",
"boolean",
"reversed",
"=",
"node",
".",
"readBoolean",
"(",
"ANIMATION_REVERSED",
")",
";",
"final",
"boolean",
"repeat",
"=",
"node",
".",
"readBoolean",
"(",
"ANIMATION_REPEAT",
")",
";",
"return",
"new",
"Animation",
"(",
"name",
",",
"start",
",",
"end",
",",
"speed",
",",
"reversed",
",",
"repeat",
")",
";",
"}"
] | Create animation data from node.
@param node The animation node (must not be <code>null</code>).
@return The animation instance.
@throws LionEngineException If error when reading animation data. | [
"Create",
"animation",
"data",
"from",
"node",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/AnimationConfig.java#L103-L115 |
cojen/Cojen | src/main/java/org/cojen/util/QuickConstructorGenerator.java | QuickConstructorGenerator.getInstance | @SuppressWarnings("unchecked")
public static synchronized <F> F getInstance(final Class<?> objectType,
final Class<F> factory) {
"""
Returns a factory instance for one type of object. Each method in the
interface defines a constructor via its parameters. Any checked
exceptions declared thrown by the constructor must also be declared by
the method. The method return types can be the same type as the
constructed object or a supertype.
<p>Here is a contrived example for constructing strings. In practice,
such a string factory is useless, since the "new" operator can be
invoked directly.
<pre>
public interface StringFactory {
String newEmptyString();
String newStringFromChars(char[] chars);
String newStringFromBytes(byte[] bytes, String charsetName)
throws UnsupportedEncodingException;
}
</pre>
Here's an example of it being used:
<pre>
StringFactory sf = QuickConstructorGenerator.getInstance(String.class, StringFactory.class);
...
String str = sf.newStringFromChars(new char[] {'h', 'e', 'l', 'l', 'o'});
</pre>
@param objectType type of object to construct
@param factory interface defining which objects can be constructed
@throws IllegalArgumentException if factory type is not an interface or
if it is malformed
"""
Cache<Class<?>, Object> innerCache = cCache.get(factory);
if (innerCache == null) {
innerCache = new SoftValueCache(5);
cCache.put(factory, innerCache);
}
F instance = (F) innerCache.get(objectType);
if (instance != null) {
return instance;
}
if (objectType == null) {
throw new IllegalArgumentException("No object type");
}
if (factory == null) {
throw new IllegalArgumentException("No factory type");
}
if (!factory.isInterface()) {
throw new IllegalArgumentException("Factory must be an interface");
}
final Cache<Class<?>, Object> fInnerCache = innerCache;
return AccessController.doPrivileged(new PrivilegedAction<F>() {
public F run() {
return getInstance(fInnerCache, objectType, factory);
}
});
} | java | @SuppressWarnings("unchecked")
public static synchronized <F> F getInstance(final Class<?> objectType,
final Class<F> factory)
{
Cache<Class<?>, Object> innerCache = cCache.get(factory);
if (innerCache == null) {
innerCache = new SoftValueCache(5);
cCache.put(factory, innerCache);
}
F instance = (F) innerCache.get(objectType);
if (instance != null) {
return instance;
}
if (objectType == null) {
throw new IllegalArgumentException("No object type");
}
if (factory == null) {
throw new IllegalArgumentException("No factory type");
}
if (!factory.isInterface()) {
throw new IllegalArgumentException("Factory must be an interface");
}
final Cache<Class<?>, Object> fInnerCache = innerCache;
return AccessController.doPrivileged(new PrivilegedAction<F>() {
public F run() {
return getInstance(fInnerCache, objectType, factory);
}
});
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"synchronized",
"<",
"F",
">",
"F",
"getInstance",
"(",
"final",
"Class",
"<",
"?",
">",
"objectType",
",",
"final",
"Class",
"<",
"F",
">",
"factory",
")",
"{",
"Cache",
"<",
"Class",
"<",
"?",
">",
",",
"Object",
">",
"innerCache",
"=",
"cCache",
".",
"get",
"(",
"factory",
")",
";",
"if",
"(",
"innerCache",
"==",
"null",
")",
"{",
"innerCache",
"=",
"new",
"SoftValueCache",
"(",
"5",
")",
";",
"cCache",
".",
"put",
"(",
"factory",
",",
"innerCache",
")",
";",
"}",
"F",
"instance",
"=",
"(",
"F",
")",
"innerCache",
".",
"get",
"(",
"objectType",
")",
";",
"if",
"(",
"instance",
"!=",
"null",
")",
"{",
"return",
"instance",
";",
"}",
"if",
"(",
"objectType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No object type\"",
")",
";",
"}",
"if",
"(",
"factory",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No factory type\"",
")",
";",
"}",
"if",
"(",
"!",
"factory",
".",
"isInterface",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Factory must be an interface\"",
")",
";",
"}",
"final",
"Cache",
"<",
"Class",
"<",
"?",
">",
",",
"Object",
">",
"fInnerCache",
"=",
"innerCache",
";",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"F",
">",
"(",
")",
"{",
"public",
"F",
"run",
"(",
")",
"{",
"return",
"getInstance",
"(",
"fInnerCache",
",",
"objectType",
",",
"factory",
")",
";",
"}",
"}",
")",
";",
"}"
] | Returns a factory instance for one type of object. Each method in the
interface defines a constructor via its parameters. Any checked
exceptions declared thrown by the constructor must also be declared by
the method. The method return types can be the same type as the
constructed object or a supertype.
<p>Here is a contrived example for constructing strings. In practice,
such a string factory is useless, since the "new" operator can be
invoked directly.
<pre>
public interface StringFactory {
String newEmptyString();
String newStringFromChars(char[] chars);
String newStringFromBytes(byte[] bytes, String charsetName)
throws UnsupportedEncodingException;
}
</pre>
Here's an example of it being used:
<pre>
StringFactory sf = QuickConstructorGenerator.getInstance(String.class, StringFactory.class);
...
String str = sf.newStringFromChars(new char[] {'h', 'e', 'l', 'l', 'o'});
</pre>
@param objectType type of object to construct
@param factory interface defining which objects can be constructed
@throws IllegalArgumentException if factory type is not an interface or
if it is malformed | [
"Returns",
"a",
"factory",
"instance",
"for",
"one",
"type",
"of",
"object",
".",
"Each",
"method",
"in",
"the",
"interface",
"defines",
"a",
"constructor",
"via",
"its",
"parameters",
".",
"Any",
"checked",
"exceptions",
"declared",
"thrown",
"by",
"the",
"constructor",
"must",
"also",
"be",
"declared",
"by",
"the",
"method",
".",
"The",
"method",
"return",
"types",
"can",
"be",
"the",
"same",
"type",
"as",
"the",
"constructed",
"object",
"or",
"a",
"supertype",
"."
] | train | https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/util/QuickConstructorGenerator.java#L104-L134 |
hsiafan/requests | src/main/java/net/dongliu/requests/utils/Cookies.java | Cookies.isDomainSuffix | public static boolean isDomainSuffix(String domain, String domainSuffix) {
"""
If domainSuffix is suffix of domain
@param domain start with "."
@param domainSuffix not start with "."
"""
if (domain.length() < domainSuffix.length()) {
return false;
}
if (domain.length() == domainSuffix.length()) {
return domain.equals(domainSuffix);
}
return domain.endsWith(domainSuffix) && domain.charAt(domain.length() - domainSuffix.length() - 1) == '.';
} | java | public static boolean isDomainSuffix(String domain, String domainSuffix) {
if (domain.length() < domainSuffix.length()) {
return false;
}
if (domain.length() == domainSuffix.length()) {
return domain.equals(domainSuffix);
}
return domain.endsWith(domainSuffix) && domain.charAt(domain.length() - domainSuffix.length() - 1) == '.';
} | [
"public",
"static",
"boolean",
"isDomainSuffix",
"(",
"String",
"domain",
",",
"String",
"domainSuffix",
")",
"{",
"if",
"(",
"domain",
".",
"length",
"(",
")",
"<",
"domainSuffix",
".",
"length",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"domain",
".",
"length",
"(",
")",
"==",
"domainSuffix",
".",
"length",
"(",
")",
")",
"{",
"return",
"domain",
".",
"equals",
"(",
"domainSuffix",
")",
";",
"}",
"return",
"domain",
".",
"endsWith",
"(",
"domainSuffix",
")",
"&&",
"domain",
".",
"charAt",
"(",
"domain",
".",
"length",
"(",
")",
"-",
"domainSuffix",
".",
"length",
"(",
")",
"-",
"1",
")",
"==",
"'",
"'",
";",
"}"
] | If domainSuffix is suffix of domain
@param domain start with "."
@param domainSuffix not start with "." | [
"If",
"domainSuffix",
"is",
"suffix",
"of",
"domain"
] | train | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/Cookies.java#L95-L104 |
aalmiray/Json-lib | src/main/java/net/sf/json/JSONSerializer.java | JSONSerializer.toJSON | private static JSON toJSON( JSONString string, JsonConfig jsonConfig ) {
"""
Creates a JSONObject, JSONArray or a JSONNull from a JSONString.
@throws JSONException if the string is not a valid JSON string
"""
return toJSON( string.toJSONString(), jsonConfig );
} | java | private static JSON toJSON( JSONString string, JsonConfig jsonConfig ) {
return toJSON( string.toJSONString(), jsonConfig );
} | [
"private",
"static",
"JSON",
"toJSON",
"(",
"JSONString",
"string",
",",
"JsonConfig",
"jsonConfig",
")",
"{",
"return",
"toJSON",
"(",
"string",
".",
"toJSONString",
"(",
")",
",",
"jsonConfig",
")",
";",
"}"
] | Creates a JSONObject, JSONArray or a JSONNull from a JSONString.
@throws JSONException if the string is not a valid JSON string | [
"Creates",
"a",
"JSONObject",
"JSONArray",
"or",
"a",
"JSONNull",
"from",
"a",
"JSONString",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONSerializer.java#L125-L127 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.trimStartAndEnd | @Nullable
@CheckReturnValue
public static String trimStartAndEnd (@Nullable final String sSrc, final char cLead, final char cTail) {
"""
Trim the passed lead and tail from the source value. If the source value does
not start with the passed lead and does not end with the passed tail, nothing
happens.
@param sSrc
The input source string
@param cLead
The char to be trimmed of the beginning
@param cTail
The char to be trimmed of the end
@return The trimmed string, or the original input string, if the lead and the
tail were not found
@see #trimStart(String, char)
@see #trimEnd(String, char)
@see #trimStartAndEnd(String, char)
"""
final String sInbetween = trimStart (sSrc, cLead);
return trimEnd (sInbetween, cTail);
} | java | @Nullable
@CheckReturnValue
public static String trimStartAndEnd (@Nullable final String sSrc, final char cLead, final char cTail)
{
final String sInbetween = trimStart (sSrc, cLead);
return trimEnd (sInbetween, cTail);
} | [
"@",
"Nullable",
"@",
"CheckReturnValue",
"public",
"static",
"String",
"trimStartAndEnd",
"(",
"@",
"Nullable",
"final",
"String",
"sSrc",
",",
"final",
"char",
"cLead",
",",
"final",
"char",
"cTail",
")",
"{",
"final",
"String",
"sInbetween",
"=",
"trimStart",
"(",
"sSrc",
",",
"cLead",
")",
";",
"return",
"trimEnd",
"(",
"sInbetween",
",",
"cTail",
")",
";",
"}"
] | Trim the passed lead and tail from the source value. If the source value does
not start with the passed lead and does not end with the passed tail, nothing
happens.
@param sSrc
The input source string
@param cLead
The char to be trimmed of the beginning
@param cTail
The char to be trimmed of the end
@return The trimmed string, or the original input string, if the lead and the
tail were not found
@see #trimStart(String, char)
@see #trimEnd(String, char)
@see #trimStartAndEnd(String, char) | [
"Trim",
"the",
"passed",
"lead",
"and",
"tail",
"from",
"the",
"source",
"value",
".",
"If",
"the",
"source",
"value",
"does",
"not",
"start",
"with",
"the",
"passed",
"lead",
"and",
"does",
"not",
"end",
"with",
"the",
"passed",
"tail",
"nothing",
"happens",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3540-L3546 |
apache/incubator-heron | heron/spi/src/java/org/apache/heron/spi/common/TokenSub.java | TokenSub.substituteURL | private static String substituteURL(Config config, String pathString) {
"""
Given a static config map, substitute occurrences of ${HERON_*} variables
in the provided URL
@param config a static map config object of key value pairs
@param pathString string representing a path including ${HERON_*} variables
@return String string that represents the modified path
"""
Matcher m = URL_PATTERN.matcher(pathString);
if (m.matches()) {
return String.format("%s://%s", m.group(1), substitute(config, m.group(2)));
}
return pathString;
} | java | private static String substituteURL(Config config, String pathString) {
Matcher m = URL_PATTERN.matcher(pathString);
if (m.matches()) {
return String.format("%s://%s", m.group(1), substitute(config, m.group(2)));
}
return pathString;
} | [
"private",
"static",
"String",
"substituteURL",
"(",
"Config",
"config",
",",
"String",
"pathString",
")",
"{",
"Matcher",
"m",
"=",
"URL_PATTERN",
".",
"matcher",
"(",
"pathString",
")",
";",
"if",
"(",
"m",
".",
"matches",
"(",
")",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"%s://%s\"",
",",
"m",
".",
"group",
"(",
"1",
")",
",",
"substitute",
"(",
"config",
",",
"m",
".",
"group",
"(",
"2",
")",
")",
")",
";",
"}",
"return",
"pathString",
";",
"}"
] | Given a static config map, substitute occurrences of ${HERON_*} variables
in the provided URL
@param config a static map config object of key value pairs
@param pathString string representing a path including ${HERON_*} variables
@return String string that represents the modified path | [
"Given",
"a",
"static",
"config",
"map",
"substitute",
"occurrences",
"of",
"$",
"{",
"HERON_",
"*",
"}",
"variables",
"in",
"the",
"provided",
"URL"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/common/TokenSub.java#L128-L134 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.beforeClosingTag | public void beforeClosingTag(StringBuilder sb, boolean pretty, String indent, String... attributeNames) {
"""
Override in a subclass to inject custom content onto XML just before the closing tag.
<p>To keep the formatting, it is recommended to implement this method as the example below.
<blockquote><pre>
if (pretty) { sb.append(ident); }
sb.append("<test>...</test>");
if (pretty) { sb.append('\n'); }
</pre></blockquote>
@param sb to write content to.
@param pretty pretty format (human readable), or one line text.
@param indent indent at current level
@param attributeNames list of attributes to include
"""
StringWriter writer = new StringWriter();
beforeClosingTag(indent.length(), writer, attributeNames);
sb.append(writer.toString());
} | java | public void beforeClosingTag(StringBuilder sb, boolean pretty, String indent, String... attributeNames) {
StringWriter writer = new StringWriter();
beforeClosingTag(indent.length(), writer, attributeNames);
sb.append(writer.toString());
} | [
"public",
"void",
"beforeClosingTag",
"(",
"StringBuilder",
"sb",
",",
"boolean",
"pretty",
",",
"String",
"indent",
",",
"String",
"...",
"attributeNames",
")",
"{",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"beforeClosingTag",
"(",
"indent",
".",
"length",
"(",
")",
",",
"writer",
",",
"attributeNames",
")",
";",
"sb",
".",
"append",
"(",
"writer",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Override in a subclass to inject custom content onto XML just before the closing tag.
<p>To keep the formatting, it is recommended to implement this method as the example below.
<blockquote><pre>
if (pretty) { sb.append(ident); }
sb.append("<test>...</test>");
if (pretty) { sb.append('\n'); }
</pre></blockquote>
@param sb to write content to.
@param pretty pretty format (human readable), or one line text.
@param indent indent at current level
@param attributeNames list of attributes to include | [
"Override",
"in",
"a",
"subclass",
"to",
"inject",
"custom",
"content",
"onto",
"XML",
"just",
"before",
"the",
"closing",
"tag",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L1042-L1046 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_reach.java | DZcs_reach.cs_reach | public static int cs_reach(DZcs G, DZcs B, int k, int[] xi, int[] pinv) {
"""
Finds a nonzero pattern of x=L\b for sparse L and b.
@param G
graph to search (G.p modified, then restored)
@param B
right hand side, b = B(:,k)
@param k
use kth column of B
@param xi
size 2*n, output in xi[top..n-1]
@param pinv
mapping of rows to columns of G, ignored if null
@return top, -1 on error
"""
int p, n, top, Bp[], Bi[], Gp[] ;
if (!CS_CSC (G) || !CS_CSC (B) || xi == null)
return (-1) ; /* check inputs */
n = G.n ; Bp = B.p ; Bi = B.i ; Gp = G.p ;
top = n ;
for (p = Bp [k] ; p < Bp [k+1] ; p++)
{
if (!CS_MARKED (Gp, Bi [p])) /* start a dfs at unmarked node i */
{
top = cs_dfs (Bi [p], G, top, xi, 0, xi, n, pinv, 0) ;
}
}
for (p = top ; p < n ; p++) CS_MARK (Gp, xi [p]) ; /* restore G */
return (top) ;
} | java | public static int cs_reach(DZcs G, DZcs B, int k, int[] xi, int[] pinv)
{
int p, n, top, Bp[], Bi[], Gp[] ;
if (!CS_CSC (G) || !CS_CSC (B) || xi == null)
return (-1) ; /* check inputs */
n = G.n ; Bp = B.p ; Bi = B.i ; Gp = G.p ;
top = n ;
for (p = Bp [k] ; p < Bp [k+1] ; p++)
{
if (!CS_MARKED (Gp, Bi [p])) /* start a dfs at unmarked node i */
{
top = cs_dfs (Bi [p], G, top, xi, 0, xi, n, pinv, 0) ;
}
}
for (p = top ; p < n ; p++) CS_MARK (Gp, xi [p]) ; /* restore G */
return (top) ;
} | [
"public",
"static",
"int",
"cs_reach",
"(",
"DZcs",
"G",
",",
"DZcs",
"B",
",",
"int",
"k",
",",
"int",
"[",
"]",
"xi",
",",
"int",
"[",
"]",
"pinv",
")",
"{",
"int",
"p",
",",
"n",
",",
"top",
",",
"Bp",
"[",
"]",
",",
"Bi",
"[",
"]",
",",
"Gp",
"[",
"]",
";",
"if",
"(",
"!",
"CS_CSC",
"(",
"G",
")",
"||",
"!",
"CS_CSC",
"(",
"B",
")",
"||",
"xi",
"==",
"null",
")",
"return",
"(",
"-",
"1",
")",
";",
"/* check inputs */",
"n",
"=",
"G",
".",
"n",
";",
"Bp",
"=",
"B",
".",
"p",
";",
"Bi",
"=",
"B",
".",
"i",
";",
"Gp",
"=",
"G",
".",
"p",
";",
"top",
"=",
"n",
";",
"for",
"(",
"p",
"=",
"Bp",
"[",
"k",
"]",
";",
"p",
"<",
"Bp",
"[",
"k",
"+",
"1",
"]",
";",
"p",
"++",
")",
"{",
"if",
"(",
"!",
"CS_MARKED",
"(",
"Gp",
",",
"Bi",
"[",
"p",
"]",
")",
")",
"/* start a dfs at unmarked node i */",
"{",
"top",
"=",
"cs_dfs",
"(",
"Bi",
"[",
"p",
"]",
",",
"G",
",",
"top",
",",
"xi",
",",
"0",
",",
"xi",
",",
"n",
",",
"pinv",
",",
"0",
")",
";",
"}",
"}",
"for",
"(",
"p",
"=",
"top",
";",
"p",
"<",
"n",
";",
"p",
"++",
")",
"CS_MARK",
"(",
"Gp",
",",
"xi",
"[",
"p",
"]",
")",
";",
"/* restore G */",
"return",
"(",
"top",
")",
";",
"}"
] | Finds a nonzero pattern of x=L\b for sparse L and b.
@param G
graph to search (G.p modified, then restored)
@param B
right hand side, b = B(:,k)
@param k
use kth column of B
@param xi
size 2*n, output in xi[top..n-1]
@param pinv
mapping of rows to columns of G, ignored if null
@return top, -1 on error | [
"Finds",
"a",
"nonzero",
"pattern",
"of",
"x",
"=",
"L",
"\\",
"b",
"for",
"sparse",
"L",
"and",
"b",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_reach.java#L59-L75 |
OpenTSDB/opentsdb | src/meta/TSMeta.java | TSMeta.parseFromColumn | public static Deferred<TSMeta> parseFromColumn(final TSDB tsdb,
final KeyValue column, final boolean load_uidmetas) {
"""
Parses a TSMeta object from the given column, optionally loading the
UIDMeta objects
@param tsdb The TSDB to use for storage access
@param column The KeyValue column to parse
@param load_uidmetas Whether or not UIDmeta objects should be loaded
@return A TSMeta if parsed successfully
@throws NoSuchUniqueName if one of the UIDMeta objects does not exist
@throws JSONException if the data was corrupted
"""
if (column.value() == null || column.value().length < 1) {
throw new IllegalArgumentException("Empty column value");
}
final TSMeta parsed_meta = JSON.parseToObject(column.value(), TSMeta.class);
// fix in case the tsuid is missing
if (parsed_meta.tsuid == null || parsed_meta.tsuid.isEmpty()) {
parsed_meta.tsuid = UniqueId.uidToString(column.key());
}
Deferred<TSMeta> meta = getFromStorage(tsdb, UniqueId.stringToUid(parsed_meta.tsuid));
if (!load_uidmetas) {
return meta;
}
return meta.addCallbackDeferring(new LoadUIDs(tsdb, parsed_meta.tsuid));
} | java | public static Deferred<TSMeta> parseFromColumn(final TSDB tsdb,
final KeyValue column, final boolean load_uidmetas) {
if (column.value() == null || column.value().length < 1) {
throw new IllegalArgumentException("Empty column value");
}
final TSMeta parsed_meta = JSON.parseToObject(column.value(), TSMeta.class);
// fix in case the tsuid is missing
if (parsed_meta.tsuid == null || parsed_meta.tsuid.isEmpty()) {
parsed_meta.tsuid = UniqueId.uidToString(column.key());
}
Deferred<TSMeta> meta = getFromStorage(tsdb, UniqueId.stringToUid(parsed_meta.tsuid));
if (!load_uidmetas) {
return meta;
}
return meta.addCallbackDeferring(new LoadUIDs(tsdb, parsed_meta.tsuid));
} | [
"public",
"static",
"Deferred",
"<",
"TSMeta",
">",
"parseFromColumn",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"KeyValue",
"column",
",",
"final",
"boolean",
"load_uidmetas",
")",
"{",
"if",
"(",
"column",
".",
"value",
"(",
")",
"==",
"null",
"||",
"column",
".",
"value",
"(",
")",
".",
"length",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Empty column value\"",
")",
";",
"}",
"final",
"TSMeta",
"parsed_meta",
"=",
"JSON",
".",
"parseToObject",
"(",
"column",
".",
"value",
"(",
")",
",",
"TSMeta",
".",
"class",
")",
";",
"// fix in case the tsuid is missing",
"if",
"(",
"parsed_meta",
".",
"tsuid",
"==",
"null",
"||",
"parsed_meta",
".",
"tsuid",
".",
"isEmpty",
"(",
")",
")",
"{",
"parsed_meta",
".",
"tsuid",
"=",
"UniqueId",
".",
"uidToString",
"(",
"column",
".",
"key",
"(",
")",
")",
";",
"}",
"Deferred",
"<",
"TSMeta",
">",
"meta",
"=",
"getFromStorage",
"(",
"tsdb",
",",
"UniqueId",
".",
"stringToUid",
"(",
"parsed_meta",
".",
"tsuid",
")",
")",
";",
"if",
"(",
"!",
"load_uidmetas",
")",
"{",
"return",
"meta",
";",
"}",
"return",
"meta",
".",
"addCallbackDeferring",
"(",
"new",
"LoadUIDs",
"(",
"tsdb",
",",
"parsed_meta",
".",
"tsuid",
")",
")",
";",
"}"
] | Parses a TSMeta object from the given column, optionally loading the
UIDMeta objects
@param tsdb The TSDB to use for storage access
@param column The KeyValue column to parse
@param load_uidmetas Whether or not UIDmeta objects should be loaded
@return A TSMeta if parsed successfully
@throws NoSuchUniqueName if one of the UIDMeta objects does not exist
@throws JSONException if the data was corrupted | [
"Parses",
"a",
"TSMeta",
"object",
"from",
"the",
"given",
"column",
"optionally",
"loading",
"the",
"UIDMeta",
"objects"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/TSMeta.java#L404-L424 |
UrielCh/ovh-java-sdk | ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhCore.java | ApiOvhCore.setLoginInfo | public void setLoginInfo(String nic, String password, int timeInSec) {
"""
Store password based credential for an automatic certificate generation
@param nic
@param password
@param timeInSec
"""
nic = nic.toLowerCase();
this.nic = nic;
this.password = password;
this.timeInSec = timeInSec;
} | java | public void setLoginInfo(String nic, String password, int timeInSec) {
nic = nic.toLowerCase();
this.nic = nic;
this.password = password;
this.timeInSec = timeInSec;
} | [
"public",
"void",
"setLoginInfo",
"(",
"String",
"nic",
",",
"String",
"password",
",",
"int",
"timeInSec",
")",
"{",
"nic",
"=",
"nic",
".",
"toLowerCase",
"(",
")",
";",
"this",
".",
"nic",
"=",
"nic",
";",
"this",
".",
"password",
"=",
"password",
";",
"this",
".",
"timeInSec",
"=",
"timeInSec",
";",
"}"
] | Store password based credential for an automatic certificate generation
@param nic
@param password
@param timeInSec | [
"Store",
"password",
"based",
"credential",
"for",
"an",
"automatic",
"certificate",
"generation"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhCore.java#L334-L339 |
nmorel/gwt-jackson | gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java | AbstractCreator.methodCallCodeWithJMapperTypeParameters | private CodeBlock methodCallCodeWithJMapperTypeParameters( MapperInstance instance, ImmutableList<? extends JMapperType> parameters ) {
"""
Build the code to create a mapper.
@param instance the class to call
@param parameters the parameters of the method
@return the code to create the mapper
"""
CodeBlock.Builder builder = initMethodCallCode( instance );
return methodCallCodeWithJMapperTypeParameters( builder, parameters );
} | java | private CodeBlock methodCallCodeWithJMapperTypeParameters( MapperInstance instance, ImmutableList<? extends JMapperType> parameters ) {
CodeBlock.Builder builder = initMethodCallCode( instance );
return methodCallCodeWithJMapperTypeParameters( builder, parameters );
} | [
"private",
"CodeBlock",
"methodCallCodeWithJMapperTypeParameters",
"(",
"MapperInstance",
"instance",
",",
"ImmutableList",
"<",
"?",
"extends",
"JMapperType",
">",
"parameters",
")",
"{",
"CodeBlock",
".",
"Builder",
"builder",
"=",
"initMethodCallCode",
"(",
"instance",
")",
";",
"return",
"methodCallCodeWithJMapperTypeParameters",
"(",
"builder",
",",
"parameters",
")",
";",
"}"
] | Build the code to create a mapper.
@param instance the class to call
@param parameters the parameters of the method
@return the code to create the mapper | [
"Build",
"the",
"code",
"to",
"create",
"a",
"mapper",
"."
] | train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java#L917-L920 |
cdk/cdk | storage/ctab/src/main/java/org/openscience/cdk/io/MDLV2000Writer.java | MDLV2000Writer.formatMDLString | protected static String formatMDLString(String s, int le) {
"""
Formats a String to fit into the connectiontable.
@param s The String to be formated
@param le The length of the String
@return The String to be written in the connectiontable
"""
s = s.trim();
if (s.length() > le) return s.substring(0, le);
int l;
l = le - s.length();
for (int f = 0; f < l; f++)
s += " ";
return s;
} | java | protected static String formatMDLString(String s, int le) {
s = s.trim();
if (s.length() > le) return s.substring(0, le);
int l;
l = le - s.length();
for (int f = 0; f < l; f++)
s += " ";
return s;
} | [
"protected",
"static",
"String",
"formatMDLString",
"(",
"String",
"s",
",",
"int",
"le",
")",
"{",
"s",
"=",
"s",
".",
"trim",
"(",
")",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
">",
"le",
")",
"return",
"s",
".",
"substring",
"(",
"0",
",",
"le",
")",
";",
"int",
"l",
";",
"l",
"=",
"le",
"-",
"s",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"f",
"=",
"0",
";",
"f",
"<",
"l",
";",
"f",
"++",
")",
"s",
"+=",
"\"",
"\"",
";",
"return",
"s",
";",
"}"
] | Formats a String to fit into the connectiontable.
@param s The String to be formated
@param le The length of the String
@return The String to be written in the connectiontable | [
"Formats",
"a",
"String",
"to",
"fit",
"into",
"the",
"connectiontable",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/ctab/src/main/java/org/openscience/cdk/io/MDLV2000Writer.java#L1158-L1166 |
Red5/red5-io | src/main/java/org/red5/io/utils/IOUtils.java | IOUtils.writeExtendedMediumInt | public final static void writeExtendedMediumInt(IoBuffer out, int value) {
"""
Writes extended medium integer (equivalent to a regular integer whose most significant byte has been moved to its end, past its least significant byte)
@param out
Output buffer
@param value
Integer to write
"""
value = ((value & 0xff000000) >> 24) | (value << 8);
out.putInt(value);
} | java | public final static void writeExtendedMediumInt(IoBuffer out, int value) {
value = ((value & 0xff000000) >> 24) | (value << 8);
out.putInt(value);
} | [
"public",
"final",
"static",
"void",
"writeExtendedMediumInt",
"(",
"IoBuffer",
"out",
",",
"int",
"value",
")",
"{",
"value",
"=",
"(",
"(",
"value",
"&",
"0xff000000",
")",
">>",
"24",
")",
"|",
"(",
"value",
"<<",
"8",
")",
";",
"out",
".",
"putInt",
"(",
"value",
")",
";",
"}"
] | Writes extended medium integer (equivalent to a regular integer whose most significant byte has been moved to its end, past its least significant byte)
@param out
Output buffer
@param value
Integer to write | [
"Writes",
"extended",
"medium",
"integer",
"(",
"equivalent",
"to",
"a",
"regular",
"integer",
"whose",
"most",
"significant",
"byte",
"has",
"been",
"moved",
"to",
"its",
"end",
"past",
"its",
"least",
"significant",
"byte",
")"
] | train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/IOUtils.java#L89-L92 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.describeImageInStream | public ImageDescription describeImageInStream(byte[] image, DescribeImageInStreamOptionalParameter describeImageInStreamOptionalParameter) {
"""
This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL.A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
@param image An image stream.
@param describeImageInStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ComputerVisionErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ImageDescription object if successful.
"""
return describeImageInStreamWithServiceResponseAsync(image, describeImageInStreamOptionalParameter).toBlocking().single().body();
} | java | public ImageDescription describeImageInStream(byte[] image, DescribeImageInStreamOptionalParameter describeImageInStreamOptionalParameter) {
return describeImageInStreamWithServiceResponseAsync(image, describeImageInStreamOptionalParameter).toBlocking().single().body();
} | [
"public",
"ImageDescription",
"describeImageInStream",
"(",
"byte",
"[",
"]",
"image",
",",
"DescribeImageInStreamOptionalParameter",
"describeImageInStreamOptionalParameter",
")",
"{",
"return",
"describeImageInStreamWithServiceResponseAsync",
"(",
"image",
",",
"describeImageInStreamOptionalParameter",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL.A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong.
@param image An image stream.
@param describeImageInStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ComputerVisionErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ImageDescription object if successful. | [
"This",
"operation",
"generates",
"a",
"description",
"of",
"an",
"image",
"in",
"human",
"readable",
"language",
"with",
"complete",
"sentences",
".",
"The",
"description",
"is",
"based",
"on",
"a",
"collection",
"of",
"content",
"tags",
"which",
"are",
"also",
"returned",
"by",
"the",
"operation",
".",
"More",
"than",
"one",
"description",
"can",
"be",
"generated",
"for",
"each",
"image",
".",
"Descriptions",
"are",
"ordered",
"by",
"their",
"confidence",
"score",
".",
"All",
"descriptions",
"are",
"in",
"English",
".",
"Two",
"input",
"methods",
"are",
"supported",
"--",
"(",
"1",
")",
"Uploading",
"an",
"image",
"or",
"(",
"2",
")",
"specifying",
"an",
"image",
"URL",
".",
"A",
"successful",
"response",
"will",
"be",
"returned",
"in",
"JSON",
".",
"If",
"the",
"request",
"failed",
"the",
"response",
"will",
"contain",
"an",
"error",
"code",
"and",
"a",
"message",
"to",
"help",
"understand",
"what",
"went",
"wrong",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L578-L580 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java | BeetlUtil.getClassPathTemplate | public static Template getClassPathTemplate(String path, String templateFileName) {
"""
获得ClassPath模板
@param path ClassPath路径
@param templateFileName 模板内容
@return 模板
@since 3.2.0
"""
return getTemplate(createClassPathGroupTemplate(path), templateFileName);
} | java | public static Template getClassPathTemplate(String path, String templateFileName) {
return getTemplate(createClassPathGroupTemplate(path), templateFileName);
} | [
"public",
"static",
"Template",
"getClassPathTemplate",
"(",
"String",
"path",
",",
"String",
"templateFileName",
")",
"{",
"return",
"getTemplate",
"(",
"createClassPathGroupTemplate",
"(",
"path",
")",
",",
"templateFileName",
")",
";",
"}"
] | 获得ClassPath模板
@param path ClassPath路径
@param templateFileName 模板内容
@return 模板
@since 3.2.0 | [
"获得ClassPath模板"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java#L157-L159 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_gaxpy.java | Scs_gaxpy.cs_gaxpy | public static boolean cs_gaxpy(Scs A, float[] x, float[] y) {
"""
Sparse matrix times dense column vector, y = A*x+y.
@param A
column-compressed matrix
@param x
size n, vector x
@param y
size m, vector y
@return true if successful, false on error
"""
int p, j, n, Ap[], Ai[];
float Ax[];
if (!Scs_util.CS_CSC(A) || x == null || y == null)
return (false); /* check inputs */
n = A.n;
Ap = A.p;
Ai = A.i;
Ax = A.x;
for (j = 0; j < n; j++) {
for (p = Ap[j]; p < Ap[j + 1]; p++) {
y[Ai[p]] += Ax[p] * x[j];
}
}
return (true);
} | java | public static boolean cs_gaxpy(Scs A, float[] x, float[] y) {
int p, j, n, Ap[], Ai[];
float Ax[];
if (!Scs_util.CS_CSC(A) || x == null || y == null)
return (false); /* check inputs */
n = A.n;
Ap = A.p;
Ai = A.i;
Ax = A.x;
for (j = 0; j < n; j++) {
for (p = Ap[j]; p < Ap[j + 1]; p++) {
y[Ai[p]] += Ax[p] * x[j];
}
}
return (true);
} | [
"public",
"static",
"boolean",
"cs_gaxpy",
"(",
"Scs",
"A",
",",
"float",
"[",
"]",
"x",
",",
"float",
"[",
"]",
"y",
")",
"{",
"int",
"p",
",",
"j",
",",
"n",
",",
"Ap",
"[",
"]",
",",
"Ai",
"[",
"]",
";",
"float",
"Ax",
"[",
"]",
";",
"if",
"(",
"!",
"Scs_util",
".",
"CS_CSC",
"(",
"A",
")",
"||",
"x",
"==",
"null",
"||",
"y",
"==",
"null",
")",
"return",
"(",
"false",
")",
";",
"/* check inputs */",
"n",
"=",
"A",
".",
"n",
";",
"Ap",
"=",
"A",
".",
"p",
";",
"Ai",
"=",
"A",
".",
"i",
";",
"Ax",
"=",
"A",
".",
"x",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"n",
";",
"j",
"++",
")",
"{",
"for",
"(",
"p",
"=",
"Ap",
"[",
"j",
"]",
";",
"p",
"<",
"Ap",
"[",
"j",
"+",
"1",
"]",
";",
"p",
"++",
")",
"{",
"y",
"[",
"Ai",
"[",
"p",
"]",
"]",
"+=",
"Ax",
"[",
"p",
"]",
"*",
"x",
"[",
"j",
"]",
";",
"}",
"}",
"return",
"(",
"true",
")",
";",
"}"
] | Sparse matrix times dense column vector, y = A*x+y.
@param A
column-compressed matrix
@param x
size n, vector x
@param y
size m, vector y
@return true if successful, false on error | [
"Sparse",
"matrix",
"times",
"dense",
"column",
"vector",
"y",
"=",
"A",
"*",
"x",
"+",
"y",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_gaxpy.java#L48-L63 |
weld/core | impl/src/main/java/org/jboss/weld/event/FastEvent.java | FastEvent.of | public static <T> FastEvent<T> of(Class<T> type, BeanManagerImpl manager, ObserverNotifier notifier, Annotation... qualifiers) {
"""
Constructs a new FastEvent instance
@param type the event type
@param manager the bean manager
@param notifier the notifier to be used for observer method resolution
@param qualifiers the event qualifiers
@return
"""
ResolvedObservers<T> resolvedObserverMethods = notifier.<T> resolveObserverMethods(type, qualifiers);
if (resolvedObserverMethods.isMetadataRequired()) {
EventMetadata metadata = new EventMetadataImpl(type, null, qualifiers);
CurrentEventMetadata metadataService = manager.getServices().get(CurrentEventMetadata.class);
return new FastEventWithMetadataPropagation<T>(resolvedObserverMethods, metadata, metadataService);
} else {
return new FastEvent<T>(resolvedObserverMethods);
}
} | java | public static <T> FastEvent<T> of(Class<T> type, BeanManagerImpl manager, ObserverNotifier notifier, Annotation... qualifiers) {
ResolvedObservers<T> resolvedObserverMethods = notifier.<T> resolveObserverMethods(type, qualifiers);
if (resolvedObserverMethods.isMetadataRequired()) {
EventMetadata metadata = new EventMetadataImpl(type, null, qualifiers);
CurrentEventMetadata metadataService = manager.getServices().get(CurrentEventMetadata.class);
return new FastEventWithMetadataPropagation<T>(resolvedObserverMethods, metadata, metadataService);
} else {
return new FastEvent<T>(resolvedObserverMethods);
}
} | [
"public",
"static",
"<",
"T",
">",
"FastEvent",
"<",
"T",
">",
"of",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"BeanManagerImpl",
"manager",
",",
"ObserverNotifier",
"notifier",
",",
"Annotation",
"...",
"qualifiers",
")",
"{",
"ResolvedObservers",
"<",
"T",
">",
"resolvedObserverMethods",
"=",
"notifier",
".",
"<",
"T",
">",
"resolveObserverMethods",
"(",
"type",
",",
"qualifiers",
")",
";",
"if",
"(",
"resolvedObserverMethods",
".",
"isMetadataRequired",
"(",
")",
")",
"{",
"EventMetadata",
"metadata",
"=",
"new",
"EventMetadataImpl",
"(",
"type",
",",
"null",
",",
"qualifiers",
")",
";",
"CurrentEventMetadata",
"metadataService",
"=",
"manager",
".",
"getServices",
"(",
")",
".",
"get",
"(",
"CurrentEventMetadata",
".",
"class",
")",
";",
"return",
"new",
"FastEventWithMetadataPropagation",
"<",
"T",
">",
"(",
"resolvedObserverMethods",
",",
"metadata",
",",
"metadataService",
")",
";",
"}",
"else",
"{",
"return",
"new",
"FastEvent",
"<",
"T",
">",
"(",
"resolvedObserverMethods",
")",
";",
"}",
"}"
] | Constructs a new FastEvent instance
@param type the event type
@param manager the bean manager
@param notifier the notifier to be used for observer method resolution
@param qualifiers the event qualifiers
@return | [
"Constructs",
"a",
"new",
"FastEvent",
"instance"
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/event/FastEvent.java#L75-L84 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java | AbstractHibernateCriteriaBuilder.sizeEq | public org.grails.datastore.mapping.query.api.Criteria sizeEq(String propertyName, int size) {
"""
Creates a Criterion that contrains a collection property by size
@param propertyName The property name
@param size The size to constrain by
@return A Criterion instance
"""
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [sizeEq] with propertyName [" +
propertyName + "] and size [" + size + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
addToCriteria(Restrictions.sizeEq(propertyName, size));
return this;
} | java | public org.grails.datastore.mapping.query.api.Criteria sizeEq(String propertyName, int size) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [sizeEq] with propertyName [" +
propertyName + "] and size [" + size + "] not allowed here."));
}
propertyName = calculatePropertyName(propertyName);
addToCriteria(Restrictions.sizeEq(propertyName, size));
return this;
} | [
"public",
"org",
".",
"grails",
".",
"datastore",
".",
"mapping",
".",
"query",
".",
"api",
".",
"Criteria",
"sizeEq",
"(",
"String",
"propertyName",
",",
"int",
"size",
")",
"{",
"if",
"(",
"!",
"validateSimpleExpression",
"(",
")",
")",
"{",
"throwRuntimeException",
"(",
"new",
"IllegalArgumentException",
"(",
"\"Call to [sizeEq] with propertyName [\"",
"+",
"propertyName",
"+",
"\"] and size [\"",
"+",
"size",
"+",
"\"] not allowed here.\"",
")",
")",
";",
"}",
"propertyName",
"=",
"calculatePropertyName",
"(",
"propertyName",
")",
";",
"addToCriteria",
"(",
"Restrictions",
".",
"sizeEq",
"(",
"propertyName",
",",
"size",
")",
")",
";",
"return",
"this",
";",
"}"
] | Creates a Criterion that contrains a collection property by size
@param propertyName The property name
@param size The size to constrain by
@return A Criterion instance | [
"Creates",
"a",
"Criterion",
"that",
"contrains",
"a",
"collection",
"property",
"by",
"size"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L1414-L1423 |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/LdapTemplate.java | LdapTemplate.deleteRecursively | protected void deleteRecursively(DirContext ctx, Name name) {
"""
Delete all subcontexts including the current one recursively.
@param ctx The context to use for deleting.
@param name The starting point to delete recursively.
@throws NamingException if any error occurs
"""
NamingEnumeration enumeration = null;
try {
enumeration = ctx.listBindings(name);
while (enumeration.hasMore()) {
Binding binding = (Binding) enumeration.next();
LdapName childName = LdapUtils.newLdapName(binding.getName());
childName.addAll(0, name);
deleteRecursively(ctx, childName);
}
ctx.unbind(name);
if (LOG.isDebugEnabled()) {
LOG.debug("Entry " + name + " deleted");
}
}
catch (javax.naming.NamingException e) {
throw LdapUtils.convertLdapException(e);
}
finally {
try {
enumeration.close();
}
catch (Exception e) {
// Never mind this
}
}
} | java | protected void deleteRecursively(DirContext ctx, Name name) {
NamingEnumeration enumeration = null;
try {
enumeration = ctx.listBindings(name);
while (enumeration.hasMore()) {
Binding binding = (Binding) enumeration.next();
LdapName childName = LdapUtils.newLdapName(binding.getName());
childName.addAll(0, name);
deleteRecursively(ctx, childName);
}
ctx.unbind(name);
if (LOG.isDebugEnabled()) {
LOG.debug("Entry " + name + " deleted");
}
}
catch (javax.naming.NamingException e) {
throw LdapUtils.convertLdapException(e);
}
finally {
try {
enumeration.close();
}
catch (Exception e) {
// Never mind this
}
}
} | [
"protected",
"void",
"deleteRecursively",
"(",
"DirContext",
"ctx",
",",
"Name",
"name",
")",
"{",
"NamingEnumeration",
"enumeration",
"=",
"null",
";",
"try",
"{",
"enumeration",
"=",
"ctx",
".",
"listBindings",
"(",
"name",
")",
";",
"while",
"(",
"enumeration",
".",
"hasMore",
"(",
")",
")",
"{",
"Binding",
"binding",
"=",
"(",
"Binding",
")",
"enumeration",
".",
"next",
"(",
")",
";",
"LdapName",
"childName",
"=",
"LdapUtils",
".",
"newLdapName",
"(",
"binding",
".",
"getName",
"(",
")",
")",
";",
"childName",
".",
"addAll",
"(",
"0",
",",
"name",
")",
";",
"deleteRecursively",
"(",
"ctx",
",",
"childName",
")",
";",
"}",
"ctx",
".",
"unbind",
"(",
"name",
")",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Entry \"",
"+",
"name",
"+",
"\" deleted\"",
")",
";",
"}",
"}",
"catch",
"(",
"javax",
".",
"naming",
".",
"NamingException",
"e",
")",
"{",
"throw",
"LdapUtils",
".",
"convertLdapException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"enumeration",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// Never mind this",
"}",
"}",
"}"
] | Delete all subcontexts including the current one recursively.
@param ctx The context to use for deleting.
@param name The starting point to delete recursively.
@throws NamingException if any error occurs | [
"Delete",
"all",
"subcontexts",
"including",
"the",
"current",
"one",
"recursively",
"."
] | train | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java#L1096-L1123 |
NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java | DfuBaseService.terminateConnection | protected void terminateConnection(@NonNull final BluetoothGatt gatt, final int error) {
"""
Disconnects from the device and cleans local variables in case of error.
This method is SYNCHRONOUS and wait until the disconnecting process will be completed.
@param gatt the GATT device to be disconnected.
@param error error number.
"""
if (mConnectionState != STATE_DISCONNECTED) {
// Disconnect from the device
disconnect(gatt);
}
// Close the device
refreshDeviceCache(gatt, false); // This should be set to true when DFU Version is 0.5 or lower
close(gatt);
waitFor(600);
if (error != 0)
report(error);
} | java | protected void terminateConnection(@NonNull final BluetoothGatt gatt, final int error) {
if (mConnectionState != STATE_DISCONNECTED) {
// Disconnect from the device
disconnect(gatt);
}
// Close the device
refreshDeviceCache(gatt, false); // This should be set to true when DFU Version is 0.5 or lower
close(gatt);
waitFor(600);
if (error != 0)
report(error);
} | [
"protected",
"void",
"terminateConnection",
"(",
"@",
"NonNull",
"final",
"BluetoothGatt",
"gatt",
",",
"final",
"int",
"error",
")",
"{",
"if",
"(",
"mConnectionState",
"!=",
"STATE_DISCONNECTED",
")",
"{",
"// Disconnect from the device",
"disconnect",
"(",
"gatt",
")",
";",
"}",
"// Close the device",
"refreshDeviceCache",
"(",
"gatt",
",",
"false",
")",
";",
"// This should be set to true when DFU Version is 0.5 or lower",
"close",
"(",
"gatt",
")",
";",
"waitFor",
"(",
"600",
")",
";",
"if",
"(",
"error",
"!=",
"0",
")",
"report",
"(",
"error",
")",
";",
"}"
] | Disconnects from the device and cleans local variables in case of error.
This method is SYNCHRONOUS and wait until the disconnecting process will be completed.
@param gatt the GATT device to be disconnected.
@param error error number. | [
"Disconnects",
"from",
"the",
"device",
"and",
"cleans",
"local",
"variables",
"in",
"case",
"of",
"error",
".",
"This",
"method",
"is",
"SYNCHRONOUS",
"and",
"wait",
"until",
"the",
"disconnecting",
"process",
"will",
"be",
"completed",
"."
] | train | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1519-L1531 |
wcm-io/wcm-io-handler | url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java | SuffixParser.getPage | public @Nullable Page getPage(@Nullable Predicate<Page> filter, @Nullable Page basePage) {
"""
Get the first item returned by {@link #getPages(Predicate, Page)} or null if list is empty
@param filter the resource filter
@param basePage the suffix path is relative to this page path (null for current page)
@return the first {@link Page} or null
"""
List<Page> suffixPages = getPages(filter, basePage);
if (suffixPages.isEmpty()) {
return null;
}
else {
return suffixPages.get(0);
}
} | java | public @Nullable Page getPage(@Nullable Predicate<Page> filter, @Nullable Page basePage) {
List<Page> suffixPages = getPages(filter, basePage);
if (suffixPages.isEmpty()) {
return null;
}
else {
return suffixPages.get(0);
}
} | [
"public",
"@",
"Nullable",
"Page",
"getPage",
"(",
"@",
"Nullable",
"Predicate",
"<",
"Page",
">",
"filter",
",",
"@",
"Nullable",
"Page",
"basePage",
")",
"{",
"List",
"<",
"Page",
">",
"suffixPages",
"=",
"getPages",
"(",
"filter",
",",
"basePage",
")",
";",
"if",
"(",
"suffixPages",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"suffixPages",
".",
"get",
"(",
"0",
")",
";",
"}",
"}"
] | Get the first item returned by {@link #getPages(Predicate, Page)} or null if list is empty
@param filter the resource filter
@param basePage the suffix path is relative to this page path (null for current page)
@return the first {@link Page} or null | [
"Get",
"the",
"first",
"item",
"returned",
"by",
"{"
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java#L312-L320 |
m-m-m/util | reflect/src/main/java/net/sf/mmm/util/reflect/base/ManifestLoader.java | ManifestLoader.completeManifest | private static void completeManifest(Manifest manifest, URL url) {
"""
This method adds dynamic attributes to the given {@code manifest}.
@param manifest is the {@link Manifest} to modify.
@param url is the {@link URL} with the source of the manifest.
"""
String path = url.getPath();
int start = 0;
int end = path.length();
if (path.endsWith(JAR_SUFFIX)) {
// 4 for ".jar"
end = end - JAR_SUFFIX.length() + 4;
start = path.lastIndexOf('/', end) + 1;
}
String source = path.substring(start, end);
manifest.getMainAttributes().put(MANIFEST_SOURCE, source);
} | java | private static void completeManifest(Manifest manifest, URL url) {
String path = url.getPath();
int start = 0;
int end = path.length();
if (path.endsWith(JAR_SUFFIX)) {
// 4 for ".jar"
end = end - JAR_SUFFIX.length() + 4;
start = path.lastIndexOf('/', end) + 1;
}
String source = path.substring(start, end);
manifest.getMainAttributes().put(MANIFEST_SOURCE, source);
} | [
"private",
"static",
"void",
"completeManifest",
"(",
"Manifest",
"manifest",
",",
"URL",
"url",
")",
"{",
"String",
"path",
"=",
"url",
".",
"getPath",
"(",
")",
";",
"int",
"start",
"=",
"0",
";",
"int",
"end",
"=",
"path",
".",
"length",
"(",
")",
";",
"if",
"(",
"path",
".",
"endsWith",
"(",
"JAR_SUFFIX",
")",
")",
"{",
"// 4 for \".jar\"\r",
"end",
"=",
"end",
"-",
"JAR_SUFFIX",
".",
"length",
"(",
")",
"+",
"4",
";",
"start",
"=",
"path",
".",
"lastIndexOf",
"(",
"'",
"'",
",",
"end",
")",
"+",
"1",
";",
"}",
"String",
"source",
"=",
"path",
".",
"substring",
"(",
"start",
",",
"end",
")",
";",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"put",
"(",
"MANIFEST_SOURCE",
",",
"source",
")",
";",
"}"
] | This method adds dynamic attributes to the given {@code manifest}.
@param manifest is the {@link Manifest} to modify.
@param url is the {@link URL} with the source of the manifest. | [
"This",
"method",
"adds",
"dynamic",
"attributes",
"to",
"the",
"given",
"{",
"@code",
"manifest",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/reflect/src/main/java/net/sf/mmm/util/reflect/base/ManifestLoader.java#L88-L100 |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/JADT.java | JADT.createDummyJADT | public static JADT createDummyJADT(List<SyntaxError> syntaxErrors, List<SemanticError> semanticErrors, String testSrcInfo, SinkFactoryFactory factory) {
"""
Create a dummy configged jADT based on the provided syntaxErrors, semanticErrors, testSrcInfo, and sink factory
Useful for testing
"""
final SourceFactory sourceFactory = new StringSourceFactory(TEST_STRING);
final Doc doc = new Doc(TEST_SRC_INFO, Pkg._Pkg(NO_COMMENTS, "pkg"), Util.<Imprt> list(), Util.<DataType> list());
final ParseResult parseResult = new ParseResult(doc, syntaxErrors);
final DocEmitter docEmitter = new DummyDocEmitter(doc, TEST_CLASS_NAME);
final Parser parser = new DummyParser(parseResult, testSrcInfo, TEST_STRING);
final Checker checker = new DummyChecker(semanticErrors);
final JADT jadt = new JADT(sourceFactory, parser, checker, docEmitter, factory);
return jadt;
} | java | public static JADT createDummyJADT(List<SyntaxError> syntaxErrors, List<SemanticError> semanticErrors, String testSrcInfo, SinkFactoryFactory factory) {
final SourceFactory sourceFactory = new StringSourceFactory(TEST_STRING);
final Doc doc = new Doc(TEST_SRC_INFO, Pkg._Pkg(NO_COMMENTS, "pkg"), Util.<Imprt> list(), Util.<DataType> list());
final ParseResult parseResult = new ParseResult(doc, syntaxErrors);
final DocEmitter docEmitter = new DummyDocEmitter(doc, TEST_CLASS_NAME);
final Parser parser = new DummyParser(parseResult, testSrcInfo, TEST_STRING);
final Checker checker = new DummyChecker(semanticErrors);
final JADT jadt = new JADT(sourceFactory, parser, checker, docEmitter, factory);
return jadt;
} | [
"public",
"static",
"JADT",
"createDummyJADT",
"(",
"List",
"<",
"SyntaxError",
">",
"syntaxErrors",
",",
"List",
"<",
"SemanticError",
">",
"semanticErrors",
",",
"String",
"testSrcInfo",
",",
"SinkFactoryFactory",
"factory",
")",
"{",
"final",
"SourceFactory",
"sourceFactory",
"=",
"new",
"StringSourceFactory",
"(",
"TEST_STRING",
")",
";",
"final",
"Doc",
"doc",
"=",
"new",
"Doc",
"(",
"TEST_SRC_INFO",
",",
"Pkg",
".",
"_Pkg",
"(",
"NO_COMMENTS",
",",
"\"pkg\"",
")",
",",
"Util",
".",
"<",
"Imprt",
">",
"list",
"(",
")",
",",
"Util",
".",
"<",
"DataType",
">",
"list",
"(",
")",
")",
";",
"final",
"ParseResult",
"parseResult",
"=",
"new",
"ParseResult",
"(",
"doc",
",",
"syntaxErrors",
")",
";",
"final",
"DocEmitter",
"docEmitter",
"=",
"new",
"DummyDocEmitter",
"(",
"doc",
",",
"TEST_CLASS_NAME",
")",
";",
"final",
"Parser",
"parser",
"=",
"new",
"DummyParser",
"(",
"parseResult",
",",
"testSrcInfo",
",",
"TEST_STRING",
")",
";",
"final",
"Checker",
"checker",
"=",
"new",
"DummyChecker",
"(",
"semanticErrors",
")",
";",
"final",
"JADT",
"jadt",
"=",
"new",
"JADT",
"(",
"sourceFactory",
",",
"parser",
",",
"checker",
",",
"docEmitter",
",",
"factory",
")",
";",
"return",
"jadt",
";",
"}"
] | Create a dummy configged jADT based on the provided syntaxErrors, semanticErrors, testSrcInfo, and sink factory
Useful for testing | [
"Create",
"a",
"dummy",
"configged",
"jADT",
"based",
"on",
"the",
"provided",
"syntaxErrors",
"semanticErrors",
"testSrcInfo",
"and",
"sink",
"factory",
"Useful",
"for",
"testing"
] | train | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/JADT.java#L177-L186 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java | ObjectArrayList.removeFromTo | public void removeFromTo(int from, int to) {
"""
Removes from the receiver all elements whose index is between
<code>from</code>, inclusive and <code>to</code>, inclusive. Shifts any succeeding
elements to the left (reduces their index).
This call shortens the list by <tt>(to - from + 1)</tt> elements.
@param from index of first element to be removed.
@param to index of last element to be removed.
@exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
"""
checkRangeFromTo(from, to, size);
int numMoved = size - to - 1;
if (numMoved >= 0) {
System.arraycopy(elements, to+1, elements, from, numMoved);
fillFromToWith(from+numMoved, size-1, null); //delta
}
int width = to-from+1;
if (width>0) size -= width;
} | java | public void removeFromTo(int from, int to) {
checkRangeFromTo(from, to, size);
int numMoved = size - to - 1;
if (numMoved >= 0) {
System.arraycopy(elements, to+1, elements, from, numMoved);
fillFromToWith(from+numMoved, size-1, null); //delta
}
int width = to-from+1;
if (width>0) size -= width;
} | [
"public",
"void",
"removeFromTo",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"size",
")",
";",
"int",
"numMoved",
"=",
"size",
"-",
"to",
"-",
"1",
";",
"if",
"(",
"numMoved",
">=",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"elements",
",",
"to",
"+",
"1",
",",
"elements",
",",
"from",
",",
"numMoved",
")",
";",
"fillFromToWith",
"(",
"from",
"+",
"numMoved",
",",
"size",
"-",
"1",
",",
"null",
")",
";",
"//delta\r",
"}",
"int",
"width",
"=",
"to",
"-",
"from",
"+",
"1",
";",
"if",
"(",
"width",
">",
"0",
")",
"size",
"-=",
"width",
";",
"}"
] | Removes from the receiver all elements whose index is between
<code>from</code>, inclusive and <code>to</code>, inclusive. Shifts any succeeding
elements to the left (reduces their index).
This call shortens the list by <tt>(to - from + 1)</tt> elements.
@param from index of first element to be removed.
@param to index of last element to be removed.
@exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>). | [
"Removes",
"from",
"the",
"receiver",
"all",
"elements",
"whose",
"index",
"is",
"between",
"<code",
">",
"from<",
"/",
"code",
">",
"inclusive",
"and",
"<code",
">",
"to<",
"/",
"code",
">",
"inclusive",
".",
"Shifts",
"any",
"succeeding",
"elements",
"to",
"the",
"left",
"(",
"reduces",
"their",
"index",
")",
".",
"This",
"call",
"shortens",
"the",
"list",
"by",
"<tt",
">",
"(",
"to",
"-",
"from",
"+",
"1",
")",
"<",
"/",
"tt",
">",
"elements",
"."
] | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java#L665-L674 |
jhunters/jprotobuf | v3/src/main/java/com/baidu/bjf/remoting/protobuf/utils/FieldUtils.java | FieldUtils.findField | public static Field findField(Class clazz, String name, Class type) {
"""
Attempt to find a {@link Field field} on the supplied {@link Class} with
the supplied <code>name</code> and/or {@link Class type}. Searches all
superclasses up to {@link Object}.
@param clazz
the class to introspect
@param name
the name of the field (may be <code>null</code> if type is
specified)
@param type
the type of the field (may be <code>null</code> if name is
specified)
@return the corresponding Field object, or <code>null</code> if not found
"""
if (clazz == null) {
throw new IllegalArgumentException("Class must not be null");
}
if (name == null && type == null) {
throw new IllegalArgumentException(
"Either name or type of the field must be specified");
}
Class searchType = clazz;
while (!Object.class.equals(searchType) && searchType != null) {
Field[] fields = searchType.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
if ((name == null || name.equals(field.getName()))
&& (type == null || type.equals(field.getType()))) {
return field;
}
}
searchType = searchType.getSuperclass();
}
return null;
} | java | public static Field findField(Class clazz, String name, Class type) {
if (clazz == null) {
throw new IllegalArgumentException("Class must not be null");
}
if (name == null && type == null) {
throw new IllegalArgumentException(
"Either name or type of the field must be specified");
}
Class searchType = clazz;
while (!Object.class.equals(searchType) && searchType != null) {
Field[] fields = searchType.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
if ((name == null || name.equals(field.getName()))
&& (type == null || type.equals(field.getType()))) {
return field;
}
}
searchType = searchType.getSuperclass();
}
return null;
} | [
"public",
"static",
"Field",
"findField",
"(",
"Class",
"clazz",
",",
"String",
"name",
",",
"Class",
"type",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Class must not be null\"",
")",
";",
"}",
"if",
"(",
"name",
"==",
"null",
"&&",
"type",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Either name or type of the field must be specified\"",
")",
";",
"}",
"Class",
"searchType",
"=",
"clazz",
";",
"while",
"(",
"!",
"Object",
".",
"class",
".",
"equals",
"(",
"searchType",
")",
"&&",
"searchType",
"!=",
"null",
")",
"{",
"Field",
"[",
"]",
"fields",
"=",
"searchType",
".",
"getDeclaredFields",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fields",
".",
"length",
";",
"i",
"++",
")",
"{",
"Field",
"field",
"=",
"fields",
"[",
"i",
"]",
";",
"if",
"(",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"equals",
"(",
"field",
".",
"getName",
"(",
")",
")",
")",
"&&",
"(",
"type",
"==",
"null",
"||",
"type",
".",
"equals",
"(",
"field",
".",
"getType",
"(",
")",
")",
")",
")",
"{",
"return",
"field",
";",
"}",
"}",
"searchType",
"=",
"searchType",
".",
"getSuperclass",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Attempt to find a {@link Field field} on the supplied {@link Class} with
the supplied <code>name</code> and/or {@link Class type}. Searches all
superclasses up to {@link Object}.
@param clazz
the class to introspect
@param name
the name of the field (may be <code>null</code> if type is
specified)
@param type
the type of the field (may be <code>null</code> if name is
specified)
@return the corresponding Field object, or <code>null</code> if not found | [
"Attempt",
"to",
"find",
"a",
"{",
"@link",
"Field",
"field",
"}",
"on",
"the",
"supplied",
"{",
"@link",
"Class",
"}",
"with",
"the",
"supplied",
"<code",
">",
"name<",
"/",
"code",
">",
"and",
"/",
"or",
"{",
"@link",
"Class",
"type",
"}",
".",
"Searches",
"all",
"superclasses",
"up",
"to",
"{",
"@link",
"Object",
"}",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/utils/FieldUtils.java#L155-L176 |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java | PutCommand.createVersion | private void createVersion(Node fileNode, InputStream inputStream, List<String> mixins) throws RepositoryException {
"""
Creates the new version of file.
@param fileNode file node
@param inputStream input stream that contains the content of file
@param mixins list of mixins
@throws RepositoryException {@link RepositoryException}
"""
if (!fileNode.isCheckedOut())
{
fileNode.checkout();
fileNode.getSession().save();
}
updateContent(fileNode, inputStream, mixins);
fileNode.getSession().save();
fileNode.checkin();
fileNode.getSession().save();
} | java | private void createVersion(Node fileNode, InputStream inputStream, List<String> mixins) throws RepositoryException
{
if (!fileNode.isCheckedOut())
{
fileNode.checkout();
fileNode.getSession().save();
}
updateContent(fileNode, inputStream, mixins);
fileNode.getSession().save();
fileNode.checkin();
fileNode.getSession().save();
} | [
"private",
"void",
"createVersion",
"(",
"Node",
"fileNode",
",",
"InputStream",
"inputStream",
",",
"List",
"<",
"String",
">",
"mixins",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"!",
"fileNode",
".",
"isCheckedOut",
"(",
")",
")",
"{",
"fileNode",
".",
"checkout",
"(",
")",
";",
"fileNode",
".",
"getSession",
"(",
")",
".",
"save",
"(",
")",
";",
"}",
"updateContent",
"(",
"fileNode",
",",
"inputStream",
",",
"mixins",
")",
";",
"fileNode",
".",
"getSession",
"(",
")",
".",
"save",
"(",
")",
";",
"fileNode",
".",
"checkin",
"(",
")",
";",
"fileNode",
".",
"getSession",
"(",
")",
".",
"save",
"(",
")",
";",
"}"
] | Creates the new version of file.
@param fileNode file node
@param inputStream input stream that contains the content of file
@param mixins list of mixins
@throws RepositoryException {@link RepositoryException} | [
"Creates",
"the",
"new",
"version",
"of",
"file",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java#L360-L373 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.computeLowestRoot | private static float computeLowestRoot(float a, float b, float c, float maxR) {
"""
Compute the lowest root for <code>t</code> in the quadratic equation <code>a*t*t + b*t + c = 0</code>.
<p>
This is a helper method for {@link #intersectSweptSphereTriangle}
@param a
the quadratic factor
@param b
the linear factor
@param c
the constant
@param maxR
the maximum expected root
@return the lowest of the two roots of the quadratic equation; or {@link Float#POSITIVE_INFINITY}
"""
float determinant = b * b - 4.0f * a * c;
if (determinant < 0.0f)
return Float.POSITIVE_INFINITY;
float sqrtD = (float) Math.sqrt(determinant);
float r1 = (-b - sqrtD) / (2.0f * a);
float r2 = (-b + sqrtD) / (2.0f * a);
if (r1 > r2) {
float temp = r2;
r2 = r1;
r1 = temp;
}
if (r1 > 0.0f && r1 < maxR) {
return r1;
}
if (r2 > 0.0f && r2 < maxR) {
return r2;
}
return Float.POSITIVE_INFINITY;
} | java | private static float computeLowestRoot(float a, float b, float c, float maxR) {
float determinant = b * b - 4.0f * a * c;
if (determinant < 0.0f)
return Float.POSITIVE_INFINITY;
float sqrtD = (float) Math.sqrt(determinant);
float r1 = (-b - sqrtD) / (2.0f * a);
float r2 = (-b + sqrtD) / (2.0f * a);
if (r1 > r2) {
float temp = r2;
r2 = r1;
r1 = temp;
}
if (r1 > 0.0f && r1 < maxR) {
return r1;
}
if (r2 > 0.0f && r2 < maxR) {
return r2;
}
return Float.POSITIVE_INFINITY;
} | [
"private",
"static",
"float",
"computeLowestRoot",
"(",
"float",
"a",
",",
"float",
"b",
",",
"float",
"c",
",",
"float",
"maxR",
")",
"{",
"float",
"determinant",
"=",
"b",
"*",
"b",
"-",
"4.0f",
"*",
"a",
"*",
"c",
";",
"if",
"(",
"determinant",
"<",
"0.0f",
")",
"return",
"Float",
".",
"POSITIVE_INFINITY",
";",
"float",
"sqrtD",
"=",
"(",
"float",
")",
"Math",
".",
"sqrt",
"(",
"determinant",
")",
";",
"float",
"r1",
"=",
"(",
"-",
"b",
"-",
"sqrtD",
")",
"/",
"(",
"2.0f",
"*",
"a",
")",
";",
"float",
"r2",
"=",
"(",
"-",
"b",
"+",
"sqrtD",
")",
"/",
"(",
"2.0f",
"*",
"a",
")",
";",
"if",
"(",
"r1",
">",
"r2",
")",
"{",
"float",
"temp",
"=",
"r2",
";",
"r2",
"=",
"r1",
";",
"r1",
"=",
"temp",
";",
"}",
"if",
"(",
"r1",
">",
"0.0f",
"&&",
"r1",
"<",
"maxR",
")",
"{",
"return",
"r1",
";",
"}",
"if",
"(",
"r2",
">",
"0.0f",
"&&",
"r2",
"<",
"maxR",
")",
"{",
"return",
"r2",
";",
"}",
"return",
"Float",
".",
"POSITIVE_INFINITY",
";",
"}"
] | Compute the lowest root for <code>t</code> in the quadratic equation <code>a*t*t + b*t + c = 0</code>.
<p>
This is a helper method for {@link #intersectSweptSphereTriangle}
@param a
the quadratic factor
@param b
the linear factor
@param c
the constant
@param maxR
the maximum expected root
@return the lowest of the two roots of the quadratic equation; or {@link Float#POSITIVE_INFINITY} | [
"Compute",
"the",
"lowest",
"root",
"for",
"<code",
">",
"t<",
"/",
"code",
">",
"in",
"the",
"quadratic",
"equation",
"<code",
">",
"a",
"*",
"t",
"*",
"t",
"+",
"b",
"*",
"t",
"+",
"c",
"=",
"0<",
"/",
"code",
">",
".",
"<p",
">",
"This",
"is",
"a",
"helper",
"method",
"for",
"{",
"@link",
"#intersectSweptSphereTriangle",
"}"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L1959-L1978 |
micronaut-projects/micronaut-core | inject-java/src/main/java/io/micronaut/annotation/processing/GenericUtils.java | GenericUtils.interfaceGenericTypeFor | protected TypeMirror interfaceGenericTypeFor(TypeElement element, String interfaceName) {
"""
Finds the generic type for the given interface for the given class element.
<p>
For example, for <code>class AProvider implements Provider<A></code>
element = AProvider
interfaceName = interface javax.inject.Provider
return A
@param element The class element
@param interfaceName The interface
@return The generic type or null
"""
List<? extends TypeMirror> typeMirrors = interfaceGenericTypesFor(element, interfaceName);
return typeMirrors.isEmpty() ? null : typeMirrors.get(0);
} | java | protected TypeMirror interfaceGenericTypeFor(TypeElement element, String interfaceName) {
List<? extends TypeMirror> typeMirrors = interfaceGenericTypesFor(element, interfaceName);
return typeMirrors.isEmpty() ? null : typeMirrors.get(0);
} | [
"protected",
"TypeMirror",
"interfaceGenericTypeFor",
"(",
"TypeElement",
"element",
",",
"String",
"interfaceName",
")",
"{",
"List",
"<",
"?",
"extends",
"TypeMirror",
">",
"typeMirrors",
"=",
"interfaceGenericTypesFor",
"(",
"element",
",",
"interfaceName",
")",
";",
"return",
"typeMirrors",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"typeMirrors",
".",
"get",
"(",
"0",
")",
";",
"}"
] | Finds the generic type for the given interface for the given class element.
<p>
For example, for <code>class AProvider implements Provider<A></code>
element = AProvider
interfaceName = interface javax.inject.Provider
return A
@param element The class element
@param interfaceName The interface
@return The generic type or null | [
"Finds",
"the",
"generic",
"type",
"for",
"the",
"given",
"interface",
"for",
"the",
"given",
"class",
"element",
".",
"<p",
">",
"For",
"example",
"for",
"<code",
">",
"class",
"AProvider",
"implements",
"Provider<",
";",
"A>",
";",
"<",
"/",
"code",
">",
"element",
"=",
"AProvider",
"interfaceName",
"=",
"interface",
"javax",
".",
"inject",
".",
"Provider",
"return",
"A"
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/GenericUtils.java#L96-L99 |
ArcBees/gwtquery | gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java | JsUtils.runJavascriptFunction | public static <T> T runJavascriptFunction(JavaScriptObject o, String meth, Object... args) {
"""
Call via jsni any arbitrary function present in a Javascript object.
It's thought for avoiding to create jsni methods to call external functions and
facilitate the writing of js wrappers.
Example
<pre>
// Create a svg node in our document.
Element svg = runJavascriptFunction(document, "createElementNS", "http://www.w3.org/2000/svg", "svg");
// Append it to the dom
$(svg).appendTo(document);
</pre>
@param o the javascript object where the function is, it it is null we use window.
@param meth the literal name of the function to call, dot separators are allowed.
@param args an array with the arguments to pass to the function.
@return the java ready boxed object returned by the jsni method or null, if the
call return a number we will get a Double, if it returns a boolean we get a java
Boolean, strings comes as java String, otherwise we get the javascript object.
@deprecated use jsni instead.
"""
return runJavascriptFunctionImpl(o, meth, JsObjectArray.create().add(args).<JsArrayMixed>cast());
} | java | public static <T> T runJavascriptFunction(JavaScriptObject o, String meth, Object... args) {
return runJavascriptFunctionImpl(o, meth, JsObjectArray.create().add(args).<JsArrayMixed>cast());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"runJavascriptFunction",
"(",
"JavaScriptObject",
"o",
",",
"String",
"meth",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"runJavascriptFunctionImpl",
"(",
"o",
",",
"meth",
",",
"JsObjectArray",
".",
"create",
"(",
")",
".",
"add",
"(",
"args",
")",
".",
"<",
"JsArrayMixed",
">",
"cast",
"(",
")",
")",
";",
"}"
] | Call via jsni any arbitrary function present in a Javascript object.
It's thought for avoiding to create jsni methods to call external functions and
facilitate the writing of js wrappers.
Example
<pre>
// Create a svg node in our document.
Element svg = runJavascriptFunction(document, "createElementNS", "http://www.w3.org/2000/svg", "svg");
// Append it to the dom
$(svg).appendTo(document);
</pre>
@param o the javascript object where the function is, it it is null we use window.
@param meth the literal name of the function to call, dot separators are allowed.
@param args an array with the arguments to pass to the function.
@return the java ready boxed object returned by the jsni method or null, if the
call return a number we will get a Double, if it returns a boolean we get a java
Boolean, strings comes as java String, otherwise we get the javascript object.
@deprecated use jsni instead. | [
"Call",
"via",
"jsni",
"any",
"arbitrary",
"function",
"present",
"in",
"a",
"Javascript",
"object",
"."
] | train | https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java#L593-L595 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/frames/FrameData.java | FrameData.buildFrameArrayForWrite | public WsByteBuffer[] buildFrameArrayForWrite() {
"""
Builds an array of buffers representing this http2 data frame
output[0] = http2 frame header data
output[1] = payload data
output[2] ?= padding
@return WsByteBuffer[]
"""
WsByteBuffer[] output;
int headerSize = SIZE_FRAME_BEFORE_PAYLOAD;
if (PADDED_FLAG) {
headerSize = SIZE_FRAME_BEFORE_PAYLOAD + 1;
}
WsByteBuffer frameHeaders = getBuffer(headerSize);
byte[] frame;
if (frameHeaders.hasArray()) {
frame = frameHeaders.array();
} else {
frame = super.createFrameArray();
}
// add the first 9 bytes of the array
setFrameHeaders(frame, utils.FRAME_TYPE_DATA);
// set up the frame payload
int frameIndex = SIZE_FRAME_BEFORE_PAYLOAD;
// add pad length field
if (PADDED_FLAG) {
utils.Move8BitstoByteArray(paddingLength, frame, frameIndex);
frameIndex++;
}
frameHeaders.put(frame, 0, headerSize);
frameHeaders.flip();
// create padding and put in return buffer array
if (PADDED_FLAG) {
WsByteBuffer padding = getBuffer(paddingLength);
for (int i = 0; i < paddingLength; i++) {
padding.put((byte) 0);
}
padding.flip();
output = new WsByteBuffer[3];
output[0] = frameHeaders;
output[1] = dataBuffer;
output[2] = padding;
}
// create the output buffer array
else {
output = new WsByteBuffer[2];
output[0] = frameHeaders;
output[1] = dataBuffer;
}
return output;
} | java | public WsByteBuffer[] buildFrameArrayForWrite() {
WsByteBuffer[] output;
int headerSize = SIZE_FRAME_BEFORE_PAYLOAD;
if (PADDED_FLAG) {
headerSize = SIZE_FRAME_BEFORE_PAYLOAD + 1;
}
WsByteBuffer frameHeaders = getBuffer(headerSize);
byte[] frame;
if (frameHeaders.hasArray()) {
frame = frameHeaders.array();
} else {
frame = super.createFrameArray();
}
// add the first 9 bytes of the array
setFrameHeaders(frame, utils.FRAME_TYPE_DATA);
// set up the frame payload
int frameIndex = SIZE_FRAME_BEFORE_PAYLOAD;
// add pad length field
if (PADDED_FLAG) {
utils.Move8BitstoByteArray(paddingLength, frame, frameIndex);
frameIndex++;
}
frameHeaders.put(frame, 0, headerSize);
frameHeaders.flip();
// create padding and put in return buffer array
if (PADDED_FLAG) {
WsByteBuffer padding = getBuffer(paddingLength);
for (int i = 0; i < paddingLength; i++) {
padding.put((byte) 0);
}
padding.flip();
output = new WsByteBuffer[3];
output[0] = frameHeaders;
output[1] = dataBuffer;
output[2] = padding;
}
// create the output buffer array
else {
output = new WsByteBuffer[2];
output[0] = frameHeaders;
output[1] = dataBuffer;
}
return output;
} | [
"public",
"WsByteBuffer",
"[",
"]",
"buildFrameArrayForWrite",
"(",
")",
"{",
"WsByteBuffer",
"[",
"]",
"output",
";",
"int",
"headerSize",
"=",
"SIZE_FRAME_BEFORE_PAYLOAD",
";",
"if",
"(",
"PADDED_FLAG",
")",
"{",
"headerSize",
"=",
"SIZE_FRAME_BEFORE_PAYLOAD",
"+",
"1",
";",
"}",
"WsByteBuffer",
"frameHeaders",
"=",
"getBuffer",
"(",
"headerSize",
")",
";",
"byte",
"[",
"]",
"frame",
";",
"if",
"(",
"frameHeaders",
".",
"hasArray",
"(",
")",
")",
"{",
"frame",
"=",
"frameHeaders",
".",
"array",
"(",
")",
";",
"}",
"else",
"{",
"frame",
"=",
"super",
".",
"createFrameArray",
"(",
")",
";",
"}",
"// add the first 9 bytes of the array",
"setFrameHeaders",
"(",
"frame",
",",
"utils",
".",
"FRAME_TYPE_DATA",
")",
";",
"// set up the frame payload",
"int",
"frameIndex",
"=",
"SIZE_FRAME_BEFORE_PAYLOAD",
";",
"// add pad length field",
"if",
"(",
"PADDED_FLAG",
")",
"{",
"utils",
".",
"Move8BitstoByteArray",
"(",
"paddingLength",
",",
"frame",
",",
"frameIndex",
")",
";",
"frameIndex",
"++",
";",
"}",
"frameHeaders",
".",
"put",
"(",
"frame",
",",
"0",
",",
"headerSize",
")",
";",
"frameHeaders",
".",
"flip",
"(",
")",
";",
"// create padding and put in return buffer array",
"if",
"(",
"PADDED_FLAG",
")",
"{",
"WsByteBuffer",
"padding",
"=",
"getBuffer",
"(",
"paddingLength",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paddingLength",
";",
"i",
"++",
")",
"{",
"padding",
".",
"put",
"(",
"(",
"byte",
")",
"0",
")",
";",
"}",
"padding",
".",
"flip",
"(",
")",
";",
"output",
"=",
"new",
"WsByteBuffer",
"[",
"3",
"]",
";",
"output",
"[",
"0",
"]",
"=",
"frameHeaders",
";",
"output",
"[",
"1",
"]",
"=",
"dataBuffer",
";",
"output",
"[",
"2",
"]",
"=",
"padding",
";",
"}",
"// create the output buffer array",
"else",
"{",
"output",
"=",
"new",
"WsByteBuffer",
"[",
"2",
"]",
";",
"output",
"[",
"0",
"]",
"=",
"frameHeaders",
";",
"output",
"[",
"1",
"]",
"=",
"dataBuffer",
";",
"}",
"return",
"output",
";",
"}"
] | Builds an array of buffers representing this http2 data frame
output[0] = http2 frame header data
output[1] = payload data
output[2] ?= padding
@return WsByteBuffer[] | [
"Builds",
"an",
"array",
"of",
"buffers",
"representing",
"this",
"http2",
"data",
"frame",
"output",
"[",
"0",
"]",
"=",
"http2",
"frame",
"header",
"data",
"output",
"[",
"1",
"]",
"=",
"payload",
"data",
"output",
"[",
"2",
"]",
"?",
"=",
"padding"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/frames/FrameData.java#L173-L221 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java | ServicesInner.getByResourceGroup | public DataMigrationServiceInner getByResourceGroup(String groupName, String serviceName) {
"""
Get DMS Service Instance.
The services resource is the top-level resource that represents the Data Migration Service. The GET method retrieves information about a service instance.
@param groupName Name of the resource group
@param serviceName Name of the service
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DataMigrationServiceInner object if successful.
"""
return getByResourceGroupWithServiceResponseAsync(groupName, serviceName).toBlocking().single().body();
} | java | public DataMigrationServiceInner getByResourceGroup(String groupName, String serviceName) {
return getByResourceGroupWithServiceResponseAsync(groupName, serviceName).toBlocking().single().body();
} | [
"public",
"DataMigrationServiceInner",
"getByResourceGroup",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"groupName",
",",
"serviceName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Get DMS Service Instance.
The services resource is the top-level resource that represents the Data Migration Service. The GET method retrieves information about a service instance.
@param groupName Name of the resource group
@param serviceName Name of the service
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DataMigrationServiceInner object if successful. | [
"Get",
"DMS",
"Service",
"Instance",
".",
"The",
"services",
"resource",
"is",
"the",
"top",
"-",
"level",
"resource",
"that",
"represents",
"the",
"Data",
"Migration",
"Service",
".",
"The",
"GET",
"method",
"retrieves",
"information",
"about",
"a",
"service",
"instance",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L344-L346 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/source/extractor/partition/Partitioner.java | Partitioner.getPartitions | @Deprecated
public HashMap<Long, Long> getPartitions(long previousWatermark) {
"""
Get partitions with low and high water marks
@param previousWatermark previous water mark from metadata
@return map of partition intervals.
map's key is interval begin time (in format {@link Partitioner#WATERMARKTIMEFORMAT})
map's value is interval end time (in format {@link Partitioner#WATERMARKTIMEFORMAT})
"""
HashMap<Long, Long> defaultPartition = Maps.newHashMap();
if (!isWatermarkExists()) {
defaultPartition.put(ConfigurationKeys.DEFAULT_WATERMARK_VALUE, ConfigurationKeys.DEFAULT_WATERMARK_VALUE);
LOG.info("Watermark column or type not found - Default partition with low watermark and high watermark as "
+ ConfigurationKeys.DEFAULT_WATERMARK_VALUE);
return defaultPartition;
}
ExtractType extractType =
ExtractType.valueOf(this.state.getProp(ConfigurationKeys.SOURCE_QUERYBASED_EXTRACT_TYPE).toUpperCase());
WatermarkType watermarkType = WatermarkType.valueOf(
this.state.getProp(ConfigurationKeys.SOURCE_QUERYBASED_WATERMARK_TYPE, ConfigurationKeys.DEFAULT_WATERMARK_TYPE)
.toUpperCase());
int interval =
getUpdatedInterval(this.state.getPropAsInt(ConfigurationKeys.SOURCE_QUERYBASED_PARTITION_INTERVAL, 0),
extractType, watermarkType);
int sourceMaxAllowedPartitions = this.state.getPropAsInt(ConfigurationKeys.SOURCE_MAX_NUMBER_OF_PARTITIONS, 0);
int maxPartitions = (sourceMaxAllowedPartitions != 0 ? sourceMaxAllowedPartitions
: ConfigurationKeys.DEFAULT_MAX_NUMBER_OF_PARTITIONS);
WatermarkPredicate watermark = new WatermarkPredicate(null, watermarkType);
int deltaForNextWatermark = watermark.getDeltaNumForNextWatermark();
LOG.info("is watermark override: " + this.isWatermarkOverride());
LOG.info("is full extract: " + this.isFullDump());
long lowWatermark = this.getLowWatermark(extractType, watermarkType, previousWatermark, deltaForNextWatermark);
long highWatermark = this.getHighWatermark(extractType, watermarkType);
if (lowWatermark == ConfigurationKeys.DEFAULT_WATERMARK_VALUE
|| highWatermark == ConfigurationKeys.DEFAULT_WATERMARK_VALUE) {
LOG.info(
"Low watermark or high water mark is not found. Hence cannot generate partitions - Default partition with low watermark: "
+ lowWatermark + " and high watermark: " + highWatermark);
defaultPartition.put(lowWatermark, highWatermark);
return defaultPartition;
}
LOG.info("Generate partitions with low watermark: " + lowWatermark + "; high watermark: " + highWatermark
+ "; partition interval in hours: " + interval + "; Maximum number of allowed partitions: " + maxPartitions);
return watermark.getPartitions(lowWatermark, highWatermark, interval, maxPartitions);
} | java | @Deprecated
public HashMap<Long, Long> getPartitions(long previousWatermark) {
HashMap<Long, Long> defaultPartition = Maps.newHashMap();
if (!isWatermarkExists()) {
defaultPartition.put(ConfigurationKeys.DEFAULT_WATERMARK_VALUE, ConfigurationKeys.DEFAULT_WATERMARK_VALUE);
LOG.info("Watermark column or type not found - Default partition with low watermark and high watermark as "
+ ConfigurationKeys.DEFAULT_WATERMARK_VALUE);
return defaultPartition;
}
ExtractType extractType =
ExtractType.valueOf(this.state.getProp(ConfigurationKeys.SOURCE_QUERYBASED_EXTRACT_TYPE).toUpperCase());
WatermarkType watermarkType = WatermarkType.valueOf(
this.state.getProp(ConfigurationKeys.SOURCE_QUERYBASED_WATERMARK_TYPE, ConfigurationKeys.DEFAULT_WATERMARK_TYPE)
.toUpperCase());
int interval =
getUpdatedInterval(this.state.getPropAsInt(ConfigurationKeys.SOURCE_QUERYBASED_PARTITION_INTERVAL, 0),
extractType, watermarkType);
int sourceMaxAllowedPartitions = this.state.getPropAsInt(ConfigurationKeys.SOURCE_MAX_NUMBER_OF_PARTITIONS, 0);
int maxPartitions = (sourceMaxAllowedPartitions != 0 ? sourceMaxAllowedPartitions
: ConfigurationKeys.DEFAULT_MAX_NUMBER_OF_PARTITIONS);
WatermarkPredicate watermark = new WatermarkPredicate(null, watermarkType);
int deltaForNextWatermark = watermark.getDeltaNumForNextWatermark();
LOG.info("is watermark override: " + this.isWatermarkOverride());
LOG.info("is full extract: " + this.isFullDump());
long lowWatermark = this.getLowWatermark(extractType, watermarkType, previousWatermark, deltaForNextWatermark);
long highWatermark = this.getHighWatermark(extractType, watermarkType);
if (lowWatermark == ConfigurationKeys.DEFAULT_WATERMARK_VALUE
|| highWatermark == ConfigurationKeys.DEFAULT_WATERMARK_VALUE) {
LOG.info(
"Low watermark or high water mark is not found. Hence cannot generate partitions - Default partition with low watermark: "
+ lowWatermark + " and high watermark: " + highWatermark);
defaultPartition.put(lowWatermark, highWatermark);
return defaultPartition;
}
LOG.info("Generate partitions with low watermark: " + lowWatermark + "; high watermark: " + highWatermark
+ "; partition interval in hours: " + interval + "; Maximum number of allowed partitions: " + maxPartitions);
return watermark.getPartitions(lowWatermark, highWatermark, interval, maxPartitions);
} | [
"@",
"Deprecated",
"public",
"HashMap",
"<",
"Long",
",",
"Long",
">",
"getPartitions",
"(",
"long",
"previousWatermark",
")",
"{",
"HashMap",
"<",
"Long",
",",
"Long",
">",
"defaultPartition",
"=",
"Maps",
".",
"newHashMap",
"(",
")",
";",
"if",
"(",
"!",
"isWatermarkExists",
"(",
")",
")",
"{",
"defaultPartition",
".",
"put",
"(",
"ConfigurationKeys",
".",
"DEFAULT_WATERMARK_VALUE",
",",
"ConfigurationKeys",
".",
"DEFAULT_WATERMARK_VALUE",
")",
";",
"LOG",
".",
"info",
"(",
"\"Watermark column or type not found - Default partition with low watermark and high watermark as \"",
"+",
"ConfigurationKeys",
".",
"DEFAULT_WATERMARK_VALUE",
")",
";",
"return",
"defaultPartition",
";",
"}",
"ExtractType",
"extractType",
"=",
"ExtractType",
".",
"valueOf",
"(",
"this",
".",
"state",
".",
"getProp",
"(",
"ConfigurationKeys",
".",
"SOURCE_QUERYBASED_EXTRACT_TYPE",
")",
".",
"toUpperCase",
"(",
")",
")",
";",
"WatermarkType",
"watermarkType",
"=",
"WatermarkType",
".",
"valueOf",
"(",
"this",
".",
"state",
".",
"getProp",
"(",
"ConfigurationKeys",
".",
"SOURCE_QUERYBASED_WATERMARK_TYPE",
",",
"ConfigurationKeys",
".",
"DEFAULT_WATERMARK_TYPE",
")",
".",
"toUpperCase",
"(",
")",
")",
";",
"int",
"interval",
"=",
"getUpdatedInterval",
"(",
"this",
".",
"state",
".",
"getPropAsInt",
"(",
"ConfigurationKeys",
".",
"SOURCE_QUERYBASED_PARTITION_INTERVAL",
",",
"0",
")",
",",
"extractType",
",",
"watermarkType",
")",
";",
"int",
"sourceMaxAllowedPartitions",
"=",
"this",
".",
"state",
".",
"getPropAsInt",
"(",
"ConfigurationKeys",
".",
"SOURCE_MAX_NUMBER_OF_PARTITIONS",
",",
"0",
")",
";",
"int",
"maxPartitions",
"=",
"(",
"sourceMaxAllowedPartitions",
"!=",
"0",
"?",
"sourceMaxAllowedPartitions",
":",
"ConfigurationKeys",
".",
"DEFAULT_MAX_NUMBER_OF_PARTITIONS",
")",
";",
"WatermarkPredicate",
"watermark",
"=",
"new",
"WatermarkPredicate",
"(",
"null",
",",
"watermarkType",
")",
";",
"int",
"deltaForNextWatermark",
"=",
"watermark",
".",
"getDeltaNumForNextWatermark",
"(",
")",
";",
"LOG",
".",
"info",
"(",
"\"is watermark override: \"",
"+",
"this",
".",
"isWatermarkOverride",
"(",
")",
")",
";",
"LOG",
".",
"info",
"(",
"\"is full extract: \"",
"+",
"this",
".",
"isFullDump",
"(",
")",
")",
";",
"long",
"lowWatermark",
"=",
"this",
".",
"getLowWatermark",
"(",
"extractType",
",",
"watermarkType",
",",
"previousWatermark",
",",
"deltaForNextWatermark",
")",
";",
"long",
"highWatermark",
"=",
"this",
".",
"getHighWatermark",
"(",
"extractType",
",",
"watermarkType",
")",
";",
"if",
"(",
"lowWatermark",
"==",
"ConfigurationKeys",
".",
"DEFAULT_WATERMARK_VALUE",
"||",
"highWatermark",
"==",
"ConfigurationKeys",
".",
"DEFAULT_WATERMARK_VALUE",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Low watermark or high water mark is not found. Hence cannot generate partitions - Default partition with low watermark: \"",
"+",
"lowWatermark",
"+",
"\" and high watermark: \"",
"+",
"highWatermark",
")",
";",
"defaultPartition",
".",
"put",
"(",
"lowWatermark",
",",
"highWatermark",
")",
";",
"return",
"defaultPartition",
";",
"}",
"LOG",
".",
"info",
"(",
"\"Generate partitions with low watermark: \"",
"+",
"lowWatermark",
"+",
"\"; high watermark: \"",
"+",
"highWatermark",
"+",
"\"; partition interval in hours: \"",
"+",
"interval",
"+",
"\"; Maximum number of allowed partitions: \"",
"+",
"maxPartitions",
")",
";",
"return",
"watermark",
".",
"getPartitions",
"(",
"lowWatermark",
",",
"highWatermark",
",",
"interval",
",",
"maxPartitions",
")",
";",
"}"
] | Get partitions with low and high water marks
@param previousWatermark previous water mark from metadata
@return map of partition intervals.
map's key is interval begin time (in format {@link Partitioner#WATERMARKTIMEFORMAT})
map's value is interval end time (in format {@link Partitioner#WATERMARKTIMEFORMAT}) | [
"Get",
"partitions",
"with",
"low",
"and",
"high",
"water",
"marks"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/partition/Partitioner.java#L118-L159 |
mojohaus/webstart | webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/dependency/task/UpdateManifestTask.java | UpdateManifestTask.createManifest | private Manifest createManifest( File jar, Map<String, String> manifestentries )
throws MojoExecutionException {
"""
Create the new manifest from the existing jar file and the new entries.
@param jar
@param manifestentries
@return Manifest
@throws MojoExecutionException
"""
JarFile jarFile = null;
try
{
jarFile = new JarFile( jar );
// read manifest from jar
Manifest manifest = jarFile.getManifest();
if ( manifest == null || manifest.getMainAttributes().isEmpty() )
{
manifest = new Manifest();
manifest.getMainAttributes().putValue( Attributes.Name.MANIFEST_VERSION.toString(), "1.0" );
}
// add or overwrite entries
Set<Map.Entry<String, String>> entrySet = manifestentries.entrySet();
for ( Map.Entry<String, String> entry : entrySet )
{
manifest.getMainAttributes().putValue( entry.getKey(), entry.getValue() );
}
return manifest;
}
catch ( IOException e )
{
throw new MojoExecutionException( "Error while reading manifest from " + jar.getAbsolutePath(), e );
}
finally
{
ioUtil.close( jarFile );
}
} | java | private Manifest createManifest( File jar, Map<String, String> manifestentries )
throws MojoExecutionException
{
JarFile jarFile = null;
try
{
jarFile = new JarFile( jar );
// read manifest from jar
Manifest manifest = jarFile.getManifest();
if ( manifest == null || manifest.getMainAttributes().isEmpty() )
{
manifest = new Manifest();
manifest.getMainAttributes().putValue( Attributes.Name.MANIFEST_VERSION.toString(), "1.0" );
}
// add or overwrite entries
Set<Map.Entry<String, String>> entrySet = manifestentries.entrySet();
for ( Map.Entry<String, String> entry : entrySet )
{
manifest.getMainAttributes().putValue( entry.getKey(), entry.getValue() );
}
return manifest;
}
catch ( IOException e )
{
throw new MojoExecutionException( "Error while reading manifest from " + jar.getAbsolutePath(), e );
}
finally
{
ioUtil.close( jarFile );
}
} | [
"private",
"Manifest",
"createManifest",
"(",
"File",
"jar",
",",
"Map",
"<",
"String",
",",
"String",
">",
"manifestentries",
")",
"throws",
"MojoExecutionException",
"{",
"JarFile",
"jarFile",
"=",
"null",
";",
"try",
"{",
"jarFile",
"=",
"new",
"JarFile",
"(",
"jar",
")",
";",
"// read manifest from jar",
"Manifest",
"manifest",
"=",
"jarFile",
".",
"getManifest",
"(",
")",
";",
"if",
"(",
"manifest",
"==",
"null",
"||",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"manifest",
"=",
"new",
"Manifest",
"(",
")",
";",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"putValue",
"(",
"Attributes",
".",
"Name",
".",
"MANIFEST_VERSION",
".",
"toString",
"(",
")",
",",
"\"1.0\"",
")",
";",
"}",
"// add or overwrite entries",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"entrySet",
"=",
"manifestentries",
".",
"entrySet",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"entrySet",
")",
"{",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"putValue",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"manifest",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"Error while reading manifest from \"",
"+",
"jar",
".",
"getAbsolutePath",
"(",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"ioUtil",
".",
"close",
"(",
"jarFile",
")",
";",
"}",
"}"
] | Create the new manifest from the existing jar file and the new entries.
@param jar
@param manifestentries
@return Manifest
@throws MojoExecutionException | [
"Create",
"the",
"new",
"manifest",
"from",
"the",
"existing",
"jar",
"file",
"and",
"the",
"new",
"entries",
"."
] | train | https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/dependency/task/UpdateManifestTask.java#L172-L206 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java | TasksImpl.listWithServiceResponseAsync | public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> listWithServiceResponseAsync(final String jobId, final TaskListOptions taskListOptions) {
"""
Lists all of the tasks that are associated with the specified job.
For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks.
@param jobId The ID of the job.
@param taskListOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CloudTask> object
"""
return listSinglePageAsync(jobId, taskListOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
TaskListNextOptions taskListNextOptions = null;
if (taskListOptions != null) {
taskListNextOptions = new TaskListNextOptions();
taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId());
taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId());
taskListNextOptions.withOcpDate(taskListOptions.ocpDate());
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, taskListNextOptions));
}
});
} | java | public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> listWithServiceResponseAsync(final String jobId, final TaskListOptions taskListOptions) {
return listSinglePageAsync(jobId, taskListOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
TaskListNextOptions taskListNextOptions = null;
if (taskListOptions != null) {
taskListNextOptions = new TaskListNextOptions();
taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId());
taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId());
taskListNextOptions.withOcpDate(taskListOptions.ocpDate());
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, taskListNextOptions));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"CloudTask",
">",
",",
"TaskListHeaders",
">",
">",
"listWithServiceResponseAsync",
"(",
"final",
"String",
"jobId",
",",
"final",
"TaskListOptions",
"taskListOptions",
")",
"{",
"return",
"listSinglePageAsync",
"(",
"jobId",
",",
"taskListOptions",
")",
".",
"concatMap",
"(",
"new",
"Func1",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"CloudTask",
">",
",",
"TaskListHeaders",
">",
",",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"CloudTask",
">",
",",
"TaskListHeaders",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"CloudTask",
">",
",",
"TaskListHeaders",
">",
">",
"call",
"(",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"CloudTask",
">",
",",
"TaskListHeaders",
">",
"page",
")",
"{",
"String",
"nextPageLink",
"=",
"page",
".",
"body",
"(",
")",
".",
"nextPageLink",
"(",
")",
";",
"if",
"(",
"nextPageLink",
"==",
"null",
")",
"{",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
";",
"}",
"TaskListNextOptions",
"taskListNextOptions",
"=",
"null",
";",
"if",
"(",
"taskListOptions",
"!=",
"null",
")",
"{",
"taskListNextOptions",
"=",
"new",
"TaskListNextOptions",
"(",
")",
";",
"taskListNextOptions",
".",
"withClientRequestId",
"(",
"taskListOptions",
".",
"clientRequestId",
"(",
")",
")",
";",
"taskListNextOptions",
".",
"withReturnClientRequestId",
"(",
"taskListOptions",
".",
"returnClientRequestId",
"(",
")",
")",
";",
"taskListNextOptions",
".",
"withOcpDate",
"(",
"taskListOptions",
".",
"ocpDate",
"(",
")",
")",
";",
"}",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
".",
"concatWith",
"(",
"listNextWithServiceResponseAsync",
"(",
"nextPageLink",
",",
"taskListNextOptions",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] | Lists all of the tasks that are associated with the specified job.
For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks.
@param jobId The ID of the job.
@param taskListOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CloudTask> object | [
"Lists",
"all",
"of",
"the",
"tasks",
"that",
"are",
"associated",
"with",
"the",
"specified",
"job",
".",
"For",
"multi",
"-",
"instance",
"tasks",
"information",
"such",
"as",
"affinityId",
"executionInfo",
"and",
"nodeInfo",
"refer",
"to",
"the",
"primary",
"task",
".",
"Use",
"the",
"list",
"subtasks",
"API",
"to",
"retrieve",
"information",
"about",
"subtasks",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java#L556-L575 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/PathMetadataFactory.java | PathMetadataFactory.forArrayAccess | public static PathMetadata forArrayAccess(Path<?> parent, @Nonnegative int index) {
"""
Create a new PathMetadata instance for indexed array access
@param parent parent path
@param index index of element
@return array access path
"""
return new PathMetadata(parent, index, PathType.ARRAYVALUE_CONSTANT);
} | java | public static PathMetadata forArrayAccess(Path<?> parent, @Nonnegative int index) {
return new PathMetadata(parent, index, PathType.ARRAYVALUE_CONSTANT);
} | [
"public",
"static",
"PathMetadata",
"forArrayAccess",
"(",
"Path",
"<",
"?",
">",
"parent",
",",
"@",
"Nonnegative",
"int",
"index",
")",
"{",
"return",
"new",
"PathMetadata",
"(",
"parent",
",",
"index",
",",
"PathType",
".",
"ARRAYVALUE_CONSTANT",
")",
";",
"}"
] | Create a new PathMetadata instance for indexed array access
@param parent parent path
@param index index of element
@return array access path | [
"Create",
"a",
"new",
"PathMetadata",
"instance",
"for",
"indexed",
"array",
"access"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/PathMetadataFactory.java#L44-L46 |
Alluxio/alluxio | job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java | TaskExecutorManager.notifyTaskCancellation | public synchronized void notifyTaskCancellation(long jobId, int taskId) {
"""
Notifies the cancellation of the task.
@param jobId the job id
@param taskId the task id
"""
Pair<Long, Integer> id = new Pair<>(jobId, taskId);
TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id);
taskInfo.setStatus(Status.CANCELED);
finishTask(id);
LOG.info("Task {} for job {} canceled", taskId, jobId);
} | java | public synchronized void notifyTaskCancellation(long jobId, int taskId) {
Pair<Long, Integer> id = new Pair<>(jobId, taskId);
TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id);
taskInfo.setStatus(Status.CANCELED);
finishTask(id);
LOG.info("Task {} for job {} canceled", taskId, jobId);
} | [
"public",
"synchronized",
"void",
"notifyTaskCancellation",
"(",
"long",
"jobId",
",",
"int",
"taskId",
")",
"{",
"Pair",
"<",
"Long",
",",
"Integer",
">",
"id",
"=",
"new",
"Pair",
"<>",
"(",
"jobId",
",",
"taskId",
")",
";",
"TaskInfo",
".",
"Builder",
"taskInfo",
"=",
"mUnfinishedTasks",
".",
"get",
"(",
"id",
")",
";",
"taskInfo",
".",
"setStatus",
"(",
"Status",
".",
"CANCELED",
")",
";",
"finishTask",
"(",
"id",
")",
";",
"LOG",
".",
"info",
"(",
"\"Task {} for job {} canceled\"",
",",
"taskId",
",",
"jobId",
")",
";",
"}"
] | Notifies the cancellation of the task.
@param jobId the job id
@param taskId the task id | [
"Notifies",
"the",
"cancellation",
"of",
"the",
"task",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java#L111-L117 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/ComplexNumber.java | ComplexNumber.Swap | public static void Swap(ComplexNumber[][] z) {
"""
Swap values between real and imaginary.
@param z Complex number.
"""
for (int i = 0; i < z.length; i++) {
for (int j = 0; j < z[0].length; j++) {
z[i][j] = new ComplexNumber(z[i][j].imaginary, z[i][j].real);
}
}
} | java | public static void Swap(ComplexNumber[][] z) {
for (int i = 0; i < z.length; i++) {
for (int j = 0; j < z[0].length; j++) {
z[i][j] = new ComplexNumber(z[i][j].imaginary, z[i][j].real);
}
}
} | [
"public",
"static",
"void",
"Swap",
"(",
"ComplexNumber",
"[",
"]",
"[",
"]",
"z",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"z",
".",
"length",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"z",
"[",
"0",
"]",
".",
"length",
";",
"j",
"++",
")",
"{",
"z",
"[",
"i",
"]",
"[",
"j",
"]",
"=",
"new",
"ComplexNumber",
"(",
"z",
"[",
"i",
"]",
"[",
"j",
"]",
".",
"imaginary",
",",
"z",
"[",
"i",
"]",
"[",
"j",
"]",
".",
"real",
")",
";",
"}",
"}",
"}"
] | Swap values between real and imaginary.
@param z Complex number. | [
"Swap",
"values",
"between",
"real",
"and",
"imaginary",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/ComplexNumber.java#L185-L191 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java | ExpressionUtils.predicateTemplate | public static PredicateTemplate predicateTemplate(Template template, Object... args) {
"""
Create a new Template expression
@param template template
@param args template parameters
@return template expression
"""
return predicateTemplate(template, ImmutableList.copyOf(args));
} | java | public static PredicateTemplate predicateTemplate(Template template, Object... args) {
return predicateTemplate(template, ImmutableList.copyOf(args));
} | [
"public",
"static",
"PredicateTemplate",
"predicateTemplate",
"(",
"Template",
"template",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"predicateTemplate",
"(",
"template",
",",
"ImmutableList",
".",
"copyOf",
"(",
"args",
")",
")",
";",
"}"
] | Create a new Template expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L176-L178 |
UrielCh/ovh-java-sdk | ovh-java-sdk-core/src/main/java/net/minidev/ovh/api/ApiOvhAuth.java | ApiOvhAuth.credential_POST | public net.minidev.ovh.api.auth.OvhCredential credential_POST(OvhAccessRule[] accessRules, String redirection) throws IOException {
"""
Request a new credential for your application
REST: POST /auth/credential
@param accessRules [required] Access required for your application
@param redirection [required] Where you want to redirect the user after sucessfull authentication
"""
String qPath = "/auth/credential";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "accessRules", accessRules);
addBody(o, "redirection", redirection);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.auth.OvhCredential.class);
} | java | public net.minidev.ovh.api.auth.OvhCredential credential_POST(OvhAccessRule[] accessRules, String redirection) throws IOException {
String qPath = "/auth/credential";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "accessRules", accessRules);
addBody(o, "redirection", redirection);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.auth.OvhCredential.class);
} | [
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"auth",
".",
"OvhCredential",
"credential_POST",
"(",
"OvhAccessRule",
"[",
"]",
"accessRules",
",",
"String",
"redirection",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/auth/credential\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"accessRules\"",
",",
"accessRules",
")",
";",
"addBody",
"(",
"o",
",",
"\"redirection\"",
",",
"redirection",
")",
";",
"String",
"resp",
"=",
"execN",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"auth",
".",
"OvhCredential",
".",
"class",
")",
";",
"}"
] | Request a new credential for your application
REST: POST /auth/credential
@param accessRules [required] Access required for your application
@param redirection [required] Where you want to redirect the user after sucessfull authentication | [
"Request",
"a",
"new",
"credential",
"for",
"your",
"application"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-core/src/main/java/net/minidev/ovh/api/ApiOvhAuth.java#L62-L70 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/tools/BigramExtractor.java | BigramExtractor.getScore | private double getScore(int[] contingencyTable, SignificanceTest test) {
"""
Returns the score of the contingency table using the specified
significance test
@param contingencyTable a contingency table specified as four {@code int}
values
@param test the significance test to use in evaluating the table
"""
switch (test) {
case PMI:
return pmi(contingencyTable);
case CHI_SQUARED:
return chiSq(contingencyTable);
case LOG_LIKELIHOOD:
return logLikelihood(contingencyTable);
default:
throw new Error(test + " not implemented yet");
}
} | java | private double getScore(int[] contingencyTable, SignificanceTest test) {
switch (test) {
case PMI:
return pmi(contingencyTable);
case CHI_SQUARED:
return chiSq(contingencyTable);
case LOG_LIKELIHOOD:
return logLikelihood(contingencyTable);
default:
throw new Error(test + " not implemented yet");
}
} | [
"private",
"double",
"getScore",
"(",
"int",
"[",
"]",
"contingencyTable",
",",
"SignificanceTest",
"test",
")",
"{",
"switch",
"(",
"test",
")",
"{",
"case",
"PMI",
":",
"return",
"pmi",
"(",
"contingencyTable",
")",
";",
"case",
"CHI_SQUARED",
":",
"return",
"chiSq",
"(",
"contingencyTable",
")",
";",
"case",
"LOG_LIKELIHOOD",
":",
"return",
"logLikelihood",
"(",
"contingencyTable",
")",
";",
"default",
":",
"throw",
"new",
"Error",
"(",
"test",
"+",
"\" not implemented yet\"",
")",
";",
"}",
"}"
] | Returns the score of the contingency table using the specified
significance test
@param contingencyTable a contingency table specified as four {@code int}
values
@param test the significance test to use in evaluating the table | [
"Returns",
"the",
"score",
"of",
"the",
"contingency",
"table",
"using",
"the",
"specified",
"significance",
"test"
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/tools/BigramExtractor.java#L332-L343 |
hal/core | gui/src/main/java/org/jboss/as/console/client/widgets/CollapsibleSplitLayoutPanel.java | CollapsibleSplitLayoutPanel.setWidgetSnapClosedSize | public void setWidgetSnapClosedSize(Widget child, int snapClosedSize) {
"""
Sets a size below which the slider will close completely. This can be used
in conjunction with {@link #setWidgetMinSize} to provide a speed-bump
effect where the slider will stick to a preferred minimum size before
closing completely.
<p>
This method has no effect for the {@link DockLayoutPanel.Direction#CENTER}
widget.
</p>
@param child the child whose slider should snap closed
@param snapClosedSize the width below which the widget will close or
-1 to disable.
"""
assertIsChild(child);
Splitter splitter = getAssociatedSplitter(child);
// The splitter is null for the center element.
if (splitter != null) {
splitter.setSnapClosedSize(snapClosedSize);
}
} | java | public void setWidgetSnapClosedSize(Widget child, int snapClosedSize) {
assertIsChild(child);
Splitter splitter = getAssociatedSplitter(child);
// The splitter is null for the center element.
if (splitter != null) {
splitter.setSnapClosedSize(snapClosedSize);
}
} | [
"public",
"void",
"setWidgetSnapClosedSize",
"(",
"Widget",
"child",
",",
"int",
"snapClosedSize",
")",
"{",
"assertIsChild",
"(",
"child",
")",
";",
"Splitter",
"splitter",
"=",
"getAssociatedSplitter",
"(",
"child",
")",
";",
"// The splitter is null for the center element.",
"if",
"(",
"splitter",
"!=",
"null",
")",
"{",
"splitter",
".",
"setSnapClosedSize",
"(",
"snapClosedSize",
")",
";",
"}",
"}"
] | Sets a size below which the slider will close completely. This can be used
in conjunction with {@link #setWidgetMinSize} to provide a speed-bump
effect where the slider will stick to a preferred minimum size before
closing completely.
<p>
This method has no effect for the {@link DockLayoutPanel.Direction#CENTER}
widget.
</p>
@param child the child whose slider should snap closed
@param snapClosedSize the width below which the widget will close or
-1 to disable. | [
"Sets",
"a",
"size",
"below",
"which",
"the",
"slider",
"will",
"close",
"completely",
".",
"This",
"can",
"be",
"used",
"in",
"conjunction",
"with",
"{",
"@link",
"#setWidgetMinSize",
"}",
"to",
"provide",
"a",
"speed",
"-",
"bump",
"effect",
"where",
"the",
"slider",
"will",
"stick",
"to",
"a",
"preferred",
"minimum",
"size",
"before",
"closing",
"completely",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/widgets/CollapsibleSplitLayoutPanel.java#L440-L447 |
droidpl/android-json-viewer | android-json-viewer/src/main/java/com/github/droidpl/android/jsonviewer/JSONViewerActivity.java | JSONViewerActivity.startActivity | public static void startActivity(@NonNull Context context, @Nullable JSONObject jsonObject) {
"""
Starts the activity with a json object.
@param context The context to start the activity.
@param jsonObject The json object.
"""
Intent intent = new Intent(context, JSONViewerActivity.class);
Bundle bundle = new Bundle();
if (jsonObject != null) {
bundle.putString(JSON_OBJECT_STATE, jsonObject.toString());
}
intent.putExtras(bundle);
context.startActivity(intent);
} | java | public static void startActivity(@NonNull Context context, @Nullable JSONObject jsonObject) {
Intent intent = new Intent(context, JSONViewerActivity.class);
Bundle bundle = new Bundle();
if (jsonObject != null) {
bundle.putString(JSON_OBJECT_STATE, jsonObject.toString());
}
intent.putExtras(bundle);
context.startActivity(intent);
} | [
"public",
"static",
"void",
"startActivity",
"(",
"@",
"NonNull",
"Context",
"context",
",",
"@",
"Nullable",
"JSONObject",
"jsonObject",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"context",
",",
"JSONViewerActivity",
".",
"class",
")",
";",
"Bundle",
"bundle",
"=",
"new",
"Bundle",
"(",
")",
";",
"if",
"(",
"jsonObject",
"!=",
"null",
")",
"{",
"bundle",
".",
"putString",
"(",
"JSON_OBJECT_STATE",
",",
"jsonObject",
".",
"toString",
"(",
")",
")",
";",
"}",
"intent",
".",
"putExtras",
"(",
"bundle",
")",
";",
"context",
".",
"startActivity",
"(",
"intent",
")",
";",
"}"
] | Starts the activity with a json object.
@param context The context to start the activity.
@param jsonObject The json object. | [
"Starts",
"the",
"activity",
"with",
"a",
"json",
"object",
"."
] | train | https://github.com/droidpl/android-json-viewer/blob/7345a7a0e6636399015a03fad8243a47f5fcdd8f/android-json-viewer/src/main/java/com/github/droidpl/android/jsonviewer/JSONViewerActivity.java#L42-L50 |
knowm/XChange | xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseTradeServiceRaw.java | CoinbaseTradeServiceRaw.quote | public CoinbaseSell quote(String accountId, BigDecimal total, Currency currency)
throws IOException {
"""
Authenticated resource that lets you convert Bitcoin crediting your primary bank account on
Coinbase. (You must link and verify your bank account through the website before this API call
will work).
@see <a
href="https://developers.coinbase.com/api/v2#place-sell-order">developers.coinbase.com/api/v2#place-sell-order</a>
"""
return sellInternal(accountId, new SellPayload(total, currency.getCurrencyCode(), false, true));
} | java | public CoinbaseSell quote(String accountId, BigDecimal total, Currency currency)
throws IOException {
return sellInternal(accountId, new SellPayload(total, currency.getCurrencyCode(), false, true));
} | [
"public",
"CoinbaseSell",
"quote",
"(",
"String",
"accountId",
",",
"BigDecimal",
"total",
",",
"Currency",
"currency",
")",
"throws",
"IOException",
"{",
"return",
"sellInternal",
"(",
"accountId",
",",
"new",
"SellPayload",
"(",
"total",
",",
"currency",
".",
"getCurrencyCode",
"(",
")",
",",
"false",
",",
"true",
")",
")",
";",
"}"
] | Authenticated resource that lets you convert Bitcoin crediting your primary bank account on
Coinbase. (You must link and verify your bank account through the website before this API call
will work).
@see <a
href="https://developers.coinbase.com/api/v2#place-sell-order">developers.coinbase.com/api/v2#place-sell-order</a> | [
"Authenticated",
"resource",
"that",
"lets",
"you",
"convert",
"Bitcoin",
"crediting",
"your",
"primary",
"bank",
"account",
"on",
"Coinbase",
".",
"(",
"You",
"must",
"link",
"and",
"verify",
"your",
"bank",
"account",
"through",
"the",
"website",
"before",
"this",
"API",
"call",
"will",
"work",
")",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseTradeServiceRaw.java#L76-L80 |
james-hu/jabb-core | src/main/java/net/sf/jabb/spring/service/AbstractThreadPoolService.java | AbstractThreadPoolService.setConfigurations | protected void setConfigurations(String commonPrefix, PropertySourcesPropertyResolver resolver) {
"""
Set configurations. This methods sets/overrides both the default configurations and the per-pool configurations.
@param commonPrefix the common prefix in the keys, for example, "threadPools."
@param resolver the configuration properties resolver
"""
setConfigurationsCommonPrefix(commonPrefix);
setConfigurations(resolver);
setDefaultCoreSize(resolver.getProperty(commonPrefix + "defaultCoreSize", Integer.class, defaultCoreSize));
setDefaultMaxSize(resolver.getProperty(commonPrefix + "defaultMaxSize", Integer.class, defaultMaxSize));
setDefaultKeepAliveSeconds(resolver.getProperty(commonPrefix + "defaultKeepAliveSeconds", Long.class, defaultKeepAliveSeconds));
setDefaultQueueSize(resolver.getProperty(commonPrefix + "defaultQueueSize", Integer.class, defaultQueueSize));
setDefaultAllowCoreThreadTimeout(resolver.getProperty(commonPrefix + "defaultAllowCoreThreadTimeout", Boolean.class, defaultAllowCoreThreadTimeout));
setShutdownWaitSeconds(resolver.getProperty(commonPrefix + "shutdownWaitSeconds", Long.class, shutdownWaitSeconds));
} | java | protected void setConfigurations(String commonPrefix, PropertySourcesPropertyResolver resolver){
setConfigurationsCommonPrefix(commonPrefix);
setConfigurations(resolver);
setDefaultCoreSize(resolver.getProperty(commonPrefix + "defaultCoreSize", Integer.class, defaultCoreSize));
setDefaultMaxSize(resolver.getProperty(commonPrefix + "defaultMaxSize", Integer.class, defaultMaxSize));
setDefaultKeepAliveSeconds(resolver.getProperty(commonPrefix + "defaultKeepAliveSeconds", Long.class, defaultKeepAliveSeconds));
setDefaultQueueSize(resolver.getProperty(commonPrefix + "defaultQueueSize", Integer.class, defaultQueueSize));
setDefaultAllowCoreThreadTimeout(resolver.getProperty(commonPrefix + "defaultAllowCoreThreadTimeout", Boolean.class, defaultAllowCoreThreadTimeout));
setShutdownWaitSeconds(resolver.getProperty(commonPrefix + "shutdownWaitSeconds", Long.class, shutdownWaitSeconds));
} | [
"protected",
"void",
"setConfigurations",
"(",
"String",
"commonPrefix",
",",
"PropertySourcesPropertyResolver",
"resolver",
")",
"{",
"setConfigurationsCommonPrefix",
"(",
"commonPrefix",
")",
";",
"setConfigurations",
"(",
"resolver",
")",
";",
"setDefaultCoreSize",
"(",
"resolver",
".",
"getProperty",
"(",
"commonPrefix",
"+",
"\"defaultCoreSize\"",
",",
"Integer",
".",
"class",
",",
"defaultCoreSize",
")",
")",
";",
"setDefaultMaxSize",
"(",
"resolver",
".",
"getProperty",
"(",
"commonPrefix",
"+",
"\"defaultMaxSize\"",
",",
"Integer",
".",
"class",
",",
"defaultMaxSize",
")",
")",
";",
"setDefaultKeepAliveSeconds",
"(",
"resolver",
".",
"getProperty",
"(",
"commonPrefix",
"+",
"\"defaultKeepAliveSeconds\"",
",",
"Long",
".",
"class",
",",
"defaultKeepAliveSeconds",
")",
")",
";",
"setDefaultQueueSize",
"(",
"resolver",
".",
"getProperty",
"(",
"commonPrefix",
"+",
"\"defaultQueueSize\"",
",",
"Integer",
".",
"class",
",",
"defaultQueueSize",
")",
")",
";",
"setDefaultAllowCoreThreadTimeout",
"(",
"resolver",
".",
"getProperty",
"(",
"commonPrefix",
"+",
"\"defaultAllowCoreThreadTimeout\"",
",",
"Boolean",
".",
"class",
",",
"defaultAllowCoreThreadTimeout",
")",
")",
";",
"setShutdownWaitSeconds",
"(",
"resolver",
".",
"getProperty",
"(",
"commonPrefix",
"+",
"\"shutdownWaitSeconds\"",
",",
"Long",
".",
"class",
",",
"shutdownWaitSeconds",
")",
")",
";",
"}"
] | Set configurations. This methods sets/overrides both the default configurations and the per-pool configurations.
@param commonPrefix the common prefix in the keys, for example, "threadPools."
@param resolver the configuration properties resolver | [
"Set",
"configurations",
".",
"This",
"methods",
"sets",
"/",
"overrides",
"both",
"the",
"default",
"configurations",
"and",
"the",
"per",
"-",
"pool",
"configurations",
"."
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/spring/service/AbstractThreadPoolService.java#L165-L175 |
JOML-CI/JOML | src/org/joml/Vector4d.java | Vector4d.set | public Vector4d set(int index, DoubleBuffer buffer) {
"""
Read this vector from the supplied {@link DoubleBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given DoubleBuffer.
@param index
the absolute position into the DoubleBuffer
@param buffer
values will be read in <code>x, y, z, w</code> order
@return this
"""
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | java | public Vector4d set(int index, DoubleBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | [
"public",
"Vector4d",
"set",
"(",
"int",
"index",
",",
"DoubleBuffer",
"buffer",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"get",
"(",
"this",
",",
"index",
",",
"buffer",
")",
";",
"return",
"this",
";",
"}"
] | Read this vector from the supplied {@link DoubleBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given DoubleBuffer.
@param index
the absolute position into the DoubleBuffer
@param buffer
values will be read in <code>x, y, z, w</code> order
@return this | [
"Read",
"this",
"vector",
"from",
"the",
"supplied",
"{",
"@link",
"DoubleBuffer",
"}",
"starting",
"at",
"the",
"specified",
"absolute",
"buffer",
"position",
"/",
"index",
".",
"<p",
">",
"This",
"method",
"will",
"not",
"increment",
"the",
"position",
"of",
"the",
"given",
"DoubleBuffer",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector4d.java#L538-L541 |
eclipse/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/formatting2/AbstractFormatter2.java | AbstractFormatter2._format | protected void _format(XtextResource resource, IFormattableDocument document) {
"""
For {@link XtextResource resources}, assume we want to format the first EObject from the contents list only.
Because that's where the parser puts the semantic model.
"""
List<EObject> contents = resource.getContents();
if (!contents.isEmpty()) {
EObject model = contents.get(0);
document.format(model);
}
} | java | protected void _format(XtextResource resource, IFormattableDocument document) {
List<EObject> contents = resource.getContents();
if (!contents.isEmpty()) {
EObject model = contents.get(0);
document.format(model);
}
} | [
"protected",
"void",
"_format",
"(",
"XtextResource",
"resource",
",",
"IFormattableDocument",
"document",
")",
"{",
"List",
"<",
"EObject",
">",
"contents",
"=",
"resource",
".",
"getContents",
"(",
")",
";",
"if",
"(",
"!",
"contents",
".",
"isEmpty",
"(",
")",
")",
"{",
"EObject",
"model",
"=",
"contents",
".",
"get",
"(",
"0",
")",
";",
"document",
".",
"format",
"(",
"model",
")",
";",
"}",
"}"
] | For {@link XtextResource resources}, assume we want to format the first EObject from the contents list only.
Because that's where the parser puts the semantic model. | [
"For",
"{"
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/formatting2/AbstractFormatter2.java#L204-L210 |
datumbox/datumbox-framework | datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java | AbstractFileStorageEngine.deleteIfExistsRecursively | protected boolean deleteIfExistsRecursively(Path path) throws IOException {
"""
Deletes the file or directory recursively if it exists.
@param path
@return
@throws IOException
"""
try {
return Files.deleteIfExists(path);
}
catch (DirectoryNotEmptyException ex) {
//do recursive delete
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
return true;
}
} | java | protected boolean deleteIfExistsRecursively(Path path) throws IOException {
try {
return Files.deleteIfExists(path);
}
catch (DirectoryNotEmptyException ex) {
//do recursive delete
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
return true;
}
} | [
"protected",
"boolean",
"deleteIfExistsRecursively",
"(",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"Files",
".",
"deleteIfExists",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"DirectoryNotEmptyException",
"ex",
")",
"{",
"//do recursive delete",
"Files",
".",
"walkFileTree",
"(",
"path",
",",
"new",
"SimpleFileVisitor",
"<",
"Path",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FileVisitResult",
"visitFile",
"(",
"Path",
"file",
",",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"Files",
".",
"delete",
"(",
"file",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"postVisitDirectory",
"(",
"Path",
"dir",
",",
"IOException",
"exc",
")",
"throws",
"IOException",
"{",
"Files",
".",
"delete",
"(",
"dir",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"}",
")",
";",
"return",
"true",
";",
"}",
"}"
] | Deletes the file or directory recursively if it exists.
@param path
@return
@throws IOException | [
"Deletes",
"the",
"file",
"or",
"directory",
"recursively",
"if",
"it",
"exists",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-common/src/main/java/com/datumbox/framework/common/storage/abstracts/AbstractFileStorageEngine.java#L75-L96 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.