📄 localdisk.java
字号:
package org.jutil.io.fileset;import java.util.Arrays;import java.util.List;import java.util.ArrayList;import java.io.File;import org.jutil.predicate.Predicate;import org.jutil.predicate.True;/** * <p>A file predicate that includes all files on local disks.<p> * * <p>Think twice before using this, traversing the entire filesystem * isn't worlds most efficient operation.</p> * * <center> * <img src="doc-files/LocalDisk.png"/> * </center> * * @path $Source: /cvsroot/org-jutil/jutil.org/src/org/jutil/io/fileset/LocalDisk.java,v $ * @version $Revision: 1.4 $ * @date $Date: 2002/09/08 14:47:11 $ * @state $State: Exp $ * @author Marko van Dooren * @release $Name: $ */public class LocalDisk extends FilePredicate implements FileSetPredicate { /** * Initialize a new LocalDisk. */ /*@ @ public behavior @ @ post getPredicate().equals(new True()); @*/ public LocalDisk() { this(new True()); } /** * Initialize a new LocalDisk. */ /*@ @ public behavior @ @ post getPredicate().equals(new True()); @*/ public LocalDisk(Predicate predicate) { _support = new FileSetPredicateSupport(predicate); } /*@ @ also public behavior @ @ // All files are on a local disk @ post \result == (file != null); @*/ public boolean evalFile(File file) { return (file != null); } /*@ @ also public behavior @ @ post \fresh(\result); @ post (\forall Object o; \result.contains(o); @ o instanceof File); @ post \result.size() == Arrays.asList(File.listRoots()).size(); @ post \result.containsAll(Arrays.asList(File.listRoots())); @*/ public List suggestDirectories() { return new ArrayList(Arrays.asList(File.listRoots())); } /*@ @ also public behavior @ @ post \result == true; @*/ public boolean enterDirectory(File directory) { return true; } /*@ @ also public behavior @ @ post \result == 1; @*/ public int nbSubPredicates() { return _support.nbSubPredicates(); } /*@ @ also public behavior @ @ post \result.contains(getPredicate()); @ post \result.size() == 1; @*/ public List getSubPredicates() { return _support.getSubPredicates(); } /*@ @ public behavior @ @ post \result != null; @*/ public Predicate getPredicate() { return _support.getPredicate(); } private FileSetPredicateSupport _support;}/* * <copyright>Copyright (C) 1997-2002. This software is copyrighted by * the people and entities mentioned after the "@author" tags above, on * behalf of the JUTIL.ORG Project. The copyright is dated by the dates * after the "@date" tags above. All rights reserved. * This software is published under the terms of the JUTIL.ORG Software * License version 1.1 or later, a copy of which has been included with * this distribution in the LICENSE file, which can also be found at * http://org-jutil.sourceforge.net/LICENSE. This software is distributed * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the JUTIL.ORG Software License for more details. For more information, * please see http://org-jutil.sourceforge.net/</copyright> */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -