public void fixFolder(CharSequence path){ if (path != null) { projectRoots.put(FilePathCache.getManager().getString(path), Integer.MAX_VALUE / 2); } }
public static List<CharSequence> asList(Collection<? extends CharSequence> paths) { List<CharSequence> out = new ArrayList<CharSequence>(paths.size()); for (CharSequence path : paths) { out.add(FilePathCache.getManager().getString(path)); } return out; }
private void addPath(CharSequence path) { CharSequence parent = findParent(path); if (parent != null) { path = parent; } CharSequence added = FilePathCache.getManager().getString(path); Integer integer = projectRoots.get(added); if (integer == null) { projectRoots.put(added, 1); } else { projectRoots.put(added, integer + 1); } }
public APTIncludeResolverImpl(FileSystem fs, CharSequence path, int baseFileIncludeDirIndex, List<IncludeDirEntry> systemIncludePaths, List<IncludeDirEntry> userIncludePaths, APTFileSearch fileSearch) { this.fileSystem = fs; this.baseFile = FilePathCache.getManager().getString(path); this.systemIncludePaths = systemIncludePaths; this.userIncludePaths = userIncludePaths; //int aHashCode = 0; //if (APTTraceFlags.USE_INCLIDE_RESOLVER_CACHE) { // for(IncludeDirEntry entry: systemIncludePaths) { // aHashCode+=entry.hashCode()*31; // } // for(IncludeDirEntry entry: userIncludePaths) { // aHashCode+=entry.hashCode()*19; // } //} //hashCode = aHashCode; this.baseFileIncludeDirIndex = baseFileIncludeDirIndex; this.fileSearch = fileSearch; // if (TRACE) { // System.err.printf("APTIncludeResolverImpl.ctor %s %s systemIncludePaths: %s\n", fileSystem, path, systemIncludePaths); // NOI18N // } }
private CharSequence getCanonicalKey(CharSequence fileKey) { try { CharSequence res = CndFileSystemProvider.getCanonicalPath(fileSystem, fileKey); res = FilePathCache.getManager().getString(res); if (fileKey.equals(res)) { return fileKey; } return res; } catch (IOException e) { // skip exception return fileKey; } }
private static CharSequence getCanonicalKey(FileObject fileObject, CharSequence fileKey) { try { CharSequence res = CndFileUtils.getCanonicalPath(fileObject); res = FilePathCache.getManager().getString(res); if (fileKey.equals(res)) { return fileKey; } return res; } catch (IOException e) { // skip exception return fileKey; } }
public StartEntry(FileSystem fs, String startFile, Key startFileProject) { Parameters.notNull("startFileProject", startFileProject); //NOI18N this.fileSystem = fs; this.startFile = FilePathCache.getManager().getString(startFile); this.startFileProject = startFileProject; }
private LibProjectImpl(ModelImpl model, FileSystem fs, CharSequence includePathName, int sourceUnitId) { super(model, fs, includePathName, includePathName, sourceUnitId); this.includePath = FilePathCache.getManager().getString(includePathName); this.projectRoots.fixFolder(includePathName); assert this.includePath != null; }
FileBufferImpl(FileSystem fileSystem, CharSequence absPath, FileImpl fileImpl) { this.absPath = FilePathCache.getManager().getString(absPath); this.fileSystem = fileSystem; this.fileImpl = fileImpl; this.bufType = (fileImpl.getFileType() == FileImpl.FileType.HEADER_FILE) ? APTFileBuffer.BufferType.INCLUDED : APTFileBuffer.BufferType.START_FILE; }
/*package*/static void invalidateFileBasedCache(String file) { final CharSequence key = FilePathCache.getManager().getString(file); Map<CharSequence, IncludeDirEntry> delegate = storage.getDelegate(key); synchronized (delegate) { IncludeDirEntry prev = delegate.remove(key); if (prev != null) { prev.invalidateDirExistence(); } } ResolverResultsCache.clearCache(); }
/*package*/ static void readStringToFileEntryMap( FileSystem fs, int unitIndex, RepositoryDataInput input, Map<CharSequence, FileEntry> aMap) throws IOException { assert input != null; assert aMap != null; final APTStringManager pathManager = FilePathCache.getManager(); aMap.clear(); final int size = input.readInt(); for (int i = 0; i < size; i++) { CharSequence key = PersistentUtils.readFileNameIndex(input, pathManager, unitIndex); FileEntry value = new FileEntry(fs, input, unitIndex); assert key != null; assert value != null; aMap.put(key, value); } }
public StartEntry(FileSystem fs, RepositoryDataInput input, int unitIndex) throws IOException { assert input != null; fileSystem = fs; startFileProject = KeyFactory.getDefaultFactory().readKey(input); startFile = APTSerializeUtils.readFileNameIndex(input, FilePathCache.getManager(), unitIndex); }
public LibProjectImpl(RepositoryDataInput aStream) throws IOException { super(aStream); this.includePath = APTSerializeUtils.readFileNameIndex(aStream, FilePathCache.getManager(), getUnitId()); assert this.includePath != null; setPlatformProject(this.includePath); } }
public static CharSequence getFileKey(CharSequence file, boolean sharedText) { return sharedText ? FilePathCache.getManager().getString(file) : DefaultCache.getManager().getString(file); }
protected AbstractFileBuffer(RepositoryDataInput input, int unitId) throws IOException { this.absPath = APTSerializeUtils.readFileNameIndex(input, FilePathCache.getManager(), unitId); this.fileSystem = PersistentUtils.readFileSystem(input); assert this.absPath != null; fileObject = new WeakReference<>(null); bufType = BufferType.values()[input.readByte()]; }
protected AbstractFileBuffer(FileObject fileObject) { this.absPath = FilePathCache.getManager().getString(CndFileUtils.normalizePath(fileObject)); assert this.absPath != null : "no path for " + fileObject; this.fileSystem = getFileSystem(fileObject); this.fileObject = new WeakReference<>(fileObject); this.bufType = MIMENames.isCppOrCOrFortran(fileObject.getMIMEType()) ? APTFileBuffer.BufferType.START_FILE : APTFileBuffer.BufferType.INCLUDED; // remote link file objects are just lightweight delegating wrappers, so they have multiple instances // if (CndUtils.isDebugMode()) { // FileObject fo2 = fileSystem.findResource(absPath.toString()); // CndUtils.assertTrue(fileObject == fo2, "File objects differ: " + fileObject + " vs " + fo2); //NOI18N // } }
private static void readStringToStringsArrMap( final int unitId, final RepositoryDataInput input, Map<CharSequence, Object/*CharSequence or CharSequence[]*/> aMap) throws IOException { assert input != null; assert aMap != null; final APTStringManager pathManager = FilePathCache.getManager(); aMap.clear(); final int size = input.readInt(); for (int i = 0; i < size; i++) { CharSequence key = APTSerializeUtils.readFileNameIndex(input, pathManager, unitId); assert key != null; final int arraySize = input.readInt(); assert arraySize != 0; if (arraySize == 1) { aMap.put(key, APTSerializeUtils.readFileNameIndex(input, pathManager, unitId)); } else { final CharSequence[] value = new CharSequence[arraySize]; for (int j = 0; j < arraySize; j++) { CharSequence path = APTSerializeUtils.readFileNameIndex(input, pathManager, unitId); assert path != null; value[j] = path; } aMap.put(key, value); } } }
/** Creates a new instance of APTFileNode */ public APTFileNode(FileSystem fileSystem, CharSequence path) { Parameters.notNull("null fileSystem", fileSystem); //NOI18N this.fileSystem = fileSystem; this.path = FilePathCache.getManager().getString(path); this.guard = TextCache.getManager().getString(guard); tokenized = true; }
public ResolvedPath(FileSystem fileSystem, CharSequence folder, CharSequence path, boolean isDefaultSearchPath, int index) { this.folder = folder;// should be already shared this.fileSystem = fileSystem; this.path = FilePathCache.getManager().getString(path); this.isDefaultSearchPath = isDefaultSearchPath; this.index = index;
public IncludeInfoImpl(final RepositoryDataInput input, int unitIndex) throws IOException { assert input != null; this.path = APTSerializeUtils.readFileNameIndex(input, FilePathCache.getManager(), unitIndex); directiveLine = input.readInt(); directiveOffset = input.readInt(); resolvedDirIndex = input.readInt(); }