/**
   * Get a Vector of Strings listing all the feature types wanted. Returned with the area features
   * first, then text features, then line features.
   */
  public Vector<String> getFeatures() {
    if (_currentFeatureList == null) {
      _currentFeatureList = new Vector<String>();

      if (_currentFeatures != null) {
        // right, first pass through doing the area items (the ones that end in 'a')
        Enumeration<FeaturePainter> enumer = _currentFeatures.elements();
        while (enumer.hasMoreElements()) {
          final FeaturePainter fp = enumer.nextElement();
          if (fp.getVisible()) {
            final String nm = fp.getFeatureType();
            if (nm.endsWith("a")) _currentFeatureList.add(fp.getFeatureType());
          }
        }

        // now pass through doing the others
        enumer = _currentFeatures.elements();
        while (enumer.hasMoreElements()) {
          final FeaturePainter fp = enumer.nextElement();
          if (fp.getVisible()) {
            final String nm = fp.getFeatureType();
            if (!nm.endsWith("a")) _currentFeatureList.add(fp.getFeatureType());
          }
        }
      }
    }

    return _currentFeatureList;
  }
示例#2
0
  void fireObjectsNotification() throws Exception {
    String strBody = "";
    String strUrl = "";

    synchronized (m_mxObjectNotify) {
      if (m_strObjectNotifyUrl.length() == 0) return;

      strUrl = getNet().resolveUrl(m_strObjectNotifyUrl);

      Enumeration valsNotify = m_hashSrcIDAndObject.elements();
      Enumeration keysNotify = m_hashSrcIDAndObject.keys();
      while (valsNotify.hasMoreElements()) {
        Integer nSrcID = (Integer) keysNotify.nextElement();
        Hashtable hashObject = (Hashtable) valsNotify.nextElement();

        Enumeration valsObject = hashObject.elements();
        Enumeration keysObject = hashObject.keys();
        while (valsObject.hasMoreElements()) {
          int nNotifyType = ((Integer) valsObject.nextElement()).intValue();
          String strObject = (String) keysObject.nextElement();

          if (nNotifyType == enNone.intValue()) continue;

          // This is slow operation
          /*
                              if ( nNotifyType == enDelete.intValue() )
                              {
                                  IDBResult res = getDB().executeSQL("SELECT object FROM object_values where object=? LIMIT 1 OFFSET 0", strObject );
                                  if ( !res.isOneEnd() )
                                      nNotifyType = enUpdate.intValue();
                              }
          */
          if (strBody.length() > 0) strBody += "&rho_callback=1&";

          if (nNotifyType == enDelete.intValue()) {
            strBody += "deleted[][object]=" + strObject;
            strBody += "&deleted[][source_id]=" + nSrcID;
          } else if (nNotifyType == enUpdate.intValue()) {
            strBody += "updated[][object]=" + strObject;
            strBody += "&updated[][source_id]=" + nSrcID;
          } else if (nNotifyType == enCreate.intValue()) {
            strBody += "created[][object]=" + strObject;
            strBody += "&created[][source_id]=" + nSrcID;
          }

          hashObject.put(strObject, enNone);
        }
      }

      if (strBody.length() == 0) return;
    }

    callNotify(new SyncNotification(strUrl, "", false), strBody);
  }
示例#3
0
  public void create(String oql) throws QueryException {

    _fieldNum = 0;
    _expr = null;
    _spCall = null;

    // Separate parser for CALL-type queries (using stored procedured)
    if (oql.startsWith("CALL ")) {
      createCall(oql);
      return;
    }

    Lexer lexer = new Lexer(oql);
    Parser parser = new Parser(lexer);
    ParseTreeNode parseTree = parser.getParseTree();

    _dbEngine = _dbImpl.getPersistenceEngine();
    if (_dbEngine == null) throw new QueryException("Could not get a persistence engine");

    ParseTreeWalker walker = new ParseTreeWalker(_dbEngine, parseTree, _dbImpl.getClassLoader());

    _objClass = walker.getObjClass();
    _clsDesc = walker.getClassDescriptor();
    _expr = walker.getQueryExpression();
    _paramInfo = walker.getParamInfo();
    _projectionType = walker.getProjectionType();
    _pathInfo = walker.getPathInfo();

    // port param info types back to the format of old bind types.
    // first get the maximum SQL param.
    int max = 0;
    for (Enumeration e = _paramInfo.elements(); e.hasMoreElements(); ) {
      ParamInfo info = (ParamInfo) e.nextElement();
      for (Enumeration f = info.getParamMap().elements(); f.hasMoreElements(); ) {
        int paramIndex = ((Integer) f.nextElement()).intValue();
        if (paramIndex > max) max = paramIndex;
      }
    }

    // then create the types array and fill it
    _bindTypes = new Class[max];
    for (Enumeration e = _paramInfo.elements(); e.hasMoreElements(); ) {
      ParamInfo info = (ParamInfo) e.nextElement();
      for (Enumeration f = info.getParamMap().elements(); f.hasMoreElements(); ) {
        int paramIndex = ((Integer) f.nextElement()).intValue();
        _bindTypes[paramIndex - 1] = f.getClass();
      }
    }
  }
  /** readObject is called to restore the state of the BasicPermissionCollection from a stream. */
  private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    // Don't call defaultReadObject()

    // Read in serialized fields
    ObjectInputStream.GetField gfields = in.readFields();

    // Get permissions
    Hashtable permissions = (Hashtable) gfields.get("permissions", null);
    perms = new HashMap(permissions.size() * 2);
    perms.putAll(permissions);

    // Get all_allowed
    all_allowed = gfields.get("all_allowed", false);

    // Get permClass
    permClass = (Class) gfields.get("permClass", null);

    if (permClass == null) {
      // set permClass
      Enumeration e = permissions.elements();
      if (e.hasMoreElements()) {
        Permission p = (Permission) e.nextElement();
        permClass = p.getClass();
      }
    }
  }
