/** * Retrieve the last element of this path. * * @return <code>None</code> iff this path is empty. */ public OptionType<String> getBaseName() { if (this.names.isEmpty() == false) { final String x = this.names.get(this.names.size() - 1); assert x != null; return Option.some(x); } return Option.none(); }
@Override public <U> OptionType<U> map( final FunctionType<T, U> f) { NullCheck.notNull(f, "Function"); return Option.of(f.call(this.x)); }
Option.some((SASegmentNumber) number); container.appendChild(this.navigationBar( link_provider,
Option.some((SASegmentNumber) number); container.appendChild(this.navigationBar(link_provider, doc, some, true));
ArchiveZipReference( final Archive<ArchiveZipKind> in_archive, final PathVirtual in_path, final Type in_type, final @Nullable ZipEntry actual) throws FilesystemError { super(in_archive, in_path, in_type); if (actual == null) { if (in_path.isRoot() == false) { throw new FilesystemError( Code.FS_ERROR_CONSTRAINT_ERROR, "Path must be root for null zip entry"); } this.zip_entry_opt = Option.none(); } else { this.zip_entry_opt = Option.some(actual); } }
@Override public <U, E extends Throwable> OptionType<U> mapPartial( final PartialFunctionType<T, U, E> f) throws E { NullCheck.notNull(f, "Function"); return Option.of(f.call(this.x)); }
private static XMLInserts loadXMLInserts( final CommandLine line) throws ValidityException, ParsingException, IOException { final OptionType<Element> start; if (line.hasOption(JSCMain.OPT_XHTML_BODY_START)) { final File file = new File(line.getOptionValue(JSCMain.OPT_XHTML_BODY_START)); final Builder b = new Builder(); final Document d = b.build(file); start = com.io7m.jfunctional.Option.some(d.getRootElement()); } else { start = com.io7m.jfunctional.Option.none(); } final OptionType<Element> end; if (line.hasOption(JSCMain.OPT_XHTML_BODY_END)) { final File file = new File(line.getOptionValue(JSCMain.OPT_XHTML_BODY_END)); final Builder b = new Builder(); final Document d = b.build(file); end = com.io7m.jfunctional.Option.some(d.getRootElement()); } else { end = com.io7m.jfunctional.Option.none(); } return new XMLInserts(start, end); }
private Filesystem( final LogUsableType in_log, final @Nullable PathReal in_archives) { this.log = NullCheck.notNull(in_log, "Log").with("filesystem"); this.log_directory = this.log.with("directory"); this.log_mount = this.log.with("mount"); this.log_lookup = this.log.with("lookup"); this.archives = Option.of(in_archives); this.handlers = new ArrayList<ArchiveHandler<?>>(); this.handlers.add(new ArchiveDirectoryHandler()); this.handlers.add(new ArchiveZipHandler()); this.archive_list = new LinkedList<Archive<?>>(); this.directories = new HashMap<PathVirtual, Calendar>(); this.directories.put(PathVirtual.ROOT, Filesystem.getUTCTimeNow()); this.time_updates = new HashMap<PathVirtual, UpdateTimeEntry>(); }