code stringlengths 146 69.7k | prompt stringlengths 55 1.5k |
|---|---|
Of course, here is the Java code you requested:
```java
public static <T> T deserializeByType(Object src, Class<T> clazz) {
if (src == null) {
return (T) ClassUtils.getDefaultPrimitiveValue(clazz);
} else if (src instanceof Boolean) {
return (T) CompatibleTypeUtils.convert(src, ... | Create a Java method that does the following: "Deserialize by type.". |
Of course, here is the Java code you requested:
```java
public void upgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
for (TableHelper th : getTableHelpers()) {
th.onUpgrade(db, oldVersion, newVersion);
}
}
```
Hope this helps! | Create a Java method that does the following: "Upgrade the database to a new version of the database.". |
Of course, here is the Java code you requested:
```java
public void setGpuIds(java.util.Collection<String> gpuIds) {
if (gpuIds == null) {
this.gpuIds = null;
return;
}
this.gpuIds = new com.amazonaws.internal.SdkInternalList<String>(gpuIds);
}
```
Hope this helps! | Create a Java method that does the following: "Sets the value of the gpuIds property.". |
Of course, here is the Java code you requested:
```java
private void initConfigs() {
client = CuratorFrameworkFactory.newClient(configProfile.getConnectStr(), configProfile.getRetryPolicy());
client.start();
client.getCuratorListenable().addListener(new CuratorListener() {
@Overrid... | Create a Java method that does the following: "Initialize the config.". |
Of course, here is the Java code you requested:
```java
public <T> void put(TypeTag tag, T red, T black, T redCopy) {
cache.put(tag, new Tuple<>(red, black, redCopy));
}
```
Hope this helps! | Create a Java method that does the following: "Put a tuple into the cache.". |
Of course, here is the Java code you requested:
```java
@Override
public List<CommerceWarehouse> findByG_A_C_P(long groupId, boolean active,
long commerceCountryId, boolean primary) {
return findByG_A_C_P(groupId, active, commerceCountryId, primary,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
```
Hope thi... | Create a Java method that does the following: "Returns all the commerce warehouse rels where groupId = ? ; and active = ? ; and commerceCountryId = ? ; and primary = ? ;.". |
Of course, here is the Java code you requested:
```java
public void execute() {
// We can assume we have the named persistence unit and its mapping file in our classpath,
// but we may have to allow some properties in that persistence unit to be overridden before
// we can successfully get that... | Create a Java method that does the following: "Execute the JPADomain exporter.". |
Of course, here is the Java code you requested:
```java
public Build withPhases(BuildPhase... phases) {
if (this.phases == null) {
setPhases(new java.util.ArrayList<BuildPhase>(phases.length));
}
for (BuildPhase ele : phases) {
this.phases.add(ele);
}
ret... | Create a Java method that does the following: "A list of build phases.". |
Of course, here is the Java code you requested:
```java
public final void setMaxNumber(final int maxNumber) {
Condition.INSTANCE.ensureGreater(maxNumber, getMinNumber(),
"The maximum number must be greater than the minimum number");
this.maxNumber = maxNumber;
setNumber(Math.min... | Create a Java method that does the following: "Sets the maximum number of the resource.". |
Of course, here is the Java code you requested:
```java
protected int parseInt (String val)
{
try {
return (val == null) ? -1 : Integer.parseInt(val);
} catch (NumberFormatException nfe) {
log.warning("Malformed integer value", "val", val);
return -1;
}
... | Create a Java method that does the following: "parseInt Method.". |
Of course, here is the Java code you requested:
```java
public String getDescriptor() {
if (sort == OBJECT) {
return valueBuffer.substring(valueBegin - 1, valueEnd + 1);
} else if (sort == INTERNAL) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append('L');
stringBu... | Create a Java method that does the following: "Get the descriptor of the value.". |
Of course, here is the Java code you requested:
```java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
JavaProcessBuilder pb = SAMPLE_QUEUE.newProcessBuilder(Locale.getDefault());
pb.setProcessName("Test 2");
pb.setProcessPersist... | Create a Java method that does the following: "JButton 2ActionPerformed.". |
Of course, here is the Java code you requested:
```java
public Observable<Page<VirtualNetworkPeeringInner>> listAsync(final String resourceGroupName, final String virtualNetworkName) {
return listWithServiceResponseAsync(resourceGroupName, virtualNetworkName)
.map(new Func1<ServiceResponse<Page<Vir... | Create a Java method that does the following: "Gets a list of a virtual network peering.". |
Of course, here is the Java code you requested:
```java
public java.util.List<String> getSecurityGroupIds() {
if (securityGroupIds == null) {
securityGroupIds = new com.amazonaws.internal.SdkInternalList<String>();
}
return securityGroupIds;
}
```
Hope this helps! | Create a Java method that does the following: "Gets the value of the securityGroupIds property.". |
Of course, here is the Java code you requested:
```java
private List<List<K>> prepareKeysForParallelism() {
// Calculate the number of row keys to be queried at a time.
// Consider whether parallelism is enabled or not.
// When numThreads is calculated, the int truncation
// causes one fewer thread to be used ... | Create a Java method that does the following: "Prepare the keys for parallelism.". |
Of course, here is the Java code you requested:
```java
public static XClass getXClass(final ClassDescriptor classDesc) throws AssertionError {
try {
return Global.getAnalysisCache().getClassAnalysis(XClass.class, classDesc);
} catch (CheckedAnalysisException e) {
AssertionError... | Create a Java method that does the following: "Get an XClass object for a ClassDescriptor.". |
Of course, here is the Java code you requested:
```java
static void processDoubleQuotedString(StringBuilder sb,
SourceRange sourceRange) throws ParseException {
// Sanity checking. Make sure input string has at least two characters
// and that the first and last are double quotes.
... | Create a Java method that does the following: "Process double - quoted string.". |
Of course, here is the Java code you requested:
```java
private void generateLegalTimesTree() {
// Create a quick cache of numbers to their keycodes.
int k0 = KeyEvent.KEYCODE_0;
int k1 = KeyEvent.KEYCODE_1;
int k2 = KeyEvent.KEYCODE_2;
int k3 = KeyEvent.KEYCODE_3;
int k... | Create a Java method that does the following: "Generate the tree of legal times.". |
Of course, here is the Java code you requested:
```java
public static TranslationParameters withIncompleteCodon(int inFramePosition) {
byte frame = (byte) (inFramePosition % 3);
switch (frame) {
case 0:
return FromLeftWithIncompleteCodon;
case 1:
... | Create a Java method that does the following: "Returns a TranslationParameters object with the incomplete CODON translation parameter.". |
Of course, here is the Java code you requested:
```java
static public String getPropertyFromSystemOrEnv(String lowerCamelCaseName, String defaultValue){
String upperCaseName = lowerCamelCaseName;
try{
upperCaseName = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.UPPER_UNDERSCORE).convert(lowerCamelCaseName);... | Create a Java method that does the following: "Gets the property from the system or environment variables.". |
Of course, here is the Java code you requested:
```java
private MapperConstructor getMapper(String dName){
return new MapperConstructor(destinationType(), sourceType(), dName, dName, getSName(), configChosen, xml,methodsToGenerate);
}
```
Hope this helps! | Create a Java method that does the following: "Returns a new instance of the MapperConstructor class.". |
Of course, here is the Java code you requested:
```java
private T getCurrent(T item) {
for( String key: order ) {
ConcurrentCache<Object,T> cache = caches.get(key);
Object val = getValue(key, item);
T tmp;
if( val instanceof BigDecimal ) {
val = ... | Create a Java method that does the following: "Gets the current item from cache.". |
Of course, here is the Java code you requested:
```java
protected ComboBox<CmsRole> getRoleComboBox(String ou) {
ComboBox<CmsRole> box = new ComboBox<CmsRole>();
CmsUserEditDialog.iniRole(A_CmsUI.getCmsObject(), ou, box, null);
box.setSelectedItem(CmsRole.EDITOR.forOrgUnit(ou));
retur... | Create a Java method that does the following: "Returns the role combo box for the given organizational unit.". |
Of course, here is the Java code you requested:
```java
@Override
public double membership(double x) {
if (this.root == null) {
throw new RuntimeException(String.format(
"[function error] function <%s> not loaded.", formula));
}
if (this.engine != null) {
... | Create a Java method that does the following: "Evaluate the membership function.". |
Of course, here is the Java code you requested:
```java
public static StreamSegmentReadResult read(SegmentHandle handle, long startOffset, int maxReadLength, int readBlockSize, ReadOnlyStorage storage) {
Exceptions.checkArgument(startOffset >= 0, "startOffset", "startOffset must be a non-negative number.");
... | Create a Java method that does the following: "Reads a segment from the given segment handle.". |
Of course, here is the Java code you requested:
```java
@Nullable
TransitionValues getMatchedTransitionValues(@NonNull View view, boolean viewInStart) {
if (mParent != null) {
return mParent.getMatchedTransitionValues(view, viewInStart);
}
ArrayList<TransitionValues> lookIn = vi... | Create a Java method that does the following: "Gets the matched TransitionValues.". |
Of course, here is the Java code you requested:
```java
private ThroughputStatDO throughputStatModelToDo(ThroughputStat throughputStat) {
ThroughputStatDO throughputStatDO = new ThroughputStatDO();
throughputStatDO.setId(throughputStat.getId());
throughputStatDO.setPipelineId(throughputStat.get... | Create a Java method that does the following: "This method is used to create a ThroughputStatDO object from a ThroughputStat object.". |
Of course, here is the Java code you requested:
```java
public GeneralTimestamp<PersianCalendar> atTime(
int hour,
int minute
) {
return this.at(PlainTime.of(hour, minute));
}
```
Hope this helps! | Create a Java method that does the following: "Gets a GeneralTimestamp representing the time in the specified calendar.". |
Of course, here is the Java code you requested:
```java
public static String elementText(Element element, String tagName) {
Element child = getElement(element, tagName);
return child == null ? null : child.getTextContent();
}
```
Hope this helps! | Create a Java method that does the following: "Gets the text content of an element.". |
Of course, here is the Java code you requested:
```java
private void determineChangesSince(File file, long lastScanTime) {
try {
if (GlobalConfiguration.verboseMode && log.isLoggable(Level.INFO)) {
log.info("Firing file changed event " + file);
}
listener.fileChanged(file);
if (file.isDirectory()) {
... | Create a Java method that does the following: "Determines if a file has changed since the given last scan time.". |
Of course, here is the Java code you requested:
```java
public static Path removeEntropyMarkerIfPresent(FileSystem fs, Path path) {
final EntropyInjectingFileSystem efs = getEntropyFs(fs);
if (efs == null) {
return path;
}
else {
try {
return resolveEntropy(path, efs, false);
}
catch (IOExcept... | Create a Java method that does the following: "Remove the entropy marker if present.". |
Of course, here is the Java code you requested:
```java
@Override
public ListCertificateAuthoritiesResult listCertificateAuthorities(ListCertificateAuthoritiesRequest request) {
request = beforeClientExecution(request);
return executeListCertificateAuthorities(request);
}
```
Hope this helps! | Create a Java method that does the following: "Retrieves a list of certificate authorities.". |
Of course, here is the Java code you requested:
```java
private void configurePersistenceUnit(PersistenceUnitInfo puInfo, Map props)
{
// Invoke Persistence unit MetaData
if (puInfo.getPersistenceUnitName() == null)
{
throw new KunderaException("Persistence unit name should... | Create a Java method that does the following: "Configure the entity entity.". |
Of course, here is the Java code you requested:
```java
public boolean manage(final DeliveryReceipt result) {
if (logger.isDebugEnabled()) {
logger.debug("Invoking manage with parameter DeliveryReceipt method" +
" - smid : " + result.getSmid() +
" - msmisdn : " + result.getMsisdn() +... | Create a Java method that does the following: "Handles the management of the DeliveryReceipt class". |
Of course, here is the Java code you requested:
```java
public static EntityGetOperation<ContentKeyAuthorizationPolicyInfo> get(
LinkInfo<ContentKeyAuthorizationPolicyInfo> link) {
return new DefaultGetOperation<ContentKeyAuthorizationPolicyInfo>(link.getHref(),
ContentKeyAuthorizat... | Create a Java method that does the following: "Create an operation that will retrieve the content key authorization policy at the given link.". |
Of course, here is the Java code you requested:
```java
@BetaApi
public final Operation deleteInstanceTemplate(
ProjectGlobalInstanceTemplateName instanceTemplate) {
DeleteInstanceTemplateHttpRequest request =
DeleteInstanceTemplateHttpRequest.newBuilder()
.setInstanceTemplate(instance... | Create a Java method that does the following: "Deletes an instance template.". |
Of course, here is the Java code you requested:
```java
private static void setAdditionalStyles(CmsClientSitemapEntry entry, CmsListItemWidget itemWidget) {
if (!entry.isResleasedAndNotExpired()
|| ((CmsSitemapView.getInstance().getEditorMode() == EditorMode.navigation)
&& !entry.i... | Create a Java method that does the following: "Sets the additional styles for the sitemap item.". |
Of course, here is the Java code you requested:
```java
public StandaloneCommandBuilder setDebug(final boolean suspend, final int port) {
debugArg = String.format(DEBUG_FORMAT, (suspend ? "y" : "n"), port);
return this;
}
```
Hope this helps! | Create a Java method that does the following: "Sets the debug argument.". |
Of course, here is the Java code you requested:
```java
public void syncRecordToBase(Record recBase, Record recAlt, boolean syncSelection)
{
if ((recAlt != null) && (recBase != null))
{
recBase.moveFields(recAlt, null, true, DBConstants.READ_MOVE, false, false, true, syncSelection);
... | Create a Java method that does the following: "Synchronize this record to the base record.". |
Of course, here is the Java code you requested:
```java
public EventContextData newEventContextData(EventTypeID eventTypeId,
Object event, ActivityContext ac, Address address,
ServiceID serviceID,
EventProcessingSucceedCallback succeedCallback,
EventProcessingFailedCallback failedCallback,
EventUnrefere... | Create a Java method that does the following: "Creates a new event context data object.". |
Of course, here is the Java code you requested:
```java
public double[] permute(double[] vector) {
double[] permuted = new double[vector.length];
for (int i = 0; i < vector.length; i++) {
permuted[i] = vector[randomlyPermutatedIndices[i]];
}
return permuted;
}
```
Hope this helps! | Create a Java method that does the following: "Permutes the vector by randomly permuting the indices in the vector.". |
Of course, here is the Java code you requested:
```java
public void itransVector()
{
// itrans_consonants = new Vector();
itransVowels.add("a : \u0905");
itransVowels.add("aa/A : \u0906");
itransVowels.add("i : \u0907");
itransVowels.add("ii/I : \u0908");
itransVow... | Create a Java method that does the following: "This method creates the itrans_consonants vector.". |
Of course, here is the Java code you requested:
```java
public void rename(String oldpath, String newpath)
throws SftpStatusException, SshException {
String from = resolveRemotePath(oldpath);
String to = resolveRemotePath(newpath);
SftpFileAttributes attrs = null;
try {
attrs = sftp.getAttributes(to);
... | Create a Java method that does the following: "Rename a file from one of the remote filesystem to another.". |
Of course, here is the Java code you requested:
```java
@SuppressFBWarnings(justification = "Accepting that this is a bad practice - but made more sense in this use case",
value = {"NP_BOOLEAN_RETURN_NULL"})
public Boolean isRetireJsFilterNonVulnerable() {
return (line != null && line.hasOption... | Create a Java method that does the following: "Returns true if the retireJsFilterNonVulnerable option is set.". |
Of course, here is the Java code you requested:
```java
private String excerpt(String str, int maxLength) {
return str.length() > maxLength ? excerptPattern.matcher(
str.substring(0, maxLength)).replaceFirst("…") : str;
}
```
Hope this helps! | Create a Java method that does the following: "Excerpt is a string of length maxLength.". |
Of course, here is the Java code you requested:
```java
private BaseCalendar.Date getCalendarDate(long fd) {
BaseCalendar cal = (fd >= gregorianCutoverDate) ? gcal : getJulianCalendarSystem();
BaseCalendar.Date d = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE);
cal.getCalendarDa... | Create a Java method that does the following: "Get the calendar date from a fixed date.". |
Of course, here is the Java code you requested:
```java
@Override
public UpdateUserProfileResult updateUserProfile(UpdateUserProfileRequest request) {
request = beforeClientExecution(request);
return executeUpdateUserProfile(request);
}
```
Hope this helps! | Create a Java method that does the following: "Updates an existing user profile.". |
Of course, here is the Java code you requested:
```java
protected Asset getAsset(final String assetId, final boolean includeAttachments) throws FileNotFoundException, IOException, BadVersionException {
Asset ass = readJson(assetId);
ass.set_id(assetId);
// We always get a wlp info when read ba... | Create a Java method that does the following: "Get an asset from Massive.". |
Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public static <T> T[] singleElementArray(T elem, Class<T> tClass) {
if (tClass == null) {
return (T[]) new Object[] { elem };
}
T[] newItems = (T[]) Array.newInstance(tClass, 1);
newI... | Create a Java method that does the following: "Returns an array of single elements.". |
Of course, here is the Java code you requested:
```java
private void sleep() {
try {
TimeUnit.MILLISECONDS.sleep(this.delay);
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IllegalStateException(
"Unexpected in... | Create a Java method that does the following: "Sleep for the specified delay.". |
Of course, here is the Java code you requested:
```java
public HttpRequest withCookie(String name, String value) {
this.cookies.withEntry(name, value);
return this;
}
```
Hope this helps! | Create a Java method that does the following: "Add a cookie to the request.". |
Of course, here is the Java code you requested:
```java
@SafeVarargs
public static Consumer<Throwable> getConsumer(Predicate<Throwable> logFilter,
Class<? extends Throwable>... ignoredThrowableTypes) {
return get(logFilter, ignoredThrowableTypes)::apply;
... | Create a Java method that does the following: "Gets an consumer that accepts all exceptions that match the given filter.". |
Of course, here is the Java code you requested:
```java
public Tree insert(int index, byte[] value, boolean asBase64String) {
if (asBase64String) {
return insertObjectInternal(index, BASE64.encode(value));
}
return insertObjectInternal(index, value);
}
```
Hope this helps! | Create a Java method that does the following: "Inserts a byte array value into the tree at the given index.". |
Of course, here is the Java code you requested:
```java
public String deriveUserDN(String username)
throws GuacamoleException {
// Pull username attributes from properties
List<String> usernameAttributes = confService.getUsernameAttributes();
// We need exactly one base DN to deri... | Create a Java method that does the following: "Derives the user DN from the username attributes from the configuration and the base DN from the LDAP search DN.". |
Of course, here is the Java code you requested:
```java
public static BufferedImage regionBorders( GrayS32 pixelToRegion ,
int borderColor ,
BufferedImage output ) {
if( output == null )
output = new BufferedImage(pixelToRegion.width,pixelToRegion.height,BufferedImage.TYPE_INT_RGB);
... | Create a Java method that does the following: "Creates a buffered image that contains the borders of the image in the image.". |
Of course, here is the Java code you requested:
```java
@Override
public void process(TestCaseResult context) {
context.getParameters().add(new Parameter()
.withName(getName())
.withValue(getValue())
.withKind(ParameterKind.valueOf(get... | Create a Java method that does the following: "Override process to add a SEQUENCE parameter to the test case result.". |
Of course, here is the Java code you requested:
```java
public static PhasedBackoffWaitStrategy withSleep(
long spinTimeout,
long yieldTimeout,
TimeUnit units)
{
return new PhasedBackoffWaitStrategy(
spinTimeout, yieldTimeout,
units, new SleepingWaitStrategy(... | Create a Java method that does the following: "Creates a new instance of the PhasedBackoffWaitStrategy class with a sleeping wait strategy.". |
Of course, here is the Java code you requested:
```java
private void convertWordNetToFlat(Properties properties) throws SMatchException {
InMemoryWordNetBinaryArray.createWordNetCaches(GLOBAL_PREFIX + SENSE_MATCHER_KEY, properties);
WordNet.createWordNetCaches(GLOBAL_PREFIX + LINGUISTIC_ORACLE_KEY, p... | Create a Java method that does the following: "Convert the WordNet to Flat.". |
Of course, here is the Java code you requested:
```java
private void injectWebDriver(Statement statement) {
if (statement instanceof WebDriverAware) {
((WebDriverAware) statement).setWebDriver(webDriverProvider.getWebDriver());
}
}
```
Hope this helps! | Create a Java method that does the following: "Injects the WebDriver in the statement.". |
Of course, here is the Java code you requested:
```java
public void setDatastoreSummaries(java.util.Collection<DatastoreSummary> datastoreSummaries) {
if (datastoreSummaries == null) {
this.datastoreSummaries = null;
return;
}
this.datastoreSummaries = new java.util.Arr... | Create a Java method that does the following: "Sets the value of the datastoreSummaries property.". |
Of course, here is the Java code you requested:
```java
final void recycleVideoBuffer(BaseVideoFrame frame) {
// Make sure we are in started state
if (state.isStarted())
{
enqueueBuffer(object, frame.getBufferInex());
synchronized(availableVideoFrames){
availableVideoFrames.add(frame);
availableVi... | Create a Java method that does the following: "Recycle video buffer.". |
Of course, here is the Java code you requested:
```java
public <T> void compare(Comparison comparison, Label trueLabel, Local<T> a, Local<T> b) {
adopt(trueLabel);
Rop rop = comparison.rop(StdTypeList.make(a.type.ropType, b.type.ropType));
addInstruction(new PlainInsn(rop, sourcePosition, null,... | Create a Java method that does the following: "Compare two Local objects.". |
Of course, here is the Java code you requested:
```java
public void destroy() throws PipelineRuntimeException {
// Firstly set this runner as destroyed
destroyed.set(true);
// Validate that this thread pool have all runners back, otherwise we're missing something and that is sign of
// a trouble.
... | Create a Java method that does the following: "Destroy the runner.". |
Of course, here is the Java code you requested:
```java
public Graph<Module> reduced() {
Graph<Module> graph = build();
// transitive reduction
Graph<Module> newGraph = buildGraph(graph.edges()).reduce();
if (DEBUG) {
PrintWriter log = new PrintWriter(System.err);
... | Create a Java method that does the following: "Returns a reduced version of the graph.". |
Of course, here is the Java code you requested:
```java
public static void randomSelection(File input, int expected_number,
boolean noTest) throws IOException {
BitSet biset = new BitSet();
Random random = new java.util.Random();
// find the number of lines in the original file
... | Create a Java method that does the following: "Random selection of a file.". |
Of course, here is the Java code you requested:
```java
private void readBioPolymer(String biopolymerFile) {
try {
// Read PDB file
FileReader fileReader = new FileReader(biopolymerFile);
ISimpleChemObjectReader reader = new ReaderFactory().createReader(fileReader);
... | Create a Java method that does the following: "Read BioPolymer from a PDB file.". |
Of course, here is the Java code you requested:
```java
public void findCandidateSubsForWildcardExpr(String topicExpression,
String topicStem,
Set consumerSet)
throws SIDiscriminatorSyntaxException
{
... | Create a Java method that does the following: "This method is called by the MatchSpace to find candidate subs for a wildcard expression.". |
Of course, here is the Java code you requested:
```java
public K allowNoIndices(boolean allow) {
setParameter(Parameters.ALLOW_NO_INDICES, String.valueOf(allow));
return (K) this;
}
```
Hope this helps! | Create a Java method that does the following: "Allow no indices for the source.". |
Of course, here is the Java code you requested:
```java
public java.util.List<EgressOnlyInternetGateway> getEgressOnlyInternetGateways() {
if (egressOnlyInternetGateways == null) {
egressOnlyInternetGateways = new com.amazonaws.internal.SdkInternalList<EgressOnlyInternetGateway>();
}
... | Create a Java method that does the following: "Gets the value of the egressOnlyInternetGateways property.". |
Of course, here is the Java code you requested:
```java
public void update(long done, long total, int item) {
if (m_exceptionTrhown) {
return;
}
m_bytesRead = done;
m_contentLength = total;
m_item = item;
// If an other request has set an exception, it is ... | Create a Java method that does the following: "Update the content of the file.". |
Of course, here is the Java code you requested:
```java
Node nextVictim(Node candidate) {
if (policy == EvictionPolicy.MFU) {
// highest, never the candidate
return freq0.prev.nextNode.next;
}
// find the lowest that is not the candidate
Node victim = freq0.next.nextNode.next;
if (vict... | Create a Java method that does the following: "Get the next victim node.". |
Of course, here is the Java code you requested:
```java
public <T> Entity get(String field, T value) throws SQLException {
return this.get(Entity.create(tableName).set(field, value));
}
```
Hope this helps! | Create a Java method that does the following: "Gets an entity by field.". |
Of course, here is the Java code you requested:
```java
public static void extractJar(JarFile jar, File extractedLocation) throws IOException {
Enumeration<JarEntry> entries = jar.entries();
while(entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
File destPath = new File(extractedLoc... | Create a Java method that does the following: "Extract the contents of a jar file to the extracted location.". |
Of course, here is the Java code you requested:
```java
public static void scheduleWithFixedDelay(ScheduledExecutorService exec, Duration delay, Runnable runnable)
{
scheduleWithFixedDelay(exec, delay, delay, runnable);
}
```
Hope this helps! | Create a Java method that does the following: "Schedule a Runnable with a fixed delay.". |
Of course, here is the Java code you requested:
```java
@Override
public Map<String, Object> getChildren(Boolean includeInheritedFields)
{
Map<String, Object> fields = new HashMap<String, Object>();
if (includeInheritedFields)
{
fields.putAll(super.getChildren(includeInheritedFields));
}
fields.put("nam... | Create a Java method that does the following: "Returns a map of all children of this node.". |
Of course, here is the Java code you requested:
```java
public Version with(Qualifier qualifier, int qualifierNumber) {
this.qualifier = defaultIfNull(qualifier, Qualifier.UNDEFINED);
this.qualifierNumber = Math.max(qualifierNumber, 0);
return this;
}
```
Hope this helps! | Create a Java method that does the following: "Sets the qualifier and qualifierNumber.". |
Of course, here is the Java code you requested:
```java
public double[] assignGasteigerSigmaMarsiliFactors(IAtomContainer ac) throws CDKException {
//a,b,c,denom,chi,q
double[] gasteigerFactors = new double[(ac.getAtomCount() * (STEP_SIZE + 1))];
double[] factors = new double[]{0.0, 0.0, 0.0};
... | Create a Java method that does the following: "Assigns the GasteigerSigmaMarsili factors to the AtomContainer.". |
Of course, here is the Java code you requested:
```java
public static void checkSQLRestriction(DatasourceConnection dc, SQL sql) throws PageException {
Array sqlparts = ListUtil.listToArrayRemoveEmpty(SQLUtil.removeLiterals(sql.getSQLString()), " \t" + System.getProperty("line.separator"));
// print.ln(List.toStrin... | Create a Java method that does the following: "check if SQL is allowed by datasource". |
Of course, here is the Java code you requested:
```java
@Override
public final String lazyGetQuTotals() throws IOException {
if (this.quTotals == null) {
this.quTotals = loadString("/accounting/trade/" + this.flTotals);
}
return this.quTotals;
}
```
Hope this helps! | Create a Java method that does the following: "Get the value of the quTotals property.". |
Of course, here is the Java code you requested:
```java
public void collectDbStats(ArrayList<com.couchbase.lite.internal.database.sqlite.SQLiteDebug.DbStats> dbStatsList) {
synchronized (mLock) {
if (mAvailablePrimaryConnection != null) {
mAvailablePrimaryConnection.collectDbStats(d... | Create a Java method that does the following: "Collect database stats.". |
Of course, here is the Java code you requested:
```java
private Constraint putToCache(final String id, final Constraint object) {
Constraint c = this.map.put(id, object);
if (c instanceof DummyConstraint) {
((DummyConstraint) c).constraint = object;
return null;
}
return c;
}
```
Hope this helps... | Create a Java method that does the following: "Put to cache.". |
Of course, here is the Java code you requested:
```java
public static char eatAmpersand(String a, int[] n) {
n[0] = 0;
if (!a.startsWith("&")) return ((char) 0);
// Seek to ';'
// We also accept spaces and the end of the String as a delimiter
while (n[0] < a.length() && !Character.isSpaceChar(a.cha... | Create a Java method that does the following: "Eats an ampersand character from the String.". |
Of course, here is the Java code you requested:
```java
@Override
public CPMeasurementUnit findByUuid_C_Last(String uuid, long companyId,
OrderByComparator<CPMeasurementUnit> orderByComparator)
throws NoSuchCPMeasurementUnitException {
CPMeasurementUnit cpMeasurementUnit = fetchByUuid_C_Last(uuid,
companyId... | Create a Java method that does the following: "Returns the cp measurement unit with the matching uuid and company.". |
Of course, here is the Java code you requested:
```java
@Trivial
public static Tracer getTracer() {
String methodName = "getTracer";
if ( TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled() ) {
Tr.entry(tc, methodName);
}
OpentracingContext tracerContext = getOp... | Create a Java method that does the following: "Returns the Tracer object that was created by this class.". |
Of course, here is the Java code you requested:
```java
private IQTree liftSliceChild(SliceNode newChildRoot, IQTree newChild, IQProperties currentIQProperties) {
return iqFactory.createUnaryIQTree(this, newChild, currentIQProperties.declareLifted());
}
```
Hope this helps! | Create a Java method that does the following: "Lifts a slice child.". |
Of course, here is the Java code you requested:
```java
public static UriTemplate append(UriTemplate uriTemplate, String fragment) {
return new UriTemplate(uriTemplate.toString() + fragment, uriTemplate.encodeSlash(),
uriTemplate.getCharset());
}
```
Hope this helps! | Create a Java method that does the following: "Append a fragment to a URI template.". |
Of course, here is the Java code you requested:
```java
public static String getCharset(final int id) {
Entry entry = getEntry(id);
if (entry != null) {
return entry.mysqlCharset;
} else {
logger.warn("Unexpect mysql charset: " + id);
return null;
... | Create a Java method that does the following: "Gets the mysql charset for a single class.". |
Of course, here is the Java code you requested:
```java
@Override
public OutputStream writeResponseStatusAndHeaders(long contentLength, ContainerResponse responseContext) throws ContainerException {
jerseyResponse = responseContext;
HttpServerResponse response = vertxRequest.response();
//... | Create a Java method that does the following: "Write the response status and headers.". |
Of course, here is the Java code you requested:
```java
public DisplayData getDisplayData() {
if (DISPLAY_FORMAT.equals(format)) {
DisplayExporter de = (DisplayExporter) exporter;
return de.getData();
} else {
return new DisplayData();
}
}
```
Hope this helps! | Create a Java method that does the following: "Get the display data.". |
Of course, here is the Java code you requested:
```java
public void logv(Level level, Throwable t, String format, Object... params) {
doLog(level, FQCN, format, params, t);
}
```
Hope this helps! | Create a Java method that does the following: "Log a message at the specified level using the specified exception.". |
Of course, here is the Java code you requested:
```java
private String exportTargetFolder() {
String targetFolder = null;
if (getRequest().getAttribute(I_CmsUploadConstants.ATTR_CURRENT_FOLDER) != null) {
targetFolder = (String)getRequest().getAttribute(I_CmsUploadConstants.ATTR_CURRENT_FO... | Create a Java method that does the following: "Export the target folder.". |
Of course, here is the Java code you requested:
```java
@Override
public void readFragmentFrom(MwsReader r) {
sellerId = r.read("SellerId", String.class);
nextToken = r.read("NextToken", String.class);
}
```
Hope this helps! | Create a Java method that does the following: "readFragmentFrom is called to read the content of a SECRET_TOKEN_SECTION node from the MWS reader.". |
Of course, here is the Java code you requested:
```java
public static void init(String templateDir, String charset, Map<String, Object> initedGlobalContext) {
globalContext.putAll(initedGlobalContext);
init(templateDir, charset);
}
```
Hope this helps! | Create a Java method that does the following: "Initializes the application with the given template directory and charset.". |
Of course, here is the Java code you requested:
```java
public void generateMessageHeaderStub() throws IOException
{
final String messageHeader = "MessageHeader";
try (Writer out = outputManager.createOutput(messageHeader))
{
final StringBuilder sb = new StringBuilder();
... | Create a Java method that does the following: "Generate a message header stub.". |
Of course, here is the Java code you requested:
```java
public Long zadd(Object key, double score, Object member) {
Jedis jedis = getJedis();
try {
return jedis.zadd(keyToBytes(key), score, valueToBytes(member));
}
finally {close(jedis);}
}
```
Hope this helps! | Create a Java method that does the following: "Add a sorted set with a score and a member". |
Of course, here is the Java code you requested:
```java
public boolean deleteLink(String featureTable, String tileTable) {
boolean deleted = false;
try {
if (featureTileLinkDao.isTableExists()) {
FeatureTileLinkKey id = new FeatureTileLinkKey(featureTable,
tileTable);
deleted = featureTileLinkDa... | Create a Java method that does the following: "Delete the feature tile link". |
Of course, here is the Java code you requested:
```java
public static <E> ImmutableMultiset<E> copyOf(Iterable<? extends E> elements) {
if (elements instanceof ImmutableMultiset) {
@SuppressWarnings("unchecked") // all supported methods are covariant
ImmutableMultiset<E> result = (ImmutableMultiset<E>)... | Create a Java method that does the following: "Creates an immutable copy of the specified elements.". |
Of course, here is the Java code you requested:
```java
private T nextWrapper(Iterator<T> it) {
try {
if (trace != null) {
trace.add(new TraceEntry(System.nanoTime(), System.currentTimeMillis(),
NextOrHasNext.NEXT, debugLabels.get(it)));
}
... | Create a Java method that does the following: "Get the next wrapper of the iterator.". |
Of course, here is the Java code you requested:
```java
private int getClassFromVotes(double votes[]){
double maxVote = -1;
int maxVoteClass = -1;
for (int i = 0; i < votes.length; i++){
if (votes[i] > maxVote){
maxVote = votes[i];
maxVoteClass = i;
}
}
return maxVoteClass;
}
```
... | Create a Java method that does the following: "Get the class from the votes array". |
Of course, here is the Java code you requested:
```java
public final void parse(final SelectStatement selectStatement) {
if (!lexerEngine.skipIfEqual(DefaultKeyword.GROUP)) {
return;
}
lexerEngine.accept(DefaultKeyword.BY);
while (true) {
addGroupByItem(basicExpr... | Create a Java method that does the following: "Parse the SELECT statement.". |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.