public class BasenameList extends Object
Constructor and Description |
---|
BasenameList()
Default constructor for an empty list.
|
BasenameList(String fileName)
This constructor loads the basename list from a random access file.
|
BasenameList(String[] str)
Constructor from an array of strings.
|
BasenameList(String dirName,
String extension)
This constructor lists the .
|
BasenameList(String setFromDir,
String setFromExt,
Vector setVec)
Default constructor from an existing vector and fields.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String str)
Adds a basename to the list.
|
void |
add(String[] str)
Adds an array of basenames to the list.
|
void |
clear()
Clear the list.
|
boolean |
contains(BasenameList bnl)
Check if the list contains another given one.
|
boolean |
contains(String str)
Check if the given basename is part of the list.
|
BasenameList |
duplicate()
Duplicates the list (i.e., emits an autonomous copy of it).
|
boolean |
equals(BasenameList bnl)
Check if two lists are equal.
|
String |
getDir()
An accessor for the original directory.
|
String |
getExt()
An accessor for the original extension.
|
int |
getLength()
An accessor for the list's length
|
String[] |
getListAsArray()
An accessor for the list of basenames, returned as an array of strings
|
Vector |
getListAsVector()
Another accessor for the list of basenames, returned as a vector of strings
|
String |
getName(int i)
Return a copy of the basename at index i.
|
boolean |
hasChanged() |
void |
load(String fileName)
Read the basenameList from a file
|
boolean |
remove(BasenameList bnl)
Removes a list from another list.
|
boolean |
remove(String str)
Removes a basename from the list, if it was present.
|
void |
sort()
Ensure that the list is alphabetically sorted.
|
BasenameList |
subList(int fromIndex,
int toIndex)
Returns an autonomous sublist between fromIndex, inclusive, and toIndex, exclusive.
|
void |
write(File file)
Write the basenameList to a File.
|
void |
write(String fileName)
Write the basenameList to a file, identified by its name.
|
public BasenameList()
public BasenameList(String setFromDir, String setFromExt, Vector setVec)
setFromDir
- setFromDirsetFromExt
- setFromExtsetVec
- setVecpublic BasenameList(String[] str)
str
- strpublic BasenameList(String dirName, String extension)
dirName
- The name of the directory to list the files from.extension
- The extension of the files to list.public BasenameList(String fileName) throws IOException
fileName
- The file to read from.IOException
- IOExceptionpublic void write(String fileName) throws IOException
fileName
- fileNameIOException
- IOExceptionpublic void write(File file) throws IOException
file
- fileIOException
- IOExceptionpublic void load(String fileName) throws IOException
fileName
- fileNameIOException
- IOExceptionpublic void add(String str)
str
- strpublic void add(String[] str)
str
- strpublic boolean remove(String str)
str
- The basename to remove.public boolean remove(BasenameList bnl)
bnl
- The basename list to remove.public BasenameList duplicate()
public BasenameList subList(int fromIndex, int toIndex)
fromIndex
- fromIndextoIndex
- toIndexpublic String[] getListAsArray()
public Vector getListAsVector()
public int getLength()
public String getDir()
public String getExt()
public String getName(int i)
i
- The index of the basename to consider.public boolean contains(String str)
str
- The basename to check for.public boolean contains(BasenameList bnl)
bnl
- The list of basenames to check for.public boolean equals(BasenameList bnl)
bnl
- The list of basenames to check for.public void sort()
public void clear()
public boolean hasChanged()
Copyright © 2000–2016 DFKI GmbH. All rights reserved.