Esempio n. 1
0
  private static void dbg() {

    synchronized (monitor) {
      Dbg.wr('|');
      for (int i = 0; i < CNT; ++i) { // @WCA loop=8
        Dbg.wr('0' + packets[i].status);
      }
      Dbg.wr('|');
    }
  }
Esempio n. 2
0
 public void complain(AST ast, String msg) {
   errCount++;
   int l = ast.lineNumber;
   int c = ast.columnNumber;
   pw.println(l + "." + c + ": Error " + msg);
   dbg.print(l + "." + c + ": Error " + msg);
 }
Esempio n. 3
0
  /** Request a packet of a given type from the pool and set new type and source. */
  public static Packet getPacket(int type, int newType, LinkLayer s) {

    int i;
    Packet p;

    if (!initOk) {
      init();
    }
    synchronized (monitor) {
      for (i = 0; i < CNT; ++i) { // @WCA loop=8
        if (packets[i].status == type) {
          break;
        }
      }
      if (i == CNT) {
        if (type == FREE) Dbg.wr('!');
        return null;
      }
      packets[i].status = newType;
      packets[i].interf = s;
      p = packets[i];
    }
    // dbg();
    return p;
  }
Esempio n. 4
0
 private static void resolveHostAddresses(String cn, Collection<String> retval) {
   try {
     InetAddress[] addresses = InetAddress.getAllByName(cn);
     for (InetAddress address : addresses) {
       retval.add(address.getHostAddress());
     }
   } catch (UnknownHostException e) {
     Dbg.d(e);
   }
 }
Esempio n. 5
0
 /** Register a critic in the global table of critics that have been
  * loaded. Critics are associated with one or more design material
  * classes. One way to do registration is in a static initializer of
  * the design material class. But additional (after-market) critics
  * could added thorugh a menu command in some control panel...*/
 public static void register(Critic cr, Class clazz) {
   //System.out.println("registering critic " + c.toString());
   Vector critics = (Vector) getCriticRegistry().get(clazz);
   if (critics == null) {
      critics = new Vector();
      _criticRegistry.put(clazz, critics);
   }
   critics.addElement(cr);
   notifyStaticObservers(cr);
   Dbg.log("debugRegistration","Registered: " + critics.toString());
   _cachedCritics.remove(clazz);
   addCritic(cr);
 }