Ignore:
Timestamp:
07/14/14 23:27:01 (10 years ago)
Author:
rkrimmel
Message:

Removed parameters from alignmentalgorihm factory constructor and changed interface by adding a new align() method, which now gets all the data via parameter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/algorithms/AlignmentAlgorithmFactory.java

    r1589 r1612  
    11package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; 
     2 
     3import java.lang.reflect.Constructor; 
     4import java.lang.reflect.InvocationTargetException; 
    25 
    36import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.SubstitutionMatrix; 
     
    58public class AlignmentAlgorithmFactory { 
    69         
     10        public static void setDefaultAlgorithm(String algorithmname) { 
     11                //TODO: check for valid algorihm class names here 
     12                algorithmclass = algorithmname; 
     13        } 
    714         
    8         public static AlignmentAlgorithm create(int[] input1, int[] input2, SubstitutionMatrix submat,float threshold) { 
    9                  
     15        private static String algorithmclass = "de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.SmithWatermanRepeated"; 
     16         
     17         
     18         
     19        public static AlignmentAlgorithm create() { 
     20                Class<?> newclass; 
     21                Object object = null; 
     22                try { 
     23                         newclass = Class.forName(algorithmclass); 
     24                         object = newclass.newInstance(); 
     25                         
     26                } catch (ClassNotFoundException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException e) { 
     27                        // TODO Auto-generated catch block 
     28                        e.printStackTrace(); 
     29                } 
    1030                //return new SmithWaterman(input1,input2,submat,threshold); 
    1131                //return new NeedlemanWunsch(input1,input2,submat,threshold); 
    12                 return new SmithWatermanRepeated(input1,input2,submat,threshold); 
     32                //return new SmithWatermanRepeated(input1,input2,submat,threshold); 
     33                return (AlignmentAlgorithm) object; 
    1334        } 
    1435} 
Note: See TracChangeset for help on using the changeset viewer.