Example #1
0
 public static String removeHTML(String code) {
   int i;
   String str = code;
   while (str.indexOf("<style>") != -1)
     str = str.replace(str.substring(str.indexOf("<style>"), str.indexOf("</style>") + 8), "");
   while (str.indexOf("<") != -1)
     str = str.replace(str.substring(str.indexOf("<"), str.indexOf(">") + 1), "");
   str = str.replace("&nbsp;", " ");
   for (i = 0; i < LINES.length(); i++) str = str.replace(LINES.substring(i), "\n");
   for (i = 0; i < SPACES.length() - 1; i++) str = str.replace(SPACES.substring(i), " ");
   str = str.replace("\n ", "\n");
   while (str.startsWith("\n")) str = str.substring(1);
   return str;
 }
 @SuppressFBWarnings(
     value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD",
     justification = "only the initializing thread accesses this field")
 public void close() {
   final long end = System.currentTimeMillis();
   int n = nesting.decrementAndGet();
   System.out.println(
       " DONE: " + SPACES.substring(0, n * 2) + name + " [" + (end - start) + " ms]");
   if (n == 0) {
     initializingThread = null;
   }
 }
 private InitTimer(String name) {
   int n = nesting.getAndIncrement();
   if (n == 0) {
     initializingThread = Thread.currentThread();
     System.out.println("INITIALIZING THREAD: " + initializingThread);
   } else {
     assert Thread.currentThread() == initializingThread
         : Thread.currentThread() + " != " + initializingThread;
   }
   this.name = name;
   this.start = System.currentTimeMillis();
   System.out.println("START: " + SPACES.substring(0, n * 2) + name);
 }
Example #4
0
 /** Return a string with number of spaces equal to the tab-stop of the TextComponent */
 public static String getTab(JTextComponent target) {
   return SPACES.substring(0, getTabSize(target));
 }