code
stringlengths
146
48.7k
prompt
stringlengths
55
1.51k
Of course, here is the Java code you requested: ```java protected URI doPostCreateMultipart(String path, InputStream inputStream, MultivaluedMap<String, String> headers) throws ClientException { this.readLock.lock(); try { WebResource.Builder requestBuilder = getResourceWrapper().rewritten(...
Create a Java method that does the following: "Creates a new resource in a multipart form.".
Of course, here is the Java code you requested: ```java public static Set<Class<?>> scanPackage(ClassLoader classLoader, String pkg) throws IOException { Reflections reflections = new Reflections(new ConfigurationBuilder() .addUrls(ClasspathHelper.forPackage(pkg, classLoader)) ....
Create a Java method that does the following: "Scans the given package for classes.".
Of course, here is the Java code you requested: ```java @Override public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException { int start = bufferIndex; this.capabilities = SMBUtil.readInt4(buffer, bufferIndex); bufferIndex += 4; System.arrayc...
Create a Java method that does the following: "Decode the SMB2 header.".
Of course, here is the Java code you requested: ```java public String getString(final String key, final String def) { String val = getString(key); if (val == null) { if (map.containsKey(key)) { return null; } return def; } return val; } ``` Hope this helps!
Create a Java method that does the following: "Gets the value for the specified key.".
Of course, here is the Java code you requested: ```java private void pullTopicMetadata(final AbstractPipelineInput input, final Collection<FileInfo> fis) throws DITAOTException { // Pull metadata (such as navtitle) into the map from the referenced topics final File styleFile = new File(input.getAttribu...
Create a Java method that does the following: "Pull the metadata from the referenced topics into the map.".
Of course, here is the Java code you requested: ```java public String getInsertDollarPrepareSQL(T bean) { if (this.tableStrategy == null) return insertDollarPrepareSQL; return insertDollarPrepareSQL.replace("${newtable}", getTable(bean)); } ``` Hope this helps!
Create a Java method that does the following: "Returns the SQL to insert a record into the database.".
Of course, here is the Java code you requested: ```java public java.util.List<ExtraParam> getExtraParams() { if (extraParams == null) { extraParams = new com.amazonaws.internal.SdkInternalList<ExtraParam>(); } return extraParams; } ``` Hope this helps!
Create a Java method that does the following: "Gets the value of the extraParams property.".
Of course, here is the Java code you requested: ```java public static <S, T extends Event> InputMapTemplate<S, T> unless( Predicate<? super S> condition, InputMapTemplate<S, T> imt) { return when(condition.negate(), imt); } ``` Hope this helps!
Create a Java method that does the following: "Returns an InputMapTemplate that is not satisfied by the given condition.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("unchecked") private static Method getMethodOrDie( final Class clazz, final String name, final Class... params) { try { return clazz.getMethod(name, params); } catch (NoSuchMethodException e) { throw new RuntimeExcept...
Create a Java method that does the following: "Gets the method with the specified name and parameters.".
Of course, here is the Java code you requested: ```java private static IconSet resolveIconSet(String iconCode) { CharSequence unicode; for (IconSet set : getRegisteredIconSets()) { if (set.fontPath().equals(FontAwesome.FONT_PATH) || set.fontPath().equals(Typicon.FONT_PATH) || set.fontPath...
Create a Java method that does the following: "Resolves the icon set for the font code.".
Of course, here is the Java code you requested: ```java public com.google.api.ads.adwords.axis.v201809.cm.ListOperations getConversionTypeIdsOps() { return conversionTypeIdsOps; } ``` Hope this helps!
Create a Java method that does the following: "Gets the conversionTypeIdsOps value for this CdnConversionType.".
Of course, here is the Java code you requested: ```java @Override public CloudStorageFileSystem getFileSystem(URI uri) { initStorage(); return newFileSystem(uri, Collections.<String, Object>emptyMap()); } ``` Hope this helps!
Create a Java method that does the following: "Get a Cloud Storage FileSystem".
Of course, here is the Java code you requested: ```java final protected ServletBeanContext getServletBeanContext() { if (_beanContext == null) { ControlContainerContext ccc = ControlThreadContext.getContext(); if (! (ccc instanceof ServletBeanContext)) throw ...
Create a Java method that does the following: "Gets the ServletBeanContext.".
Of course, here is the Java code you requested: ```java @Override public void loadSheets(Media rasterConfig, boolean smooth) { final Collection<Integer> sheets = map.getSheets(); final Iterator<Integer> itr = sheets.iterator(); final int th = map.getTileHeight(); while (itr.has...
Create a Java method that does the following: "Load sheets.".
Of course, here is the Java code you requested: ```java public byte[] readByteArray(int length) throws IOException { byte buf[] = new byte[length]; for (int i = 0; i < length; i++) { buf[i] = (byte) read(); } return buf; } ``` Hope this helps!
Create a Java method that does the following: "read a byte array of length bytes from the stream.".
Of course, here is the Java code you requested: ```java @Override public Chain getChain(String asymId, int modelnr) { List<Chain> chains = getChains(modelnr); for (Chain c : chains) { if (c.getId().equals(asymId)) { return c; } } return null; } ``` Hope this helps!
Create a Java method that does the following: "Get the chain with the specified asymId and modelnr.".
Of course, here is the Java code you requested: ```java public void setScope(String scopeName) { if ("page".equals(scopeName)) { scope = PageContext.PAGE_SCOPE; } else if ("request".equals(scopeName)) { scope = PageContext.REQUEST_SCOPE; } else if ("sessi...
Create a Java method that does the following: "Sets the scope of the current page.".
Of course, here is the Java code you requested: ```java private XThesaurus GetThesaurus(XLinguServiceManager mxLinguSvcMgr) { try { if (mxLinguSvcMgr != null) { return mxLinguSvcMgr.getThesaurus(); } } catch (Throwable t) { // If anything goes wrong, give the user a stack trace ...
Create a Java method that does the following: "Get the Thesaurus object from the database.".
Of course, here is the Java code you requested: ```java public void readCatalog(Catalog catalog, InputStream is) throws IOException, CatalogException { // Create an instance of the parser if (parserFactory == null && parserClass == null) { debug.message(1, "Cannot read SAX catalog without a parser"...
Create a Java method that does the following: "Read a catalog from an input stream.".
Of course, here is the Java code you requested: ```java protected void initHistorySettingsObject() { Object o; if (CmsStringUtil.isEmpty(getParamAction())) { o = new CmsHistorySettings(); } else { // this is not the initial call, get the job object from session ...
Create a Java method that does the following: "Initialize the history settings object.".
Of course, here is the Java code you requested: ```java private Thing parseThing(Kind kind, JSONObject data) { // For a comment if (kind == Kind.COMMENT) { return new Comment(data); // For a submission } else if (kind == Kind.LINK) { return...
Create a Java method that does the following: "Parses a Thing object from a JSON object.".
Of course, here is the Java code you requested: ```java @XmlElement(name = "totalSize", required = true) @JsonProperty(value = "totalSize", required = true) @ApiModelProperty(value = "The total size of available elements.", position = 2, required = true) @Override public long getTotalSize() { r...
Create a Java method that does the following: "Gets the total size of the service.".
Of course, here is the Java code you requested: ```java public void marshall(SqsParameters sqsParameters, ProtocolMarshaller protocolMarshaller) { if (sqsParameters == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMar...
Create a Java method that does the following: "marshalls the given SQSParameters object to the JSON - compatible parameter object.".
Of course, here is the Java code you requested: ```java @Override public void cacheResult(List<CommerceDiscountRule> commerceDiscountRules) { for (CommerceDiscountRule commerceDiscountRule : commerceDiscountRules) { if (entityCache.getResult( CommerceDiscountRuleModelImpl.ENTITY_CACHE_ENABLED, Commer...
Create a Java method that does the following: "Caches the commerce discount rules in the entity cache if it is enabled.".
Of course, here is the Java code you requested: ```java @Override public void serializeClassifier(String serializePath) { System.err.print("Serializing classifier to " + serializePath + "..."); try { ObjectOutputStream oos = IOUtils.writeStreamFromString(serializePath); oos.writeObject...
Create a Java method that does the following: "Serialize the classifier to a file.".
Of course, here is the Java code you requested: ```java public FormInputHandler webDriver(final WebDriver theWebDriver) { Fields fields = new Fields(this); fields.finder = fields.finder.webDriver(theWebDriver); return new FormInputHandler(fields); } ``` Hope this helps!
Create a Java method that does the following: "Creates a new FormInputHandler that will handle the input of a web driver.".
Of course, here is the Java code you requested: ```java public BaseField setupField(int iFieldSeq) { BaseField field = null; //if (iFieldSeq == 0) //{ // field = new CounterField(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null); // field.setHidden(true); //} ...
Create a Java method that does the following: "Set up the Field for this ID.".
Of course, here is the Java code you requested: ```java public long getNearestPosition(long recordNumber) { if (recordNumber < startingRecordNumber || recordNumber > lastRecordNumber) throw new IndexOutOfBoundsException(); return index.get((int) ((recordNumber - startingRecordNumber) / step...
Create a Java method that does the following: "Gets the nearest position of a record.".
Of course, here is the Java code you requested: ```java public void addWeightParam(@NonNull String paramKey, @NonNull long... paramShape) { Preconditions.checkArgument(paramShape.length > 0, "Provided weight parameter shape is" + " invalid: length 0 provided for shape. Parameter: " + pa...
Create a Java method that does the following: "Adds a weight parameter to the image.".
Of course, here is the Java code you requested: ```java protected List<List<Row<I>>> incorporateCounterExample(DefaultQuery<I, D> ce) { return ObservationTableCEXHandlers.handleClassicLStar(ce, table, oracle); } ``` Hope this helps!
Create a Java method that does the following: "Incorporates a counter example.".
Of course, here is the Java code you requested: ```java public static void writeToStream(BitMatrix matrix, String format, OutputStream stream) throws IOException { writeToStream(matrix, format, stream, DEFAULT_CONFIG); } ``` Hope this helps!
Create a Java method that does the following: "Write a BitMatrix to an OutputStream.".
Of course, here is the Java code you requested: ```java public void setLenient(boolean lenient) { calendar.setLenient(lenient); setBooleanAttribute(BooleanAttribute.PARSE_ALLOW_NUMERIC, lenient); setBooleanAttribute(BooleanAttribute.PARSE_ALLOW_WHITESPACE, lenient); } ``` Hope this hel...
Create a Java method that does the following: "Sets the lenient flag.".
Of course, here is the Java code you requested: ```java @XmlElementDecl(namespace = "http://www.ibm.com/websphere/wim", name = "postalAddress") public JAXBElement<String> createPostalAddress(String value) { return new JAXBElement<String>(_PostalAddress_QNAME, String.class, null, value); } ``` Hope thi...
Create a Java method that does the following: "Create an instance of the postalAddress property.".
Of course, here is the Java code you requested: ```java @Override public boolean hasInstance(Scriptable value) { Scriptable proto = value.getPrototype(); while (proto != null) { if (proto.equals(this)) return true; proto = proto.getPrototype(); } ...
Create a Java method that does the following: "Check if the passed in value is an instance of this class.".
Of course, here is the Java code you requested: ```java public void marshall(UpdateThingGroupsForThingRequest updateThingGroupsForThingRequest, ProtocolMarshaller protocolMarshaller) { if (updateThingGroupsForThingRequest == null) { throw new SdkClientException("Invalid argument passed to marshall...
Create a Java method that does the following: "Updates the given parameter object.".
Of course, here is the Java code you requested: ```java public static JPanel makeVBox (Policy policy, Justification justification) { return new JPanel(new VGroupLayout(policy, justification)); } ``` Hope this helps!
Create a Java method that does the following: "Make a JPanel with a VGroupLayout.".
Of course, here is the Java code you requested: ```java @Override public @Nullable String getPassword( @Nonnull String instanceId ) throws InternalException, CloudException { APITrace.begin(getProvider(), "getPassword"); try { return new GetPassCallable(instanceId, getProvider()).call()...
Create a Java method that does the following: "Get the password for the specified instance.".
Of course, here is the Java code you requested: ```java public CompressionCodec getCodec(Path file) { CompressionCodec result = null; if (codecs != null) { String filename = file.getName(); String reversedFilename = new StringBuffer(filename).reverse().toString(); SortedMap<String, Compressio...
Create a Java method that does the following: "Get the CompressionCodec for a file".
Of course, here is the Java code you requested: ```java public static final void stringToBytes( String s, byte[] data, int[] offset ) { byte[] s_bytes = s.getBytes(); if (data != null) { intToBytes(s_bytes.length, data, offset); memcpy(data, offset[0], s_bytes, 0, s_bytes.lengt...
Create a Java method that does the following: "Convert a String to a byte array.".
Of course, here is the Java code you requested: ```java private void setSizeOfMonthYearPanel() { // Skip this function if the settings have not been applied. if (settings == null) { return; } // Get the font metrics object. Font font = labelMonth.getFont(); C...
Create a Java method that does the following: "Set the size of the month and year panel to the appropriate size for the calendar panel.".
Of course, here is the Java code you requested: ```java public MultiChangeBuilder<PS, SEG, S> replaceTextAbsolutely(int start, int end, String text) { return absoluteReplace(start, end, ReadOnlyStyledDocument.fromString( text, area.getInitialParagraphStyle(), area.getInitialTextStyle(), area.ge...
Create a Java method that does the following: "Replaces the text in the document.".
Of course, here is the Java code you requested: ```java public Git cloneRepository(String remoteUrl, Path localPath) { try { return Git.cloneRepository() .setURI(remoteUrl) .setDirectory(localPath.toFile()) .call(); } catch (GitAPIException e)...
Create a Java method that does the following: "Clones a repository.".
Of course, here is the Java code you requested: ```java public List<IssueCategory> getCategories(int projectID) throws RedmineException { return transport.getChildEntries(Project.class, Integer.toString(projectID), IssueCategory.class); } ``` Hope this helps!
Create a Java method that does the following: "Get a list of issue categories for a given project.".
Of course, here is the Java code you requested: ```java @Override public void addGroup(RibbonGroup ribbonGroup) { if (null == ribbonGroup) { throw new IllegalArgumentException("Cannot add RibbonGroup with null value."); } groups.add(ribbonGroup); ribbonGroup.setShowTitle(showGroupTitles); ribbonGroup.asW...
Create a Java method that does the following: "Adds a new RibbonGroup to the RibbonGroupGroupGroup.".
Of course, here is the Java code you requested: ```java public static sslservice_sslcertkey_binding[] get(nitro_service service, String servicename) throws Exception{ sslservice_sslcertkey_binding obj = new sslservice_sslcertkey_binding(); obj.set_servicename(servicename); sslservice_sslcertkey_binding response[...
Create a Java method that does the following: "Use this API to fetch sslservice_sslcertkey_binding resources of given name.".
Of course, here is the Java code you requested: ```java private StateConnection readBody() { try { //_requestHttp.readBodyChunk(this); /* if (! _isBodyComplete) { // XXX: only on non-upgrade and non-101 _requestHttp.readBodyChunk(this); } */ if (! _isBodyComp...
Create a Java method that does the following: "readBody is called to read the body of the request.".
Of course, here is the Java code you requested: ```java @Override public RoundedMoney scaleByPowerOfTen(int n) { return new RoundedMoney(number.scaleByPowerOfTen(n), currency, rounding); } ``` Hope this helps!
Create a Java method that does the following: "Scale by power of ten.".
Of course, here is the Java code you requested: ```java private static PercentileDistributionSummary computeIfAbsent( Registry registry, Id id, long min, long max) { Object summary = Utils.computeIfAbsent( registry.state(), id, i -> new PercentileDistributionSummary(registry, id, min, max)); retu...
Create a Java method that does the following: "Compute the entry in the cache if it exists.".
Of course, here is the Java code you requested: ```java private String extractPathFromUrl(String url) { String path = url.replaceAll(".+://.+?(?=/)", ""); if (!path.startsWith("/")) { throw new RuntimeException("Path must start with '/': " + path); } return path; } ``` ...
Create a Java method that does the following: "Extract path from url".
Of course, here is the Java code you requested: ```java private boolean parseAndExecute( Class<?> docletClass, String[] argv, Iterable<? extends JavaFileObject> fileObjects) throws IOException { long tm = System.currentTimeMillis(); ListBuffer<String> javaNames = ne...
Create a Java method that does the following: "Parse and execute the C ++ command line and execute the C ++ doclet.".
Of course, here is the Java code you requested: ```java public T getLogger(final String name, final MessageFactory messageFactory) { return getOrCreateInnerMap(factoryKey(messageFactory)).get(name); } ``` Hope this helps!
Create a Java method that does the following: "Get a logger by name and message factory.".
Of course, here is the Java code you requested: ```java public static CPDefinitionOptionValueRel findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.product.exception.NoSuchCPDefinitionOptionValueRelException { return getPersistence().findByUUID_G(uuid, groupId); } ``` Hope this helps!
Create a Java method that does the following: "Returns the cp definition option value rel with the UUID and group.".
Of course, here is the Java code you requested: ```java public static Logger getLogger(Class<?> cls, String resourcename) { //Liberty Change for CXF Begin return createLogger(cls, resourcename, cls.getName() + cls.getClassLoader()); //Liberty Change for CXF End } ``` Hope this helps!
Create a Java method that does the following: "Create a Logger for a Class".
Of course, here is the Java code you requested: ```java private JPanel getPaneSelect() { if (paneSelect == null) { paneSelect = new JPanel(); paneSelect.setLayout(new BorderLayout(0,0)); paneSelect.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); paneSelect.add(getTabbedSelect()); } ret...
Create a Java method that does the following: "This method initializes paneSelect".
Of course, here is the Java code you requested: ```java private static byte[] createBlob(byte[] targetInformation, byte[] clientNonce, long time) { byte[] blobSignature = new byte[] { (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00 }; byte[] reserved = new byte[] { (byte)...
Create a Java method that does the following: "Create a blob of the type A1. 1. 2.".
Of course, here is the Java code you requested: ```java public Message decorateMessage(Message message, String sender, String recipients) throws JMSException { message.setStringProperty("sender", sender); message.setStringProperty("recipients", StringUtils.isEmpty(recipients) ? null : "," + recipients ...
Create a Java method that does the following: "Decorate a message with the specified sender and recipients.".
Of course, here is the Java code you requested: ```java private static <E extends Enum<E>> Class<E> asEnum(final Class<E> enumClass) { Validate.notNull(enumClass, ENUM_CLASS_MUST_BE_DEFINED); Validate.isTrue(enumClass.isEnum(), S_DOES_NOT_SEEM_TO_BE_AN_ENUM_TYPE, enumClass); return enumClass; ...
Create a Java method that does the following: "Returns the given class as an enum.".
Of course, here is the Java code you requested: ```java @Override @SuppressWarnings("unchecked") public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); // TODO: do we need to write/read the capacity? final int capacity = in.readInt(); if(isLea...
Create a Java method that does the following: "Override the readExternal method to read the object data.".
Of course, here is the Java code you requested: ```java public void merge(Model target, BioPAXElement source) { merge(target, Collections.singleton(source)); } ``` Hope this helps!
Create a Java method that does the following: "Merges the given BioPAXElement into the target model.".
Of course, here is the Java code you requested: ```java void close() { if (this.project != null) { Util.logger().log(Level.FINE, "Closing Protege project {0}", this.projectIdentifier); for (Iterator<ProjectListener> itr = this.projectListene...
Create a Java method that does the following: "Closes the connection.".
Of course, here is the Java code you requested: ```java @Override public Locale getLocale() { if (super.getSession(false) == null) { return super.getLocale(); } final IUserInstance userInstance = this.userInstanceManager.getUserInstance(this.getWrappedRequest())...
Create a Java method that does the following: "Get the Locale for this request.".
Of course, here is the Java code you requested: ```java public static <T> Iterator<T> getUnmodifiableIterator (Iterable<T> c) { return getUnmodifiableIterator(c.iterator()); } ``` Hope this helps!
Create a Java method that does the following: "Get an iterator that returns an unmodifiable iterator of the specified iterable.".
Of course, here is the Java code you requested: ```java @Override public final Iterable<HeadDocument> findAll( final RootDocument rootDocument) { final Iterable<HeadDocument> headDocuments = findAll(rootDocument.getFilename()); if (headDocuments == null) { re...
Create a Java method that does the following: "Find all the head documents in the database.".
Of course, here is the Java code you requested: ```java public static cmppolicy get(nitro_service service, String name) throws Exception{ cmppolicy obj = new cmppolicy(); obj.set_name(name); cmppolicy response = (cmppolicy) obj.get_resource(service); return response; } ``` Hope this helps!
Create a Java method that does the following: "Use this API to fetch cmppolicy resource of given name.".
Of course, here is the Java code you requested: ```java public static <T> Predicate<T> or(final Predicate<? super T> first, final Predicate<? super T> second) { //NOPMD return new Predicate<T>() { @Override public boolean test(final T testValue) { return first.tes...
Create a Java method that does the following: "Create a predicate that returns true if the two predicates are true.".
Of course, here is the Java code you requested: ```java public static void removeTrigger(String triggerName) throws SundialSchedulerException { try { getScheduler().unscheduleJob(triggerName); } catch (SchedulerException e) { throw new SundialSchedulerException("ERROR REMOVING TRIGGER!!!", e)...
Create a Java method that does the following: "Remove a trigger from the scheduler".
Of course, here is the Java code you requested: ```java private void rebuildSubscriptionAndNotifyBusOfEffectiveImmediateChange(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory, final DefaultSubscriptionBase subscription, final Subscr...
Create a Java method that does the following: "Rebuild the subscription and notify bus of effective event.".
Of course, here is the Java code you requested: ```java public Iterable<String> getAllSortedTypeNames() { synchronized (lock) { if (lazyAllSortedTypeNames == null) { lazyAllSortedTypeNames = Stream.concat(BUILTIN_TYPES.keySet().stream(), descriptors.keySet().stream()) .sor...
Create a Java method that does the following: "Get all sorted type names.".
Of course, here is the Java code you requested: ```java public static BufferedImage renderLabeled(GrayS32 labelImage, int numRegions, BufferedImage out) { int colors[] = new int[numRegions]; Random rand = new Random(123); for( int i = 0; i < colors.length; i++ ) { colors[i] = rand.nextInt(); } return r...
Create a Java method that does the following: "Renders a image of the specified number of regions using the specified label image.".
Of course, here is the Java code you requested: ```java public VarValueDefBuilder hasIf( String name, Object value) { return value != null ? has( name, value) : this; } ``` Hope this helps!
Create a Java method that does the following: "Adds a variable value definition if the given value is not null.".
Of course, here is the Java code you requested: ```java private void initializeFields() { final IPath path = this.workingCopy.getJarFile(); String tooltip = null; String basename = null; if (path != null) { tooltip = path.toOSString(); final IPath tmpPath = path.removeTrailingSeparator(); if (tmpPath ...
Create a Java method that does the following: "Initialize the fields.".
Of course, here is the Java code you requested: ```java public BoltDeclarer setBolt(String id, IWindowedBolt bolt, Number parallelism_hint) throws IllegalArgumentException { return setBolt(id, new backtype.storm.topology.WindowedBoltExecutor(bolt), parallelism_hint); } ``` Hope this helps!
Create a Java method that does the following: "Declarative Services method for windowed bolt".
Of course, here is the Java code you requested: ```java @Override public XlsWorksheet createSheet(FileColumn[] columns, List<String[]> lines, String sheetName) throws IOException { // Create the worksheet and add the cells WritableSheet sheet = writableWorkbook.createSheet(sheetName, 99...
Create a Java method that does the following: "Create a worksheet with the specified name and columns and lines.".
Of course, here is the Java code you requested: ```java public Observable<ServerConnectionPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, ServerConnectionType connectionType) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, connectionType).map(new Fun...
Create a Java method that does the following: "Creates or updates a server s connection policy.".
Of course, here is the Java code you requested: ```java public static String collectReplacements(String orig, @ClosureParams(value=SimpleType.class, options="char") Closure<String> transform) { if (orig == null) return orig; StringBuilder sb = null; // lazy create for edge-case efficiency for ...
Create a Java method that does the following: "Collect replacements from a string.".
Of course, here is the Java code you requested: ```java public MethodPermissionType<AssemblyDescriptorType<T>> getOrCreateMethodPermission() { List<Node> nodeList = childNode.get("method-permission"); if (nodeList != null && nodeList.size() > 0) { return new MethodPermissionTypeImpl<Asse...
Create a Java method that does the following: "Gets the method - permission.".
Of course, here is the Java code you requested: ```java protected void addLineageSourceInfo(WorkUnit workUnit, State state) { if (!lineageInfo.isPresent()) { log.info("Lineage is not enabled"); return; } String platform = state.getProp(ConfigurationKeys.SOURCE_FILEBASED_PLATFORM, DatasetConsta...
Create a Java method that does the following: "Add the lineage source info to the lineageInfo".
Of course, here is the Java code you requested: ```java public long getTime() throws NotAvailableException { synchronized (timeSync) { try { if (!isRunning()) { throw new InvalidStateException("Stopwatch was never started!"); } if...
Create a Java method that does the following: "Gets the time in milliseconds.".
Of course, here is the Java code you requested: ```java private long guessIndex(int seqNo) { if (this.seqNum < 32768) { if (seqNo - this.seqNum > 32768) { guessedROC = roc - 1; } else { guessedROC = roc; } } else { if (seqNum - 32768 > seqNo) { guessedROC = roc + 1; } else { guessedR...
Create a Java method that does the following: "Returns the index of the ROC that corresponds to the sequence number.".
Of course, here is the Java code you requested: ```java public static <T> String join(Iterable<T> iterable, char separator, T... pieces) { StringBuilder sb = new StringBuilder(); for (T element: iterable) { sb.append(element != null ? element.toString() : "null").append(separator); ...
Create a Java method that does the following: "Join a sequence of objects into a single string.".
Of course, here is the Java code you requested: ```java public InputStream fetchExternalContent() { final URI uri = link.getUri(); final String scheme = uri.getScheme(); LOGGER.debug("scheme is {}", scheme); if (scheme != null) { try { if (scheme.equals("fil...
Create a Java method that does the following: "Fetch the external content from the link.".
Of course, here is the Java code you requested: ```java public static boolean sDTcompare(String t1, String t2) { // 将字符串形式的时间转化为Date类型的时间 Date d1 = parseq(DF_DATE_TIME, t1); Date d2 = parseq(DF_DATE_TIME, t2); // Date类的一个方法,如果a早于b返回true,否则返回false if (d1.before(d2)) ...
Create a Java method that does the following: "Compare two dates.".
Of course, here is the Java code you requested: ```java private static String getAddrInfo(InetAddress pAddr) throws SocketException { String ret = pAddr.getHostName() != null ? pAddr.getHostName() + " (" + pAddr.getHostAddress() + ")" : pAddr.getHostAddress(); ret += " [site-local: " + pAddr.isSiteLoca...
Create a Java method that does the following: "Get the address info for a given InetAddress.".
Of course, here is the Java code you requested: ```java public void writeHash(String id) { try (BufferedWriter fileWriter = Files.newBufferedWriter(baseDir.resolve(FILE_NAME), StandardCharsets.UTF_8)) { fileWriter.write(id); } catch (IOException ioException) { Log.errorLog(494461668, ioException, "Der Filmli...
Create a Java method that does the following: "Write a hash to the file.".
Of course, here is the Java code you requested: ```java private static void extractAndAddPackageInfo(ClassInfo classInfo, Set<String> packages, IndexView indexView) { if (classInfo == null) { return; } // Check if we were given an abstract class / interface, in which case we need t...
Create a Java method that does the following: "Extract and add package info.".
Of course, here is the Java code you requested: ```java boolean isDirEmpty(INode targetNode) { boolean dirNotEmpty = true; if (!(targetNode != null && targetNode.isDirectory())) { return true; } readLock(); try { assert targetNode != null : "should be taken care in isDir() above"; ...
Create a Java method that does the following: "Checks if the target node is empty.".
Of course, here is the Java code you requested: ```java @Override public void send(final CharSequence text) { final KeyCharacterMap characterMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD); long timeout = System.currentTimeMillis() + serverInstrumentation.getAndroidWait().ge...
Create a Java method that does the following: "Send text to the user.".
Of course, here is the Java code you requested: ```java protected boolean bindsHydrogen(IBond bond) { for (int i = 0; i < bond.getAtomCount(); i++) { IAtom atom = bond.getAtom(i); if ("H".equals(atom.getSymbol())) return true; } return false; } ``` Hope this helps!
Create a Java method that does the following: "Checks if the bond binds hydrogens.".
Of course, here is the Java code you requested: ```java public static ContentValues putAll(ContentValues target, Object... values) { int length = values.length; checkArgument(length % 2 == 0, "values length must be a multiple of two"); for (int i = 0; i < length; i += 2) { String ke...
Create a Java method that does the following: "Put all the content values in the array into the target ContentValues object.".
Of course, here is the Java code you requested: ```java @Override public long getUpdateTime(Table table) throws UpdateNotFoundException { try { return getUpdateTime(table.getDataLocation()); } catch (IOException e) { throw new UpdateNotFoundException(String.format("Failed to get update time for %...
Create a Java method that does the following: "Get the update time for a single table.".
Of course, here is the Java code you requested: ```java public static DateTime getDateFromParameter(final String _value) throws EFapsException { final StyleDateConverter styledate = new StyleDateConverter(false); final DateTimeFormatter fmt = DateTimeFormat.forPattern(styledate.getDatePatte...
Create a Java method that does the following: "Method to get a DateTime from a parameter.".
Of course, here is the Java code you requested: ```java @Override public EClass getServiceDescriptor() { if (serviceDescriptorEClass == null) { serviceDescriptorEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(56); } return serviceDescriptorEClass; }...
Create a Java method that does the following: "Returns the serviceDescriptorEClass property.".
Of course, here is the Java code you requested: ```java public void setJobsNotFound(java.util.Collection<String> jobsNotFound) { if (jobsNotFound == null) { this.jobsNotFound = null; return; } this.jobsNotFound = new java.util.ArrayList<String>(jobsNotFound); } ``` ...
Create a Java method that does the following: "Sets the value of the jobsNotFound property.".
Of course, here is the Java code you requested: ```java @Override public void onProgress(final StreamingProgressEvent event) { assertStateConsistency(fileUploadId, event.getFileName()); if (event.getBytesReceived() > maxSize || event.getContentLength() > maxSize) { LOG.error("User trie...
Create a Java method that does the following: "Upload progress event.".
Of course, here is the Java code you requested: ```java public static Map<String, Map<String, String>> getJournalStats( Collection<Journal> journals) { Map<String, Map<String, String>> stats = new HashMap<String, Map<String, String>>(); for (Journal j : journals) { try { Map<String, String>...
Create a Java method that does the following: "Get the Journal stats for a collection of journals".
Of course, here is the Java code you requested: ```java protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { inventory_status_responses result = (inventory_status_responses) service.get_payload_formatter().string_to_resource(inventory_status_responses.class,...
Create a Java method that does the following: "Use this API to fetch resources of given name.".
Of course, here is the Java code you requested: ```java @Override public void eUnset(int featureID) { switch (featureID) { case AfplibPackage.BDX__DMX_NAME: setDMXName(DMX_NAME_EDEFAULT); return; } super.eUnset(featureID); } ``` Hope this helps!
Create a Java method that does the following: "Set the value of the featureID to the default value.".
Of course, here is the Java code you requested: ```java public void addRelationToResource( CmsRequestContext context, CmsResource resource, CmsResource target, CmsRelationType type, boolean importCase) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getD...
Create a Java method that does the following: "Adds a relation to a resource.".
Of course, here is the Java code you requested: ```java @Override public void removeByC_A(long commerceCountryId, boolean active) { for (CommerceRegion commerceRegion : findByC_A(commerceCountryId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceRegion); } } ``` Hope this helps!
Create a Java method that does the following: "Removes all the commerce regions in the database where C_A = active.".
Of course, here is the Java code you requested: ```java public DynamicType.Builder<?> subclass(Type superType) { return subclass(TypeDefinition.Sort.describe(superType)); } ``` Hope this helps!
Create a Java method that does the following: "Create a subclass of this type with the given super type.".