Executes the pattern search.
967593
private void mine()
	{
		Miner miner = (Miner) patternCombo.getSelectedItem();
		if (miner instanceof MinerAdapter)
			((MinerAdapter) miner).setIDFetcher(new CommonIDFetcher());

		// Constructing the pattern before loading any model for a debug friendly code. Otherwise if
		// loading model takes time and an exception occurs in pattern construction, it is just too
		// much wait for nothing.
				((Miner) patternCombo.getSelectedItem()).getPattern();

		// Prepare progress bar

		ProgressWatcher prg = new ProgressWatcher()
		{
			@Override
			public synchronized  void setTotalTicks(int total)
			{
				prgBar.setMaximum(total);
			}

			@Override
			public synchronized  void tick(int times)
			{
				prgBar.setValue(prgBar.getValue() + times);
			}
		};

		prgBar.setVisible(true);

		// Get the model file

		File modFile;

		if (pcRadio.isSelected())
		{
			if (getMaxMemory() < 4000)
			{
				showMessageDialog(this, "Maximum memory not large enough for handling\n" +
					"Pathway Commons data. But will try anyway.\n" +
					"Please consider running this application with the\n" +
					"virtual machine parameter \"-Xmx5G\".");
			}

			modFile = new File(getPCFilename());
			if (!modFile.exists())
			{
				prgLabel.setText("Downloading model");
				if (!downloadPC(prg))
				{
					eraseProgressBar();
					showMessageDialog(this,
						"Cannot download Pathway Commons data for some reason. Sorry.");
					return;
				}
				assert modFile.exists();
			}
		}
		else if (customFileRadio.isSelected())
		{
			modFile = new File(modelField.getText());
		}
		else if (customURLRadio.isSelected())
		{
			String url = urlField.getText().trim();
			prgLabel.setText("Downloading model");
			if (url.endsWith(".gz")) downloadCompressed(prg, url, "temp.owl", true);
			else if (url.endsWith(".zip")) downloadCompressed(prg, url, "temp.owl", false);
			else downloadPlain(url, "temp.owl");

			modFile = new File("temp.owl");

			if (!modFile.exists())
			{
				showMessageDialog(this,
					"Cannot download the model at the given URL.");
				eraseProgressBar();
				return;
			}
		}
		else
		{
			throw new RuntimeException("Code should not be able to reach here!");
		}

		// Get the output file

		File outFile = new File(outputField.getText());

		try
		{
			BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));
			writer.write("x");
			writer.close();
			outFile.delete();
		}
		catch (IOException e)
		{
			e.printStackTrace();
			eraseProgressBar();
			showMessageDialog(this, "Cannot write to file: " + outFile.getPath());
			return;
		}

		// Load model

		prgLabel.setText("Loading the model");
		prgBar.setIndeterminate(true);
		prgBar.setStringPainted(false);
		SimpleIOHandler io = new SimpleIOHandler();
		Model model;

		try
		{
			model = io.convertFromOWL(new FileInputStream(modFile));
			prgBar.setIndeterminate(false);
			prgBar.setStringPainted(true);
		}
		catch (FileNotFoundException e)
		{
			e.printStackTrace();
			eraseProgressBar();
			showMessageDialog(this, "File not found: " + modFile.getPath());
			return;
		}

		// Search

		Miner min = (Miner) patternCombo.getSelectedItem();

		Pattern p = min.getPattern();
		prgLabel.setText("Searching the pattern");
		prgBar.setValue(0);
		Map<BioPAXElement,List<Match>> matches = Searcher.search(model, p, prg);

		if (matches.isEmpty())
		{
			prgLabel.setText("No results found!");
		}
		else
		{
			try
			{
				prgLabel.setText("Writing result");
				prgBar.setValue(0);
				prgBar.setStringPainted(false);
				prgBar.setIndeterminate(true);
				FileOutputStream os = new FileOutputStream(outFile);
				min.writeResult(matches, os);
				os.close();
				prgBar.setIndeterminate(false);
			}
			catch (IOException e)
			{
				e.printStackTrace();
				eraseProgressBar();
				showMessageDialog(this, "Error occurred while writing the results");
				return;
			}

			prgLabel.setText("Success!    ");
			System.out.println("Success!");
			this.dispose();
		}
	}
