BrightSide Workbench Full Report + Source Code
org.turro.file.zul.control.FileResults Class Reference

Public Member Functions

 FileResults ()
 
String getSearchValue ()
 
void setSearchValue (String searchValue)
 
boolean isPath ()
 
void setPath (boolean path)
 
boolean isRegexp ()
 
void setRegexp (boolean regexp)
 
boolean isPartial ()
 
void setPartial (boolean partial)
 
boolean matches (File file)
 
Collection< String > getFolders (File folder)
 
Collection< File > getFiles (File folder)
 
Collection< File > getFileList (File folder)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 31 of file FileResults.java.

Constructor & Destructor Documentation

◆ FileResults()

org.turro.file.zul.control.FileResults.FileResults ( )

Definition at line 36 of file FileResults.java.

36  {
37  searchValue = "*";
38  path = false;
39  regexp = false;
40  partial = true;
41  }

Member Function Documentation

◆ getFileList()

Collection<File> org.turro.file.zul.control.FileResults.getFileList ( File  folder)

Definition at line 132 of file FileResults.java.

132  {
133  Set<File> files = new TreeSet<>();
134  if(folder.exists()) {
135  for(File file : folder.listFiles()) {
136  if(!file.isHidden()) {
137  if(file.isDirectory() || matches(file)) files.add(file);
138  }
139  }
140  }
141  return files;
142  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFiles()

Collection<File> org.turro.file.zul.control.FileResults.getFiles ( File  folder)

Definition at line 120 of file FileResults.java.

120  {
121  Set<File> files = new TreeSet<>();
122  if(folder.exists()) {
123  for(File file : folder.listFiles()) {
124  if(file.isFile() && !file.isHidden()) {
125  if(matches(file)) files.add(file);
126  }
127  }
128  }
129  return files;
130  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFolders()

Collection<String> org.turro.file.zul.control.FileResults.getFolders ( File  folder)

Definition at line 108 of file FileResults.java.

108  {
109  Set<String> subdirs = new TreeSet<>();
110  if(folder.exists()) {
111  for(File file : folder.listFiles()) {
112  if(file.isDirectory() && !file.isHidden()) {
113  subdirs.add(file.getName());
114  }
115  }
116  }
117  return subdirs;
118  }
Here is the caller graph for this function:

◆ getSearchValue()

String org.turro.file.zul.control.FileResults.getSearchValue ( )

Definition at line 43 of file FileResults.java.

43  {
44  return searchValue;
45  }

◆ isPartial()

boolean org.turro.file.zul.control.FileResults.isPartial ( )

Definition at line 67 of file FileResults.java.

67  {
68  return partial;
69  }

◆ isPath()

boolean org.turro.file.zul.control.FileResults.isPath ( )

Definition at line 51 of file FileResults.java.

51  {
52  return path;
53  }

◆ isRegexp()

boolean org.turro.file.zul.control.FileResults.isRegexp ( )

Definition at line 59 of file FileResults.java.

59  {
60  return regexp;
61  }

◆ matches()

boolean org.turro.file.zul.control.FileResults.matches ( File  file)

Definition at line 75 of file FileResults.java.

75  {
76  if(Strings.isBlank(searchValue)) return false;
77  if(regexp) {
78  if(path) {
79  if(partial) {
80  return file.getAbsolutePath().matches(".*" + searchValue + ".*");
81  } else {
82  return file.getAbsolutePath().matches(searchValue);
83  }
84  } else {
85  if(partial) {
86  return file.getName().matches(".*" + searchValue + ".*");
87  } else {
88  return file.getName().matches(searchValue);
89  }
90  }
91  } else {
92  if(path) {
93  if(partial) {
94  return file.getAbsolutePath().matches(Strings.convertToRegEx("*" + searchValue + "*"));
95  } else {
96  return file.getAbsolutePath().matches(Strings.convertToRegEx(searchValue));
97  }
98  } else {
99  if(partial) {
100  return file.getName().matches(Strings.convertToRegEx("*" + searchValue + "*"));
101  } else {
102  return file.getName().matches(Strings.convertToRegEx(searchValue));
103  }
104  }
105  }
106  }
Here is the caller graph for this function:

◆ setPartial()

void org.turro.file.zul.control.FileResults.setPartial ( boolean  partial)

Definition at line 71 of file FileResults.java.

71  {
72  this.partial = partial;
73  }
Here is the caller graph for this function:

◆ setPath()

void org.turro.file.zul.control.FileResults.setPath ( boolean  path)

Definition at line 55 of file FileResults.java.

55  {
56  this.path = path;
57  }
Here is the caller graph for this function:

◆ setRegexp()

void org.turro.file.zul.control.FileResults.setRegexp ( boolean  regexp)

Definition at line 63 of file FileResults.java.

63  {
64  this.regexp = regexp;
65  }
Here is the caller graph for this function:

◆ setSearchValue()

void org.turro.file.zul.control.FileResults.setSearchValue ( String  searchValue)

Definition at line 47 of file FileResults.java.

47  {
48  this.searchValue = searchValue;
49  }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: