public CodeSampleElement GetOrBuildCodeSample(ClassElem klass, PostElement parent, List<LinkSpan> spans)
	{
		CodeSampleElement codeSample = null;

		if( !ClassIndex.getInstance().SampleMap.containsKey(parent.Id) )
		{
			codeSample = new CodeSampleElement();
			codeSample.Parent = parent;
			
			Hashtable<Integer,CodeBlock> blocks = new Hashtable<Integer,CodeBlock>();
			CachedPostBody postBody = CachePostBodyIndex.getInstance().ParseOrGet(parent);

			for( String blockBody : postBody.CodeBlocks )
			{
				CodeBlock block = new CodeBlock();
				block.setBody( blockBody );
				codeSample.Blocks.add(block);
			}
			ClassIndex.getInstance().SampleMap.put(parent.Id, codeSample);
		}
		codeSample = ClassIndex.getInstance().SampleMap.get(parent.Id);
		
		int b = 0;
		for( CodeBlock block : codeSample.Blocks )
		{
			for( LinkSpan span : spans )
			{
				if( span.Validated && span.LinkType == LinkType.CodeSampleLink && span.SiteIndex == b)
				{
					block.ClassMatches.add(new CodeSpan(span.Start,span.End,klass.Name,klass.getFQN()));
				}
			}
			b++;
		}
		
		return ClassIndex.getInstance().SampleMap.get(parent.Id);
	}