示例#5
0
  public Params(Params other) {

    // copy values from other
    debug = other.debug;
    verbose = other.verbose;
    ignoreVParams = other.ignoreVParams;
    stopLevel = other.stopLevel;
    Species = other.Species;
    WoodType = other.WoodType;
    Seed = other.Seed;
    Smooth = other.Smooth;

    // create paramDB
    paramDB = new Hashtable();
    levelParams = new LevelParams[4];
    for (int l = 0; l < 4; l++) {
      levelParams[l] = new LevelParams(l, paramDB);
    }
    registerParams();

    // copy param values
    for (Enumeration e = paramDB.elements(); e.hasMoreElements(); ) {
      AbstractParam p = ((AbstractParam) e.nextElement());
      try {
        AbstractParam otherParam = other.getParam(p.name);
        if (!otherParam.empty()) {
          p.setValue(otherParam.getValue());
        } // else use default value
      } catch (ParamError err) {
        System.err.println("Error copying params: " + err.getMessage());
      }
    }
  }
示例#6
0
  public String closestNote(double frequency) {
    double f = frequency;
    double minDist = Double.MAX_VALUE;
    double val = 0, x;
    double dist;
    String s = "hello";

    while (f < 261.6) f = f * 2.0;

    while (f > 783.9) f = f * 0.5;

    for (Enumeration<Double> e = notes.elements(); e.hasMoreElements(); ) {
      x = e.nextElement();
      dist = Math.abs(x - f);
      if (dist < minDist) {
        minDist = dist;
        val = x;
      }
    }

    for (@SuppressWarnings("rawtypes") Map.Entry entry : notes.entrySet()) {
      if (entry.getValue().equals(val)) {
        s = (String) entry.getKey();
        break;
      }
    }

    return s;
  }
示例#7
0
 /** This method is periodically invoked so that memory footprint will be minimized. */
 void compress() {
   if (compressCount++ > COMPRESS_THRESHOLD) {
     compressCount = 0;
     Enumeration e = classes.elements();
     while (e.hasMoreElements()) ((CtClass) e.nextElement()).compress();
   }
 }
示例#8
0
  // ------------------------------------------------------------------------
  // SCREEN PAINTER
  // Put some function here to paint whatever you want over the screen before and after
  // all edges and nodes have been painted.
  public void PaintScreenBefore(Graphics g) {

    Dimension d = MainClass.mainFrame.GetGraphDisplayPanel().getSize();
    NodeInfo nodeInfo;
    int x = 0;
    int y = 0;
    int step = 10;

    for (; x < d.width; x += step) {
      for (y = 0; y < d.height; y += step) {
        double val = 0;
        double sum = 0;
        double total = 0;
        double min = 10000000;
        for (Enumeration nodes = proprietaryNodeInfo.elements(); nodes.hasMoreElements(); ) {
          nodeInfo = (NodeInfo) nodes.nextElement();
          double dist = distance(x, y, nodeInfo.centerX, nodeInfo.centerY);
          if (nodeInfo.value != -1 && nodeInfo.nodeNumber.intValue() != 1) { // 121
            if (dist < min) min = dist;
            val += ((double) nodeInfo.value) / dist / dist;
            sum += (1 / dist / dist);
          }
        }
        int reading = (int) (val / sum);
        reading = reading >> 2;
        if (reading > 255) reading = 255;
        g.setColor(new Color(reading, reading, reading));
        g.fillRect(x, y, step, step);
      }
    }
  }
