code
stringlengths
160
48.7k
prompt
stringlengths
55
1.51k
Of course, here is the Java code you requested: ```java public PaymentSummaryBuilder addPriceLabel(String label, String amount) { PriceLabel priceLabel = new PriceLabel(label, amount); return addPriceLabel(priceLabel); } ``` Hope this helps!
Create a Java method that does the following: "Add a price label to the payment summary.".
Of course, here is the Java code you requested: ```java public static Cell searchColCell(Sheet sheet, short colIndex, String searchKey) { if (StringUtils.isEmpty(searchKey)) return null; for (int i = sheet.getFirstRowNum(), ii = sheet.getLastRowNum(); i < ii; ++i) { val row = sheet.getRow(...
Create a Java method that does the following: "Search col cell.".
Of course, here is the Java code you requested: ```java public static Record newRecord(Name name, int type, int dclass, long ttl, byte [] data) { return newRecord(name, type, dclass, ttl, data.length, data); } ``` Hope this helps!
Create a Java method that does the following: "Create a new Record ID from the given name type dclass ttl and data.".
Of course, here is the Java code you requested: ```java public static JSONObject toJSON(Attributes attributes) { JSONObject res = new JSONObject(); JSONObject vms = new JSONObject(); JSONObject nodes = new JSONObject(); for (Element e : attributes.getDefined()) { JSONObject ...
Create a Java method that does the following: "Convert a Attributes object to a JSONObject.".
Of course, here is the Java code you requested: ```java public static String randomString(int length, int min, int max) { return randomString(length, min, max, CharMatcher.ANY); } ``` Hope this helps!
Create a Java method that does the following: "Returns a random string of the specified length.".
Of course, here is the Java code you requested: ```java public void setBuckets(java.util.Collection<Bucket> buckets) { if (buckets == null) { this.buckets = null; return; } this.buckets = new com.amazonaws.internal.SdkInternalList<Bucket>(buckets); } ``` Hope this ...
Create a Java method that does the following: "Sets the value of the buckets property.".
Of course, here is the Java code you requested: ```java public static <O extends Object> ParameterItem<O> create(final ObjectParameter<O> parameterParams) { // Ensure that the uid will be unique at runtime return (ParameterItem<O>) ParameterItemImpl.create(parameterParams.object()).uid(parameterIdGener...
Create a Java method that does the following: "Create a new ParameterItem with the given parameters.".
Of course, here is the Java code you requested: ```java public static <S> AreaF toAreaF(final PAreaF<S> a) { Objects.requireNonNull(a, "area"); return AreaF.of(a.minimumX(), a.maximumX(), a.minimumY(), a.maximumY()); } ``` Hope this helps!
Create a Java method that does the following: "Converts an area to an area F.".
Of course, here is the Java code you requested: ```java public CookieCacheData duplicate() { // Create second instance and copy members CookieCacheData cData = new CookieCacheData(); cData.parsedList = copyList(this.parsedList); cData.isDirty = this.isDirty; cData.hdrIndex = thi...
Create a Java method that does the following: "Create a duplicate of this instance.".
Of course, here is the Java code you requested: ```java public JRBandDataDataSource subDataSource(String bandName) { if (containsVisitedBand(bandName)) return null; BandData newParentBand = createNewBand(bandName); currentBand = root; currentIterator = root.getChildrenList...
Create a Java method that does the following: "Create a sub data source for the specified band name.".
Of course, here is the Java code you requested: ```java private Acknowledge startJobExecution(JobMasterId newJobMasterId) throws Exception { validateRunsInMainThread(); checkNotNull(newJobMasterId, "The new JobMasterId must not be null."); if (Objects.equals(getFencingToken(), newJobMasterId)) { log.info("...
Create a Java method that does the following: "Start the execution of the job.".
Of course, here is the Java code you requested: ```java public Vector4f set(Vector3ic v, float w) { return set(v.x(), v.y(), v.z(), w); } ``` Hope this helps!
Create a Java method that does the following: "Sets this vector to be the same as v but with a given weight.".
Of course, here is the Java code you requested: ```java public void printSource(Source src, PrintStream out) { TransformerFactory tFact = TransformerFactory.newInstance(); try { Transformer transformer = tFact.newTransformer(); Result result = new StreamResult( out ); ...
Create a Java method that does the following: "Print source to out.".
Of course, here is the Java code you requested: ```java public static <T extends HierarchyEntity<T, ?>> List<T> getPath(final T node) { List<T> path = CollectUtils.newArrayList(); T curNode = node; while (null != curNode && !path.contains(curNode)) { path.add(0, curNode); curNode = curNode.getP...
Create a Java method that does the following: "Gets the path of the given node.".
Of course, here is the Java code you requested: ```java public boolean isRAEntityLinkNameReferenced(String raLinkName) { if (raLinkName == null) { throw new NullPointerException("null ra link name"); } boolean b = false; try { b = transactionManager.requireTransaction(); for (ServiceID serviceID : co...
Create a Java method that does the following: "Checks if the given RA link name is referenced by this resource adapter.".
Of course, here is the Java code you requested: ```java public static <ElementT> void shuffleHead(@NonNull ElementT[] elements, int n) { shuffleHead(elements, n, ThreadLocalRandom.current()); } ``` Hope this helps!
Create a Java method that does the following: "Randomly shuffle the elements in the array.".
Of course, here is the Java code you requested: ```java public void write(char c) throws IOException { ensureSpareCapacity(1); if (c>=0&&c<=0x7f) _buf[_size++]=(byte)c; else { char[] ca ={c}; writeEncoded(ca,0,1); } } ``` Hope...
Create a Java method that does the following: "Write a single unicode character to the output stream.".
Of course, here is the Java code you requested: ```java public static String removeSpaces(final String value) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); return value.replaceAll("\\s", ""); } ``` Hope this helps!
Create a Java method that does the following: "Removes all spaces from a string.".
Of course, here is the Java code you requested: ```java public Paragraph<PS, SEG, S> restyle(S style) { return new Paragraph<>(paragraphStyle, segmentOps, segments, StyleSpans.singleton(style, length())); } ``` Hope this helps!
Create a Java method that does the following: "Restyle the Paragraph.".
Of course, here is the Java code you requested: ```java public void evictFromMemoryCache(final Uri uri) { Predicate<CacheKey> predicate = predicateForUri(uri); mBitmapMemoryCache.removeAll(predicate); mEncodedMemoryCache.removeAll(predicate); } ``` Hope this helps!
Create a Java method that does the following: "Evicts the cache entries for the given URI from the memory cache.".
Of course, here is the Java code you requested: ```java public static void download(String type, int unitCount, String path) { int timeout = 300000; Set<String> hrefs = new HashSet<>(); System.out.println("【"+type+"】*** starting... "); for(int i=1; i<=unitCount; i++) { int t...
Create a Java method that does the following: "Download a number of units from the Course.".
Of course, here is the Java code you requested: ```java @Override public boolean moveToTrash(Path path) throws IOException { Path fullyResolvedPath = path.isAbsolute() ? path : new Path(this.fs.getWorkingDirectory(), path); Path targetPathInTrash = PathUtils.mergePaths(this.trashLocation, fullyResolvedPath);...
Create a Java method that does the following: "Move the path to the trash location.".
Of course, here is the Java code you requested: ```java protected Identifier identifier(Data data, boolean firstCanBeNumber, boolean upper) { Position start = data.srcCode.getPosition(); if (!data.srcCode.isCurrentLetter() && !data.srcCode.isCurrentSpecial()) { if (!firstCanBeNumber) return null; else if (...
Create a Java method that does the following: "Returns the identifier of the given data.".
Of course, here is the Java code you requested: ```java public static List<RedisClusterNode> sortByClientCount(Iterable<RedisClusterNode> clusterNodes) { LettuceAssert.notNull(clusterNodes, "Cluster nodes must not be null"); List<RedisClusterNode> ordered = LettuceLists.newList(clusterNodes); ...
Create a Java method that does the following: "Sort cluster nodes by client count.".
Of course, here is the Java code you requested: ```java boolean service(ServletRequest servletRequest, ServletResponse servletResponse) throws IOException, ServletException { final HttpServletRequest request = (HttpServletRequest) servletRequest; final String path = ServletUtils.getContextRelativePath(r...
Create a Java method that does the following: "service method.".
Of course, here is the Java code you requested: ```java @Nonnull public static FileIOError renameDir (@Nonnull final Path aSourceDir, @Nonnull final Path aTargetDir) { ValueEnforcer.notNull (aSourceDir, "SourceDirectory"); ValueEnforcer.notNull (aTargetDir, "TargetDirectory"); final Path aRealSourceDi...
Create a Java method that does the following: "Rename the source directory to the target directory.".
Of course, here is the Java code you requested: ```java @CheckReturnValue @SchedulerSupport(SchedulerSupport.COMPUTATION) public final Maybe<T> timeout(long timeout, TimeUnit timeUnit) { return timeout(timeout, timeUnit, Schedulers.computation()); } ``` Hope this helps!
Create a Java method that does the following: "Timeout for a .".
Of course, here is the Java code you requested: ```java public final EObject entryRuleComparison() throws RecognitionException { EObject current = null; EObject iv_ruleComparison = null; try { // InternalSimpleExpressions.g:254:2: (iv_ruleComparison= ruleComparison EOF ) ...
Create a Java method that does the following: "Use this method to look for a ruleComparison in the ruleSet.".
Of course, here is the Java code you requested: ```java public static <T> Iterator<T> singleElementIterator(final T element) { return new Iterator<T>() { private boolean mHasNext = true; @Override public boolean hasNext() { return mHasNext; } @Override public T next() ...
Create a Java method that does the following: "Returns an iterator over the elements in the specified element.".
Of course, here is the Java code you requested: ```java @Override public UpdateMaintenanceStartTimeResult updateMaintenanceStartTime(UpdateMaintenanceStartTimeRequest request) { request = beforeClientExecution(request); return executeUpdateMaintenanceStartTime(request); } ``` Hope this helps!
Create a Java method that does the following: "Updates the maintenance start time of a maintenance unit.".
Of course, here is the Java code you requested: ```java private void addNextToken(String token, Queue<String> nextWords, Queue<String> nextRealWords) { String replacement = pseudoWordMap.get(token); if (replacement == null) { nextW...
Create a Java method that does the following: "Add the next token to the next words and next real words.".
Of course, here is the Java code you requested: ```java public Observable<Void> disableRecommendationForSiteAsync(String resourceGroupName, String siteName, String name) { return disableRecommendationForSiteWithServiceResponseAsync(resourceGroupName, siteName, name).map(new Func1<ServiceResponse<Void>, Void>()...
Create a Java method that does the following: "Disables the CDN image recommendation for a site.".
Of course, here is the Java code you requested: ```java @Override public final void setState(XMLEventListenerState newState, String[] newElementStack) throws IllegalArgumentException { // Check arguments if (newState == null) { throw new IllegalArgumentException("newState == null"); ...
Create a Java method that does the following: "Sets the state of the XML Event Listener.".
Of course, here is the Java code you requested: ```java public void insert(final DevState[] argin) { attrval.r_dim.dim_x = argin.length; attrval.r_dim.dim_y = 0; DevVarStateArrayHelper.insert(attrval.value, argin); } ``` Hope this helps!
Create a Java method that does the following: "Insert a DevState array into the list.".
Of course, here is the Java code you requested: ```java public static DiagnosticType warning(String name, String descriptionFormat) { return make(name, CheckLevel.WARNING, descriptionFormat); } ``` Hope this helps!
Create a Java method that does the following: "Create a diagnostic type at check level WARNING.".
Of course, here is the Java code you requested: ```java @Override public void doClick(int click) { if (click < clicks.length) { clicks[click] = true; lastClick = click; } } ``` Hope this helps!
Create a Java method that does the following: "Override the doClick method to add a click to the array of clicks.".
Of course, here is the Java code you requested: ```java private void evict(Node candidate) { if (data.size() > maximumSize) { Node victim = policy.findVictim(sentinel, policyStats); policyStats.recordEviction(); boolean admit = admittor.admit(candidate.key, victim.key); if (admit) { ...
Create a Java method that does the following: "Evicts a single entry from the cache.".
Of course, here is the Java code you requested: ```java @WillCloseWhenClosed public static void sleepFor(long timeout, TimeUnit unit) { try { unit.sleep(timeout); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } ``` Hope this helps!
Create a Java method that does the following: "Sleep for the specified amount of time.".
Of course, here is the Java code you requested: ```java @CheckReturnValue protected Description describeMatch(DiagnosticPosition position, Fix fix) { return buildDescription(position).addFix(fix).build(); } ``` Hope this helps!
Create a Java method that does the following: "Description for a match.".
Of course, here is the Java code you requested: ```java private void addZealotXmlInContext() { for (String xmlPath: xmlPaths) { String nameSpace = XmlNodeHelper.getZealotXmlNameSpace(xmlPath); if (StringHelper.isNotBlank(nameSpace)) { XmlContext.INSTANCE.add(nameSpace, x...
Create a Java method that does the following: "Add the lista xml context.".
Of course, here is the Java code you requested: ```java @Override protected List<IPersonAttributes> getPeopleForQuery(QueryBuilder queryBuilder, String queryUserName) { final String currentUserName = currentUserProvider.getCurrentUserName(); ; if (currentUserName == null) { thi...
Create a Java method that does the following: "Get the people for the query.".
Of course, here is the Java code you requested: ```java public void actionParent() throws Exception { String ouFqn = CmsOrganizationalUnit.getParentFqn(getParamOufqn()); Map<String, String[]> params = new HashMap<String, String[]>(); params.put(A_CmsOrgUnitDialog.PARAM_OUFQN, new String[] {ou...
Create a Java method that does the following: "Action called to forward the parent of the current user.".
Of course, here is the Java code you requested: ```java public static void write(char c, Writer writer) { try { writer.write(c); } catch (IOException e) { throw E.ioException(e); } } ``` Hope this helps!
Create a Java method that does the following: "Write a char to a Writer.".
Of course, here is the Java code you requested: ```java @Handler public void onNioRegistration(NioRegistration event) throws IOException { SelectableChannel channel = event.ioChannel(); channel.configureBlocking(false); SelectionKey key; synchronized (selectorGate) { ...
Create a Java method that does the following: "Handle an event of a NIO Registration.".
Of course, here is the Java code you requested: ```java public static File resolveAbsolutely(String pathToResolve, String baseDir) { // TODO: handle the case where pathToResolve specifies a non-existent path, for example, a base directory equal to "/" and a relative path of "../../foo". File fileToReso...
Create a Java method that does the following: "Resolves a path to a file in absolute form.".
Of course, here is the Java code you requested: ```java public static String colorToHex(Color color) { return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue()); } ``` Hope this helps!
Create a Java method that does the following: "Convert a color to a hex string.".
Of course, here is the Java code you requested: ```java void initialized() { LOG.info("initialized with " + size() + " entries " + lookups + " lookups"); this.initialized = true; transientMap.clear(); transientMap = null; } ``` Hope this helps!
Create a Java method that does the following: "Called by the cache when the cache is initialized.".
Of course, here is the Java code you requested: ```java private void rcvMFPSchema(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) ...
Create a Java method that does the following: "This method is called by the MFP server to handle a schema request from a MFP server.".
Of course, here is the Java code you requested: ```java public SipTransaction resendWithAuthorization(ResponseEvent event) { Response response = event.getResponse(); int status = response.getStatusCode(); if ((status == Response.UNAUTHORIZED) || (status == Response.PROXY_AUTHENTICATION_REQUIRED)) { ...
Create a Java method that does the following: "Resend with authorization.".
Of course, here is the Java code you requested: ```java public void setThresholdVisible(final boolean VISIBLE) { if (null == thresholdVisible) { _thresholdVisible = VISIBLE; fireUpdateEvent(VISIBILITY_EVENT); } else { thresholdVisible.set(VISIBLE); } } ``...
Create a Java method that does the following: "Defines if the threshold should be drawn in the image.".
Of course, here is the Java code you requested: ```java @Override public Map<String, WroModelFactory> provideModelFactories() { final Map<String, WroModelFactory> map = new HashMap<String, WroModelFactory>(); map.put(GroovyModelFactory.ALIAS, new GroovyModelFactory()); map.put(JsonModelFactory.ALIAS, new...
Create a Java method that does the following: "Provide the model factories.".
Of course, here is the Java code you requested: ```java public synchronized boolean existsReferencesTo(NodeId targetId) throws ItemStateException { if (!initialized) { throw new IllegalStateException("not initialized"); } ResultSet rs = null; try { rs = conHelpe...
Create a Java method that does the following: "Checks if a node reference exists to the target node id.".
Of course, here is the Java code you requested: ```java @Override public Features getDefaultFeatures(String url) { Features result = new Features(); for (Map.Entry<String, Object> entry : defaultFeatureMap.entrySet()) { // value is either a Boolean or Function Object value = entry.getValue(); if (v...
Create a Java method that does the following: "Returns a copy of the default features.".
Of course, here is the Java code you requested: ```java final Table SYSTEM_ALLTYPEINFO() { Table t = sysTables[SYSTEM_ALLTYPEINFO]; if (t == null) { t = createBlankTable(sysTableHsqlNames[SYSTEM_ALLTYPEINFO]); //------------------------------------------- // same ...
Create a Java method that does the following: "Create the table system_alltypeinfo.".
Of course, here is the Java code you requested: ```java public void installFeatureNoResolve(String esaLocation, String toExtension, boolean acceptLicense) throws InstallException { fireProgressEvent(InstallProgressEvent.CHECK, 1, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_CHECKING")); ArrayL...
Create a Java method that does the following: "Install feature without resolving".
Of course, here is the Java code you requested: ```java public void marshall(ClassifierMetadata classifierMetadata, ProtocolMarshaller protocolMarshaller) { if (classifierMetadata == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { ...
Create a Java method that does the following: "marshalls the given classifierMetadata to the JSON object.".
Of course, here is the Java code you requested: ```java public CrosstabBuilder addColumn(String title, String property, String className, boolean showTotal, Style headerStyle, Style totalStyle, Style totalHeaderStyle) { DJCrosstabColumn col = new CrosstabColumnBuilder() .setProperty(property,className) .s...
Create a Java method that does the following: "Adds a column to the table.".
Of course, here is the Java code you requested: ```java protected Set<Event> resolveCandidateAuthenticationEvents(final RequestContext context, final Service service, final RegisteredService regi...
Create a Java method that does the following: "Resolve candidate authentication events set.".
Of course, here is the Java code you requested: ```java @Override public void write(final String s) { usageFlag = true; if (trouble || s == null) { return; } try { getOut().write(s); } catch (IOException e) { handleIOException(e);...
Create a Java method that does the following: "Write a string to the underlying stream.".
Of course, here is the Java code you requested: ```java public static OIdentifiable readIdentifiable(final OChannelBinaryClient network) throws IOException { final int classId = network.readShort(); if (classId == RECORD_NULL) return null; if (classId == RECORD_RID) { return network.read...
Create a Java method that does the following: "Reads a record from the stream.".
Of course, here is the Java code you requested: ```java private String getCustomReloginErrorPage(HttpServletRequest req) { String reLogin = CookieHelper.getCookieValue(req.getCookies(), ReferrerURLCookieHandler.CUSTOM_RELOGIN_URL_COOKIENAME); if (reLogin != null && reLogin.length() > 0) { i...
Create a Java method that does the following: "Get the custom error page from the request".
Of course, here is the Java code you requested: ```java public boolean implies(final String topic, final String[] splitTopic, final QOS qoS, final ACTIVITY activity) { if (topic == null || qoS == null || activity == null) { return false; } final boolean activityImplies = getActivi...
Create a Java method that does the following: "Checks if the topic implies the activity implies the qos implies the topic.".
Of course, here is the Java code you requested: ```java public static <T> NamedParameterNode<T> createNamedParameterNode(final Node parent, final Class<? extends Name<T>> clazz, final T...
Create a Java method that does the following: "Create a NamedParameterNode from a Class".
Of course, here is the Java code you requested: ```java private String getCompilationCommand(final String input) { return String.format("compilerWrapper.compile(%s, %s)", WroUtil.toJSMultiLineString(input), ecmaScriptVersion); } ``` Hope this helps!
Create a Java method that does the following: "Get the command to compile the input.".
Of course, here is the Java code you requested: ```java public Token findTokenByUid(String uid) { EntityManager entityManager = getEntityManager(); try { return entityManager.createQuery("SELECT token FROM Token AS token WHERE uid = :uid", Token.class) .setParameter("uid", uid).setMaxResults(1)...
Create a Java method that does the following: "Find a Token by its UID.".
Of course, here is the Java code you requested: ```java @SafeVarargs public static <T> Stream<T> buildStream(T... array) { return JMOptional.getOptional(array).map(Arrays::stream) .orElseGet(Stream::empty); } ``` Hope this helps!
Create a Java method that does the following: "Build stream.".
Of course, here is the Java code you requested: ```java public static HttpRequestBase put(String path, HttpEntity entity) { return put(path, null, null, entity, null); } ``` Hope this helps!
Create a Java method that does the following: "Create a PUT request with the specified path and entity.".
Of course, here is the Java code you requested: ```java public boolean isInhibition(Control ctrl) { return ctrl.getControlType() != null && ctrl.getControlType().toString().startsWith("I"); } ``` Hope this helps!
Create a Java method that does the following: "Checks if the given control is an IControl.".
Of course, here is the Java code you requested: ```java public void clickLinkInCell(int row, int column) { String xPath = getXPathBase() + "tr[" + row + "]/td[" + column + "]/a"; new Link(xPath).click(); } ``` Hope this helps!
Create a Java method that does the following: "Clicks a Link in a cell.".
Of course, here is the Java code you requested: ```java public static String getStyleUri(CmsJspActionElement jsp) { if (m_styleUri == null) { CmsProject project = jsp.getCmsObject().getRequestContext().getCurrentProject(); try { jsp.getCmsObject().getRequestContext().s...
Create a Java method that does the following: "Gets the style uri.".
Of course, here is the Java code you requested: ```java @Nullable public static Bundle optBundle(@Nullable Bundle bundle, @Nullable String key) { return optBundle(bundle, key, new Bundle()); } ``` Hope this helps!
Create a Java method that does the following: "Get an optional bundle value or create a new Bundle.".
Of course, here is the Java code you requested: ```java private int runCommitScript() { if (m_checkout && !m_fetchAndResetBeforeImport) { m_logStream.println("Skipping script...."); return 0; } try { m_logStream.flush(); String commandParam; ...
Create a Java method that does the following: "Runs the commit script.".
Of course, here is the Java code you requested: ```java public static svcbindings get(nitro_service service, String servicename) throws Exception{ svcbindings obj = new svcbindings(); obj.set_servicename(servicename); svcbindings response = (svcbindings) obj.get_resource(service); return response; } ``` Hope...
Create a Java method that does the following: "Use this API to fetch svcbindings resource of given name.".
Of course, here is the Java code you requested: ```java public static UnsafeMappedBuffer allocate(File file, FileChannel.MapMode mode, long capacity) { return allocate(file, mode, capacity, capacity); } ``` Hope this helps!
Create a Java method that does the following: "Allocate a new UnsafeMappedBuffer.".
Of course, here is the Java code you requested: ```java public void setCatalog(String location) { CatalogBuilder builder = new CatalogBuilder(); try { Catalog cat = builder.buildFromLocation(location, null); setCatalog(cat); } catch (Exception ioe) { JOptionPane.showMessageDialog(this, ...
Create a Java method that does the following: "Set the catalog from a file.".
Of course, here is the Java code you requested: ```java public ServiceFuture<Iteration> trainProjectAsync(UUID projectId, final ServiceCallback<Iteration> serviceCallback) { return ServiceFuture.fromResponse(trainProjectWithServiceResponseAsync(projectId), serviceCallback); } ``` Hope this helps!
Create a Java method that does the following: "Train a CDN project.".
Of course, here is the Java code you requested: ```java static void extractString(Elements elementUtils, Element item, Class<? extends Annotation> annotationClass, AnnotationAttributeType attribute, OnAttributeFoundListener listener) { extractAttributeValue(elementUtils, item, annotationClass.getCanonicalName(), att...
Create a Java method that does the following: "Extract string value from annotation.".
Of course, here is the Java code you requested: ```java public void setSpotPriceHistory(java.util.Collection<SpotPrice> spotPriceHistory) { if (spotPriceHistory == null) { this.spotPriceHistory = null; return; } this.spotPriceHistory = new com.amazonaws.internal.SdkInte...
Create a Java method that does the following: "Sets the spotPriceHistory value.".
Of course, here is the Java code you requested: ```java public Transaction enter(IsolationLevel level) { mLock.lock(); try { TransactionImpl<Txn> parent = mActive; IsolationLevel actualLevel = mTxnMgr.selectIsolationLevel(parent, level); if (actualLevel == null)...
Create a Java method that does the following: "Enter a new transaction.".
Of course, here is the Java code you requested: ```java public static String arrayString(int[] items) { StringBuilder sB = new StringBuilder("i["); boolean isFirst = true; for (int item : items) { if (isFirst) { isFirst = false; } else { s...
Create a Java method that does the following: "A method to get an array of int strings.".
Of course, here is the Java code you requested: ```java @Override public ValidationErrors validate(Database database) { ValidationErrors changeValidationErrors = new ValidationErrors(); // Record an error if a parameter is not set, but that parameter is required by database. for (ChangePar...
Create a Java method that does the following: "Validate the database.".
Of course, here is the Java code you requested: ```java private void recursiveCollapseAreas(AreaImpl root) { if (canCollapse(root)) { //System.out.println("Collapsing: " + root); recursiveCollapseSubtree(root, root); root.removeAllChildren(); } el...
Create a Java method that does the following: "Recursive collapse the areas.".
Of course, here is the Java code you requested: ```java public static void appendTo(Formatter formatter, int width, int precision, boolean leftJustified, String out) { try { Appendable appendable = formatter.out(); if (precision > -1 && out.length() > precision) ...
Create a Java method that does the following: "Append to the specified string.".
Of course, here is the Java code you requested: ```java private TwillController addCleanupListener(TwillController controller, final File hConfFile, final File cConfFile, final Program program, final File programDir) { final AtomicBoolean deleted = new AtomicBoolean(fa...
Create a Java method that does the following: "Add cleanup listener to TwillController".
Of course, here is the Java code you requested: ```java private String findSpringContextFileName(Object handler, Annotation[] annotations) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { String contextFileName = null; for (Annotation a : annotations) { Stri...
Create a Java method that does the following: "Find the spring context file name from the annotations.".
Of course, here is the Java code you requested: ```java public String getDeleteNamesPrepareSQL(T bean) { if (this.tableStrategy == null) return deleteNamesPrepareSQL; return deleteNamesPrepareSQL.replace("${newtable}", getTable(bean)); } ``` Hope this helps!
Create a Java method that does the following: "Returns the SQL to delete the table for the given bean.".
Of course, here is the Java code you requested: ```java public long addMemoryTransaction(int deviceId, long timeSpentNanos, long numberOfBytes, @NonNull MemcpyDirection direction) { // we calculate bytes per microsecond now val bw = (long) (numberOfBytes / (timeSpentNanos / (double) 1000.0)); ...
Create a Java method that does the following: "Add memory transaction to the cache.".
Of course, here is the Java code you requested: ```java public GridTable getGridTable(Record gridRecord) { GridTable gridTable = null; if (!(gridRecord.getTable() instanceof GridTable)) { gridTable = new GridTable(null, gridRecord); boolean bCacheGrid = false; ...
Create a Java method that does the following: "Get the grid table.".
Of course, here is the Java code you requested: ```java public Integer loadPreferenceAsInteger(String key, Integer defaultValue) { Integer value = defaultValue; if (hasPreference(key)) { value = getSharedPreferences().getInt(key, 0); } logLoad(key, value); return value; } ``` Hope this helps!
Create a Java method that does the following: "Retrieve an Integer value from the preferences.".
Of course, here is the Java code you requested: ```java public void setJobNames(java.util.Collection<String> jobNames) { if (jobNames == null) { this.jobNames = null; return; } this.jobNames = new java.util.ArrayList<String>(jobNames); } ``` Hope this helps!
Create a Java method that does the following: "Sets the value of the jobNames property.".
Of course, here is the Java code you requested: ```java public void add(int deltaHi, int deltaLo) { while (true) { long encoded = get(); long update = encode(getHi(encoded) + deltaHi, getLo(encoded) + deltaLo); if (compareAndSet(encoded, update)) return; ...
Create a Java method that does the following: "Add deltaHi and deltaLo to the hi and lo values of this instance.".
Of course, here is the Java code you requested: ```java @Override protected String escapeSpecialChars(String pattern) { char[] chars = pattern.toCharArray(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < chars.length; i++) { switch (chars[i]) { ...
Create a Java method that does the following: "Escapes special characters in a pattern.".
Of course, here is the Java code you requested: ```java public static String getHttpResponseBufferAnnotations() { String annotations = ""; TracyThreadContext ctx = threadContext.get(); if (isValidContext(ctx)) { annotations = ctx.getHttpResponseBufferAnnotations(); } re...
Create a Java method that does the following: "Gets the HttpResponseBufferAnnotations".
Of course, here is the Java code you requested: ```java public static ChronoPrinter<PlainDate> ofDate(IsoDateStyle style) { switch (style) { case BASIC_CALENDAR_DATE: return Iso8601Format.BASIC_CALENDAR_DATE; case BASIC_ORDINAL_DATE: return Iso8601Format...
Create a Java method that does the following: "Returns a ChronoPrinter of the given ISO date style.".
Of course, here is the Java code you requested: ```java @Override public Wagon lookup(final String roleHint) throws Exception { if (roleHint.equals(HTTP)) { return setAuthenticator(new LightweightHttpWagon()); } else if (roleHint.equals(HTTPS)) { return setAuthenticator(new ...
Create a Java method that does the following: "Lookup a Wagon object based on the roleHint.".
Of course, here is the Java code you requested: ```java private void analyse(StructuralNode node) throws Exception { // if analysed already, return; // move to host part if (node.getHistoryReference() == null) { return; } if (!parent.nodeInScope(node.getName())) { ...
Create a Java method that does the following: "Analyse the HTTP response of a single node.".
Of course, here is the Java code you requested: ```java @Override public Date deserializeFromByteBufferObject(ByteBuffer buffer) { final ODateTimeSerializer dateTimeSerializer = ODateTimeSerializer.INSTANCE; return dateTimeSerializer.deserializeFromByteBufferObject(buffer); } ``` Hope this helps!
Create a Java method that does the following: "Deserialize a CID from a ByteBuffer object.".
Of course, here is the Java code you requested: ```java public int getLayerIndex(String name) { int idx = 0; for (int i = 0; i < layers.size(); i++) { Layer layer = (Layer) layers.get(i); if (layer.name.equals(name)) { return i; } } return -1; } ``` Hope this helps!
Create a Java method that does the following: "Gets the index of the layer with the specified name.".
Of course, here is the Java code you requested: ```java @Override public JsonElement serialize(PartnerUser user, Type type, JsonSerializationContext context) { // Convert the user to an array of users as that is what the Partner API expects JsonObject obj = new JsonObject(); JsonArray a...
Create a Java method that does the following: "Serialize a Cluster Identity Specifications object to a JSON object.".
Of course, here is the Java code you requested: ```java void tryUnlockCurrent() { if ((m_lockAction != null) && m_lockAction.getChange().equals(CmsLockActionRecord.LockChange.locked)) { try { A_CmsUI.getCmsObject().unlockResource(m_currentResource); } catch (CmsExceptio...
Create a Java method that does the following: "Try to unlock the current resource.".