View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   
6   package org.lcsim.recon.tracking.seedtracker.strategybuilder;
7   
8   import java.io.File;
9   import java.util.ArrayList;
10  import java.util.List;
11  import org.lcsim.recon.tracking.seedtracker.SeedStrategy;
12  import org.lcsim.recon.tracking.seedtracker.StrategyXMLUtils;
13  
14  /**
15   *
16   * @author cozzy
17   */
18  public class StrategyCombiner {
19  
20      public static void main(String[] args){
21          
22          if (args.length < 3){
23              printUsage(); 
24              System.exit(1); 
25          }
26          
27          String filename = args[0]; 
28          
29          List<SeedStrategy> lst = new ArrayList<SeedStrategy>(); 
30          
31          for (int i = 1; i < args.length; i++) {
32              List<SeedStrategy> portion = StrategyXMLUtils.getStrategyListFromFile(new File(args[i])); 
33              for (SeedStrategy s : portion){
34                  if (!lst.contains(s)) lst.add(s); 
35              }
36          }
37          
38          StrategyXMLUtils.writeStrategyListToFile(lst, new File(filename));
39      }
40      
41      
42      
43      
44      private static void printUsage(){
45          System.out.println("Usage:"); 
46          System.out.println("StrategyCombiner OUTPUT_FILE STRATEGY1 STRATEGY2 [STRATEGY3... ]");
47          System.out.println("\t\tWhere the different strategies are XML files");   
48      }
49      
50  }