public void addTagAt(final int pos, final Tag tag) { final int index=getIndexOfPos(pos); final CacheEntry nextCacheEntry=array[index]; final CacheEntry previousCacheEntry=getPrevious(nextCacheEntry); add(previousCacheEntry,new CacheEntry(index,pos,tag,pos==previousCacheEntry.pos+1,pos==nextCacheEntry.pos-1),nextCacheEntry); }
if (tagPos==pos) return; // the tag was found exactly on pos, so cache has already been fully updated int index=getIndexOfPos(pos); CacheEntry stepCacheEntry=array[index]; stepCacheEntry=array[index=getIndexOfPos(pos)];
public Tag getTagAt(final int pos, final boolean serverTagOnly) { // This must only be called on allTagTypesSubCache (ie tagType==null) if (cache.getSourceLength()==0) return null; if (pos<0 || pos>=cache.getSourceLength()) return null; final int index=getIndexOfPos(pos); final CacheEntry cacheEntry=array[index]; if (cacheEntry.pos==pos) { if (serverTagOnly && !cacheEntry.tag.getTagType().isServerTag()) return null; return cacheEntry.tag; } if (cacheEntry.previousCached) return null; return cache.addTagAt(pos,serverTagOnly); }
if (tagPos==pos) return; // the tag was found exactly on pos, so cache has already been fully updated int index=getIndexOfPos(pos); CacheEntry stepCacheEntry=array[index]; stepCacheEntry=array[index=getIndexOfPos(pos)];
public Tag getPreviousTag(final int pos) { // Note that this method never returns tags for which tag.includInSearch() is false, so separate caching of unregistered tags won't work. if (cache.getSourceLength()==0) return null; if (pos<0 || pos>=cache.getSourceLength()) return null; int index=getIndexOfPos(pos); final CacheEntry cacheEntry=array[index]; final Tag tag; if (cacheEntry.pos==pos && cacheEntry.tag!=null && cacheEntry.tag.includeInSearch()) return cacheEntry.tag; tag=getPreviousTag(getPrevious(cacheEntry),pos,cacheEntry); addPreviousTag(pos,tag); return tag; }
public Tag getNextTag(final int pos) { // Note that this method never returns tags for which tag.includInSearch() is false, so separate caching of unregistered tags won't work. if (cache.getSourceLength()==0) return null; if (pos<0 || pos>=cache.getSourceLength()) return null; int index=getIndexOfPos(pos); final CacheEntry cacheEntry=array[index]; final Tag tag; if (cacheEntry.pos==pos) { if (cacheEntry.tag!=null && cacheEntry.tag.includeInSearch()) return cacheEntry.tag; tag=getNextTag(cacheEntry,pos,getNext(cacheEntry)); } else { tag=getNextTag(getPrevious(cacheEntry),pos,cacheEntry); } addNextTag(pos,tag); return tag; }