public virtual void  actionPerformed(System.Object event_sender, System.EventArgs event_Renamed)
 {
     //UPGRADE_NOTE: The method 'java.util.EventObject.getSource' needs to be in a event handling method in order to be properly converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1171"'
     if (event_sender.equals(closeButton))
     {
         dispose();
     }
     else
     {
         //UPGRADE_NOTE: The method 'java.util.EventObject.getSource' needs to be in a event handling method in order to be properly converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1171"'
         if (event_sender.equals(resultsBox))
         {
             System.Object item = resultsBox.SelectedItem;
             if (item != null)
             {
                 //UPGRADE_TODO: The equivalent in .NET for method 'java.Object.toString' may return a different value. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1043"'
                 aboutArea.setText((System.String)batchResults.get(item.ToString()));
             }
             batchResultsButton.setIcon(IconLoader.getImageIcon("lorry"));
         }
         else
         {
             //UPGRADE_NOTE: The method 'java.util.EventObject.getSource' needs to be in a event handling method in order to be properly converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1171"'
             if (event_sender.equals(removeButton))
             {
                 System.Object item = resultsBox.SelectedItem;
                 if (item != null)
                 {
                     resultsBoxModel.removeItem(item);
                     batchResults.remove(item);
                     aboutArea.setText("");
                     resultsBox.setSelectedIndex(-1);
                     // if we removed the last result we hide the indicator button
                     if (batchResults.isEmpty())
                     {
                         batchResultsButton.setVisible(false);
                     }
                 }
             }
             else
             {
                 //UPGRADE_NOTE: The method 'java.util.EventObject.getSource' needs to be in a event handling method in order to be properly converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1171"'
                 if (event_sender.equals(reloadButton))
                 {
                     resultsBoxModel.setItems(batchResults.keySet().toArray());
                     aboutArea.setText("");
                     resultsBox.setSelectedIndex(-1);
                 }
             }
         }
     }
 }
Example #2
0
 //public double GetDefault() {
 //   return 1.0;
 //}
 /// This is used to compare the expected and current versions of
 /// the class. Once compared the comparison result is cached
 /// within the revision class so that it can be used repeatedly.
 /// </summary>
 /// <param name="expected">
 /// this is the expected version of the class
 /// </param>
 /// <param name="current">
 /// this is the current version of the class
 /// </param>
 /// <returns>
 /// this returns true if the versions are the same
 /// </returns>
 public bool Compare(Object expected, Object current) {
    if(current != null) {
       equal = current.equals(expected);
    } else if(expected != null) {
       equal = expected.equals(1.0);
    }
    return equal;
 }
 /**
  * Is the key equal to the combined key.
  *
  * @param entry  the entry to compare to
  * @param key1  the first key
  * @param key2  the second key
  * @param key3  the third key
  * @param key4  the fourth key
  * @return true if the key matches
  */
 protected bool isEqualKey(AbstractHashedMap.HashEntry entry, Object key1, Object key2, Object key3, Object key4)
 {
     MultiKey multi = (MultiKey)entry.getKey();
     return
         multi.size() == 4 &&
         (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
         (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
         (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2))) &&
         (key4 == null ? multi.getKey(3) == null : key4.equals(multi.getKey(3)));
 }
 /**
  * Removes all mappings where the first four keys are those specified.
  * <p>
  * This method removes all the mappings where the <code>MultiKey</code>
  * has four or more keys, and the first four match those specified.
  *
  * @param key1  the first key
  * @param key2  the second key
  * @param key3  the third key
  * @param key4  the fourth key
  * @return true if any elements were removed
  */
 public bool removeAll(Object key1, Object key2, Object key3, Object key4)
 {
     bool modified = false;
     MapIterator it = mapIterator();
     while (it.hasNext())
     {
         MultiKey multi = (MultiKey)it.next();
         if (multi.size() >= 4 &&
             (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) &&
             (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) &&
             (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2))) &&
             (key4 == null ? multi.getKey(3) == null : key4.equals(multi.getKey(3))))
         {
             it.remove();
             modified = true;
         }
     }
     return modified;
 }
 //-----------------------------------------------------------------------
 /**
  * Removes all mappings where the first key is that specified.
  * <p>
  * This method removes all the mappings where the <code>MultiKey</code>
  * has one or more keys, and the first matches that specified.
  *
  * @param key1  the first key
  * @return true if any elements were removed
  */
 public bool removeAll(Object key1)
 {
     bool modified = false;
     MapIterator it = mapIterator();
     while (it.hasNext())
     {
         MultiKey multi = (MultiKey)it.next();
         if (multi.size() >= 1 &&
             (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))))
         {
             it.remove();
             modified = true;
         }
     }
     return modified;
 }
 /**
  * Returns the number of occurrences of <i>obj</i> in <i>coll</i>.
  *
  * @param obj  the object to find the cardinality of
  * @param coll  the collection to search
  * @return the the number of occurrences of obj in coll
  */
 public static int cardinality(Object obj, java.util.Collection<Object> coll)
 {
     if (coll is java.util.Set<Object>)
     {
         return (coll.contains(obj) ? 1 : 0);
     }
     if (coll is Bag)
     {
         return ((Bag)coll).getCount(obj);
     }
     int count = 0;
     if (obj == null)
     {
         for (java.util.Iterator<Object> it = coll.iterator(); it.hasNext(); )
         {
             if (it.next() == null)
             {
                 count++;
             }
         }
     }
     else
     {
         for (java.util.Iterator<Object> it = coll.iterator(); it.hasNext(); )
         {
             if (obj.equals(it.next()))
             {
                 count++;
             }
         }
     }
     return count;
 }