code stringlengths 146 466k | prompt stringlengths 54 1.5k |
|---|---|
Of course, here is the Java code you requested:
```java
public int getTotalNumberOfPages() throws QueryException {
prepareResultData(false);
if (isEmpty()) {
return 1;
}
int total = totalNumberOfEntries / this.pageSize;
if (totalNumberOfEntries % this.pageSize > 0) {
total += 1;
}
return total;
}
... | Create a Java method that does the following: "Get the total number of pages.". |
Of course, here is the Java code you requested:
```java
public List<V> page(int pageNumber) throws QueryException {
List<Object> pageKeys = null;
boolean firstTry = true;
while (pageKeys == null) {
prepareResultData(!firstTry);
if (!pageExists(pageNumber)) {
throw new IndexOutOfBoundsException("The p... | Create a Java method that does the following: "Returns the values of the specified page of the query.". |
Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
private List<V> getValues(List<Object> entriesKeysForPage) {
if (entriesKeysForPage.isEmpty()) {
return Collections.emptyList();
}
Map<Object, V> entriesMap = queryRegion.getAll(entriesKeysForPage);
List<V> entries = ne... | Create a Java method that does the following: "Get the values for the given page of entries.". |
Of course, here is the Java code you requested:
```java
private void storeResults(List<Object> resultKeys) {
if (resultKeys.size() > queryLimit) {
resultKeys = resultKeys.subList(0, queryLimit);
}
int keyNumber = 0;
int pageNumber = 0;
List<Object> page = new ArrayList<Object>();
for (Object key : res... | Create a Java method that does the following: "Store the results of the query.". |
Of course, here is the Java code you requested:
```java
@Override
protected String doRender(final RenderConfiguration config, final Port entity) {
final String prefix = entity.getId() != null && !entity.getId().isEmpty()
? ": " + quote(entity.getId()) + " "
: "";
/... | Create a Java method that does the following: "Override to render the CRUD.". |
Of course, here is the Java code you requested:
```java
public T create(Object... attributes) {
// build
T object = build(attributes);
// excute beforeCreate callback
executeCallbacks(BeforeFactoryCreate.class, object);
// persist
persist(object);
// execute a... | Create a Java method that does the following: "Create a new object with the specified attributes.". |
Of course, here is the Java code you requested:
```java
@Override
public int compare(final TagToCategory o1, final TagToCategory o2) {
if (o1 == null && o2 == null) return 0;
if (o1 == null) return lessThan;
if (o2 == null) return greaterThan;
if (o1.getSorting() == null && o2.ge... | Create a Java method that does the following: "Compare two TagToCategory objects.". |
Of course, here is the Java code you requested:
```java
public String process(XProperty field) {
String fieldName = field.getName();
return "if (in.readByte() != 0) {\n" +
tab("result.set" + firstLetterToUpperCase(fieldName) + "(new java.util.Date(in.readLong()));\n") +
... | Create a Java method that does the following: "Process a single record set.". |
Of course, here is the Java code you requested:
```java
public static boolean recalculateMinHash(final Topic topic, final List<MinHashXOR> minHashXORs) {
boolean retValue = false;
final Set<MinHash> existingMinHashes = topic.getMinHashes();
final Map<Integer, Integer> minHashes = getMinHashes... | Create a Java method that does the following: "Recalculate min hash.". |
Of course, here is the Java code you requested:
```java
public static Integer getMinHash(final String xml, final Integer xor) {
return getMinHashInternal(cleanXMLForMinHash(xml), xor);
}
```
Hope this helps! | Create a Java method that does the following: "Get the min hash value from the XML.". |
Of course, here is the Java code you requested:
```java
protected static String cleanXMLForMinHash(final String xml) {
// Treat null and empty strings the same
final String fixedXML = xml == null ? "" : xml;
String text = null;
try {
final Document doc = XMLUtilities.conver... | Create a Java method that does the following: "Clean XML for min hash.". |
Of course, here is the Java code you requested:
```java
protected static Integer getMinHashInternal(final String cleanedXML, final Integer xor) {
// now generate the minhashes
String[] words = cleanedXML.replaceAll("\\p{Punct}", " ").split("\\s+");
if (words.length == 0) {
words = ... | Create a Java method that does the following: "Get the minhash for the XML.". |
Of course, here is the Java code you requested:
```java
public static List<Integer> getMatchingMinHash(final EntityManager entityManager, final Map<Integer, Integer> minhashes, final Float threshold) {
try {
if (minhashes.size() == 0) {
/*
If the source does not... | Create a Java method that does the following: "Gets the matching minhash.". |
Of course, here is the Java code you requested:
```java
public static void validateAndFixRelationships(final Topic topic) {
/* remove relationships to this topic in the parent collection */
final ArrayList<TopicToTopic> removeList = new ArrayList<TopicToTopic>();
for (final TopicToTopic topicTo... | Create a Java method that does the following: "Validate and fix relationships.". |
Of course, here is the Java code you requested:
```java
public static void updateContentHash(final Topic topic) {
if (topic.getTopicXML() != null) {
topic.setTopicContentHash(HashUtilities.generateSHA256(topic.getTopicXML()).toCharArray());
}
}
```
Hope this helps! | Create a Java method that does the following: "Update content hash.". |
Of course, here is the Java code you requested:
```java
public static SortedMap<PackageDoc, SortedSet<ClassDoc>> sortClassesPerPackage(final ClassDoc... classDocs) {
final SortedMap<PackageDoc, SortedSet<ClassDoc>> toReturn = new TreeMap<>(Comparators.PACKAGE_NAME_COMPARATOR);
if (classDocs != null) ... | Create a Java method that does the following: "Sort classes per package.". |
Of course, here is the Java code you requested:
```java
protected static boolean containsPrefix(final List<String> source, final String toCheck) {
if (source != null) {
for (final String current : source) {
if (toCheck.startsWith(current)) {
return true;
... | Create a Java method that does the following: "Checks if the list of strings contains a prefix.". |
Of course, here is the Java code you requested:
```java
private static Class<?extends ObjectFactory> getFactoryClass(Class<?> factoryClass) {
if(factoryPackages.size() == 0) throw new IllegalArgumentException("No package provide to look for factories.");
if(factoryClasses == null) {
factor... | Create a Java method that does the following: "Get the factory class.". |
Of course, here is the Java code you requested:
```java
@Override
protected String doRender(final RenderConfiguration config, final RightSideEdge entity) {
final String prefix = RightSideEdge.getEdgeSeparator(config.isDirectedGraph())
+ " "
+ (entity.getNodeID() != null
... | Create a Java method that does the following: "Render the RightSideEdge.". |
Of course, here is the Java code you requested:
```java
@SuppressWarnings({ "ThrowableInstanceNeverThrown" })
private void handleException(Throwable e, ResultSender<Serializable> resultSender, String queryString) {
logger.error("Failed to execute bucket oriented query" + (queryString != null ? ": " + queryString ... | Create a Java method that does the following: "Handle exception.". |
Of course, here is the Java code you requested:
```java
private List<Object> formatResults(SelectResults<?> selectResults) {
List<Object> results = new ArrayList<Object>(selectResults.size() + 1);
results.addAll(selectResults.asList());
results.add(selectResults.getCollectionType().getElementType());
return resu... | Create a Java method that does the following: "Format the results of a select query.". |
Of course, here is the Java code you requested:
```java
public String process(XProperty field) {
String fieldName = field.getName();
String getter = "get" + firstLetterToUpperCase(fieldName) + "()";
return "if (concrete." + getter + " == null) {\n" +
" out.writeByte(0);\n" +
... | Create a Java method that does the following: "Process a single field to generate the result of a get operation.". |
Of course, here is the Java code you requested:
```java
@Override
protected String doRender(final RenderConfiguration config, final Node node) {
// Do we have a non-empty NodeAttributes within the supplied Node?
// Don't add the extra newline after the attributes - so call doRender directly.
... | Create a Java method that does the following: "Override this method to render a single node.". |
Of course, here is the Java code you requested:
```java
public static boolean isSocketAlive(String host, int port) {
boolean socketAlive = false;
Socket socket = null;
try {
socket = new Socket(host, port);
socketAlive = socket.isConnected();
} catch (Throwable t) {
// do nothing
} finally ... | Create a Java method that does the following: "Checks if a socket is alive.". |
Of course, here is the Java code you requested:
```java
public static void execute(Thread thread, long timeout) {
thread.start();
try {
thread.join(timeout);
} catch (InterruptedException e) {
// Should not be interrupted normally.
}
if (thread.isAlive()) {
thread.interrupt();
}
}
```
Hope ... | Create a Java method that does the following: "Execute a thread.". |
Of course, here is the Java code you requested:
```java
public static RightSideEdge to(final String id, final Graph withinGraph) {
// Check sanity
if (id == null) {
throw new IllegalArgumentException("Cannot handle null 'id' argument.");
}
if (withinGraph == null) {
... | Create a Java method that does the following: "Create a RightSideEdge from a node ID and a graph.". |
Of course, here is the Java code you requested:
```java
public final void add(final String... lines) {
if (lines != null) {
for (String current : lines) {
commentLines.add(current.replace(NEWLINE, ""));
}
}
}
```
Hope this helps! | Create a Java method that does the following: "Add a list of lines to the Crazil - Australia.". |
Of course, here is the Java code you requested:
```java
protected CheckstyleExecutorRequest createRequest()
throws MavenReportException {
CheckstyleExecutorRequest request = new CheckstyleExecutorRequest();
request.setAggregate(true)
.setReactorProjects(reactorProjects)
... | Create a Java method that does the following: "Creates a new request object.". |
Of course, here is the Java code you requested:
```java
public boolean canGenerateReport() {
if (skip) {
return false;
}
// TODO: would be good to scan the files here
for (File sourceDirectory : getSourceDirectories()) {
if (sourceDirectory.exists()) {
... | Create a Java method that does the following: "Checks if the generated report can be generated.". |
Of course, here is the Java code you requested:
```java
private void mergeDeprecatedInfo()
throws MavenReportException {
if ("sun_checks.xml".equals(configLocation) && !"sun".equals(format)) {
configLocation = FORMAT_TO_CONFIG_LOCATION.get(format);
throw new MavenReportExce... | Create a Java method that does the following: "Merge deprecated information.". |
Of course, here is the Java code you requested:
```java
public static void clearRegion(Region<?, ?> region, boolean wanCompatible,
boolean cleanLocal) {
ClearRegionFunction cleaner = new ClearRegionFunction();
FunctionService.registerFunction(cleaner);
FunctionService.onRegion(region).withArgs(wanCompatible... | Create a Java method that does the following: "Clear the region.". |
Of course, here is the Java code you requested:
```java
public static <K> void removeAll(Region<K, ?> region, Set<K> keys) {
if (keys == null) {
throw new NullPointerException();
}
if (keys.isEmpty()) {
// Nothing to do
return;
}
Function function = new RemoveAllFunction();
FunctionService.regist... | Create a Java method that does the following: "Removes all the elements in the specified set.". |
Of course, here is the Java code you requested:
```java
public static <T> T retryWithExponentialBackoff(Retryable<T> runnable,
int maxRetries) throws InterruptedException,
OperationRetryFailedException {
int retry = 0;
while (retry < maxRetries) {
retry++;
try {
return runnable.execute();
} ca... | Create a Java method that does the following: "Retry with exponential backoff.". |
Of course, here is the Java code you requested:
```java
protected void generateBufferedImage(TranscoderInput in, int w, int h) throws TranscoderException {
BufferedImageTranscoder t = new BufferedImageTranscoder();
if (w != 0 && h != 0) {
t.setDimensions(w, h);
}
t.transcode... | Create a Java method that does the following: "Generate buffered image.". |
Of course, here is the Java code you requested:
```java
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
if (backgroundColour == null) g.drawImage(bufferedImage, x, y, null);
else g.drawImage(bufferedImage, x, y, backgroundColour, null);
}
```
Hope this helps! | Create a Java method that does the following: "Paint the image of the segment.". |
Of course, here is the Java code you requested:
```java
@SuppressWarnings({"unchecked"})
@Override
protected void performValidation(final MavenProject project, final EnforcerRuleHelper helper)
throws RuleFailureException {
// Acquire the ProjectType
final ProjectType projectType;
... | Create a Java method that does the following: "Perform validation of the rule.". |
Of course, here is the Java code you requested:
```java
private static BufferedReader getReader() {
if (bufferedReader == null) {
bufferedReader = new BufferedReader(new InputStreamReader(System.in));
}
return bufferedReader;
}
```
Hope this helps! | Create a Java method that does the following: "Get the reader.". |
Of course, here is the Java code you requested:
```java
protected void parseCommandLineArguments(String[] commandLineArguments) {
Options options = constructGnuOptions();
if (commandLineArguments.length < 1) {
printHelp(options);
}
CommandLineParser parser = new GnuParser();
try {
CommandLine line = ... | Create a Java method that does the following: "Parses the command - line arguments.". |
Of course, here is the Java code you requested:
```java
protected Options constructGnuOptions() {
final Options gnuOptions = new Options();
gnuOptions
.addOption("t", TIMEOUT_OPTION, true,
"Timeout, ms. Default timeout is " + DEFAULT_TIMEOUT)
.addOption(
"r",
REGION_OPTION,
true,
"The na... | Create a Java method that does the following: "Construct the options for the GNU test.". |
Of course, here is the Java code you requested:
```java
public ExpressionBuilder notNullOrEmpty(final Object property, final String name) {
notNull(property, name);
if (property instanceof String && ((String) property).isEmpty()) {
messageContainer.addErrorMessage("Property '" + name + "'... | Create a Java method that does the following: "Check that the property is not null or empty and contains elements.". |
Of course, here is the Java code you requested:
```java
private static void parseCommandLineArguments(String[] commandLineArguments) {
Options options = constructGnuOptions();
CommandLineParser parser = new GnuParser();
try {
CommandLine line = parser.parse(options, commandLineArguments);
if (line.has... | Create a Java method that does the following: "Parses the command line arguments.". |
Of course, here is the Java code you requested:
```java
private static Options constructGnuOptions() {
final Options gnuOptions = new Options();
gnuOptions.addOption("d", DEBUG_OPTION, false, "Print debug information")
.addOption("q", QUIET_OPTION, false, "Quiet output. Doesn't work if --" + DEBUG_OPTION + " spec... | Create a Java method that does the following: "Construct the options for the GNU command.". |
Of course, here is the Java code you requested:
```java
private static String[] extractLauncherArgs(String[] args, int commandIndex) {
String[] launcherArgs = new String[commandIndex];
System.arraycopy(args, 0, launcherArgs, 0, commandIndex);
return launcherArgs;
}
```
Hope this helps! | Create a Java method that does the following: "Extract launcher arguments from the given command line arguments.". |
Of course, here is the Java code you requested:
```java
private static String[] extractCommandArgs(String[] args, int commandIndex) {
String[] commandArgs = new String[args.length - commandIndex - 1];
System.arraycopy(args, commandIndex + 1, commandArgs, 0, args.length - commandIndex - 1);
return commandArgs;
... | Create a Java method that does the following: "Extract command arguments from command line arguments.". |
Of course, here is the Java code you requested:
```java
@Override
protected String doRender(final RenderConfiguration config, final Edge edge) {
// Edges can be from/to Nodes and Subgraphs. Pick the correct ID source.
final String edgeID = edge.getNodeID() != null
? nodeIdRenderer.... | Create a Java method that does the following: "Render the node ID and attributes after the edge.". |
Of course, here is the Java code you requested:
```java
private void start() {
try {
timer.schedule(new IsAliveTimerTask(), 0, period);
} catch (Throwable t) {
Utils.exitWithFailure("Throwable caught during the startup", t);
}
}
```
Hope this helps! | Create a Java method that does the following: "Start the timer.". |
Of course, here is the Java code you requested:
```java
public Set<Region<?, ?>> createRegions(Map<String, String> regionNames) {
Set<Region<?, ?>> regions = new HashSet<Region<?, ?>>();
proxyRegionFactory = cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
for (String regionPath : regionNames.keySet()... | Create a Java method that does the following: "Create a set of regions from a map of region paths.". |
Of course, here is the Java code you requested:
```java
@Override
protected String doRender(final RenderConfiguration config, final Comment comment) {
// Check sanity
final StringBuilder builder = new StringBuilder(config.getNewline() + config.getIndent());
final List<String> commentLines ... | Create a Java method that does the following: "Override to render the CRAsCTYPE.". |
Of course, here is the Java code you requested:
```java
public final void setIndentationToken(final String indentationToken) {
// Check sanity
if (indentationToken == null || indentationToken.isEmpty()) {
throw new IllegalArgumentException("Cannot handle null or empty 'indentationToken' ar... | Create a Java method that does the following: "Sets the indentation token.". |
Of course, here is the Java code you requested:
```java
public final RenderConfiguration cloneAndChangeIndentation(final int indentationChange)
throws IllegalArgumentException {
// Check sanity
final int newIndentationLevel = getIndentationLevel() + indentationChange;
final RenderC... | Create a Java method that does the following: "Clone and change indentation level.". |
Of course, here is the Java code you requested:
```java
public static int optionLength(final String option) {
final int standardOptionLength = Standard.optionLength(option);
eventSequence.add("optionLength (" + option + "): " + standardOptionLength);
return standardOptionLength;
}
```
H... | Create a Java method that does the following: "Get the option length.". |
Of course, here is the Java code you requested:
```java
public static boolean validOptions(final String options[][], DocErrorReporter reporter) {
final boolean toReturn = Standard.validOptions(options, reporter);
if(options == null || options.length == 0) {
eventSequence.add("validOptions... | Create a Java method that does the following: "validOptions Method.". |
Of course, here is the Java code you requested:
```java
private Set<Integer> extractPortsSet(SystemMember member)
throws AdminException {
Set<Integer> portsSet = new HashSet<Integer>();
SystemMemberCache cache = member.getCache();
if (cache != null) {
SystemMemberCacheServer[] cacheServers = cache.getCacheS... | Create a Java method that does the following: "Extract ports set from member". |
Of course, here is the Java code you requested:
```java
private Pool findOrCreatePool(String host, int port) {
String poolName = Utils.toKey(host, port);
Pool pool = PoolManager.find(poolName);
if (pool == null) {
poolFactory.reset();
poolFactory.addServer(host, port);
pool = poolFactory.create(poolName... | Create a Java method that does the following: "Find or create a pool.". |
Of course, here is the Java code you requested:
```java
public static String getName(String eventSrcName) {
if (eventSrcName == null) {
return null;
}
if (eventSrcName.endsWith("Check")) {
eventSrcName = eventSrcName.substring(0, eventSrcName.length() - 5);
}
... | Create a Java method that does the following: "Get the name of the class from the event source name.". |
Of course, here is the Java code you requested:
```java
public static String getCategory(String eventSrcName) {
if (eventSrcName == null) {
return null;
}
int end = eventSrcName.lastIndexOf('.');
eventSrcName = eventSrcName.substring(0, end);
if (CHECKSTYLE_PACKAGE... | Create a Java method that does the following: "Get the category of the event.". |
Of course, here is the Java code you requested:
```java
@Override
public void printWarning(final SourcePosition pos, final String msg) {
wrappedRootDoc.printWarning(pos, msg);
}
```
Hope this helps! | Create a Java method that does the following: "Print a warning to the standard output stream.". |
Of course, here is the Java code you requested:
```java
@Override
public void printNotice(final SourcePosition pos, final String msg) {
wrappedRootDoc.printNotice(pos, msg);
}
```
Hope this helps! | Create a Java method that does the following: "Print a warning message.". |
Of course, here is the Java code you requested:
```java
public static void enterFrame(String className) {
int counter = local.get().incrementAndGet();
classNames.get().add(className);
if (counter == MAX_STACK_DEPTH) {
throw new RuntimeException(STACK_OVERFLOW_MSG + getClassNames());... | Create a Java method that does the following: "Enter a new class frame.". |
Of course, here is the Java code you requested:
```java
public static void exitFrame(String className) {
int counter = local.get().decrementAndGet();
if (counter < 0) {
String errorMessage = "Method frame counter is less then 0. Some programming error: count(exitFrame) > count(enterFrame)."... | Create a Java method that does the following: "Exit the method frame.". |
Of course, here is the Java code you requested:
```java
public String process(XProperty field) {
String fieldName = field.getName();
String fullClassName = CodeGenUtils.className(field.getType());
return "if (in.readByte() != 0) {\n" +
CodeGenUtils.tab("result.set" + CodeGenUti... | Create a Java method that does the following: "Process a single record record.". |
Of course, here is the Java code you requested:
```java
private void addPackages(final File fileOrDirectory,
final SortedMap<String, SortedSet<String>> package2FileNamesMap) {
for (PackageExtractor current : packageExtractors) {
final FileFilter sourceFileDefinitionFi... | Create a Java method that does the following: "Add the packages to the map.". |
Of course, here is the Java code you requested:
```java
public void setUiOriginalFileName(final String uiOriginalFileName) {
this.uiOriginalFileName = uiOriginalFileName;
if (this.uiOriginalFileName != null && !this.uiOriginalFileName.isEmpty()) originalFileName = this.uiOriginalFileName;
}
```
Ho... | Create a Java method that does the following: "Sets the original file name for the class.". |
Of course, here is the Java code you requested:
```java
@SuppressWarnings({ "unchecked" })
public static SelectResults<Object> executeOnBuckets(String queryString, Region region, Set<Object> keys)
throws QueryException {
return executeOnBuckets(queryString, null, region, keys);
}
```
Hope this helps! | Create a Java method that does the following: "Execute a query on a set of buckets.". |
Of course, here is the Java code you requested:
```java
@SuppressWarnings({ "unchecked" })
public static SelectResults<Object> executeOnBuckets(String queryString, Object[] queryParameters, Region region,
Set<Object> keys) throws QueryException {
if ((queryString == null) || (queryString.length() == 0)) {
... | Create a Java method that does the following: "Execute a query on the specified region and keys.". |
Of course, here is the Java code you requested:
```java
private static int extractLimit(String queryString) {
int limitIndex = queryString.lastIndexOf("limit");
if (limitIndex == -1) {
limitIndex = queryString.lastIndexOf("LIMIT");
}
if (limitIndex == -1) {
return limitIndex;
}
String limitValue = q... | Create a Java method that does the following: "Extract limit from query string.". |
Of course, here is the Java code you requested:
```java
@SuppressWarnings({ "unchecked" })
private static SelectResults<Object> formatSelectResults(List<List<Object>> queryResults, int limit) {
List<Object> list = new ArrayList<Object>();
ObjectType baseElementType = null;
for (List<Object> queryResult : quer... | Create a Java method that does the following: "Format the list of results for a select query.". |
Of course, here is the Java code you requested:
```java
private static void checkAllowedInRealTime0(Object obj, int depth) throws InvalidClassException {
if (depth >= MethodFrameCounter.MAX_STACK_DEPTH) { //todo: correct >? or >=?
throw new RuntimeException();
}
Class<?> clazz = obj... | Create a Java method that does the following: "checkAllowedInRealTime0 This method checks if the object is a class of a class that is allowed in real time.". |
Of course, here is the Java code you requested:
```java
public Process runWithConfirmation(String id, Class<?> klass,
String[] javaArguments, String[] processArguments)
throws IOException, InterruptedException {
Process process = startProcess(id, klass, javaArguments, processArguments,
true);
waitConfir... | Create a Java method that does the following: "Run a process with a confirmation.". |
Of course, here is the Java code you requested:
```java
public Process runWithStartupDelay(Class<?> klass, String[] javaArguments,
String[] processArguments) throws IOException,
InterruptedException, TimeoutException {
return runWithStartupDelay(klass, javaArguments, processArguments,
DEFAULT_PROCESS_START... | Create a Java method that does the following: "Run with startup delay.". |
Of course, here is the Java code you requested:
```java
public Process runWithStartupDelay(Class<?> klass, String[] javaArguments,
String[] processArguments, long processStartupTime)
throws IOException, InterruptedException, TimeoutException {
Process process = runWithConfirmation("", klass, javaArguments,
... | Create a Java method that does the following: "Run a process with a delay between startup time.". |
Of course, here is the Java code you requested:
```java
public void stopBySendingNewLineIntoProcess(Process process)
throws IOException, InterruptedException {
if (process != null) {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
process.getOutputStream()));
writer.newLine();
w... | Create a Java method that does the following: "Stop by sending a new line into a process.". |
Of course, here is the Java code you requested:
```java
private List<String> createCommandLineForProcess(Class<?> klazz,
String[] processArguments) {
return createCommandLineForProcess(klazz, null, processArguments);
}
```
Hope this helps! | Create a Java method that does the following: "Create command line for process.". |
Of course, here is the Java code you requested:
```java
private List<String> createCommandLineForProcess(Class<?> klazz,
String[] javaArguments, String[] processArguments) {
String javaHome = System.getProperty("java.home");
String javaBin = javaHome + File.separator + "bin" + File.separator
+ "java";
Str... | Create a Java method that does the following: "Creates the command line for the process.". |
Of course, here is the Java code you requested:
```java
private void waitConfirmation(String className, Process process)
throws IOException, InterruptedException {
System.out
.println("Waiting startup complete confirmation for a process ("
+ className + ")...");
BufferedReader bufferedReader = new Bu... | Create a Java method that does the following: "Wait for a startup complete process to complete.". |
Of course, here is the Java code you requested:
```java
@Override
protected Graph doConvert(final VisualizationWrappedRootDoc toConvert) {
final Graph toReturn = new Graph();
// Create subgraphs for each package and add them to the returned Graph.
toConvert.sortClassesPerPackage().forEach... | Create a Java method that does the following: "Convert a single CIDCTYPE to a CIDCTYPE graph.". |
Of course, here is the Java code you requested:
```java
public void generate( String outputFilename, String template, Context context )
throws VelocityException, MojoExecutionException, IOException
{
Writer writer = null;
try
{
File f = new File( outputFilename );
... | Create a Java method that does the following: "Generate a single file from a Velocity template.". |
Of course, here is the Java code you requested:
```java
public void fileStarted(AuditEvent event) {
final String fileName = StringUtils.replace(event.getFileName(), "\\", "/");
for (File sourceDirectory : sourceDirectories) {
String sourceDirectoryPath = StringUtils.replace(sourceDirectory... | Create a Java method that does the following: "Called when a file is started.". |
Of course, here is the Java code you requested:
```java
public int process() throws IOException, InterruptedException {
debug("ReplicationProcessor#process(): Processing start");
Properties gemfireProperties = PropertiesHelper.filterProperties(
System.getProperties(), "gemfire.");
String[] vmOptions = Proper... | Create a Java method that does the following: "Process the cluster properties and wait for all processes to finish". |
Of course, here is the Java code you requested:
```java
@Pointcut(value = "initialization(se.jguru.nazgul.tools.validation.api.Validatable+.new(..)) && if()",
argNames = "joinPoint")
public static boolean anyNonDefaultConstructor(final JoinPoint joinPoint) {
// Extract the JoinPoint signature.... | Create a Java method that does the following: "Check if the JoinPoint is a constructor with a non - default constructor.". |
Of course, here is the Java code you requested:
```java
@AfterReturning(value = "anyNonDefaultConstructor(joinPoint) && target(aValidatable)",
argNames = "joinPoint, aValidatable")
public void performValidationAfterCompoundConstructor(final JoinPoint joinPoint, final Validatable aValidatable)
... | Create a Java method that does the following: "Perform validation after a compound constructor.". |
Of course, here is the Java code you requested:
```java
public static boolean isA(Class clazz, ParameterizedType pType) {
return clazz.isAssignableFrom((Class) pType.getRawType());
}
```
Hope this helps! | Create a Java method that does the following: "Checks if the given class is an instance of the given type.". |
Of course, here is the Java code you requested:
```java
public static Method getImplementingMethod(Class clazz, Method intfMethod) {
Class<?> declaringClass = intfMethod.getDeclaringClass();
if (declaringClass.equals(clazz))
return intfMethod;
Class[] paramTypes = intfMethod.g... | Create a Java method that does the following: "Returns the implementation of the specified method in the specified class.". |
Of course, here is the Java code you requested:
```java
public static Class<?> getTypeArgument(Type genericType) {
if (!(genericType instanceof ParameterizedType))
return null;
ParameterizedType parameterizedType = (ParameterizedType) genericType;
Class<?> typeArg = (Class<?>) p... | Create a Java method that does the following: "Gets the type argument of the given generic type.". |
Of course, here is the Java code you requested:
```java
public static Type resolveTypeVariable(Class<?> root, TypeVariable<?> typeVariable) {
if (typeVariable.getGenericDeclaration() instanceof Class<?>) {
Class<?> classDeclaringTypeVariable = (Class<?>) typeVariable.getGenericDeclaration();
... | Create a Java method that does the following: "Resolves a type variable from a class.". |
Of course, here is the Java code you requested:
```java
public static Type[] getActualTypeArgumentsOfAnInterface(Class<?> classToSearch, Class<?> interfaceToFind) {
Type[] types = findParameterizedTypes(classToSearch, interfaceToFind);
if (types == null)
throw new RuntimeException("Unabl... | Create a Java method that does the following: "Gets the actual type arguments of an interface.". |
Of course, here is the Java code you requested:
```java
public static Type[] findParameterizedTypes(Class<?> root, Class<?> searchedFor) {
if (searchedFor.isInterface()) {
return findInterfaceParameterizedTypes(root, null, searchedFor);
}
return findClassParameterizedTypes(root,... | Create a Java method that does the following: "Finds the parameterized types of a class in a class hierarchy.". |
Of course, here is the Java code you requested:
```java
public RedisKeyValueStoreBuilder setRedisUri(final URI uri) {
getRedisOptions().setPort(uri.getPort());
getRedisOptions().setHost(uri.getHost());
final String userInfo = uri.getUserInfo();
final String[] split = Str.split(userInf... | Create a Java method that does the following: "Sets the Redis URI.". |
Of course, here is the Java code you requested:
```java
@Override
public double[] score(Object[] scorable) throws FOSException {
return WekaUtils.score(classifier, scorable, instanceSetters, instances, attributes);
}
```
Hope this helps! | Create a Java method that does the following: "Score a set of classes.". |
Of course, here is the Java code you requested:
```java
@Override
public double[] score(Object[] scorable) throws FOSException {
/* the pool can change while this is processing (reload) so assign a local variable */
final ObjectPool<Classifier> localPool = pool;
Classifier classifier = nul... | Create a Java method that does the following: "Score a set of objects using the CRA - 2D algorithm.". |
Of course, here is the Java code you requested:
```java
private Destination getDestination(final String destinationName) {
if (!destinations.containsKey(destinationName)) {
Destination destination = destinationSupplier.apply(destinationName);
destinations.put(destinationName, destinatio... | Create a Java method that does the following: "Gets the destination.". |
Of course, here is the Java code you requested:
```java
private MessageConsumer getConsumer(final String destinationName) {
if (!consumers.containsKey(destinationName)) {
Session session = getSession();
Destination destination = getDestination(destinationName);
try {
... | Create a Java method that does the following: "Gets the MessageConsumer for the specified destination name.". |
Of course, here is the Java code you requested:
```java
private MessageProducer getProducer(final String destinationName) {
if (!producers.containsKey(destinationName)) {
Session session = getSession();
Destination destination = getDestination(destinationName);
MessagePro... | Create a Java method that does the following: "Gets the MessageProducer for the specified destination name.". |
Of course, here is the Java code you requested:
```java
private Session getSession() {
if (!sessionOption.isPresent()) {
try {
sessionOption = Optional.of(getConnection().createSession(transacted, acknowledgeMode));
} catch (JMSException e) {
throw new J... | Create a Java method that does the following: "Gets the JMS session.". |
Of course, here is the Java code you requested:
```java
private Connection getConnection() {
if (!connectionOption.isPresent()) {
final Connection connection = connectionSupplier.get();
if (connection instanceof ActiveMQConnection) {
((ActiveMQConnection) connection).a... | Create a Java method that does the following: "Gets the connection.". |
Of course, here is the Java code you requested:
```java
public String receiveTextMessageFromDestinationWithTimeout(final String destinationName, final int timeout) {
if (!this.isConnected()) {
throw new JmsNotConnectedException("Not connected");
}
MessageConsumer consumer = getCon... | Create a Java method that does the following: "This method will receive a text message from a destination.". |
Of course, here is the Java code you requested:
```java
private static void addAlgorithm(PMML pmml, Algorithm algorithm) {
Extension extension = new Extension();
extension.withName(ALGORITHM_EXTENSION_ELEMENT);
extension.withValue(algorithm.name());
pmml.withExtensions(extension);
... | Create a Java method that does the following: "Adds the algorithm extension to the PMML.". |
Of course, here is the Java code you requested:
```java
private void handleLoadFromUserDataService(final User loadedUser,
final Callback<List<Recommendation>> recommendationsCallback) {
/** Add a runnable to the callbacks list. */
callbacks.add(() -> {
... | Create a Java method that does the following: "Handle load from user data service.". |
Of course, here is the Java code you requested:
```java
public static void main(final String... args) {
final ManagedServiceBuilder managedServiceBuilder = managedServiceBuilder();
managedServiceBuilder.getHttpServerBuilder().addResponseDecorator(new HttpResponseDecorator() {
@Override
... | Create a Java method that does the following: "Main method for the application.". |
Of course, here is the Java code you requested:
```java
private static Algorithm getAlgorithm(PMML pmml) throws PMMLConversionException {
for (Extension extension : pmml.getExtensions()) {
if (ALGORITHM_EXTENSION_ELEMENT.equals(extension.getName())) {
return Algorithm.valueOf(extens... | Create a Java method that does the following: "Gets the Algorithm from the extension element of the PMML.". |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.