示例#9
0
  /** Dump the dependency information loaded from the classes to the Ant log */
  private void dumpDependencies() {
    log("Reverse Dependency Dump for " + affectedClassMap.size() + " classes:", Project.MSG_DEBUG);

    Enumeration classEnum = affectedClassMap.keys();
    while (classEnum.hasMoreElements()) {
      String className = (String) classEnum.nextElement();
      log(" Class " + className + " affects:", Project.MSG_DEBUG);
      Hashtable affectedClasses = (Hashtable) affectedClassMap.get(className);
      Enumeration affectedClassEnum = affectedClasses.keys();
      while (affectedClassEnum.hasMoreElements()) {
        String affectedClass = (String) affectedClassEnum.nextElement();
        ClassFileInfo info = (ClassFileInfo) affectedClasses.get(affectedClass);
        log("    " + affectedClass + " in " + info.absoluteFile.getPath(), Project.MSG_DEBUG);
      }
    }

    if (classpathDependencies != null) {
      log("Classpath file dependencies (Forward):", Project.MSG_DEBUG);

      Enumeration classpathEnum = classpathDependencies.keys();
      while (classpathEnum.hasMoreElements()) {
        String className = (String) classpathEnum.nextElement();
        log(" Class " + className + " depends on:", Project.MSG_DEBUG);
        Hashtable dependencies = (Hashtable) classpathDependencies.get(className);

        Enumeration classpathFileEnum = dependencies.elements();
        while (classpathFileEnum.hasMoreElements()) {
          File classpathFile = (File) classpathFileEnum.nextElement();
          log("    " + classpathFile.getPath(), Project.MSG_DEBUG);
        }
      }
    }
  }
  @Override
  public void dispose() {
    getSite().getPage().removePartListener(fPartListener);

    Enumeration<IMemoryViewPane> enumeration = fViewPanes.elements();
    while (enumeration.hasMoreElements()) {
      Object element = enumeration.nextElement();
      if (element instanceof IMemoryViewPane) {
        ((IMemoryViewPane) element).dispose();
      }
    }

    fViewPaneControls.clear();

    IViewSite viewSite = getViewSite();
    String secondaryId = viewSite.getSecondaryId();
    if (secondaryId != null) MemoryViewIdRegistry.deregisterView(secondaryId);

    fSyncService.shutdown();

    if (fAddHandler != null) fAddHandler.dispose();

    if (fToggleMonitorsHandler != null) fToggleMonitorsHandler.dispose();

    if (fNextMemoryBlockHandler != null) fNextMemoryBlockHandler.dispose();

    super.dispose();
  }
  /** Shut down all connections and clean up. */
  public void shutDown() {
    // inform all associated streams
    synchronized (connectionTable) {
      // return if multiplexer already officially dead
      if (!alive) return;
      alive = false;

      Enumeration<MultiplexConnectionInfo> enum_ = connectionTable.elements();
      while (enum_.hasMoreElements()) {
        MultiplexConnectionInfo info = enum_.nextElement();
        info.in.disconnect();
        info.out.disconnect();
      }
      connectionTable.clear();
      numConnections = 0;
    }

    // close underlying connection, if possible (and not already done)
    try {
      in.close();
    } catch (IOException e) {
    }
    try {
      out.close();
    } catch (IOException e) {
    }
  }
示例#12
0
  /** Store the keystore to a file. */
  public void store() throws Exception {
    Enumeration elementEnum = _licences.elements();

    if (_file == null) create();

    FileWriter writer = new FileWriter(_file);

    while (elementEnum.hasMoreElements()) {
      LicenceKey l = (LicenceKey) elementEnum.nextElement();
      ActivationKey a = (ActivationKey) _keys.get(l);

      writer.write(l.toString());
      if (a != null) writer.write(a.toString());

      // This should not be null
      if (_publicGroup.equals(new Boolean("true"))) writer.write("1");
      else writer.write("0");

      String strInstallationRef =
          getAdjustInstallationReferenceNumber(_installationReferenceNumber);
      writer.write(strInstallationRef);

      String availableMessages = getAdjustPublicMessages(getAvailablePublicMessages());
      writer.write(availableMessages);

      if (_registeredEmailAddress != null) {
        writer.write(_registeredEmailAddress);
      }
    }

    writer.close();
  }
  /** @see net.sf.mzmine.datamodel.RawDataFile#getDataMaxBasePeakIntensity() */
  public double getDataMaxBasePeakIntensity(int msLevel) {
    // check if we have this value already cached
    Double maxBasePeak = dataMaxBasePeakIntensity.get(msLevel);
    if (maxBasePeak != null) return maxBasePeak;

    // find the value
    Enumeration<StorableScan> scansEnum = scans.elements();
    while (scansEnum.hasMoreElements()) {
      Scan scan = scansEnum.nextElement();

      // ignore scans of other ms levels
      if (scan.getMSLevel() != msLevel) continue;

      DataPoint scanBasePeak = scan.getHighestDataPoint();
      if (scanBasePeak == null) continue;

      if ((maxBasePeak == null) || (scanBasePeak.getIntensity() > maxBasePeak))
        maxBasePeak = scanBasePeak.getIntensity();
    }

    // return -1 if no scan at this MS level
    if (maxBasePeak == null) maxBasePeak = -1d;

    // cache the value
    dataMaxBasePeakIntensity.put(msLevel, maxBasePeak);

    return maxBasePeak;
  }
