Ignore:
Timestamp:
07/04/11 15:57:06 (13 years ago)
Author:
sherbold
Message:
  • replaced java.util.Set and Java.util.List with java.util.Collection where possible
Location:
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/DeterministicFiniteAutomaton.java

    r101 r102  
    11package de.ugoe.cs.eventbench.models; 
    22 
     3import java.util.Collection; 
    34import java.util.LinkedList; 
    45import java.util.List; 
     
    6162                } 
    6263 
    63                 List<Event<?>> followers = trie.getFollowingSymbols(contextCopy); 
     64                Collection<Event<?>> followers = trie.getFollowingSymbols(contextCopy); 
    6465 
    6566                if (followers.size() != 0 && followers.contains(symbol)) { 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/FirstOrderMarkovModel.java

    r101 r102  
    22 
    33import java.util.ArrayList; 
     4import java.util.Collection; 
    45import java.util.List; 
    56import java.util.Random; 
     
    167168                        List<Event<?>> context = new ArrayList<Event<?>>(); 
    168169                        context.add(symbol); 
    169                         List<Event<?>> followers = trie.getFollowingSymbols(context); 
     170                        Collection<Event<?>> followers = trie.getFollowingSymbols(context); 
    170171                        for (Event<?> follower : followers) { 
    171172                                stringBuilder.append(" " + symbol.hashCode() + " -> " 
     
    199200                        context.add(symbol); 
    200201 
    201                         List<Event<?>> followers = trie.getFollowingSymbols(context); 
     202                        Collection<Event<?>> followers = trie.getFollowingSymbols(context); 
    202203 
    203204                        for (Event<?> follower : followers) { 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/HighOrderMarkovModel.java

    r101 r102  
    11package de.ugoe.cs.eventbench.models; 
    22 
     3import java.util.Collection; 
    34import java.util.LinkedList; 
    45import java.util.List; 
     
    4950 
    5051         
    51                 List<Event<?>> followers = trie.getFollowingSymbols(contextCopy); 
     52                Collection<Event<?>> followers = trie.getFollowingSymbols(contextCopy); 
    5253                int sumCountFollowers = 0; // N(s\sigma') 
    5354                for( Event<?> follower : followers ) { 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/IStochasticProcess.java

    r99 r102  
    22 
    33import java.io.Serializable; 
     4import java.util.Collection; 
    45import java.util.List; 
    5 import java.util.Set; 
    66 
    77import de.ugoe.cs.eventbench.data.Event; 
     
    5555         * @see #generateSequences(int, boolean) 
    5656         */ 
    57         public Set<List<? extends Event<?>>> generateSequences(int length); 
     57        public Collection<List<? extends Event<?>>> generateSequences(int length); 
    5858 
    5959        /** 
     
    7373         * @return generated sequences 
    7474         */ 
    75         public Set<List<? extends Event<?>>> generateSequences(int length, 
     75        public Collection<List<? extends Event<?>>> generateSequences(int length, 
    7676                        boolean fromStart); 
    7777 
     
    8888         * @return generated sequences 
    8989         */ 
    90         public Set<List<? extends Event<?>>> generateValidSequences(int length); 
     90        public Collection<List<? extends Event<?>>> generateValidSequences(int length); 
    9191 
    9292        /** 
     
    117117         * @return events known by the process 
    118118         */ 
    119         public Set<? extends Event<?>> getEvents(); 
     119        public Collection<? extends Event<?>> getEvents(); 
    120120 
    121121} 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/PredictionByPartialMatch.java

    r101 r102  
    11package de.ugoe.cs.eventbench.models; 
    22 
     3import java.util.Collection; 
    34import java.util.LinkedList; 
    45import java.util.List; 
     
    116117                } 
    117118 
    118                 List<Event<?>> followers = trie.getFollowingSymbols(contextCopy); // \Sigma' 
     119                Collection<Event<?>> followers = trie.getFollowingSymbols(contextCopy); // \Sigma' 
    119120                int sumCountFollowers = 0; // N(s\sigma') 
    120121                for (Event<?> follower : followers) { 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/Trie.java

    r86 r102  
    22 
    33import java.io.Serializable; 
     4import java.util.Collection; 
    45import java.util.LinkedHashSet; 
    56import java.util.LinkedList; 
     
    103104         
    104105        // returns all symbols that follow the defined sequence 
    105         public List<T> getFollowingSymbols(List<T> sequence) { 
    106                 List<T> result = new LinkedList<T>(); 
     106        public Collection<T> getFollowingSymbols(List<T> sequence) { 
     107                Collection<T> result = new LinkedList<T>(); 
    107108                TrieNode<T> node = find(sequence); 
    108109                if( node!=null ) { 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieBasedModel.java

    r100 r102  
    33import java.security.InvalidParameterException; 
    44import java.util.ArrayList; 
     5import java.util.Collection; 
    56import java.util.LinkedHashSet; 
    67import java.util.LinkedList; 
     
    8485         *            training data 
    8586         */ 
    86         public void train(List<List<Event<?>>> sequences) { 
     87        public void train(Collection<List<Event<?>>> sequences) { 
    8788                trie = new Trie<Event<?>>(); 
    8889 
     
    204205         */ 
    205206        @Override 
    206         public Set<? extends Event<?>> getEvents() { 
     207        public Collection<? extends Event<?>> getEvents() { 
    207208                return trie.getKnownSymbols(); 
    208209        } 
     
    215216         */ 
    216217        @Override 
    217         public Set<List<? extends Event<?>>> generateSequences(int length) { 
     218        public Collection<List<? extends Event<?>>> generateSequences(int length) { 
    218219                return generateSequences(length, false); 
    219220        } 
     
    249250                        return sequenceSet; 
    250251                } 
    251                 Set<? extends Event<?>> events = getEvents(); 
    252                 Set<List<? extends Event<?>>> seqsShorter = generateSequences( 
     252                Collection<? extends Event<?>> events = getEvents(); 
     253                Collection<List<? extends Event<?>>> seqsShorter = generateSequences( 
    253254                                length - 1, fromStart); 
    254255                for (Event<?> event : events) { 
     
    273274         */ 
    274275        @Override 
    275         public Set<List<? extends Event<?>>> generateValidSequences(int length) { 
     276        public Collection<List<? extends Event<?>>> generateValidSequences(int length) { 
    276277                // check for min-length implicitly done by generateSequences 
    277                 Set<List<? extends Event<?>>> allSequences = generateSequences(length, 
     278                Collection<List<? extends Event<?>>> allSequences = generateSequences(length, 
    278279                                true); 
    279                 Set<List<? extends Event<?>>> validSequences = new LinkedHashSet<List<? extends Event<?>>>(); 
     280                Collection<List<? extends Event<?>>> validSequences = new LinkedHashSet<List<? extends Event<?>>>(); 
    280281                for (List<? extends Event<?>> sequence : allSequences) { 
    281282                        if (sequence.size() == length 
  • trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieNode.java

    r86 r102  
    33import java.io.Serializable; 
    44import java.security.InvalidParameterException; 
     5import java.util.Collection; 
    56import java.util.LinkedList; 
    67import java.util.List; 
     
    2223        private final T symbol; 
    2324         
    24         private List<TrieNode<T>> children; 
     25        private Collection<TrieNode<T>> children; 
    2526         
    2627        TrieNode() { 
     
    9697         
    9798        // returns all symbols that follow this node 
    98         public List<T> getFollowingSymbols() { 
    99                 List<T> followingSymbols = new LinkedList<T>(); 
     99        public Collection<T> getFollowingSymbols() { 
     100                Collection<T> followingSymbols = new LinkedList<T>(); 
    100101                for( TrieNode<T> child : children ) { 
    101102                        followingSymbols.add(child.getSymbol()); 
Note: See TracChangeset for help on using the changeset viewer.