Ignore:
Timestamp:
09/28/11 03:03:13 (13 years ago)
Author:
sherbold
Message:
  • greatly improved type checking and consistency of type checking for objects checked out of the GlobalDataContainer?
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDupdateModel.java

    r203 r209  
    55import java.util.List; 
    66 
     7import de.ugoe.cs.eventbench.SequenceInstanceOf; 
    78import de.ugoe.cs.eventbench.data.Event; 
    89import de.ugoe.cs.eventbench.data.GlobalDataContainer; 
     
    3940                } 
    4041 
    41                 Collection<List<Event<?>>> sequences = null; 
    4242                Object dataObject = GlobalDataContainer.getInstance().getData( 
    4343                                sequencesName); 
     
    4747                        return; 
    4848                } 
    49                 try { 
    50                         sequences = (Collection<List<Event<?>>>) dataObject; 
    51                 } catch (ClassCastException e) { 
    52                         Console.println("Object " + sequencesName 
    53                                         + "not of type Collection<List<Event<?>>>."); 
    54                 } 
    55                 if (sequences.size() == 0 
    56                                 || !(sequences.iterator().next().get(0) instanceof Event)) { 
     49                if (!SequenceInstanceOf.isCollectionOfSequences(dataObject)) { 
    5750                        Console.println("Object " + sequencesName 
    5851                                        + "not of type Collection<List<Event<?>>>."); 
    5952                        return; 
    6053                } 
     54                Collection<List<Event<?>>> sequences = (Collection<List<Event<?>>>) dataObject; 
    6155 
    6256                dataObject = GlobalDataContainer.getInstance().getData(modelname); 
    6357                if (dataObject == null) { 
    64                         Console.println("Model " + modelname + " not found in storage."); 
     58                        Console.println("Object " + modelname + " not found in storage."); 
    6559                        return; 
    6660                } 
    6761                if (!(dataObject instanceof TrieBasedModel)) { 
    6862                        Console.println("Object " + modelname 
    69                                         + " not of type TrieBasedModel!"); 
     63                                        + " not of type TrieBasedModel"); 
    7064                        return; 
    7165                } 
     66 
    7267                TrieBasedModel model = (TrieBasedModel) dataObject; 
    7368                model.update(sequences); 
Note: See TracChangeset for help on using the changeset viewer.