Remove Javadoc header from all source files

Also removed SendEvent and simplified some other calls.
This commit is contained in:
2020-09-25 14:29:23 +02:00
parent f0e645c0ae
commit 8eb7743057
140 changed files with 397 additions and 1260 deletions

View File

@ -1,20 +1,14 @@
package envoy.client.data;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.Queue;
import java.util.*;
import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.*;
import envoy.util.EnvoyLog;
/**
* Stores elements in a queue to process them later.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>Cache.java</strong><br>
* Created: <strong>6 Feb 2020</strong><br>
*
* @param <T> the type of cached elements
* @author Kai S. K. Engelbart

View File

@ -1,16 +1,11 @@
package envoy.client.data;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
/**
* Stores a heterogeneous map of {@link Cache} objects with different type
* parameters.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>CacheMap.java</strong><br>
* Created: <strong>09.07.2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta

View File

@ -1,25 +1,16 @@
package envoy.client.data;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.io.*;
import java.util.*;
import envoy.client.net.WriteProxy;
import envoy.data.Contact;
import envoy.data.Message;
import envoy.data.*;
import envoy.data.Message.MessageStatus;
import envoy.data.User;
import envoy.event.MessageStatusChange;
/**
* Represents a chat between two {@link User}s
* as a list of {@link Message} objects.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>Chat.java</strong><br>
* Created: <strong>19 Oct 2019</strong><br>
*
* @author Maximilian K&auml;fer
* @author Leon Hofmeister
@ -51,7 +42,7 @@ public class Chat implements Serializable {
public Chat(Contact recipient) { this.recipient = recipient; }
@Override
public String toString() { return String.format("Chat[recipient=%s,messages=%d]", recipient, messages.size()); }
public String toString() { return String.format("%s[recipient=%s,messages=%d]", getClass().getSimpleName(), recipient, messages.size()); }
/**
* Generates a hash code based on the recipient.

View File

@ -7,10 +7,6 @@ import envoy.data.Config;
/**
* Implements a configuration specific to the Envoy Client with default values
* and convenience methods.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>ClientConfig.java</strong><br>
* Created: <strong>01.03.2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta

View File

@ -2,16 +2,11 @@ package envoy.client.data;
import javafx.stage.Stage;
import envoy.client.net.Client;
import envoy.client.net.WriteProxy;
import envoy.client.net.*;
import envoy.client.ui.SceneContext;
/**
* Provides access to commonly used objects.
* <p>
* Project: <strong>client</strong><br>
* File: <strong>Context.java</strong><br>
* Created: <strong>01.09.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Client v0.2-beta

View File

@ -4,19 +4,13 @@ import java.io.IOException;
import java.time.Instant;
import envoy.client.net.WriteProxy;
import envoy.data.Contact;
import envoy.data.GroupMessage;
import envoy.data.*;
import envoy.data.Message.MessageStatus;
import envoy.data.User;
import envoy.event.GroupMessageStatusChange;
/**
* Represents a chat between a user and a group
* as a list of messages.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>GroupChat.java</strong><br>
* Created: <strong>05.07.2020</strong><br>
*
* @author Maximilian K&auml;fer
* @since Envoy Client v0.1-beta

View File

@ -22,10 +22,6 @@ import dev.kske.eventbus.EventListener;
* For message ID generation a {@link IDGenerator} is stored as well.
* <p>
* The managed objects are stored inside a folder in the local file system.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>LocalDB.java</strong><br>
* Created: <strong>3 Feb 2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Client v0.3-alpha
@ -174,6 +170,26 @@ public final class LocalDB implements EventListener {
}, 2000, ClientConfig.getInstance().getLocalDBSaveInterval() * 60000);
}
/**
* Performs a contact name change if the corresponding contact is present.
*
* @param event the {@link NameChange} to process
* @since Envoy Client v0.1-beta
*/
public void replaceContactName(NameChange event) {
chats.stream().map(Chat::getRecipient).filter(c -> c.getID() == event.getID()).findAny().ifPresent(c -> c.setName(event.get()));
}
/**
* Performs a group resize operation if the corresponding group is present.
*
* @param event the {@link GroupResize} to process
* @since Envoy Client v0.1-beta
*/
public void updateGroup(GroupResize event) {
getChat(event.getGroupID()).map(Chat::getRecipient).map(Group.class::cast).ifPresent(event::apply);
}
/**
* Stores all users. If the client user is specified, their chats will be stored
* as well. The message id generator will also be saved if present.
@ -219,6 +235,26 @@ public final class LocalDB implements EventListener {
*/
public Map<String, User> getUsers() { return users; }
/**
* Searches for a message by ID.
*
* @param id the ID of the message to search for
* @return an optional containing the message
* @since Envoy Client v0.1-beta
*/
public Optional<Message> getMessage(long id) {
return chats.stream().map(Chat::getMessages).flatMap(List::stream).filter(m -> m.getID() == id).findAny();
}
/**
* Searches for a chat by recipient ID.
*
* @param recipientID the ID of the chat's recipient
* @return an optional containing the chat
* @since Envoy Client v0.1-beta
*/
public Optional<Chat> getChat(long recipientID) { return chats.stream().filter(c -> c.getRecipient().getID() == recipientID).findAny(); }
/**
* @return all saved {@link Chat} objects that list the client user as the
* sender
@ -278,59 +314,4 @@ public final class LocalDB implements EventListener {
* @since Envoy Client v0.2-beta
*/
public String getAuthToken() { return authToken; }
/**
* Searches for a message by ID.
*
* @param id the ID of the message to search for
* @return an optional containing the message
* @since Envoy Client v0.1-beta
*/
public Optional<Message> getMessage(long id) {
return chats.stream().map(Chat::getMessages).flatMap(List::stream).filter(m -> m.getID() == id).findAny();
}
/**
* Searches for a chat by recipient ID.
*
* @param recipientID the ID of the chat's recipient
* @return an optional containing the chat
* @since Envoy Client v0.1-beta
*/
public Optional<Chat> getChat(long recipientID) { return chats.stream().filter(c -> c.getRecipient().getID() == recipientID).findAny(); }
/**
* Performs a contact name change if the corresponding contact is present.
*
* @param event the {@link NameChange} to process
* @since Envoy Client v0.1-beta
*/
public void replaceContactName(NameChange event) {
chats.stream().map(Chat::getRecipient).filter(c -> c.getID() == event.getID()).findAny().ifPresent(c -> c.setName(event.get()));
}
/**
* Performs a group resize operation if the corresponding group is present.
*
* @param event the {@link GroupResize} to process
* @since Envoy Client v0.1-beta
*/
public void updateGroup(GroupResize event) {
chats.stream()
.map(Chat::getRecipient)
.filter(Group.class::isInstance)
.filter(g -> g.getID() == event.getGroupID() && g.getID() != user.getID())
.map(Group.class::cast)
.findAny()
.ifPresent(group -> {
switch (event.getOperation()) {
case ADD:
group.getContacts().add(event.get());
break;
case REMOVE:
group.getContacts().remove(event.get());
break;
}
});
}
}

