|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindprod.common11.Misc
public final class Misc
Simple convenience methods used often by CMP utilities.
Simple enough to work in any JDK1.1+.
Field Summary | |
---|---|
(package private) static boolean |
DEBUGGING
true if you want extra debugging output and test code |
Method Summary | |
---|---|
static void |
beep()
makeshift system beep if awt.Toolkit.beep is not available. |
static java.awt.Frame |
getParentFrame(java.awt.Component child)
find Frame/JFrame enclosing a Component/Container/Dialog/Applet... |
static java.lang.String[][] |
loadProperties(java.io.InputStream fis)
Load a properties file, but not into a Property hashTable, into an array that does not disturb property order. |
static void |
main(java.lang.String[] args)
Debug harness |
static java.lang.String |
miniURLEncode(java.lang.String URL)
Tidy the URL encoding, simplified. |
static int |
signum(double diff)
Collapse magnitude down to +1, 0 or -1 . |
static int |
signum(float diff)
Collapse magnitude down to +1, 0 or -1 . |
static int |
signum(long diff)
alternate to signum for use in compare. |
static int |
thisDayOfMonth()
Get this day e.g. |
static int |
thisMonth()
Get this month e.g. |
static int |
thisYear()
Get this year e.g. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final boolean DEBUGGING
Method Detail |
---|
public static void beep()
public static java.awt.Frame getParentFrame(java.awt.Component child)
public static java.lang.String[][] loadProperties(java.io.InputStream fis) throws java.io.IOException
fis
- InputStream from which the properties can be read.
java.io.IOException
public static java.lang.String miniURLEncode(java.lang.String URL)
URL
- URLString to encode. May already be encoded.
public static int signum(long diff)
diff = edx:eax result = eax mov ebx,eax shl eax,1 or eax,ebx slr eax,1 or eax,edx which would take 5 cycles, 2 more that lohi. However, JET did even better, with code essentially this using a clever trick to implement piotr. lea ecx,0(eax,eax) ; shifts lo left by doubling, keeps copy of lo or eax,ecx shr eax,1 or eax,edx This is 4 cycles, still one more than lohi. Why was Piotr so much faster on JET? Piotr has no pipeline-confounding jumps. Further, the lo then high operands actually come from the ram-based stack. Piotr nicely separates the accesses giving plenty of for pre-emptive fetch of hi. lohi insists on having them both upfront, so it has to wait for memory access. Piotr does not have to wait. Modern CPUS hurry up and wait for RAM most of the time.
diff
- number to be collapsed to an int preserving sign and zeroness. usually represents the difference of
two long.
public static int signum(double diff)
diff
- number to test.
public static int signum(float diff)
diff
- number to test.
public static int thisDayOfMonth()
public static int thisMonth()
public static int thisYear()
public static void main(java.lang.String[] args)
args
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |