1 19 20 package org.netbeans.modules.retouche.source.usages; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import java.io.InputStream ; 25 import java.util.HashMap ; 26 import java.util.HashSet ; 27 import java.util.List ; 28 import java.util.Map ; 29 import java.util.Set ; 30 import java.util.concurrent.atomic.AtomicBoolean ; 31 import org.netbeans.api.progress.ProgressHandle; 32 import org.netbeans.modules.retouche.source.util.LowMemoryEvent; 33 import org.netbeans.modules.retouche.source.util.LowMemoryListener; 34 35 36 45 public class BinaryAnalyser implements LowMemoryListener { 46 47 static final String OBJECT = Object .class.getName(); 48 49 private final Index index; 50 private final Map <String ,List <String >> refs = new HashMap <String ,List <String >>(); 51 private final Set <String > toDelete = new HashSet <String > (); 52 private final AtomicBoolean lowMemory; 53 private boolean cacheCleared; 54 55 public BinaryAnalyser (Index index) { 56 assert index != null; 57 this.index = index; 58 this.lowMemory = new AtomicBoolean (false); 59 } 60 61 65 public final void analyse (final File root, final ProgressHandle handle) throws IOException , IllegalArgumentException { 66 } 103 104 110 private void analyseFolder (final File folder, final String rootPath) throws IOException { 111 } 145 146 public void lowMemory (final LowMemoryEvent event) { 147 this.lowMemory.set(true); 148 } 149 150 152 private boolean accepts(String name) { 153 int index = name.lastIndexOf('.'); 154 if (index == -1 || (index+1) == name.length()) { 155 return false; 156 } 157 return "CLASS".equalsIgnoreCase(name.substring(index+1)); } 159 160 private final void delete (final String className) throws IOException { 162 assert className != null; 163 if (!this.index.isValid(false)) { 164 return; 165 } 166 this.toDelete.add(className); 167 } 168 169 private void analyse (InputStream inputStream ) throws IOException { 170 } 172 173 174 private final boolean isUpToDate(String resourceName, long resourceMTime) throws IOException { 175 return this.index.isUpToDate(resourceName, resourceMTime); 176 } 177 } 178 | Popular Tags |