Last change
on this file since 553 was
548,
checked in by sherbold, 12 years ago
|
- countless adaptations throughout nearly all components to remove errors introduced due to the refactoring of the event core
|
-
Property svn:mime-type set to
text/plain
|
File size:
761 bytes
|
Rev | Line | |
---|
[518] | 1 | package de.ugoe.cs.quest.usageprofiles;
|
---|
| 2 |
|
---|
| 3 | import java.util.ArrayList;
|
---|
| 4 | import java.util.List;
|
---|
| 5 | import java.util.Random;
|
---|
| 6 |
|
---|
| 7 | import de.ugoe.cs.quest.eventcore.Event;
|
---|
| 8 | import de.ugoe.cs.quest.usageprofiles.TrieBasedModel;
|
---|
| 9 |
|
---|
| 10 | public class MockTrieBasedModel extends TrieBasedModel {
|
---|
| 11 | private static final long serialVersionUID = 1L;
|
---|
| 12 |
|
---|
| 13 | public MockTrieBasedModel(int markovOrder, Random r) {
|
---|
| 14 | super(markovOrder, r);
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | @Override
|
---|
[548] | 18 | public double getProbability(List<Event> context,
|
---|
| 19 | Event symbol) {
|
---|
| 20 | List<Event> list = new ArrayList<Event>();
|
---|
[518] | 21 | if( context.isEmpty() ) {
|
---|
| 22 | return 2;
|
---|
| 23 | }
|
---|
| 24 | list.add(context.get(context.size()-1));
|
---|
| 25 | if( trie.find(list).getFollowingSymbols().contains(symbol) ) {
|
---|
| 26 | return 1;
|
---|
| 27 | } else {
|
---|
| 28 | return 0;
|
---|
| 29 | }
|
---|
| 30 | }
|
---|
| 31 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.