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
37c9910e
Commit
37c9910e
authored
Mar 11, 2021
by
Oskars
Browse files
Add: createPostInPage in BusinessUSer class
parent
2cd6946a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
11 deletions
+17
-11
src/ifaces/IPost.java
src/ifaces/IPost.java
+2
-1
src/model/users/BusinessUser.java
src/model/users/BusinessUser.java
+8
-4
src/model/users/PrivateUser.java
src/model/users/PrivateUser.java
+7
-6
No files found.
src/ifaces/IPost.java
View file @
37c9910e
package
ifaces
;
import
model.PostType
;
import
model.Post
;
public
interface
IPost
{
public
void
createPost
(
PostType
postType
,
String
msg
);
public
Post
createPost
(
PostType
postType
,
String
msg
);
}
src/model/users/BusinessUser.java
View file @
37c9910e
...
...
@@ -46,11 +46,15 @@ public class BusinessUser extends User implements IPost{
listOfPages
.
add
(
page
);
}
//
IPLEMENTED METHODS
public
void
createPost
(
PostType
postType
,
String
message
,
Page
page
){
super
.
createPost
(
postType
);
//
DERRIVED ABSTRACT METHODS, includes IPost interface
@Override
public
Post
createPost
(
PostType
postType
,
String
message
)
{
Post
newPost
=
new
Post
(
postType
,
message
);
return
newPost
;
}
public
void
createPostInPage
(
PostType
postType
,
String
message
,
Page
page
){
Post
newPost
=
createPost
(
postType
,
message
);
for
(
Page
pag:
listOfPages
)
{
if
(
pag
.
getTitle
()
==
page
.
getTitle
())
{
ArrayList
<
Post
>
postsInPage
=
pag
.
getPostsInPage
();
...
...
src/model/users/PrivateUser.java
View file @
37c9910e
...
...
@@ -63,12 +63,13 @@ public class PrivateUser extends User{
}
}
//DERRIVED ABSTRACT METHODS
//@Override
//public void createPost(PostType postType, String message){
// Post newPost = new Post(postType, message);
// posts.add(newPost);
//}
//DERRIVED ABSTRACT METHODS, includes IPost interface
@Override
public
Post
createPost
(
PostType
postType
,
String
message
){
Post
newPost
=
new
Post
(
postType
,
message
);
posts
.
add
(
newPost
);
return
newPost
;
}
}
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