Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Oskars
JAVA_seminar3
Commits
1f9f0a12
Commit
1f9f0a12
authored
Mar 08, 2021
by
Oskars
Browse files
Change: updating previeously made classes
parent
5db3fc88
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
13 deletions
+63
-13
src/model/Page.java
src/model/Page.java
+10
-2
src/model/users/BusinessUser.java
src/model/users/BusinessUser.java
+41
-0
src/model/users/PrivateUser.java
src/model/users/PrivateUser.java
+12
-11
No files found.
src/model/Page.java
View file @
1f9f0a12
...
@@ -17,6 +17,14 @@ public class Page {
...
@@ -17,6 +17,14 @@ public class Page {
followers
=
new
ArrayList
<
User
>();
followers
=
new
ArrayList
<
User
>();
postsInPage
=
new
ArrayList
<
Post
>();
postsInPage
=
new
ArrayList
<
Post
>();
}
}
public
Page
(
String
title
,
String
description
,
ArrayList
<
User
>
followers
,
ArrayList
<
Post
>
postsInPage
)
{
setTitle
(
title
);
setDescription
(
description
);
setFollowers
(
followers
);
setPostsInPage
(
postsInPage
);
}
//SETTERS
//SETTERS
public
void
setTitle
(
String
title
)
{
public
void
setTitle
(
String
title
)
{
this
.
title
=
(
title
!=
null
)
?
title
:
"no title"
;
this
.
title
=
(
title
!=
null
)
?
title
:
"no title"
;
...
@@ -27,11 +35,11 @@ public class Page {
...
@@ -27,11 +35,11 @@ public class Page {
}
}
public
void
setFollowers
(
ArrayList
<
User
>
followers
)
{
public
void
setFollowers
(
ArrayList
<
User
>
followers
)
{
if
(
followers
!
=
null
&&
!
followers
.
isEmpty
()
)
this
.
followers
=
followers
;
followers
=
(
followers
!=
null
)?
followers
:
new
ArrayList
<
User
>()
;
}
}
public
void
setPostsInPage
(
ArrayList
<
Post
>
posts
)
{
public
void
setPostsInPage
(
ArrayList
<
Post
>
posts
)
{
if
(
posts
!
=
null
&&
!
posts
.
isEmpty
()
)
postsInPage
=
posts
;
posts
=
(
posts
!=
null
)?
postsInPage
:
new
ArrayList
<
Post
>()
;
}
}
//GETTERS
//GETTERS
...
...
src/model/users/BusinessUser.java
0 → 100644
View file @
1f9f0a12
package
model.users
;
import
java.util.ArrayList
;
import
model.Page
;
import
model.Post
;
public
class
BusinessUser
extends
User
{
ArrayList
<
Page
>
listOfPages
;
//CONSTRUCTORS
public
BusinessUser
()
{
super
();
listOfPages
=
new
ArrayList
<
Page
>();
}
public
BusinessUser
(
String
nameAndSurname
,
String
username
,
String
password
,
ArrayList
<
Page
>
listOfPages
)
{
super
(
nameAndSurname
,
username
,
password
);
this
.
listOfPages
=
(
listOfPages
!=
null
)?
listOfPages
:
new
ArrayList
<
Page
>();
}
//SETTERS
public
ArrayList
<
Page
>
getListOfPages
()
{
return
listOfPages
;
}
//GETTERS
public
void
setListOfPages
(
ArrayList
<
Page
>
listOfPages
)
{
this
.
listOfPages
=
(
listOfPages
!=
null
)?
listOfPages
:
new
ArrayList
<
Page
>();
}
//OTHER METHODS
public
String
toString
()
{
return
super
.
toString
()
+
", Pages: "
+
listOfPages
.
size
();
}
public
void
createPage
()
{
}
}
src/model/users/PrivateUser.java
View file @
1f9f0a12
...
@@ -19,25 +19,26 @@ public class PrivateUser extends User {
...
@@ -19,25 +19,26 @@ public class PrivateUser extends User {
public
PrivateUser
(
String
nameAndSurname
,
String
username
,
String
password
,
ArrayList
<
Post
>
posts
,
ArrayList
<
User
>
followers
)
{
public
PrivateUser
(
String
nameAndSurname
,
String
username
,
String
password
,
ArrayList
<
Post
>
posts
,
ArrayList
<
User
>
followers
)
{
super
(
nameAndSurname
,
username
,
password
);
super
(
nameAndSurname
,
username
,
password
);
this
.
posts
=
(
posts
!=
null
)?
posts
:
new
ArrayList
<
Post
>(
);
setPosts
(
posts
);
this
.
followers
=
(
followers
!=
null
)?
followers
:
new
ArrayList
<
User
>(
);
setFollowers
(
followers
);
}
}
//SETTERS
//SETTERS
public
void
setUser
(
User
user
)
{
if
(
user
!=
null
)
{
// public void setUser(User user) {
this
.
setNameAndSurname
(
user
.
getNameAndSurname
());
// if(user != null) {
this
.
setUsername
(
user
.
getUsername
());
// this.setNameAndSurname(user.getNameAndSurname());
this
.
setPassword
(
user
.
getPassword
());
// this.setUsername(user.getUsername());
}
// this.setPassword(user.getPassword());
}
// }
// }
public
void
setPosts
(
ArrayList
<
Post
>
posts
)
{
public
void
setPosts
(
ArrayList
<
Post
>
posts
)
{
if
(
posts
!=
null
)
this
.
posts
=
posts
;
this
.
posts
=
(
posts
!=
null
)
?
posts
:
new
ArrayList
<
Post
>()
;
}
}
public
void
setFollowers
(
ArrayList
<
User
>
followers
)
{
public
void
setFollowers
(
ArrayList
<
User
>
followers
)
{
if
(
followers
!=
null
)
this
.
followers
=
followers
;
this
.
followers
=
(
followers
!=
null
)
?
followers
:
new
ArrayList
<
User
>()
;
}
}
//GETTERS
//GETTERS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment