C-1462 protected void set(String path, String value) {
FileData fd = new FileData();
fd.setFileContent(value);
set(path, fd);
}
public static FsRoot getRoot() {
return root;
}
public static File getFile() {
return file;
}
public static String getValue() {
return value;
}
public static void setFile(File file) {
FsFile.file = file;
}
public static void setValue(String value) {
FsFile.value = value;
}
public static void reset() {
file = null;
value = null;
}
protected void add(FsFile newOne) {
newOne.parent = this;
children.add(newOne);
}
protected void remove(FsFile file) {
children.remove(file);
}
protected void set(Path path, FileData fd) {
String[] parts = path.getPath().split("/");
FsFile impl = this;
for(int i = 0; i < parts.length - 1; i++) {
impl = impl.getChild(parts[i]);
}
impl.set(parts[parts.length - 1], fd);
}
protected void set(String name, FileData fd) {
FsFile child = new FsFile();
child.setName(name);
child.setData(fd);
this.add(child);
}
protected void delete(FsFile file) {
children.remove(file);
}
protected FsFile getChild(String name) {
for(FsFile child: children) {
if(child.getName().equals(name)) {
return child;
}
}
return null;
}
protected File getName() {
return name;
}
2011年1月26日