650601
private final boolean matchPattern(byte[][] patterns, int bufferIndex)
   {
      boolean match = false;
      for (byte[] pattern : patterns)
      {
         int index = 0;
         match = true;
         for (byte b : pattern)
         {
            if (b != m_buffer[bufferIndex + index])
            {
               match = false;
               break;
            }
            ++index;
         }
         if (match)
         {
            break;
         }
      }
      return match;
   }
1052933
public void execute()
        throws InstallationException
    {
        Instance instance = searchInstance();
        if (instance == null) {
            instance = createInstance();
        }
        updateDB(instance);
    }
643373
public function execute()
    {
        $batch  = $this->getBatch();
        $import = $batch->getVariable('import');

        if (! (isset($import['trackId']) && $import['trackId'])) {
            // Do nothing
            return;
        }

        $tracker     = $this->loader->getTracker();
        $trackEngine = $tracker->getTrackEngine($import['trackId']);
        $trackEngine->updateRoundCount($this->currentUser->getUserLoginId());
        
        // Now cleanup the cache
        $this->cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('tracks'));
    }
157163
public function execute() {
        if (!\core_search\manager::is_indexing_enabled()) {
            return;
        }

        $globalsearch = \core_search\manager::instance();

        // Optimize index at last.
        $globalsearch->optimize_index();
    }
30554
public void execute() {
		
		try {
			createBundles();
		} catch (Exception ex) {
			Logger logger = Logger.getLogger(getClass().getName());
			if(ex instanceof ServletException){
				logger.log(Level.SEVERE, null, ((ServletException)ex).getRootCause());
			}else{
				logger.log(Level.SEVERE, null, ex);
			}
		}
	}
14602
final public function execute()
    {
        $platform = $this->connection->getDatabasePlatform();
        $queries  = $this->currentSchema->getMigrateToSql($this->schema, $platform);

        foreach ($queries as $query) {
            $this->connection->query($query);
        }
    }
