code
stringlengths
146
48.7k
prompt
stringlengths
55
1.51k
Of course, here is the Java code you requested: ```java public static Date parseSecondsFromEpoch(Double d) { synchronized (MONITOR) { return new Date(SECONDS.toMillis(d.longValue())); } } ``` Hope this helps!
Create a Java method that does the following: "Parse seconds from epoch.".
Of course, here is the Java code you requested: ```java @Override public void initSprite(int width, int height, int x, int y, boolean rotated) { if (width == 0 || height == 0) { //assume block atlas width = BLOCK_TEXTURE_WIDTH; height = BLOCK_TEXTURE_HEIGHT; } this.sheetWidth = width; this.sheetHe...
Create a Java method that does the following: "Initializes the sprite with the specified parameters.".
Of course, here is the Java code you requested: ```java protected void addPropertiesProcessingTime() { HashMap<String, Long> mapComponentTimes = new HashMap<>(); HashMap<String, Long> mapComponentInvocations = new HashMap<>(); // For multi-threaded transaction: will calculate the sum of the time spent ...
Create a Java method that does the following: "Add properties processing time.".
Of course, here is the Java code you requested: ```java public EvaluatedTemplate evaluateTemplate(String template, EvaluationContext context) { return evaluateTemplate(template, context, false); } ``` Hope this helps!
Create a Java method that does the following: "Evaluate a template using the given context.".
Of course, here is the Java code you requested: ```java public void sync(Map<String, Map<String, MappingConfig>> mappingConfig, List<Dml> dmls, Properties envProperties) { sync(dmls, dml -> { if (dml.getIsDdl() != null && dml.getIsDdl() && StringUtils.isNotEmpty(dml.getSql())) { // ...
Create a Java method that does the following: "Synchronize DMLs with the specified mapping config.".
Of course, here is the Java code you requested: ```java public void addException(Exception e) { if (exceptions == null) { exceptions = new ArrayList<>(); } exceptions.add(e); log.error(e.getMessage(), e); } ``` Hope this helps!
Create a Java method that does the following: "Add an exception to the exception list.".
Of course, here is the Java code you requested: ```java public Promise<String> getGreeting() { Promise<String> p = q.all(getSalutation(), getName()) .then(new Continue<String, JSArray<?>>() { // Formats the greeting when salutation and name are delivered. ...
Create a Java method that does the following: "Gets the greeting when the salutation and name are delivered.".
Of course, here is the Java code you requested: ```java private Object getCursor(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { final boolean trace = TraceComponent.isAny...
Create a Java method that does the following: "This method is called by the JDBC driver to get a cursor object.".
Of course, here is the Java code you requested: ```java public void beginArray() throws IOException { int p = peeked; if (p == PEEKED_NONE) { p = doPeek(); } if (p == PEEKED_BEGIN_ARRAY) { push(JsonScope.EMPTY_ARRAY); pathIndices[stackSize - 1] = 0; peeked = PEEKED_NONE; } e...
Create a Java method that does the following: "Begin an array.".
Of course, here is the Java code you requested: ```java public static final void checkSystemLiteral(String s) throws NullPointerException, InvalidXMLException { checkSystemLiteral(s.toCharArray(), 0, s.length()); } ``` Hope this helps!
Create a Java method that does the following: "Check that a string is a system literal.".
Of course, here is the Java code you requested: ```java public void setWidth(int width) { if (1 > width) { String _message = "The specified width ({0}) is incorrect, it must be greater or equal than 1."; Object[] _parameters = { new Integer(width) }; throw new IllegalArgumentException(MessageFo...
Create a Java method that does the following: "Sets the width of the image.".
Of course, here is the Java code you requested: ```java public java.util.List<String> getValueOptions() { if (valueOptions == null) { valueOptions = new com.amazonaws.internal.SdkInternalList<String>(); } return valueOptions; } ``` Hope this helps!
Create a Java method that does the following: "Gets the valueOptions value for this CrafterSession.".
Of course, here is the Java code you requested: ```java private int hash32shift(int key) { key += hash2seed; key = ~key + (key << 15); key = key ^ (key >>> 12); key = key + (key << 2); key = key ^ (key >>> 4); key = key * 2057; key = key ^ (key >>> 16); ...
Create a Java method that does the following: "This function is used to hash a 32 bit key.".
Of course, here is the Java code you requested: ```java private void registerDirectory(Path path) { try { LOGGER.info("监控目录:" + path); WatchKey key = path.register(watchService, events); directories.put(key, path); } catch (IOException ex) { LOGGER.error(...
Create a Java method that does the following: "Register a directory.".
Of course, here is the Java code you requested: ```java public MavenProject resolveFromReactor( Artifact artifact, MavenProject mp, List<MavenProject> reactorProjects ) throws MojoExecutionException { MavenProject result = null; String artifactId = artifact.getArtifactId(); Str...
Create a Java method that does the following: "Resolves the Maven project from the reactor project.".
Of course, here is the Java code you requested: ```java public static ContextObjectHolder getInstance() { if (singleton == null) { synchronized (ContextObjectHolder.class) { if (singleton == null) { // double check singleton = new ContextObjectHolder(); ...
Create a Java method that does the following: "Get the singleton instance.".
Of course, here is the Java code you requested: ```java protected void commitChange(final CmsSitemapChange change, final Command callback) { if (change != null) { // save the sitemap CmsRpcAction<CmsSitemapChange> saveAction = new CmsRpcAction<CmsSitemapChange>() { /**...
Create a Java method that does the following: "Commit a sitemap change.".
Of course, here is the Java code you requested: ```java public BigDecimal stripTrailingZeros() { if (intCompact == 0 || (intVal != null && intVal.signum() == 0)) { return BigDecimal.ZERO; } else if (intCompact != INFLATED) { return createAndStripZerosToMatchScale(intCompact, sca...
Create a Java method that does the following: "This method strips trailing zeros from the result.".
Of course, here is the Java code you requested: ```java private boolean isUserAuthorized(HttpServletRequest httpRequest) { if (authorizedUsers == null) { return true; } // Get Authorization header final String auth = httpRequest.getHeader("Authorization"); if (auth == null) { return false; // no...
Create a Java method that does the following: "Check if the user is authorized to access the specified resource.".
Of course, here is the Java code you requested: ```java private void initAnchorsMap(final Workbook wb, final ChartsData chartsData) { try { if (wb instanceof XSSFWorkbook) { ChartUtility.initXSSFAnchorsMap((XSSFWorkbook) wb, chartsData); } } catch (Exception e) { LOG.log(Level.SEVERE,...
Create a Java method that does the following: "Initializes the anchor map.".
Of course, here is the Java code you requested: ```java protected void launchTIBCOBinary(File binary, List<File> tras, ArrayList<String> arguments, File workingDir, String errorMsg) throws IOException, MojoExecutionException { launchTIBCOBinary(binary, tras, arguments, workingDir, errorMsg, false, true); } ``` Hop...
Create a Java method that does the following: "Launch the TIBCO binary.".
Of course, here is the Java code you requested: ```java public Result video(Http.Request request, Long videoId) { File videoFile = getVideoFile(videoId); return RangeResults.ofFile(request, videoFile); } ``` Hope this helps!
Create a Java method that does the following: "Get the video file from the videoId.".
Of course, here is the Java code you requested: ```java public static Connection connect() throws IOException, InterruptedException { Options options = new Options.Builder().server(Options.DEFAULT_URL).build(); return createConnection(options, false); } ``` Hope this helps!
Create a Java method that does the following: "Creates a new connection to the authority.".
Of course, here is the Java code you requested: ```java protected Object getNIOInstance(Constructor<?> constructor, Object... args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { final String method = "getInstance"; //$NON-NLS-1$ Object ret = null; ...
Create a Java method that does the following: "Gets the NIO instance.".
Of course, here is the Java code you requested: ```java public static Builder from(XmlMultiConfiguration config) { return new Builder() { @Override public Builder withManager(String identity, Configuration configuration) { Map<String, Config> configurations = new HashMap<>(config.configurations...
Create a Java method that does the following: "Create a new Builder from an existing configuration.".
Of course, here is the Java code you requested: ```java public void commitAddedRules() { // commit changes in the context initialization rules ChainableContextInitRule nextContextInitRule; Chain<ChainableContextInitRule> contextInitRuleChain; nextContextInitRule = addedContextInitRules_; contextInitRuleChai...
Create a Java method that does the following: "Commits changes in the added rules.".
Of course, here is the Java code you requested: ```java public static cachepolicy_csvserver_binding[] get(nitro_service service, String policyname) throws Exception{ cachepolicy_csvserver_binding obj = new cachepolicy_csvserver_binding(); obj.set_policyname(policyname); cachepolicy_csvserver_binding response[] =...
Create a Java method that does the following: "Use this API to fetch cachepolicy_csvserver_binding resources of given name.".
Of course, here is the Java code you requested: ```java public <T extends J4pRequest> HttpUriRequest getHttpRequest(List<T> pRequests,Map<J4pQueryParameter,String> pProcessingOptions) throws UnsupportedEncodingException, URISyntaxException { JSONArray bulkRequest = new JSONArray(); String q...
Create a Java method that does the following: "Gets an HTTP request from a list of J4pRequests.".
Of course, here is the Java code you requested: ```java synchronized public Element get(long index) { int bind = ((int)index & Integer.MAX_VALUE) % buckets.length; Element[] bucket = buckets[bind]; if (bucket == null) return null; for (int i = 0; i < counts[bind]; i++) if (bucket[i].getInde...
Create a Java method that does the following: "Gets the element at the specified index.".
Of course, here is the Java code you requested: ```java public static LocalDateIterator createLocalDateIterator( String rdata, LocalDate start, DateTimeZone tzid, boolean strict) throws ParseException { return new RecurrenceIteratorWrapper( RecurrenceIteratorFactory.crea...
Create a Java method that does the following: "Create a LocalDateIterator from a CRA file.".
Of course, here is the Java code you requested: ```java public Selection performWLMLookup(HashSet guessSet, SIBUuid8 preferredME, Capability capability, HashMap handlers, bool...
Create a Java method that does the following: "This method is called to perform a WLMLookup operation on a single HIPI.".
Of course, here is the Java code you requested: ```java public static AFPChain fastaToAfpChain(String sequence1, String sequence2, Structure structure1, Structure structure2) throws StructureException, CompoundNotFoundException { ProteinSequence s1 = new ProteinSequence(sequence1); s1.setUserCollection(getAlign...
Create a Java method that does the following: "Convert a sequence of FASTA to an AFPChain.".
Of course, here is the Java code you requested: ```java public static PageFlowController getPageFlowForRelativeURI( HttpServletRequest request, HttpServletResponse response, String path, ...
Create a Java method that does the following: "Gets the PageFlowController for a relative URI.".
Of course, here is the Java code you requested: ```java static double max(double[] values) { double max = values[0]; for (double value : values) if (value > max) max = value; return max; } ``` Hope this helps!
Create a Java method that does the following: "Get the maximum value of a set of class attribute values.".
Of course, here is the Java code you requested: ```java protected void initMessageObject() { try { if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) { // create a new message info object m_msgInfo = new CmsMessageInfo(...
Create a Java method that does the following: "Initialize the message object.".
Of course, here is the Java code you requested: ```java public static ComplexNumber Subtract(ComplexNumber z1, ComplexNumber z2) { return new ComplexNumber(z1.real - z2.real, z1.imaginary - z2.imaginary); } ``` Hope this helps!
Create a Java method that does the following: "Subtract two complex numbers.".
Of course, here is the Java code you requested: ```java public void setValue(Object newValue) { synchronized (lock) { // Allow only once. if (ready) { return; } result = newValue; ready = true; if (waiters > 0) { ...
Create a Java method that does the following: "Sets the value of the attribute.".
Of course, here is the Java code you requested: ```java @XmlElementDecl(namespace = "http://www.immobilienscout24.de/immobilientransfer", name = "Zwangsversteigerung", substitutionHeadNamespace = "http://www.immobilienscout24.de/immobilientransfer", substitutionHeadName = "Immobilie") public Zwangsversteigerung cr...
Create a Java method that does the following: "Create an instance of the Zwangsversteigerung class.".
Of course, here is the Java code you requested: ```java public final void addFields(Document document, CellName cellName) { String serializedKey = ByteBufferUtils.toString(cellName.toByteBuffer()); Field field = new StringField(FIELD_NAME, serializedKey, Field.Store.YES); document.add(field); ...
Create a Java method that does the following: "Add the fields to the document.".
Of course, here is the Java code you requested: ```java @Nonnull @Override public RunnableFuture<SnapshotResult<OperatorStateHandle>> snapshot( long checkpointId, long timestamp, @Nonnull CheckpointStreamFactory streamFactory, @Nonnull CheckpointOptions checkpointOptions) throws Exception { long syncStart...
Create a Java method that does the following: "Performs a single snapshot of the state of the specified block.".
Of course, here is the Java code you requested: ```java public static ResourceHandle use(Resource resource) { return resource instanceof ResourceHandle ? ((ResourceHandle) resource) : new ResourceHandle(resource); } ``` Hope this helps!
Create a Java method that does the following: "Use the resource to create a resource handle.".
Of course, here is the Java code you requested: ```java private void init() { setSize(600, 400); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(new BorderLayout()); getContentPane().setBackground(BACKGROUND); JPanel modelPanel = new JPanel(new GridBagLayout()); pcRad...
Create a Java method that does the following: "Initialize the content pane of the page.".
Of course, here is the Java code you requested: ```java @Override public DeleteBandwidthRateLimitResult deleteBandwidthRateLimit(DeleteBandwidthRateLimitRequest request) { request = beforeClientExecution(request); return executeDeleteBandwidthRateLimit(request); } ``` Hope this helps!
Create a Java method that does the following: "Deletes the bandwidth rate limit for a specific language.".
Of course, here is the Java code you requested: ```java public MtasToken getObjectById(String field, int docId, int mtasId) throws IOException { try { Long ref; Long objectRefApproxCorrection; IndexDoc doc = getDoc(field, docId); IndexInput inObjectId = indexInputList.get("indexObject...
Create a Java method that does the following: "Gets the object by id.".
Of course, here is the Java code you requested: ```java public static Result ofStream(Http.Request request, InputStream stream) { return JavaRangeResult.ofStream(stream, rangeHeader(request), null, Optional.empty()); } ``` Hope this helps!
Create a Java method that does the following: "Create a new Result instance from an input stream.".
Of course, here is the Java code you requested: ```java static void cleanUpAndCheckBackup(Configuration conf, File origin) throws IOException { // get all backups String[] backups = getBackups(origin); File root = origin.getParentFile(); // maximum total number of backups int copiesToKeep = co...
Create a Java method that does the following: "Clean up the backup files and check if there are any backups".
Of course, here is the Java code you requested: ```java @Override protected void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException { boolean responseSet = false; boolean validRequest = Arrays.asList( CSS_STYLESHEET, BANNER_IMAGE ).contains( req.getServletPath()); i...
Create a Java method that does the following: "Override doGet to handle the GET request.".
Of course, here is the Java code you requested: ```java public String getResultDetail(int index) { if (!detail) return null; if (index < 0 || index >= getResultCount()) throw new IllegalArgumentException(CLASS + ": illegal value for index"); return details.get(index); } ``` Hope this helps!
Create a Java method that does the following: "Get the detail of the result at the specified index.".
Of course, here is the Java code you requested: ```java public <T> T deserialize(File file, TypeRef returnType) throws ApiException { JavaType javaType = mapper.constructType(returnType.getType()); try { return mapper.readValue(file, javaType); } catch (IOException e) { throw new ApiException(5...
Create a Java method that does the following: "Deserialize a single entity from a file.".
Of course, here is the Java code you requested: ```java public Set<Integer> removeConnections(String endpointId) { Set<Integer> removed = this.entries.removeAll(endpointId); if (!removed.isEmpty() && log.isDebugEnabled()) { log.debug("Call " + getCallIdHex() + " unregistered connections " +...
Create a Java method that does the following: "Removes all connections from the call.".
Of course, here is the Java code you requested: ```java public static Map<String, Object> from(Pair... pairs) { Map<String, Object> map = new HashMap<String, Object>(pairs.length); for (Pair p : pairs) { map.put(p.key, p.value); } return map; } ``` Hope this helps!
Create a Java method that does the following: "Create a map from the given pairs.".
Of course, here is the Java code you requested: ```java static public String getBasicAuthUsername(HttpServletRequest request){ String[] userAndPassword = getBasicAuthUsernameAndPassword(request); return userAndPassword == null || userAndPassword.length == 0 ? null : userAndPassword[0]; } ``` Hope this helps!
Create a Java method that does the following: "Get the username from the Basic Authentication header.".
Of course, here is the Java code you requested: ```java public final void backReferenceExpression() throws RecognitionException { try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:545:5: ( ( DOT DOT DIV )=> ( DOT DOT DIV )+ unaryExpressionNotPlusMinus ) // src/main/resources/org/drools/com...
Create a Java method that does the following: "Use for backReferenceExpression in the backReferenceExpressionRule".
Of course, here is the Java code you requested: ```java public boolean isImportingPAXWicketAPI() { // Check if there is a package wiring (either static or dynamic) BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); boolean hasPackageImport = hasWireMatchingFilter(bundleWi...
Create a Java method that does the following: "Checks if the application is importing aPAXWicketAPI.".
Of course, here is the Java code you requested: ```java public static final char getFileTypeLetter(Path path) { if (Files.isRegularFile(path)) { return '-'; } if (Files.isDirectory(path)) { return 'd'; } if (Files.isSymbolicL...
Create a Java method that does the following: "Gets the file type letter from the given path.".
Of course, here is the Java code you requested: ```java public void setPartitionSerialList(java.util.Collection<String> partitionSerialList) { if (partitionSerialList == null) { this.partitionSerialList = null; return; } this.partitionSerialList = new com.amazonaws.inte...
Create a Java method that does the following: "Sets the value partitionSerialList ;".
Of course, here is the Java code you requested: ```java public List<HashMap<IBond, IBond>> getTargetQueryBondMappings() { if (mappings == null) return null; List<HashMap<IBond,IBond>> bondMap = new ArrayList<>(); // query -> target so need to inverse the mapping // XXX...
Create a Java method that does the following: "Get the target query bond mappings.".
Of course, here is the Java code you requested: ```java public void setQueuesFromString(String queueList) { if (StringUtils.isNotBlank(queueList)) { String[] queues = queueList.split(Constants.SEP); for (String q : queues) { this.queues.add(q); } } } ``` Hope this helps!
Create a Java method that does the following: "Sets the queues from a string.".
Of course, here is the Java code you requested: ```java public static IAtomContainer checkAndCleanMolecule(IAtomContainer molecule) { boolean isMarkush = false; for (IAtom atom : molecule.atoms()) { if (atom.getSymbol().equals("R")) { isMarkush = true; break;...
Create a Java method that does the following: "Check if the molecule is a C - C - C.".
Of course, here is the Java code you requested: ```java public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsJobLogCQ> queryLambda, ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsJobLogCA> aggsLambda) { JobLogCQ cq = new JobLogCQ(); if (queryLambda...
Create a Java method that does the following: "Filter a resource by name.".
Of course, here is the Java code you requested: ```java public SignalRResourceInner update(String resourceGroupName, String resourceName) { return updateWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().last().body(); } ``` Hope this helps!
Create a Java method that does the following: "Updates an existing SignalR resource.".
Of course, here is the Java code you requested: ```java public void setActualImageScaleType(ScalingUtils.ScaleType scaleType) { Preconditions.checkNotNull(scaleType); getScaleTypeDrawableAtIndex(ACTUAL_IMAGE_INDEX).setScaleType(scaleType); } ``` Hope this helps!
Create a Java method that does the following: "Sets the actual image scale type.".
Of course, here is the Java code you requested: ```java public void billingAccount_line_serviceName_removeSimultaneousLines_POST(String billingAccount, String serviceName, Long quantityRemove) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/removeSimultaneousLines"; StringBuilde...
Create a Java method that does the following: "Remove multiple lines from the given line".
Of course, here is the Java code you requested: ```java public Tuple2<ReadOnlyStyledDocument<PS, SEG, S>, ReadOnlyStyledDocument<PS, SEG, S>> split( int paragraphIndex, int columnPosition) { return tree.splitAt(paragraphIndex).map((l, p, r) -> { Paragraph<PS, SEG, S> p1 = p.trim(columnP...
Create a Java method that does the following: "Split the document at the given paragraph and column position.".
Of course, here is the Java code you requested: ```java public JSONObject getJSONObject(int index) throws JSONException { Object object = get(index); if (object instanceof JSONObject) { return (JSONObject) object; } else { throw JSON.typeMismatch(index, object, "JSONObject"); } } ``` Hope this helps!
Create a Java method that does the following: "Gets the JSONObject at the given index.".
Of course, here is the Java code you requested: ```java public ResponseWrapper removeChatRoomMembers(long roomId, Members members) throws APIConnectionException, APIRequestException { return _chatRoomClient.removeChatRoomMembers(roomId, members); } ``` Hope this helps!
Create a Java method that does the following: "remove members from chat room".
Of course, here is the Java code you requested: ```java private void initReplacer(Map<String, String> replacer, String tableName, String fieldName) { replacer.clear(); replacer.put(REPLACEMENT_TABLENAME, tableName); replacer.put(REPLACEMENT_FIELD_NAME, fieldName); } ``` Hope this helps!
Create a Java method that does the following: "Initialize the replacer.".
Of course, here is the Java code you requested: ```java @Override public Optional<String> getMessage(final String code) { return Optional.ofNullable(properties.getProperty(code)); } ``` Hope this helps!
Create a Java method that does the following: "Gets the message for the given code.".
Of course, here is the Java code you requested: ```java @Override public int encode ( byte[] dst, int dstIndex ) { int start = dstIndex; SMBUtil.writeInt8(this.allocationSize, dst, dstIndex); dstIndex += 8; SMBUtil.writeInt8(this.endOfFile, dst, dstIndex); dstIndex += 8; ...
Create a Java method that does the following: "Encode the extended header in the SMB2 header format.".
Of course, here is the Java code you requested: ```java protected void writeDirectBytes(byte[] b, int off, int len) throws IOException { ostream.write(b, off, len); len += len; } ``` Hope this helps!
Create a Java method that does the following: "Write a byte array to the output stream.".
Of course, here is the Java code you requested: ```java @Override public Decompressor createDecompressor() { if (!isNativeSnappyLoaded(conf)) { throw new RuntimeException("native snappy library not available"); } int bufferSize = conf.getInt( IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_KEY, ...
Create a Java method that does the following: "Create a decompressor using the native snappy library.".
Of course, here is the Java code you requested: ```java @Override public void process(GrayF32 input , GrayU8 output ) { inputPow2.reshape(input.width,input.height); inputMean.reshape(input.width,input.height); inputMeanPow2.reshape(input.width,input.height); inputPow2Mean.reshape(input.width,input.height); ...
Create a Java method that does the following: "Computes the C - T cosine standard deviation of the image.".
Of course, here is the Java code you requested: ```java public void init(MessageDataParent messageDataParent, String strKey) { m_messageDataParent = messageDataParent; m_strKey = strKey; if (messageDataParent != null) messageDataParent.addMessageDataDesc(this); } ``` Hope t...
Create a Java method that does the following: "Initialize this object.".
Of course, here is the Java code you requested: ```java @Deprecated public static int parsePAT(ByteBuffer data) { PATSection pat = PATSection.parsePAT(data); if (pat.getPrograms().size() > 0) return pat.getPrograms().values()[0]; else return -1; } ``` Hope this ...
Create a Java method that does the following: "Parse a single SEGMENT from a byte buffer.".
Of course, here is the Java code you requested: ```java public static void removeAnnotation(JVar field, JAnnotationUse annotation) { List<JAnnotationUse> annotations = getPrivateField(field, "annotations"); annotations.remove(annotation); } ``` Hope this helps!
Create a Java method that does the following: "Removes an annotation from a field.".
Of course, here is the Java code you requested: ```java @Override protected void processVelocityResource(ITemplateSource source, VelocityContext context, String target) throws Exception { if(source.isFile()) { super.processVelocityFile(source.getEntry(source.getResource()), context, target); } else if(source.i...
Create a Java method that does the following: "Process a Velocity resource.".
Of course, here is the Java code you requested: ```java private static Dictionary<String, Object> massageNewConfig(Dictionary<String, Object> oldProps, Dictionary<String, Object> newProps) { ConfigurationDictionary ret = new ConfigurationDictionary(); if (oldProps != null) { for (Enumerati...
Create a Java method that does the following: "Massage new config.".
Of course, here is the Java code you requested: ```java public static <E> Set<E> filter(Set<E> unfiltered, Predicate<? super E> predicate) { if (unfiltered instanceof SortedSet) { return filter((SortedSet<E>) unfiltered, predicate); } if (unfiltered instanceof FilteredSet) { // Support clear(),...
Create a Java method that does the following: "Filter a set of elements from a given set using a predicate.".
Of course, here is the Java code you requested: ```java public C getCell(int itemIndex) { Lists.checkIndex(itemIndex, items.size()); return cellPositioner.getSizedCell(itemIndex); } ``` Hope this helps!
Create a Java method that does the following: "Get a cell from the index.".
Of course, here is the Java code you requested: ```java @Override public void visitMethod(final Method obj) { try { if (obj.isSynthetic()) { return; } Code code = obj.getCode(); if (code == null) { return; } ...
Create a Java method that does the following: "overrides the visitor to look for method invocations that have a code that is not marked as synthetic.".
Of course, here is the Java code you requested: ```java boolean isConfigValid(ConvergedClientConfig config) { boolean valid = true; String clientId = config.getClientId(); String clientSecret = config.getClientSecret(); String authorizationEndpoint = config.getAuthorizationEndpointUrl()...
Create a Java method that does the following: "Check if the configuration is valid.".
Of course, here is the Java code you requested: ```java public BinaryPackageControlFile createPackageControlFile(File file, BigInteger pDataSize) throws IOException, ParseException { FilteredFile controlFile = new FilteredFile(new FileInputStream(file), resolver); BinaryPackageControlFile packageContro...
Create a Java method that does the following: "Create a binary package control file from the specified file.".
Of course, here is the Java code you requested: ```java public Dimension getPreferredSize(JComponent c) { Insets insets = c.getInsets(); return (scrollbar.getOrientation() == JScrollBar.VERTICAL) ? new Dimension(scrollBarWidth + insets.left + insets.right, 48) : new Dimension(48, scroll...
Create a Java method that does the following: "Get the preferred size of the component.".
Of course, here is the Java code you requested: ```java public final double updateAndGet(DoubleUnaryOperator updateFunction) { double prev, next; do { prev = get(); next = updateFunction.applyAsDouble(prev); } while (!compareAndSet(prev, next)...
Create a Java method that does the following: "Updates the value of the managed object with the result of applying the provided function and returns the updated value.".
Of course, here is the Java code you requested: ```java public final double getValueAtRisk(final Number confidenceLevel, final Number timePeriod) { final double aReturn = this.getMeanReturn(); final double aStdDev = this.getVolatility(); final double tmpConfidenceScale = SQRT_TWO * RandomUtil...
Create a Java method that does the following: "Get the value at the risk.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("unchecked") public static SqlInfo buildSqlInfo(String nameSpace, SqlInfo sqlInfo, Node node, Object paramObj) { // 获取所有子节点,并分别将其使用StringBuilder拼接起来 List<Node> nodes = node.selectNodes(ZealotConst.ATTR_CHILD); for (No...
Create a Java method that does the following: "Build SQL info from a node.".
Of course, here is the Java code you requested: ```java public String currentStatus() { StringBuffer sb = new StringBuffer(); sb.append("===== CommonThreadPool Status at ").append(new Date()).append(" =====\n"); sb.append("Threads: current=").append(thread_pool.getPoolSize()); sb.append...
Create a Java method that does the following: "Get the current status of the CommonThreadPool".
Of course, here is the Java code you requested: ```java public boolean match(final float ieVersion, String expression) { expression = StringUtil.removeChars(expression, "()"); expression = expression.substring(3); String[] andChunks = StringUtil.splitc(expression, '&'); boolean valid = true; for (String a...
Create a Java method that does the following: "Checks if the given IE version matches the given expression.".
Of course, here is the Java code you requested: ```java public static boolean isLastDayOfTheMonth(final Date date) { Date dateOfMonthsBack = getDateOfMonthsBack(-1, date); int dayOfMonth = getDayOfMonth(dateOfMonthsBack); Date dateOfDaysBack = getDateOfDaysBack(dayOfMonth, dateOfMonthsBack); return da...
Create a Java method that does the following: "Checks if the given date is the last day of the month.".
Of course, here is the Java code you requested: ```java public char getExplicitChar(final @NonNull CharSequence text, final int cursor) { if (cursor < 0 || cursor > text.length()) { return (char) 0; } SpannableStringBuilder ssb = new SpannableStringBuilder(text); int start =...
Create a Java method that does the following: "Gets the explicit character from the text.".
Of course, here is the Java code you requested: ```java private ExampleSet readDataSet(File in) throws IOException { logger.info("read the example set"); // ExampleSet inputSet = new SentenceSetCopy(); inputSet.read(new BufferedReader(new FileReader(in))); String trainFrac = parameter.getProperty("train-f...
Create a Java method that does the following: "read the data set".
Of course, here is the Java code you requested: ```java @Override public void cancelAllScheduledForActor() { final Set<ActionContext<T>> toCancel; synchronized (contexts) { toCancel = new HashSet<>(contexts); contexts.clear(); } // Cancel all toCancel.forEach(cxt -> { if (!cxt.isDone()) { cx...
Create a Java method that does the following: "Cancel all scheduled actions for the actor.".
Of course, here is the Java code you requested: ```java private List getModes() { ArrayList ret = new ArrayList(); ret.add( new CmsSelectWidgetOption( String.valueOf(CmsHistorySettings.MODE_DELETED_HISTORY_DISABLED), m_historySettings.getMode() == CmsHistor...
Create a Java method that does the following: "Get the modes.".
Of course, here is the Java code you requested: ```java private int compareToErrStackLines(List<StackLine> stackLines, List<StackLine> errStackLines) { if (errStackLines == null || errStackLines.size() == 0) { return -1; // already executed } if (stackLines.size() == 0) { ...
Create a Java method that does the following: "Compare two list of stack lines.".
Of course, here is the Java code you requested: ```java public void addResourceToOrgUnit(CmsRequestContext context, CmsOrganizationalUnit orgUnit, CmsResource resource) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); ...
Create a Java method that does the following: "Add a resource to an organizational unit.".
Of course, here is the Java code you requested: ```java private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed char[] rgchPassword = passwordField.getPassword(); char[] rgchRePassword = rePasswordField.getPassword(); if (new String...
Create a Java method that does the following: "The login button has been changed. Set the password and save info fields to the values in the password field.".
Of course, here is the Java code you requested: ```java @Override public Query createNamedQuery(String name) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "em.createNamedQuery(" + name + ");\n" + toString()); return getEMInvocationInfo(false).creat...
Create a Java method that does the following: "Create a named query object.".
Of course, here is the Java code you requested: ```java protected synchronized void do_send(final OtpOutputStream header, final OtpOutputStream payload) throws IOException { try { if (traceLevel >= sendThreshold) { // Need to decode header and output buffer to show trace...
Create a Java method that does the following: "Send an Erlang message to the remote node.".
Of course, here is the Java code you requested: ```java public void setMapEntries(java.util.Collection<ParameterMapEntry> mapEntries) { if (mapEntries == null) { this.mapEntries = null; return; } this.mapEntries = new java.util.ArrayList<ParameterMapEntry>(mapEntries); ...
Create a Java method that does the following: "Sets the value of the mapEntries property.".
Of course, here is the Java code you requested: ```java public Observable<ServiceResponse<OCR>> oCRFileInputWithServiceResponseAsync(String language, byte[] imageStream, OCRFileInputOptionalParameter oCRFileInputOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentExce...
Create a Java method that does the following: "Read an image from an image stream.".