示例#14
0
  @Test
  public void testToListWithHashtable() {
    final Hashtable<String, Integer> expected = new Hashtable<String, Integer>();
    expected.put("one", Integer.valueOf(1));
    expected.put("two", Integer.valueOf(2));
    expected.put("three", Integer.valueOf(3));
    // validate elements.
    final List<Integer> actualEltList = EnumerationUtils.toList(expected.elements());
    assertEquals(expected.size(), actualEltList.size());
    assertTrue(actualEltList.contains(Integer.valueOf(1)));
    assertTrue(actualEltList.contains(Integer.valueOf(2)));
    assertTrue(actualEltList.contains(Integer.valueOf(3)));
    final List<Integer> expectedEltList = new ArrayList<Integer>();
    expectedEltList.add(Integer.valueOf(1));
    expectedEltList.add(Integer.valueOf(2));
    expectedEltList.add(Integer.valueOf(3));
    assertTrue(actualEltList.containsAll(expectedEltList));

    // validate keys.
    final List<String> actualKeyList = EnumerationUtils.toList(expected.keys());
    assertEquals(expected.size(), actualEltList.size());
    assertTrue(actualKeyList.contains("one"));
    assertTrue(actualKeyList.contains("two"));
    assertTrue(actualKeyList.contains("three"));
    final List<String> expectedKeyList = new ArrayList<String>();
    expectedKeyList.add("one");
    expectedKeyList.add("two");
    expectedKeyList.add("three");
    assertTrue(actualKeyList.containsAll(expectedKeyList));
  }
  // ---------------------------------------------------------------
  public void newEntity(Address addr) {
    // Inform listeners
    Enumeration e = virtual.elements();
    while (e.hasMoreElements()) ((VirtualMBusListener) e.nextElement()).newEntity(addr);

    external.addElement(addr);
  }
示例#16
0
 public synchronized boolean checkAllBlocksReceived() {
   synchronized (_blocksReceived) {
     if (_totalBlocks < 0) {
       PackagingLogger.debugLog(
           CLASS_NAME, "checkAllBlocksReceived", "totalBlocks < 0 : " + _totalBlocks);
       return false;
     } else if (_blocksReceived.size() < _totalBlocks) {
       PackagingLogger.debugLog(
           CLASS_NAME,
           "checkAllBlocksReceived",
           "_blocksReceived.size=" + _blocksReceived.size() + " , _totalBlocks=" + _totalBlocks);
       return false;
     } else {
       Enumeration elements = _blocksReceived.elements();
       while (elements.hasMoreElements()) {
         if (!((Boolean) elements.nextElement()).booleanValue()) {
           PackagingLogger.infoLog(CLASS_NAME, "checkAllBlocksReceived", "element = false!");
           return false;
         }
       }
       PackagingLogger.infoLog(CLASS_NAME, "checkAllBlocksReceived", "return true!!!!!");
       return true;
     }
   }
 }
示例#17
0
  /**
   * Calls the actionPerformed method of all the registered callbacks.
   *
   * <p>
   */
  public void notifyUCallbackListeners() {
    for (Enumeration e = tab.elements(); e.hasMoreElements(); ) {
      UCallbackListener listener = (UCallbackListener) tab.get(e.nextElement());

      listener.actionPerformed(null);
    }
  }
示例#18
0
 /**
  * Returns a list (no order) of RollingStock.
  *
  * @return list of RollingStock
  */
 public List<RollingStock> getList() {
   Enumeration<RollingStock> en = _hashTable.elements();
   List<RollingStock> out = new ArrayList<RollingStock>();
   while (en.hasMoreElements()) {
     out.add(en.nextElement());
   }
   return out;
 }
示例#19
0
 protected void selectCheckboxes(boolean enable) {
   Enumeration<JCheckBox> en = checkBoxes.elements();
   while (en.hasMoreElements()) {
     JCheckBox checkBox = en.nextElement();
     checkBox.setSelected(enable);
   }
   isSetMode = false;
 }
 /** This method is to be overrided by subclass. */
 public void saveParam() throws Exception {
   Enumeration en = tablePanel.elements();
   AbstractParamPanel panel = null;
   while (en.hasMoreElements()) {
     panel = (AbstractParamPanel) en.nextElement();
     panel.saveParam(paramObject);
   }
 }
示例#21
0
  /** Returns the number of bytes used by the controller cache */
  public static int getControllerCacheBytes() {
    if (!_cacheControllers) return 0;

    int count = 0;
    Enumeration e = _controllerCache.elements();
    while (e.hasMoreElements()) count += ((byte[]) e.nextElement()).length;
    return count;
  }
 /**
  * Returns the supported MIME types
  *
  * @return List
  */
 public static Vector<String> getSupportedMimeTypes() {
   Vector<String> result = new Vector<String>();
   for (Enumeration<String> e = mimeTable.elements(); e.hasMoreElements(); ) {
     String mime = e.nextElement();
     result.addElement(mime);
   }
   return result;
 }
示例#23
0
 public static void main(String[] args) {
   Hashtable ht = new Hashtable();
   ht.put("1", "One");
   ht.put("2", "Two");
   ht.put("3", "Three");
   Enumeration e = ht.elements();
   while (e.hasMoreElements()) System.out.println(e.nextElement());
 }
示例#24
0
 private void compileModes(ClassGenerator classGen) {
   _defaultMode.compileApplyTemplates(classGen);
   final Enumeration modes = _modes.elements();
   while (modes.hasMoreElements()) {
     final Mode mode = (Mode) modes.nextElement();
     mode.compileApplyTemplates(classGen);
   }
 }
示例#25
0
 private final void closeNorms() throws IOException {
   synchronized (norms) {
     Enumeration enumerator = norms.elements();
     while (enumerator.hasMoreElements()) {
       Norm norm = (Norm) enumerator.nextElement();
       norm.in.close();
     }
   }
 }
示例#26
0
  /**
   * List all stored cookies for all contexts.
   *
   * @return an array of all Cookies
   * @since V0.3-1
   */
  public static Cookie[] listAllCookies() {
    synchronized (cookie_cntxt_list) {
      Cookie[] cookies = new Cookie[0];
      int idx = 0;

      Enumeration cntxt_list = cookie_cntxt_list.elements();
      while (cntxt_list.hasMoreElements()) {
        Hashtable cntxt = (Hashtable) cntxt_list.nextElement();
        synchronized (cntxt) {
          cookies = Util.resizeArray(cookies, idx + cntxt.size());
          Enumeration cookie_list = cntxt.elements();
          while (cookie_list.hasMoreElements()) cookies[idx++] = (Cookie) cookie_list.nextElement();
        }
      }

      return cookies;
    }
  }
示例#27
0
 public void processModes() {
   if (_defaultMode == null) _defaultMode = new Mode(null, this, Constants.EMPTYSTRING);
   _defaultMode.processPatterns(_keys);
   final Enumeration modes = _modes.elements();
   while (modes.hasMoreElements()) {
     final Mode mode = (Mode) modes.nextElement();
     mode.processPatterns(_keys);
   }
 }
 public void sync() throws ClientTestException {
   if (Log.isLoggable(Log.TRACE)) {
     Log.trace(TAG_LOG, "sync all sources");
   }
   Enumeration sources = syncSources.elements();
   while (sources.hasMoreElements()) {
     sync((CheckSyncSource) sources.nextElement());
   }
 }
  public static ClassProxy forName(String s) throws ClassNotFoundException {

    Enumeration<RemoteFactory> factories = registry.elements();
    while (factories.hasMoreElements()) {
      ClassProxy classProxy = factories.nextElement().forName(s);
      if (classProxy != null) return classProxy;
    }
    return javaClassForName(s);
  }
  /**
   * Get all the exporters metadata
   *
   * @return an array of {@link ExporterMetadata}
   */
  public static ExporterMetadata[] getAllExporterMetadata() {
    ExporterMetadata[] _exporters = new ExporterMetadata[exporters.size()];
    Enumeration<ExporterMetadata> enumr = exporters.elements();
    for (int i = 0; enumr.hasMoreElements(); i++) {
      _exporters[i] = enumr.nextElement();
    }

    return _exporters;
  }