code
stringlengths
146
466k
prompt
stringlengths
54
1.5k
Of course, here is the Java code you requested: ```java public static <N> Literal.UriLiteral<N> Literal(final URI value) { return new Literal.UriLiteral<>(value); } ``` Hope this helps!
Create a Java method that does the following: "Create a Literal from a URI.".
Of course, here is the Java code you requested: ```java public static QName QName(String namespaceURI, String localPart, String prefix) { return new QName(namespaceURI, localPart, prefix); } ``` Hope this helps!
Create a Java method that does the following: "Create a QName from a namespace URI and local part and prefix.".
Of course, here is the Java code you requested: ```java public static void main( String[] args ) throws Exception { System.out.println("SBOL 1 example"); write(new OutputStreamWriter(System.out), DataTreeCreator.makeDocument()); System.out.println(); System.out.println("-----------------------------...
Create a Java method that does the following: "This is the main method of the class.".
Of course, here is the Java code you requested: ```java public void init(final FilterConfig filterConfig) throws ServletException { // Get the init params Properties props = getFilterInitParameters(filterConfig); // Extract and parse all required CORS filter properties try { config = new CORSConfigu...
Create a Java method that does the following: "Initialize the servlet with the specified filter configuration.".
Of course, here is the Java code you requested: ```java private void printMessage(final HttpServletResponse response, final int sc, final String msg) throws IOException, ServletException { // Set the status code response.setStatus(sc); // Write the error message response.resetBuffer(); respon...
Create a Java method that does the following: "Print the error message to the response.".
Of course, here is the Java code you requested: ```java private void doFilter(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws IOException, ServletException { // Tag handler.tagRequest(request); CORSRequestType type = CORSRequestType.detect(request); ...
Create a Java method that does the following: "Handle the HTTP request.".
Of course, here is the Java code you requested: ```java public void created(final UUID createdByEntityId) { if (this.entityId != null) { throw new IllegalStateException("This entity has already been created: entityId = " + entityId); } this.entityId = UUID.randomUUID(); this.entityVersion = 1; this.create...
Create a Java method that does the following: "Sets the entity to be created.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("incomplete-switch") @Override public void init(InputStream json) throws IOException { try (final JsonParser parser = JsonUtils.createJsonParser(json)) { JsonToken tk; while ((tk = parser.nextToken()) != null) { switch (tk) { c...
Create a Java method that does the following: "Initializes the object from the given JSON stream.".
Of course, here is the Java code you requested: ```java protected void init(JsonParser parser) throws IOException { LoggerFactory.getLogger(getClass()).warn("init(JsonParser parser) invoked to handle field: {}", parser.getCurrentName()); } ``` Hope this helps!
Create a Java method that does the following: "Initialize the field.".
Of course, here is the Java code you requested: ```java private Collection<DuplicateCode> convert(final List<Duplication> duplications, final String moduleName) { List<DuplicateCode> annotations = new ArrayList<DuplicateCode>(); for (Duplication duplication : duplications) { List<Duplicate...
Create a Java method that does the following: "Convert a list of duplications to a collection of DuplicateCode objects.".
Of course, here is the Java code you requested: ```java @Override public void registerService(ISemanticLocator packedServiceDescriptor) throws ServiceExecutionException { try { BSDFLogger.getLogger().info("Deploys service(s) from: " + packedServiceDescriptor.toString()); ...
Create a Java method that does the following: "Register a single service from the given packed service descriptor.".
Of course, here is the Java code you requested: ```java @Transactional protected HashServiceConfiguration hashServiceConfiguration() { Exception exception = null; for (int i = 0; i < 3; i++) { final HashServiceConfiguration config = hashServiceConfigurationDAO.findByName(getHashServiceConfigurationName()); ...
Create a Java method that does the following: "Returns the hash service configuration.".
Of course, here is the Java code you requested: ```java public void close( int port ) { for (Iterator i = _listeners.keySet().iterator(); i.hasNext(); ) { Object k = i.next(); Object s = _listeners.get(k); if (s instanceof SocketHandler) { SocketHandler sh = (SocketHandler)s; if (...
Create a Java method that does the following: "Close all SocketHandlers on the specified port.".
Of course, here is the Java code you requested: ```java public void subscribe( String name, Listener listener, Map headers ) { synchronized (_listeners) { if (listener != null) { List list = (List)_listeners.get( name ); if (list == null) { list = new ArrayList(); _listen...
Create a Java method that does the following: "Subscribe to a single resource.".
Of course, here is the Java code you requested: ```java public void unsubscribe( String name, Listener l ) { synchronized (_listeners) { List list = (List)_listeners.get( name ); if (list != null) { list.remove( l ); if (list.size() == 0) { unsubscribe( name ); } ...
Create a Java method that does the following: "Unsubscribe a single listener from a source.".
Of course, here is the Java code you requested: ```java public void unsubscribe( String name, Map header ) { if (header == null) header = new HashMap(); synchronized( _listeners ) { _listeners.remove( name ); } header.put( "destination", name ); transmit( Command.UNSUBSCRIBE, header ); } ``` Hope th...
Create a Java method that does the following: "Unsubscribe a service from a service.".
Of course, here is the Java code you requested: ```java public void unsubscribeW( String name, Map header ) throws InterruptedException { String receipt = addReceipt( header ); unsubscribe( name, (HashMap)null ); waitOnReceipt( receipt ); } ``` Hope this helps!
Create a Java method that does the following: "Unsubscribe from a name and header.".
Of course, here is the Java code you requested: ```java public void sendW( String dest, String mesg ) throws InterruptedException { sendW( dest, mesg, null ); } ``` Hope this helps!
Create a Java method that does the following: "Send a message to a destination.".
Of course, here is the Java code you requested: ```java public void send( String dest, String mesg, Map header ) { if (header == null) header = new HashMap(); header.put( "destination", dest ); transmit( Command.SEND, header, mesg ); } ``` Hope this helps!
Create a Java method that does the following: "Send message to a destination.".
Of course, here is the Java code you requested: ```java public void clearReceipt( String receipt_id ) { synchronized( _receipts ) { for (Iterator i=_receipts.iterator(); i.hasNext();) { String o = (String)i.next(); if (o.equals(receipt_id)) i.remove(); } } } ``` Hope this helps!
Create a Java method that does the following: "Clear the receipt from the list of all the records.".
Of course, here is the Java code you requested: ```java protected Priority getPriority(final int lines) { if (lines >= highThreshold) { return Priority.HIGH; } else if (lines >= normalThreshold) { return Priority.NORMAL; } else { return Priori...
Create a Java method that does the following: "Get the priority of a record set.".
Of course, here is the Java code you requested: ```java public String getSuffix() { String s = host; if (port != -1) s = s + ":" + port; return s; } ``` Hope this helps!
Create a Java method that does the following: "Get the suffix of the URI.".
Of course, here is the Java code you requested: ```java public MavenAggregatedReport createAggregatedAction(final MavenModuleSetBuild build, final Map<MavenModule, List<MavenBuild>> moduleBuilds) { return new DryMavenResultAction(build, getHealthDescriptor(), getDefaultEncoding(), new DryResu...
Create a Java method that does the following: "Create aggregated report.".
Of course, here is the Java code you requested: ```java @Override public String loadFile(final URI fileUri) { try { final URL urlLocation = Resources.getResource(this.getClass(), fileUri.getPath()); return Resources.toString(urlLocation, Charsets.UTF_8); } catch ...
Create a Java method that does the following: "Load a single file from the resource directory.".
Of course, here is the Java code you requested: ```java @Override public String loadFile(final URI fileUri) throws IOException { final File fileLocation = new File(fileUri); if (fileLocation.exists() && fileLocation.canRead()) { if (fileLocation.isFile()) { return Fi...
Create a Java method that does the following: "Load a single file from the base directory.".
Of course, here is the Java code you requested: ```java public synchronized void receiveMessagesSyncronously(long ms) throws ServiceGroundingException { for (IChannelConsumer chConsumer : this.serviceChannelConsumers) { if (chConsumer instanceof AbstractJMSChannelConsumer) {...
Create a Java method that does the following: "Receives messages from the server asynchronously.".
Of course, here is the Java code you requested: ```java protected static String formatCanonical(final String name) { String nameTrimmed = name.trim(); if (nameTrimmed.isEmpty()) throw new IllegalArgumentException("The header field name must not be an empty string"); // Check for valid syntax: must begi...
Create a Java method that does the following: "Format a name to be canonical.".
Of course, here is the Java code you requested: ```java public boolean setOptions(String[] options) throws Exception { ArgumentParser parser; Namespace ns; parser = ArgumentParsers.newArgumentParser(MinDeps.class.getName()); parser.addArgument("--java-home") .type(Arguments.fileType().verifyExis...
Create a Java method that does the following: "Sets the options.".
Of course, here is the Java code you requested: ```java protected String check() { String error; if (!m_JavaHome.exists()) return "Java home directory does not exist: " + m_JavaHome; if (!m_JavaHome.isDirectory()) return "Java home does not point to a directory: " + m_JavaHome; if (System...
Create a Java method that does the following: "Check if the contents of the classes file and resources file are valid.".
Of course, here is the Java code you requested: ```java protected String packagesRegExp() { StringBuilder result; int i; String pkg; result = new StringBuilder(); result.append(".* ("); for (i = 0; i < m_Packages.size(); i++) { if (i > 0) result.append("|"); pkg = m_Pack...
Create a Java method that does the following: "Returns a regular expression for the packages.".
Of course, here is the Java code you requested: ```java public String execute() { String result; initialize(); result = check(); if (result == null) result = determine(); if (result == null) { m_Dependencies = new ArrayList<>(); m_Dependencies.addAll(m_Classes); for (St...
Create a Java method that does the following: "Execute the CRT.".
Of course, here is the Java code you requested: ```java @Override public int compareTo(InstanceProvider instanceProvider) { if (this.getPriority().equals(instanceProvider.getPriority())) { return this.getName().compareTo(instanceProvider.getName()); } else { return this.getPriority().compareTo(in...
Create a Java method that does the following: "Compare to another instance provider.".
Of course, here is the Java code you requested: ```java public static IOUtils getIOUtils() { if (ioUtils == null) { try { Class clazz = Class.forName(IO_UTILS); ioUtils = (IOUtils) clazz.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) ...
Create a Java method that does the following: "Get the IOUtils object.".
Of course, here is the Java code you requested: ```java public static ImageUtils getImageUtils() { if (imageUtils == null) { try { Class clazz = Class.forName(IMAGE_UTILS); imageUtils = (ImageUtils) clazz.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalA...
Create a Java method that does the following: "Get the ImageUtils object.".
Of course, here is the Java code you requested: ```java public static PriceUtils getPriceUtils() { if (priceUtils == null) { try { Class clazz = Class.forName(PRICE_UTILS); priceUtils = (PriceUtils) clazz.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalA...
Create a Java method that does the following: "Get the price util object".
Of course, here is the Java code you requested: ```java public static ZipUtils getZipUtils() { if (zipUtils == null) { try { Class clazz = Class.forName(ZIP_UTILS); zipUtils = (ZipUtils) clazz.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessExcepti...
Create a Java method that does the following: "Get the ZipUtils object.".
Of course, here is the Java code you requested: ```java public static ResourceService getResourceService() { if (resourceService == null) { try { Class clazz = Class.forName(RESOURCE_SERVICE); resourceService = (ResourceService) clazz.newInstance(); } catch (ClassNotFoundException | Ins...
Create a Java method that does the following: "Get the resource service.".
Of course, here is the Java code you requested: ```java public static InstanceService getInstanceService() { if (instanceService == null) { try { Class clazz = Class.forName(INSTANCE_SERVICE); instanceService = (InstanceService) clazz.newInstance(); } catch (ClassNotFoundException | Ins...
Create a Java method that does the following: "Get the instance service.".
Of course, here is the Java code you requested: ```java public IoWriter<QName> createIoWriter(final XMLStreamWriter writer) { return new IoWriter<QName>() { @Override public void write(DocumentRoot<QName> document) throws CoreIoException { try { writer.writeStartDoc...
Create a Java method that does the following: "Create an IoWriter for the specification.".
Of course, here is the Java code you requested: ```java public IoReader<QName> createIoReader(final XMLStreamReader xmlReader) throws XMLStreamException { return new IoReader<QName>() { @Override public DocumentRoot<QName> read () throws CoreIoException { try { while ...
Create a Java method that does the following: "Create an IoReader for the XML file.".
Of course, here is the Java code you requested: ```java @ManagedOperation( description = "Sets the policy governing whether core threads may time out and terminate if no tasks arrive within the keep-alive time, being replaced if needed when new tasks arrive.") @ManagedOperationParameters({ @ManagedOperationP...
Create a Java method that does the following: "Sets the policy that allows core threads to time out.".
Of course, here is the Java code you requested: ```java @Override @ManagedOperation(description = "Sets the time limit in seconds for which threads may remain idle before being terminated.") @ManagedOperationParameters({ @ManagedOperationParameter(name = "time", description = "the time in seconds to wait. A...
Create a Java method that does the following: "Sets the time limit in seconds for the idle threads to wait before being terminated.".
Of course, here is the Java code you requested: ```java @Override public void init() throws HarvesterException { forceLocalStorage = getJsonConfig().getBoolean(true, "harvester", "workflow-harvester", "force-storage"); forceUpdate = getJsonConfig().getBoolean(false, ...
Create a Java method that does the following: "Initialize the Harvester instance.".
Of course, here is the Java code you requested: ```java @Override public Set<String> getObjectId(File uploadedFile) throws HarvesterException { Set<String> objectIds = new HashSet<String>(); try { objectIds.add(createDigitalObject(uploadedFile)); } catch (StorageException se) { ...
Create a Java method that does the following: "Get the object id from the file.".
Of course, here is the Java code you requested: ```java private void storeList(Properties props, Map<String, List<String>> details, String field) { Set<String> valueSet = new LinkedHashSet<String>(); // merge with original property value if exists String currentValue = props.getProp...
Create a Java method that does the following: "Store list of a single entry in the properties.".
Of course, here is the Java code you requested: ```java public FormValidation doCheckHighThreshold(@QueryParameter final String highThreshold, @QueryParameter final String normalThreshold) { return VALIDATION.validateHigh(highThreshold, normalThreshold); } ``` Hope this helps!
Create a Java method that does the following: "Check if the given parameters are high or normal.".
Of course, here is the Java code you requested: ```java private Object createDrySourceDetail(final AbstractBuild<?, ?> owner, final AnnotationContainer container, final String defaultEncoding, final String fromString, final String toString) { long from = Long.parseLong(fromString); ...
Create a Java method that does the following: "Create a Dry Source Detail object.".
Of course, here is the Java code you requested: ```java public Collection<FileAnnotation> parse(final File file, final String moduleName) throws InvocationTargetException { String oldProperty = System.getProperty(SAX_DRIVER_PROPERTY); if (oldProperty != null) { System.setProperty(SAX_DRIVER...
Create a Java method that does the following: "Parses the given file and returns a collection of duplicate code annotations.".
Of course, here is the Java code you requested: ```java private void createLinkNames(final Collection<DuplicateCode> result) { if (workspacePath != null) { for (FileAnnotation duplication : result) { duplication.setPathName(workspacePath); } } } ``` Hope thi...
Create a Java method that does the following: "Create link names.".
Of course, here is the Java code you requested: ```java public Resource createCommandResourceWadl() { final Resource resource = new Resource(); resource.setPath(getName()); final Method method = new Method(); method.setName("POST"); resource.getMethodOrResource().add(method); definePostMethodWadl(method)...
Create a Java method that does the following: "Create a command resource wadl.".
Of course, here is the Java code you requested: ```java public static <T, D> List<IHandler<T, D>> scan() throws Exception { return scan(false); } ``` Hope this helps!
Create a Java method that does the following: "Scans the database for handlers.".
Of course, here is the Java code you requested: ```java @Override public String loadFile(final URI fileUri) throws IOException { return Resources.toString(fileUri.toURL(), charset); } ``` Hope this helps!
Create a Java method that does the following: "Load a single file from the file system.".
Of course, here is the Java code you requested: ```java static boolean onClasspath(String className) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { cl.loadClass(className); } catch (ClassNotFoundException e) { return false; } ret...
Create a Java method that does the following: "On classpath.".
Of course, here is the Java code you requested: ```java public FormValidation doCheckNormalThreshold(@QueryParameter final String highThreshold, @QueryParameter final String normalThreshold) { return THRESHOLD_VALIDATION.validateNormal(highThreshold, normalThreshold); } ``` Hope this helps!
Create a Java method that does the following: "Check the normal threshold.".
Of course, here is the Java code you requested: ```java public boolean accept(final URI uri) { for (final MigrationLoader loader : loaders) { if (loader.accept(uri)) { return true; } } return false; } ``` Hope this helps!
Create a Java method that does the following: "Check if the uri is a Crazil language or a Crazil language.".
Of course, here is the Java code you requested: ```java private void readCommands() { try { final Enumeration<URL> urls = Thread.currentThread().getContextClassLoader() .getResources(XmlCommands.FILEPATH); while (urls.hasMoreElements()) { URL url...
Create a Java method that does the following: "Reads commands from the XML file.".
Of course, here is the Java code you requested: ```java protected void postProcess(final String target, final Request baseRequest, final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { // NOOP } ``` Hope this helps!
Create a Java method that does the following: "Post processing of the URL.".
Of course, here is the Java code you requested: ```java public Map<String, ValidationResult> dbValidate(final Collection<String> personalities, final MigratoryOption ... options) throws MigratoryException { init(); final InternalValidator validator = new InternalValidator(this); return vali...
Create a Java method that does the following: "Validate a collection of personalities.".
Of course, here is the Java code you requested: ```java public void dbClean(final MigratoryOption ... options) { init(); final InternalClean internalClean = new InternalClean(this); internalClean.clean(options); } ``` Hope this helps!
Create a Java method that does the following: "Clean all data in the database.".
Of course, here is the Java code you requested: ```java public Map<String, StatusResult> dbStatus(final Collection<String> personalities, final MigratoryOption ... options) { init(); final InternalStatus internalStatus = new InternalStatus(this); return internalStatus.status(personalities, ...
Create a Java method that does the following: "Get the status of the database.".
Of course, here is the Java code you requested: ```java public Migratory addDbSupport(final String dbName, final Class<? extends DbSupport> dbSupport) { if (initialized) { throw new MigratoryException(Reason.INIT, "Already initialized!"); } dbSupportFactory.addDbSupport(dbName, ...
Create a Java method that does the following: "Add a db support class.".
Of course, here is the Java code you requested: ```java public final boolean isAllowedSubdomainOrigin(final Origin origin) { try { ValidatedOrigin validatedOrigin = origin.validate(); String scheme = validatedOrigin.getScheme(); String suffix = validatedOrigin.getSuffix(); for (ValidatedOrigin...
Create a Java method that does the following: "Checks if the given origin is allowed in the domain.".
Of course, here is the Java code you requested: ```java protected static String[] parseWords(final String s) { String s1 = s.trim(); if (s1.isEmpty()) return new String[]{}; else return s1.split("\\s*,\\s*|\\s+"); } ``` Hope this helps!
Create a Java method that does the following: "Parses the given string into an array of words.".
Of course, here is the Java code you requested: ```java List<SqlStatement> linesToStatements(List<String> lines) { final List<SqlStatement> statements = Lists.newArrayList(); final StringBuilder statementSql = new StringBuilder(); int count = 0; String delimiter = DEFAULT_STATEMENT...
Create a Java method that does the following: "Converts a list of lines to SQL statements.".
Of course, here is the Java code you requested: ```java @Programmatic public List<NotableLink> findByNotable(final Object notable) { if(notable == null) { return null; } final Bookmark bookmark = bookmarkService.bookmarkFor(notable); if(bookmark == null) { re...
Create a Java method that does the following: "Find by notable.".
Of course, here is the Java code you requested: ```java @Programmatic public List<NotableLink> findByNotableInDateRange( final Object notable, final LocalDate startDate, final LocalDate endDate) { if(notable == null) { return null; } final Boo...
Create a Java method that does the following: "Find by notable in date range.".
Of course, here is the Java code you requested: ```java @Programmatic public NotableLink createLink( final Note note, final Object notable) { final Class<? extends NotableLink> subtype = subtypeClassFor(notable); final NotableLink link = repositoryService.instantiate(subty...
Create a Java method that does the following: "Create a NotableLink object.".
Of course, here is the Java code you requested: ```java @Programmatic public void updateLink(final Note note) { final NotableLink link = findByNote(note); sync(note, link); } ``` Hope this helps!
Create a Java method that does the following: "Update a NotableLink.".
Of course, here is the Java code you requested: ```java public void transmit( Command c, Map h, String b ) { _server.receive( c, h, b, this ); } ``` Hope this helps!
Create a Java method that does the following: "Transmit a command to the server.".
Of course, here is the Java code you requested: ```java @Programmatic public List<Note> findByNotable(final Object notable) { final List<NotableLink> links = linkRepository.findByNotable(notable); return Lists.newArrayList( Iterables.transform(links, NotableLink.Functions.note())); ...
Create a Java method that does the following: "Find by notable.".
Of course, here is the Java code you requested: ```java @Programmatic public Note findByNotableAndCalendarName( final Object notable, final String calendarName) { final NotableLink link = linkRepository .findByNotableAndCalendarName(notable, calendarName); re...
Create a Java method that does the following: "Find by notable and calendar name.".
Of course, here is the Java code you requested: ```java @Programmatic public Note add( final Object notable, final String noteText, final LocalDate date, final String calendarName) { final Note note = repositoryService.instantiate(Note.class); note.se...
Create a Java method that does the following: "Add a new note to the database.".
Of course, here is the Java code you requested: ```java public String getFormattedSourceCode() { try { JavaSource source = new JavaSourceParser().parse(new StringReader(sourceCode)); JavaSource2HTMLConverter converter = new JavaSource2HTMLConverter(); StringWriter writer = n...
Create a Java method that does the following: "Get the formatted source code.".
Of course, here is the Java code you requested: ```java public void transmit( Command c, Map h, String b ) { try { Transmitter.transmit( c, h, b, _output ); } catch (Exception e) { receive( Command.ERROR, null, e.getMessage() ); } } ``` Hope this helps!
Create a Java method that does the following: "Transmit a command to the server.".
Of course, here is the Java code you requested: ```java public static JAXBContext get(final String contextPath) { Assert.hasText(contextPath, "contextPath is required"); JAXBContext ctx = jaxbContexts.get(contextPath); if (ctx == null) { try { ctx = JAXBContext.newInstance(contextPath); } catch (final ...
Create a Java method that does the following: "Get a JAXBContext for the given context path.".
Of course, here is the Java code you requested: ```java public static void main(String[] args) { if (args.length < 1) throw new IllegalArgumentException("You must specify a job id"); String jobId = args[0]; RmiProxyFactoryBean factoryBean = new RmiProxyFactoryBean(); factory...
Create a Java method that does the following: "Main method for the application.".
Of course, here is the Java code you requested: ```java protected BoxNode buildTree(ElementBox rootbox) { //create the working list of nodes log.trace("LIST"); Vector<BoxNode> boxlist = new Vector<BoxNode>(); order_counter = 1; createBoxList(rootbox, boxlist); ...
Create a Java method that does the following: "Build the tree of the element box.".
Of course, here is the Java code you requested: ```java private List<URL> loadList(String filename) { List<URL> ret = new ArrayList<URL>(); try { BufferedReader read = new BufferedReader(new FileReader(filename)); String line; while ((line = read.readLine...
Create a Java method that does the following: "Load a list of URL from a file.".
Of course, here is the Java code you requested: ```java protected void copyFile(File artifact, File dest, File prevent) throws IOException, MojoExecutionException { if (dest.exists()) { if (prevent.exists()) //noinspection ResultOfMethodCallIgnored prevent.delete(); ...
Create a Java method that does the following: "Copy file.".
Of course, here is the Java code you requested: ```java private String interpolate(String content, Map<String, Object> replaces, char mode) { Pattern pattern = mode == 'A' ? INTERPOLATE_PTN_A : INTERPOLATE_PTN_B; Matcher m = pattern.matcher(content); StringBuffer sb = new StringBuffer(); ...
Create a Java method that does the following: "Interpolate the content with the replaces map.".
Of course, here is the Java code you requested: ```java public void setMappingFile(URL url, String realFile){ if (componentFiles == null) initFastIndexes("app", "lib", "repository"); File file = new File(realFile); componentFiles.put(url.getFile(), file); } ``` Hope this helps!
Create a Java method that does the following: "Set the mapping file for the specified URL.".
Of course, here is the Java code you requested: ```java public File getMappingFile(URL url) throws IOException { if (componentFiles == null) initFastIndexes("app", "lib", "repository"); String fileName = FilenameUtils.normalize(url.getFile(), true); if( !fileName.endsWith(".jar") ) fileName = f...
Create a Java method that does the following: "Get the mapping file for the given URL.".
Of course, here is the Java code you requested: ```java public boolean accept(Versionize componentOrDependency) { boolean accept = getGroupId().equals(componentOrDependency.getGroupId()) && getArtifactId().equals(componentOrDependency.getArtifactId()); if (!accept) return false...
Create a Java method that does the following: "Check if the component is a versionize component.".
Of course, here is the Java code you requested: ```java public final void parseVersion( String version ) { unparsed = version; int index = version.indexOf( "-" ); String part1; String part2 = null; if ( index < 0 ) { part1 = version; } ...
Create a Java method that does the following: "Parses the version string.".
Of course, here is the Java code you requested: ```java @Override public InputStream getInputStream(String relativePath) throws IOException { File file = new File(folder, relativePath); if( !file.exists() ) { String msg = String.format("Can't find any file with rela...
Create a Java method that does the following: "Get an InputStream for a file with the specified relative path.".
Of course, here is the Java code you requested: ```java public boolean isIndexed() { if( indexes == null ){ InputStream stream = null; try { stream = getInputStream("META-INF/INDEX.DETAIL"); List<String> lines = IOUtils.readLines(stream); ...
Create a Java method that does the following: "isIndexed returns true if the class is indexed.".
Of course, here is the Java code you requested: ```java @Override public AppLauncher createLauncher(Component component) throws IOException { AppLauncher launcher = new AppLauncher(component, this); //配置 class world this.loader = createLoader(component); this.context = (ComponentCon...
Create a Java method that does the following: "Create launcher.".
Of course, here is the Java code you requested: ```java @Override public Component resolveComponent(Dependency dependency) throws InvalidComponentNameException, DependencyNotMeetException { List<Component> meets = resolveComponents(dependency); if (meets.isEmpty()) { Set<Dep...
Create a Java method that does the following: "Resolves a component from the current repository.".
Of course, here is the Java code you requested: ```java @Override public List<Component> resolveComponents(Dependency dependency) { logger.trace("Finding {}", dependency); List<Component> meets = new ArrayList<Component>(); for (Component component : components) { if (dependen...
Create a Java method that does the following: "Resolves the components that are accepted by the specified dependency.".
Of course, here is the Java code you requested: ```java @Override public void sortComponents(List<Component> components) { //将组件集合之间的依赖关系以map的形式展现出来 Map<Component, Set<Component>> dependencies = dependsMap(components); //清空待排序的components,用于做结果的容器 components.clear(); //基于依赖关系...
Create a Java method that does the following: "Sort the components.".
Of course, here is the Java code you requested: ```java @Override public void addComponent(Component component) { logger.debug("Register {} into repository", component); components.add(component); } ``` Hope this helps!
Create a Java method that does the following: "Register a new component into the repository.".
Of course, here is the Java code you requested: ```java public BoxTransform concatenate(BoxTransform src) { if (src.isEmpty()) return this; else if (this.isEmpty()) return src; else { BoxTransform ret = new BoxTransform(this); ret.tran...
Create a Java method that does the following: "Concatenate two BoxTransform objects.".
Of course, here is the Java code you requested: ```java public Rectangular transformRect(Rectangular rect) { if (transform != null) { Rectangle src = new Rectangle(rect.getX1(), rect.getY1(), rect.getWidth(), rect.getHeight()); Shape dest = transform.createTransformedShape(s...
Create a Java method that does the following: "Transform a rectangular object to a single object.".
Of course, here is the Java code you requested: ```java protected AbstractApplicationContext resolveByXml(Component component, ApplicationContext parent) { XmlComponentApplicationContext context = new XmlComponentApplicationContext(component, parent); ...
Create a Java method that does the following: "Resolves the application context by xml.".
Of course, here is the Java code you requested: ```java private Rectangular getMinimalVisualBounds() { final Box box = getBox(); if (box instanceof TextBox) return new RectangularZ(box.getAbsoluteBounds().intersection(box.getClipBlock().getClippedContentBounds()), zoom); else if...
Create a Java method that does the following: "Get minimal visual bounds of the image.".
Of course, here is the Java code you requested: ```java public void recomputeBounds() { bounds = new Rectangular(visual); for (int i = 0; i < getChildCount(); i++) { BoxNode child = (BoxNode) getChildAt(i); child.recomputeBounds(); expandToEnclose(child);...
Create a Java method that does the following: "Recompute the bounds of the image.".
Of course, here is the Java code you requested: ```java @Override public int getLeftBorder() { Box box = getBox(); if (box instanceof ElementBox) return ((ElementBox) box).getBorder().left; else return 0; } ``` Hope this helps!
Create a Java method that does the following: "Gets the left border of the element box.".
Of course, here is the Java code you requested: ```java @Override public int getRightBorder() { Box box = getBox(); if (box instanceof ElementBox) return ((ElementBox) box).getBorder().right; else return 0; } ``` Hope this helps!
Create a Java method that does the following: "Get the right border of the element box.".
Of course, here is the Java code you requested: ```java public boolean visuallyEncloses(BoxNode childNode) { int cx1 = childNode.getVisualBounds().getX1(); int cy1 = childNode.getVisualBounds().getY1(); int cx2 = childNode.getVisualBounds().getX2(); int cy2 = childNode.getVisualBoun...
Create a Java method that does the following: "visuallyEncloses the box node.".
Of course, here is the Java code you requested: ```java public void markNodesInside(Vector<BoxNode> list, boolean full) { for (Iterator<BoxNode> it = list.iterator(); it.hasNext();) { BoxNode node = it.next(); if (full) { if (node != this ...
Create a Java method that does the following: "Mark the nodes inside of this page.".