141485
public void run() {
    final Scanner scanner = getScanner();

    // start the process by loading all of the trees in the system
    final List<Tree> trees;
    try {
      trees = Tree.fetchAllTrees(tsdb).joinUninterruptibly();
      LOG.info("[" + thread_id + "] Complete");
    } catch (Exception e) {
      LOG.error("[" + thread_id + "] Unexpected Exception", e);
      throw new RuntimeException("[" + thread_id + "] Unexpected exception", e);
    }
    
    if (trees == null) {
      LOG.warn("No tree definitions were found");
      return;
    } else {
      boolean has_enabled_tree = false;
      for (Tree tree : trees) {
        if (tree.getEnabled()) {
          has_enabled_tree = true;
          break;
        }
      }
      if (!has_enabled_tree) {
        LOG.warn("No enabled trees were found");
        return;
      }
      LOG.info("Found [" + trees.size() + "] trees");
    }
    
    // setup an array for storing the tree processing calls so we can block 
    // until each call has completed
    final ArrayList<Deferred<Boolean>> tree_calls = 
      new ArrayList<Deferred<Boolean>>();
    
    final Deferred<Boolean> completed = new Deferred<Boolean>();

    /**
     * Scanner callback that loops through the UID table recursively until 
     * the scanner returns a null row set.
     */
    final class TsuidScanner implements Callback<Deferred<Boolean>, 
      ArrayList<ArrayList<KeyValue>>> {

      /**
       * Fetches the next set of rows from the scanner, adding this class as a 
       * callback
       * @return A meaningless deferred used to wait on until processing has
       * completed
       */
      public Deferred<Boolean> scan() {
        return scanner.nextRows().addCallbackDeferring(this);
      }
      
      @Override
      public Deferred<Boolean> call(ArrayList<ArrayList<KeyValue>> rows)
          throws Exception {
        if (rows == null) {
          completed.callback(true);
          return null;
        }
        
        for (final ArrayList<KeyValue> row : rows) {
          // convert to a string one time
          final String tsuid = UniqueId.uidToString(row.get(0).key());
          
          /**
           * A throttling callback used to wait for the current TSMeta to 
           * complete processing through the trees before continuing on with 
           * the next set.
           */
          final class TreeBuilderBufferCB implements Callback<Boolean, 
            ArrayList<ArrayList<Boolean>>> {

            @Override
            public Boolean call(ArrayList<ArrayList<Boolean>> builder_calls)
                throws Exception {
              //LOG.debug("Processed [" + builder_calls.size() + "] tree_calls");
              return true;
            }
            
          }
          
          /**
           * Executed after parsing a TSMeta object and loading all of the
           * associated UIDMetas. Once the meta has been loaded, this callback
           * runs it through each of the configured TreeBuilder objects and
           * stores the resulting deferred in an array. Once processing of all
           * of the rules has completed, we group the deferreds and call
           * BufferCB() to wait for their completion.
           */
          final class ParseCB implements Callback<Deferred<Boolean>, TSMeta> {

            final ArrayList<Deferred<ArrayList<Boolean>>> builder_calls = 
              new ArrayList<Deferred<ArrayList<Boolean>>>();
            
            @Override
            public Deferred<Boolean> call(TSMeta meta) throws Exception {
              if (meta != null) {
                LOG.debug("Processing TSMeta: " + meta + " w value: " + 
                    JSON.serializeToString(meta));
                
                // copy the trees into a tree builder object and iterate through
                // each builder. We need to do this as a builder is not thread
                // safe and cannot be used asynchronously.
                final ArrayList<TreeBuilder> tree_builders = 
                new ArrayList<TreeBuilder>(trees.size());
                for (Tree tree : trees) {
                  if (!tree.getEnabled()) {
                    continue;
                  }
                  final TreeBuilder builder = new TreeBuilder(tsdb, tree);
                  tree_builders.add(builder);
                }
                
                for (TreeBuilder builder : tree_builders) {
                  builder_calls.add(builder.processTimeseriesMeta(meta));
                }
                return Deferred.group(builder_calls)
                  .addCallback(new TreeBuilderBufferCB());
              } else {
                return Deferred.fromResult(false);
              }
            }
            
          }
          
          /**
           * An error handler used to catch issues when loading the TSMeta such
           * as a missing UID name. In these situations we want to log that the 
           * TSMeta had an issue and continue on.
           */
          final class ErrBack implements Callback<Deferred<Boolean>, Exception> {
            
            @Override
            public Deferred<Boolean> call(Exception e) throws Exception {
              
              if (e.getClass().equals(IllegalStateException.class)) {
                LOG.error("Invalid data when processing TSUID [" + tsuid + "]", e);
              } else if (e.getClass().equals(IllegalArgumentException.class)) {
                LOG.error("Invalid data when processing TSUID [" + tsuid + "]", e);
              } else if (e.getClass().equals(NoSuchUniqueId.class)) {
                LOG.warn("Timeseries [" + tsuid + 
                    "] includes a non-existant UID: " + e.getMessage());
              } else {
                LOG.error("[" + thread_id + "] Exception while processing TSUID [" + 
                    tsuid + "]", e);
              }
              
              return Deferred.fromResult(false);
            }
            
          }

          // matched a TSMeta column, so request a parsing and loading of
          // associated UIDMeta objects, then pass it off to callbacks for 
          // parsing through the trees.
          final Deferred<Boolean> process_tsmeta = 
            TSMeta.parseFromColumn(tsdb, row.get(0), true)
              .addCallbackDeferring(new ParseCB());
          process_tsmeta.addErrback(new ErrBack());
          tree_calls.add(process_tsmeta);
        }
        
        /**
         * Another buffer callback that waits for the current set of TSMetas to
         * complete their tree calls before we fetch another set of rows from
         * the scanner. This necessary to avoid OOM issues.
         */
        final class ContinueCB implements Callback<Deferred<Boolean>, 
          ArrayList<Boolean>> {

          @Override
          public Deferred<Boolean> call(ArrayList<Boolean> tsuids)
              throws Exception {
            LOG.debug("Processed [" + tsuids.size() + "] tree_calls, continuing");
            tree_calls.clear();
            return scan();
          }
          
        }
        
        // request the next set of rows from the scanner, but wait until the
        // current set of TSMetas has been processed so we don't slaughter our
        // host
        Deferred.group(tree_calls).addCallback(new ContinueCB());
        return Deferred.fromResult(null);
      }
      
    }
    
    /**
     * Used to capture unhandled exceptions from the scanner callbacks and 
     * exit the thread properly
     */
    final class ErrBack implements Callback<Deferred<Boolean>, Exception> {
      
      @Override
      public Deferred<Boolean> call(Exception e) throws Exception {
        LOG.error("Unexpected exception", e);
        completed.callback(false);
        return Deferred.fromResult(false);
      }
      
    }
    
    final TsuidScanner tree_scanner = new TsuidScanner();
    tree_scanner.scan().addErrback(new ErrBack());
    try {
      completed.joinUninterruptibly();
      LOG.info("[" + thread_id + "] Complete");
    } catch (Exception e) {
      LOG.error("[" + thread_id + "] Scanner Exception", e);
      throw new RuntimeException("[" + thread_id + "] Scanner exception", e);
    }
    return;
  }
