FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaRepository/Boris/src/laba33/Directory.java at master · karzhouAndrew/JavaRepository · GitHub
karzhouAndrew
/
JavaRepository
Public
Notifications
You must be signed in to change notification settings
Fork
16
Star
0
Code
Issues
0
Pull requests
96
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaRepository
/
Boris
/
src
/
laba33
/
Directory.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
66 lines (54 loc) · 1.72 KB
Breadcrumbs
JavaRepository
/
Boris
/
src
/
laba33
/
Directory.java
Copy path
File metadata and controls
66 lines (54 loc) · 1.72 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package
laba33
;
import
java
.
io
.
File
;
import
java
.
util
.
List
;
public
class
Directory
{
private
File
path
;
private
Catalogue
catalogues
;
public
Directory
(
String
path
) {
this
.
path
=
new
File
(
path
);
isExist
();
}
private
void
isExist
() {
if
(
path
.
exists
()) {
catalogues
=
new
Catalogue
(
path
);
}
else
{
System
.
out
.
println
(
"Exception. There are no such catalogue."
);
}
}
public
StringBuilder
seeFiles
() {
if
(
path
.
exists
()) {
return
isFileExist
(
catalogues
.
getFiles
());
}
else
{
return
new
StringBuilder
(
"Exception. There are no such catalogue.!!!"
);
}
}
private
StringBuilder
isFileExist
(
List
<
String
>
names
) {
if
(
path
.
isFile
()) {
return
new
StringBuilder
(
"Exception. This is file!!!"
);
}
else
{
StringBuilder
strB
=
new
StringBuilder
();
isEmptyCatalogue
(
strB
,
names
);
return
strB
;
}
}
private
void
isEmptyCatalogue
(
StringBuilder
strB
,
List
<
String
>
names
) {
if
(
names
.
isEmpty
()) {
strB
.
append
(
"The folder is empty."
);
}
else
{
strB
.
append
(
catalogues
.
getName
()).
append
(
" folder contains:
\n
"
);
addElementToStrBuilder
(
strB
,
names
);
}
}
public
StringBuilder
seeCatalogues
() {
if
(
path
.
exists
()) {
return
isFileExist
(
catalogues
.
getCatalogue
());
}
else
{
return
new
StringBuilder
(
"Exception. There are no such catalogue.!!!"
);
}
}
private
void
addElementToStrBuilder
(
StringBuilder
strB
,
List
<
String
>
names
) {
for
(
String
name
:
names
) {
strB
.
append
(
name
).
append
(
"
\n
"
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL