From f439d07229d26f650192bdeef3b0df7805b7c2e2 Mon Sep 17 00:00:00 2001 From: 0xb00bface <0xboobface@gmail.com> Date: Sun, 19 Dec 2021 17:55:57 +0100 Subject: [PATCH] Code cleanup --- common/src/main/java/ctbrec/Model.java | 115 ++++++++++++------------- 1 file changed, 53 insertions(+), 62 deletions(-) diff --git a/common/src/main/java/ctbrec/Model.java b/common/src/main/java/ctbrec/Model.java index a60362a3..dd13beb6 100644 --- a/common/src/main/java/ctbrec/Model.java +++ b/common/src/main/java/ctbrec/Model.java @@ -20,10 +20,10 @@ import ctbrec.sites.Site; public interface Model extends Comparable, Serializable { - public static final long RECORD_INDEFINITELY = 9000000000000000000l; - public static final int MAX_PRIO = 10_000; + long RECORD_INDEFINITELY = 9000000000000000000L; + int MAX_PRIO = 10_000; - public enum State { + enum State { ONLINE("online"), OFFLINE("offline"), AWAY("away"), @@ -31,7 +31,7 @@ public interface Model extends Comparable, Serializable { GROUP("group"), UNKNOWN("unknown"); - String display; + final String display; State(String display) { this.display = display; } @@ -42,71 +42,62 @@ public interface Model extends Comparable, Serializable { } } - public String getUrl(); + String getUrl(); - public void setUrl(String url); + void setUrl(String url); - public String getDisplayName(); + String getDisplayName(); - public void setDisplayName(String name); + void setDisplayName(String name); - public String getName(); + String getName(); - public void setName(String name); + void setName(String name); /** * Returns a name, which is safe to use with the filesystem */ - public String getSanitizedNamed(); + String getSanitizedNamed(); - public String getPreview(); + String getPreview(); - public void setPreview(String preview); + void setPreview(String preview); - public List getTags(); + List getTags(); - public void setTags(List tags); + void setTags(List tags); - public String getDescription(); + String getDescription(); - public void setDescription(String description); + void setDescription(String description); - public int getStreamUrlIndex(); + int getStreamUrlIndex(); - public void setStreamUrlIndex(int streamUrlIndex); + void setStreamUrlIndex(int streamUrlIndex); - public boolean isOnline() throws IOException, ExecutionException, InterruptedException; + boolean isOnline() throws IOException, ExecutionException, InterruptedException; - /** - * - * @param failFast - * If set to true, the method returns immediately and might return false even if the model actually is online - * @return - * @throws IOException - * @throws ExecutionException - * @throws InterruptedException - */ - public boolean isOnline(boolean ignoreCache) throws IOException, ExecutionException, InterruptedException; + boolean isOnline(boolean ignoreCache) throws IOException, ExecutionException, InterruptedException; - public State getOnlineState(boolean failFast) throws IOException, ExecutionException; + State getOnlineState(boolean failFast) throws IOException, ExecutionException; - public List getStreamSources() throws IOException, ExecutionException, ParseException, PlaylistException, JAXBException; + List getStreamSources() throws IOException, ExecutionException, ParseException, PlaylistException, JAXBException; - public void invalidateCacheEntries(); + void invalidateCacheEntries(); - public void receiveTip(Double tokens) throws IOException; + void receiveTip(Double tokens) throws IOException; - public void setLastSeen(Instant timestamp); + void setLastSeen(Instant timestamp); - public Instant getLastSeen(); + Instant getLastSeen(); - public void setLastRecorded(Instant timestamp); + void setLastRecorded(Instant timestamp); - public Instant getLastRecorded(); + Instant getLastRecorded(); - public void setAddedTimestamp(Instant timestamp); + void setAddedTimestamp(Instant timestamp); - public Instant getAddedTimestamp(); + Instant getAddedTimestamp(); /** * Determines the stream resolution for this model @@ -118,48 +109,48 @@ public interface Model extends Comparable, Serializable { * @return a tupel of width and height represented by an int[2] * @throws ExecutionException */ - public int[] getStreamResolution(boolean failFast) throws ExecutionException; + int[] getStreamResolution(boolean failFast) throws ExecutionException; - public boolean follow() throws IOException; + boolean follow() throws IOException; - public boolean unfollow() throws IOException; + boolean unfollow() throws IOException; - public void setSite(Site site); + void setSite(Site site); - public Site getSite(); + Site getSite(); - public void writeSiteSpecificData(JsonWriter writer) throws IOException; + void writeSiteSpecificData(JsonWriter writer) throws IOException; - public void readSiteSpecificData(JsonReader reader) throws IOException; + void readSiteSpecificData(JsonReader reader) throws IOException; - public boolean isSuspended(); + boolean isSuspended(); - public void setSuspended(boolean suspended); + void setSuspended(boolean suspended); - public boolean isMarkedForLaterRecording(); + boolean isMarkedForLaterRecording(); - public void setMarkedForLaterRecording(boolean marked); + void setMarkedForLaterRecording(boolean marked); - public Download createDownload(); + Download createDownload(); - public void setPriority(int priority); + void setPriority(int priority); - public int getPriority(); + int getPriority(); - public HttpHeaderFactory getHttpHeaderFactory(); + HttpHeaderFactory getHttpHeaderFactory(); - public boolean isRecordingTimeLimited(); - public Instant getRecordUntil(); - public void setRecordUntil(Instant instant); + boolean isRecordingTimeLimited(); + Instant getRecordUntil(); + void setRecordUntil(Instant instant); - public SubsequentAction getRecordUntilSubsequentAction(); - public void setRecordUntilSubsequentAction(SubsequentAction action); + SubsequentAction getRecordUntilSubsequentAction(); + void setRecordUntilSubsequentAction(SubsequentAction action); /** * Check, if this model account exists * @return true, if it exists, false otherwise * @throws IOException */ - public boolean exists() throws IOException; + boolean exists() throws IOException; -} \ No newline at end of file +}