com.zerjio.JIRC
Class Utils

java.lang.Object
  extended bycom.zerjio.JIRC.Utils

public class Utils
extends java.lang.Object

A general utilities class. All its methods should be static.


Constructor Summary
Utils()
           
 
Method Summary
static boolean areChannelsEquivalent(java.lang.String channelName1, java.lang.String channelName2)
          Tests if two channel names are equivalent.
static boolean areNicksEquivalent(java.lang.String nick1, java.lang.String nick2)
          Tests if two nicks are equivalent.
static int countChar(char character, java.lang.String string)
          Counts the number of ocurrences of a char into a given string.
static boolean isChannel(java.lang.String name)
          Returns if a string is the name of a channel (begins with # or &).
static boolean isCommand(java.lang.String command)
          Returns if a string begins with a '/' and should be recognized as a command.
static boolean isReplyMessage(java.lang.String command)
          Checks if a command string is a reply message command (a 3 digit number).
static java.lang.String[] splitString(char separatorChar, java.lang.String string)
          Splits a given string into one or more which are separated by a given separator character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

isReplyMessage

public static boolean isReplyMessage(java.lang.String command)
Checks if a command string is a reply message command (a 3 digit number).

Returns:
true if the command corresponds to a reply message. false otherwise.

countChar

public static int countChar(char character,
                            java.lang.String string)
Counts the number of ocurrences of a char into a given string.

Parameters:
character - The character that should be count.
string - The string where the character should be counted.
Returns:
The number of ocurrences of the character into the given string.

splitString

public static java.lang.String[] splitString(char separatorChar,
                                             java.lang.String string)
Splits a given string into one or more which are separated by a given separator character.

Parameters:
separatorChar - The char which separates the different substrings
string - The string that must be splitted
Returns:
An array of strings which were on string but separated with the separatorChar.

areNicksEquivalent

public static boolean areNicksEquivalent(java.lang.String nick1,
                                         java.lang.String nick2)
Tests if two nicks are equivalent.

Parameters:
nick1 - The first nick to compare
nick2 - The second nick to compare
Returns:
true if both nicks are equivalent. false otherwise.

areChannelsEquivalent

public static boolean areChannelsEquivalent(java.lang.String channelName1,
                                            java.lang.String channelName2)
Tests if two channel names are equivalent.

Parameters:
channelName1 - The first channel name to compare
channelName2 - The second channel name to compare
Returns:
true if both channels names are equivalent. false otherwise.

isCommand

public static boolean isCommand(java.lang.String command)
Returns if a string begins with a '/' and should be recognized as a command.

Parameters:
command - The line that can be a command
Returns:
true if the line represents a command (begins with '/') false otherwise.

isChannel

public static boolean isChannel(java.lang.String name)
Returns if a string is the name of a channel (begins with # or &).

Parameters:
name - The string that must be tested
Returns:
true if the string is a channel name false otherwise