1258
def execute(self):
        
        r = self._s.execute()
        r._faceted_search = self
        return r
129398
public function execute()
    {
        //Now load all patches, and save the resulting changed patches for later (not used yet)
        $changed  = $this->patcher->uploadPatches($this->loader->getVersions()->getBuild());


        if ($changed) {
            $this->getBatch()->addMessage(sprintf($this->_('%d new or changed patch(es).'), $changed));
        }
    }
66811
public void setPattern(String pattern) {
        if (pattern == null || pattern.length() <= 0) {
            throw new IllegalArgumentException(
                    "Pattern to search for can not be null or of length 0");
        }
        pattern_.text_ = pattern;
        initialize();
    }
1168107
private static boolean matchesPatternList(final String str, final List<Pattern> patterns) {
        if (patterns != null) {
            for (final Pattern pattern : patterns) {
                if (pattern.matcher(str).matches()) {
                    return true;
                }
            }
        }
        return false;
    }
848622
public void execute() {
		if (condition == null) {
			throw new SystemException("Rule cannot be executed as it has no condition");
		}

		if (condition.isTrue()) {
			for (Action action : onTrue) {
				action.execute();
			}
		} else {
			for (Action action : onFalse) {
				action.execute();
			}
		}
	}
1360963
public void
run() {
	try {
		Message response = res.send(query);
		listener.receiveMessage(id, response);
	}
	catch (Exception e) {
		listener.handleException(id, e);
	}
}
140324
def execute(self):
        
        self.print_info()
        linters = [
            l for l in [
                self._config.lint,
                self._config.verifier.lint,
                self._config.provisioner.lint,
            ] if l
        ]

        for l in linters:
            l.execute()
116716
public void doMatch() {
    boolean matchFound = false;
    for (ConsumablePattern<T> pattern : patterns) {
      if (pattern.matches(value)) {
        pattern.consume(value);
        matchFound = true;
        break;
      }
    }

    if (!matchFound) {
      throw new MatchException("No match found for " + value);
    }
  }
515462
public void run() {

        while (keepGoing) {
            TriggerData triggerData = popPair();

            if (triggerData != null) {
                if (triggerData.username != null) {
                    trigger.fire(this.vectorIndex, name.name,
                                 table.getName().name, triggerData.oldRow,
                                 triggerData.newRow);
                }
            }
        }
    }