@Override
	public Boolean Train(List<Sequence> trainingSequences) {
		
		
		mDictionary = new HashMap<List<Integer>, LZNode>();

		LinkedList<Integer> window = new LinkedList<Integer>();
		int maxWindowLength = 0;
		
		
		for(Sequence seq : trainingSequences) {
			
			List<Item> items = seq.getItems();
			List<Integer> prefix = new ArrayList<Integer>();
			List<Integer> lzPhrase = new ArrayList<Integer>();
			
			//for each given item in this sequence
			for(int offset = 0; offset < items.size(); offset++) {
				
				
				//generating the lzPhrase from the prefix and the current item
				Integer cur = items.get(offset).val;
				lzPhrase = new ArrayList<Integer>(prefix);
				lzPhrase.add(cur);
				
				
				//if the dictionary contains this phrase already
				LZNode node = mDictionary.get(lzPhrase);
				if(node != null) {
					
					//incrementing the support of this phrase
					node.inc();
					mDictionary.put(lzPhrase, node);
			
					//adding the current node as a child of the prefix
					if(prefix.size() > 0 && mDictionary.get(prefix) != null) {
						mDictionary.get(prefix).incChildSupport();
					}
					
					//adding the current item to the prefix
					prefix.add(cur);
					
				}
				else {
					
					//adding the current node as a child of the prefix
					if(prefix.size() > 0 && mDictionary.get(prefix) != null) {
						mDictionary.get(prefix).addChild(cur);
					}
					
					//Updating the max order if needed
					maxWindowLength = (lzPhrase.size() > maxWindowLength) ? lzPhrase.size() : maxWindowLength;
					
					//adding this phrase in the dictionary
					mDictionary.put(lzPhrase, new LZNode(cur));
					prefix.clear();
					count++;
					
				}
				
				
				
				//adding the current item to the window,
				//if the window is too large, it removes the first oldest item
				window.add(cur);
				if(window.size() > maxWindowLength) {
					window.remove(0);
				}
				updateFromWindow(window);
				
				
				System.out.println(window);
				
			}
		}
		
		
		
		return null;
	}