Package org.cishell.framework.algorithm

Examples of org.cishell.framework.algorithm.Algorithm


  /**
     * @see org.cishell.service.conversion.Converter#convert(org.cishell.framework.data.Data)
     */
    public Data convert(Data inData) throws ConversionException {
        AlgorithmFactory factory = getAlgorithmFactory();
        Algorithm algorithm = factory.createAlgorithm(new Data[]{inData}, new Hashtable<String, Object>(), ciContext);

        Data[] resultDataArray;
        try {
          resultDataArray = algorithm.execute();
    } catch (AlgorithmExecutionException e) {
      e.printStackTrace();
      throw new ConversionException(e.getMessage(), e);
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here


     * @see org.cishell.framework.algorithm.AlgorithmFactory#createAlgorithm(org.cishell.framework.data.Data[], java.util.Dictionary, org.cishell.framework.CIShellContext)
     */
    public Algorithm createAlgorithm(Data[] dm, final Dictionary parameters,
            final CIShellContext context) {
       
        Algorithm alg = new Algorithm() {
            public Data[] execute() {
                String host = (String) parameters.get("org.cishell.reference.remoting.frontend.client.host");
                int port = ((Integer) parameters.get("org.cishell.reference.remoting.frontend.client.port")).intValue();
               
                new ClientInstanceAlg(bContext, context).connect(host, port);
View Full Code Here

            for (int ii = 0; ii < serviceReferences.size(); ii++) {
                AlgorithmFactory factory =
                  bContext.getService(serviceReferences.get(ii));
               
                if (factory != null) {
                    Algorithm algorithm = factory.createAlgorithm(
                      convertedData, this.parameters, this.ciShellContext);
                   
                    try {
                      convertedData = algorithm.execute();
                    } catch(AlgorithmExecutionException e) {
                      boolean isLastStep = (ii == serviceReferences.size() - 1);
                      if (isLastStep && isHandler(serviceReferences.get(ii))) {
                        /* If the last step of the converter chain is a
                         * handler and it is the first (and so only) step
View Full Code Here

    Set keys = algorithmToGuiItemMap.keySet();

    tableItemToAlgorithmMap = Collections.synchronizedMap(new Hashtable());

    for (Iterator i = keys.iterator(); i.hasNext();) {
      Algorithm algorithm = (Algorithm) i.next();
      SchedulerTableItem schedulerTableItem = (SchedulerTableItem) algorithmToGuiItemMap
          .get(algorithm);
      schedulerTableItem.initTableEntry(table, 0);

      TableItem tableItem = schedulerTableItem.getTableItem();
View Full Code Here

    private void removeSelection() {
    TableItem[] tableItems = table.getSelection();
    for (int i = 0; i < tableItems.length; ++i) {
      for (Iterator j = algorithmToGuiItemMap.keySet().iterator(); j
          .hasNext();) {
        Algorithm algorithm = (Algorithm) j.next();
        SchedulerTableItem schedulerTableItem = (SchedulerTableItem) algorithmToGuiItemMap
            .get(algorithm);
        if (tableItems[i].equals(schedulerTableItem.getTableItem())) {
          if (algorithmIsProgressTrackable(algorithm)) {
            ProgressMonitor monitor = ((ProgressTrackable) algorithm)
View Full Code Here

     * @param destNdx Destination of table item
     */
    private void moveTableItems(int ndxToMove, int destNdx) {
    TableItem item = table.getItem(ndxToMove);
    if (item != null) {
      Algorithm algorithm = (Algorithm) tableItemToAlgorithmMap
          .get(item);
      tableItemToAlgorithmMap.remove(item);

      SchedulerTableItem schedulerTableItem = (SchedulerTableItem) algorithmToGuiItemMap
          .get(algorithm);
View Full Code Here

    private class TableListener extends SelectionAdapter {
    public void widgetSelected(SelectionEvent e) {
      TableItem[] items = table.getSelection();
      for (int i = 0; i < items.length; ++i) {
        TableItem item = items[i];
        Algorithm algorithm = (Algorithm) tableItemToAlgorithmMap
            .get(item);
        if (algorithm != null) {
          if (algorithmIsProgressTrackable(algorithm)) {
            removeButton.setEnabled(true);
          } else {
View Full Code Here

     */
  private class PauseListener implements Listener {
    public void handleEvent(Event event) {
      TableItem item   = table.getItem(table.getSelectionIndex());
      if (item != null) {
        Algorithm algorithm = (Algorithm)tableItemToAlgorithmMap.get(item);
        if (algorithm instanceof ProgressTrackable) {
          ProgressMonitor monitor = ((ProgressTrackable)algorithm).getProgressMonitor();
          if (monitor != null) {
            monitor.setPaused(true);
            setEnabledMenuItems(algorithm);
View Full Code Here

   */
  private class CancelListener implements Listener {
    public void handleEvent(Event event) {
      TableItem item   = table.getItem(table.getSelectionIndex());
      if (item != null) {
        Algorithm algorithm = (Algorithm) tableItemToAlgorithmMap
            .get(item);
        if (algorithm instanceof ProgressTrackable) {
          ProgressMonitor monitor = ((ProgressTrackable) algorithm)
              .getProgressMonitor();
          if (monitor != null) {
View Full Code Here

   */
  private class StartListener implements Listener {   
    public void handleEvent(Event event) {
      TableItem item   = table.getItem(table.getSelectionIndex());
      if (item != null) {
        Algorithm algorithm = (Algorithm) tableItemToAlgorithmMap
            .get(item);
        if (algorithm instanceof ProgressTrackable) {
          ProgressMonitor monitor = ((ProgressTrackable) algorithm)
              .getProgressMonitor();
          if (monitor != null) {
View Full Code Here

TOP

Related Classes of org.cishell.framework.algorithm.Algorithm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.