|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimnet.Utils
Contains generic methods that are not simulation instance specific.
| Field Summary | |
static int |
os_count
How many times was getObjectSize called (for debugging). |
| Constructor Summary | |
Utils()
|
|
| Method Summary | |
static void |
ancestorClone(java.lang.Object dest,
java.lang.Object source)
For all of the fields in all of the superclasses that source and dest have in common, if the field is not static or transent, and the value in source is not null, copy that value into dest. |
static java.lang.String |
chomp(java.lang.String line,
int n)
Returns the first 'n' words of a line. |
static java.lang.Class |
findCommonBaseClass(java.lang.Class a,
java.lang.Class b)
Return the class that both arguments have as superclasses in common, including the two classes itself. |
static java.lang.String[] |
getArgsFromInt(int i)
For convienence, to convert a single integer to the first element of a string array. |
static int |
getIPFromString(java.lang.String name)
Determines the ID of the Node by IP address string |
static int |
getNetworkPart(int ip,
int fixed_bits)
Returns the network part of an ip address with the given fixed bits (fixed_bits is number of leading bits that are part of network address). |
static int |
getObjectSize(java.lang.Object object)
Returns the size of the given object, using reflection. |
protected static int |
getObjectSize(java.lang.Object object,
java.lang.Class base_class,
java.lang.String prefix,
java.util.HashSet processed)
Returns the size of the given object using reflection (actual implementation). |
static int |
getPrimitiveSize(java.lang.Object o)
For a given object, if is a primitive type or a wrapper for a primitive type, return the size of that object. |
static java.lang.String |
getRIPEntryString(RIPEntry re)
Returns a string representation of a RIPEntry. |
static java.lang.String |
getRIPMessageString(RIPMessage rm)
Returns a string represenation of a RIPMessage. |
static java.lang.String |
getStringFromArgs(java.lang.String[] args)
Return a comma delimited string of the arguments passed to it. |
static java.lang.String |
getStringFromIP(int ip)
Convert an 32-bit integer IP into a string. |
static boolean |
inSameSubnet(int ip1,
int ip2,
int fixed_bits)
Returns if two IP addresses are in the same network of the specified size. |
static boolean |
isIPString(java.lang.String name)
Checks whether a string can be an IP address. |
static boolean |
isNATtedAddress(int ip)
Utility method to determine whether or not an IP address is NATted. |
static boolean |
isParent(java.lang.Class newclass,
java.lang.String parentname)
Determines whether the specified class is a descendant of the class with the specified name (or that class itself). |
static java.lang.String |
makeAbsoluteDNSName(java.lang.String name,
java.lang.String zone)
Converts a domain name in the specified zone into a fully qualified domain name (with trailing dot). |
static java.lang.String |
peek(java.lang.String line)
Returns the first word of a line. |
static void |
printout(java.lang.String string)
Prints out a string and flushes the output buffer. |
static java.lang.String |
toHexString(byte[] b)
Returns a string representing the Hex encoding of b |
static java.lang.String |
toShortString(java.lang.Object o,
int len)
Returns a short string representation of the specified object. |
static java.lang.String |
trim(java.lang.String str,
int len)
Method to reduce the length of the String representation for some objects, like BigIntegers. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static int os_count
| Constructor Detail |
public Utils()
| Method Detail |
public static java.lang.String toHexString(byte[] b)
public static java.lang.String peek(java.lang.String line)
public static java.lang.String chomp(java.lang.String line,
int n)
line - line to chompn - number of workds to chomppublic static void printout(java.lang.String string)
string - the string to print out
public static int getNetworkPart(int ip,
int fixed_bits)
public static boolean inSameSubnet(int ip1,
int ip2,
int fixed_bits)
public static int getObjectSize(java.lang.Object object)
protected static int getObjectSize(java.lang.Object object,
java.lang.Class base_class,
java.lang.String prefix,
java.util.HashSet processed)
throws java.lang.Exception
java.lang.Exceptionpublic static int getPrimitiveSize(java.lang.Object o)
public static java.lang.Class findCommonBaseClass(java.lang.Class a,
java.lang.Class b)
public static void ancestorClone(java.lang.Object dest,
java.lang.Object source)
public static java.lang.String toShortString(java.lang.Object o,
int len)
public static java.lang.String[] getArgsFromInt(int i)
public static java.lang.String getStringFromArgs(java.lang.String[] args)
public static boolean isParent(java.lang.Class newclass,
java.lang.String parentname)
newclass - the class whose inheritence is to be determinedparentname - the name of the parent class
public static boolean isIPString(java.lang.String name)
name - the string to check
public static int getIPFromString(java.lang.String name)
name - a dotted decimal IP address string
public static java.lang.String getStringFromIP(int ip)
ip - the integer ip address
public static java.lang.String getRIPEntryString(RIPEntry re)
public static java.lang.String getRIPMessageString(RIPMessage rm)
public static boolean isNATtedAddress(int ip)
ip - The ip address to check
public static java.lang.String makeAbsoluteDNSName(java.lang.String name,
java.lang.String zone)
name - The name of the nodezone - The zone the nods is in.
public static java.lang.String trim(java.lang.String str,
int len)
str - The string to reducelen - The number of characters in the string that will remain
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||