View File

@ -15,10 +15,6 @@ import dev.kske.eventbus.EventListener;
* Manages all application settings, which are different objects that can be
* changed during runtime and serialized them by using either the file system or
* the {@link Preferences} API.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>Settings.java</strong><br>
* Created: <strong>11 Nov 2019</strong><br>
*
* @author Leon Hofmeister
* @author Maximilian K&auml;fer

View File

@ -8,10 +8,6 @@ import javax.swing.JComponent;
/**
* Encapsulates a persistent value that is directly or indirectly mutable by the
* user.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>SettingsItem.java</strong><br>
* Created: <strong>23.12.2019</strong><br>
*
* @param <T> the type of this {@link SettingsItem}'s value
* @author Kai S. K. Engelbart

View File

@ -6,10 +6,6 @@ import envoy.exception.EnvoyException;
/**
* Plays back audio from a byte array.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>AudioPlayer.java</strong><br>
* Created: <strong>05.07.2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta

View File

@ -1,8 +1,7 @@
package envoy.client.data.audio;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.*;
import javax.sound.sampled.*;
@ -10,10 +9,6 @@ import envoy.exception.EnvoyException;
/**
* Records audio and exports it as a byte array.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>AudioRecorder.java</strong><br>
* Created: <strong>02.07.2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta

View File

@ -1,9 +1,5 @@
/**
* Contains classes related to recording and playing back audio clips.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>package-info.java</strong><br>
* Created: <strong>05.07.2020</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Client v0.1-beta

View File

@ -5,10 +5,6 @@ import java.util.function.Supplier;
/**
* This interface defines an action that should be performed when a system
* command gets called.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>OnCall.java</strong><br>
* Created: <strong>23.07.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Client v0.2-beta

View File

@ -1,10 +1,7 @@
package envoy.client.data.commands;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.*;
import java.util.function.*;
/**
* This class is the base class of all {@code SystemCommands} and contains an
@ -16,10 +13,6 @@ import java.util.function.Supplier;
* function. This approach has one limitation:<br>
* <b>Order matters!</b> Changing the order of arguments will likely result in
* unexpected behavior.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>SystemCommand.java</strong><br>
* Created: <strong>16.07.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Client v0.2-beta

View File

@ -1,15 +1,10 @@
package envoy.client.data.commands;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.function.Consumer;
/**
* This class acts as a builder for {@link SystemCommand}s.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>SystemCommandBuilder.java</strong><br>
* Created: <strong>23.07.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Client v0.2-beta

View File

@ -10,10 +10,6 @@ import envoy.util.EnvoyLog;
/**
* This class stores all {@link SystemCommand}s used.
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>SystemCommandsMap.java</strong><br>
* Created: <strong>17.07.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Client v0.2-beta

View File

@ -1,10 +1,6 @@
/**
* This package contains all classes that can be used as system commands.<br>
* Every system command can be called using a specific syntax:"/&lt;command&gt;"
* <p>
* Project: <strong>envoy-client</strong><br>
* File: <strong>package-info.java</strong><br>
* Created: <strong>16.07.2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Client v0.2-beta