22 package com.realtime.crossfire.jxclient.metaserver;
24 import java.util.regex.Pattern;
25 import org.jetbrains.annotations.NotNull;
26 import org.jetbrains.annotations.Nullable;
115 public MetaserverEntry(
final int updateSeconds, @NotNull
final String hostname,
final int players, @NotNull
final String version, @NotNull
final String comment,
final long bytesIn,
final long bytesOut,
final int uptimeSeconds, @NotNull
final String archBase, @NotNull
final String mapBase, @NotNull
final String codeBase) {
229 return "Host:"+hostname+
" Version:"+version+
" Players:"+players+
" Comment:"+
comment;
237 return hostname.compareTo(o.hostname);
245 return hostname.hashCode();
252 public boolean equals(@Nullable
final Object obj) {
256 if (obj.getClass() != getClass()) {
287 final StringBuilder sb =
new StringBuilder();
288 final char[] formatChars = format.toCharArray();
290 while (i < formatChars.length) {
291 final char ch = formatChars[i++];
292 if (ch !=
'%' || i >= formatChars.length) {
295 switch (formatChars[i++]) {
309 sb.append(HTML_TAG_MATCHER.matcher(comment).replaceAll(
" "));
337 sb.append(updateSeconds);
341 sb.append(uptimeSeconds);
350 sb.append(formatChars[i-1]);
355 return sb.toString();
final String archBase
The server's arch base.
String format(@NotNull final String format)
Returns a formatted string using the given format.
String getComment()
Returns the server comment.
final long bytesOut
The number of bytes sent.
final int uptimeSeconds
The server's uptime in seconds.
String getMapBase()
Returns the server's map base.
final String mapBase
The server's map base.
final int players
The number of players.
int getUptimeSeconds()
Returns the server's uptime in seconds.
final long bytesIn
The number of bytes received.
final String version
Returns the server version.
int getPlayers()
Returns the number of players.
long getBytesOut()
Returns the number of bytes sent.
Represents a response line from the metaserver.
static final Pattern HTML_TAG_MATCHER
Matches html tags.
int getUpdateSeconds()
Returns the time since last update in seconds.
String getArchBase()
Returns the server's arch base.
String getVersion()
Returns the server version.
String getCodeBase()
Returns the server's code base.
final int updateSeconds
Time since last update in seconds.
boolean equals(@Nullable final Object obj)
final String hostname
The hostname.
final String codeBase
The server's code base.
long getBytesIn()
Returns the number of bytes received.
int compareTo(@NotNull final MetaserverEntry o)
final String comment
Returns the server comment.
MetaserverEntry(final int updateSeconds, @NotNull final String hostname, final int players, @NotNull final String version, @NotNull final String comment, final long bytesIn, final long bytesOut, final int uptimeSeconds, @NotNull final String archBase, @NotNull final String mapBase, @NotNull final String codeBase)
Creates a new instance.
String getHostname()
Returns the hostname.