org.eclipse.mylyn.tasks.index.core_3.7.1.v20120425-0100

16:46:53.341 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.tasks.index.core_3.7.1.v20120425-0100.jar
package org.eclipse.mylyn.internal.tasks.index.core;

import org.eclipse.mylyn.tasks.core.ITask;

public abstract class TaskListIndex$TaskCollector
{
  public abstract void collect(ITask paramITask);
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex.TaskCollector
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.index.core;

import org.apache.lucene.analysis.KeywordAnalyzer;
import org.apache.lucene.analysis.PerFieldAnalyzerWrapper;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.util.Version;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskSchema.Field;

class TaskAnalyzer
  extends PerFieldAnalyzerWrapper
{
  public TaskAnalyzer()
  {
    super(new StandardAnalyzer(Version.LUCENE_CURRENT));
    addAnalyzer(TaskListIndex.FIELD_IDENTIFIER.getIndexKey(), new KeywordAnalyzer());
    addAnalyzer(TaskListIndex.FIELD_TASK_KEY.getIndexKey(), new KeywordAnalyzer());
    addAnalyzer(TaskListIndex.FIELD_REPOSITORY_URL.getIndexKey(), new KeywordAnalyzer());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.index.core.TaskAnalyzer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.index.core;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.mylyn.commons.core.StatusHandler;

class TaskListIndex$MaintainIndexJob
  extends Job
{
  public TaskListIndex$MaintainIndexJob(TaskListIndex paramTaskListIndex)
  {
    super(Messages.TaskListIndex_indexerJob);
    setUser(false);
    setSystem(false);
    setPriority(30);
  }
  
  public IStatus run(IProgressMonitor m)
  {
    if (m.isCanceled()) {
      return Status.CANCEL_STATUS;
    }
    try
    {
      TaskListIndex.access$0(this$0, m);
    }
    catch (CoreException e)
    {
      MultiStatus logStatus = new MultiStatus("org.eclipse.mylyn.tasks.index.core", 0, 
        "Failed to update task list index", e);
      logStatus.add(e.getStatus());
      StatusHandler.log(logStatus);
    }
    return Status.OK_STATUS;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex.MaintainIndexJob
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.index.core;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.tasks.core.ITask;

class TaskListIndex$TaskListState
  implements ITaskListRunnable
{
  List<ITask> indexableTasks;
  
  private TaskListIndex$TaskListState(TaskListIndex paramTaskListIndex) {}
  
  public void execute(IProgressMonitor monitor)
    throws CoreException
  {
    Collection<AbstractTask> tasks = TaskListIndex.access$1(this$0).getAllTasks();
    indexableTasks = new ArrayList(tasks.size());
    for (ITask task : tasks) {
      if (this$0.taskIsIndexable(task, null)) {
        indexableTasks.add(task);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex.TaskListState
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.index.core;

 enum TaskListIndex$MaintainIndexType
{
  STARTUP,  REINDEX;
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex.MaintainIndexType
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.tasks.index.core;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.logging.Logger;
import org.apache.lucene.document.DateTools;
import org.apache.lucene.document.DateTools.Resolution;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Index;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.PrefixQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.NIOFSDirectory;
import org.apache.lucene.util.Version;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.ITaskList;
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
import org.eclipse.mylyn.internal.tasks.core.ITaskListRunnable;
import org.eclipse.mylyn.internal.tasks.core.TaskComment;
import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.data.ITaskDataManagerListener;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManagerEvent;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.IRepositoryListener;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskSchema.Field;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskSchema.Flag;
import org.eclipse.mylyn.tasks.core.data.DefaultTaskSchema;
import org.eclipse.mylyn.tasks.core.data.ITaskDataManager;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData;
import org.eclipse.mylyn.tasks.core.data.TaskData;

public class TaskListIndex
  implements ITaskDataManagerListener, ITaskListChangeListener, IRepositoryListener
{
  private static final Object COMMAND_RESET_INDEX = "index:reset";
  private static final String INDEX_TASK_ATTRIBUTE_PREFIX = "index:";
  private static final String TASK_ATTRIBUTE_IDENTIFIER = "index:handle-identifier";
  private static final String TASK_ATTRIBUTE_REPOSITORY_URL = "index:repository-url";
  private static final String TASK_ATTRIBUTE_CONTENT = "index:content";
  private static final String TASK_ATTRIBUTE_PERSON = "index:person";
  public static final AbstractTaskSchema.Field FIELD_IDENTIFIER = new AbstractTaskSchema.Field(
    "index:handle-identifier", Messages.TaskListIndex_field_identifier, "shortText", 
    "identifier", new AbstractTaskSchema.Flag[0]);
  public static final AbstractTaskSchema.Field FIELD_REPOSITORY_URL = new AbstractTaskSchema.Field(
    "index:repository-url", Messages.TaskListIndex_field_repository_url, "url", 
    "repository_url", new AbstractTaskSchema.Flag[0]);
  public static final AbstractTaskSchema.Field FIELD_CONTENT = new AbstractTaskSchema.Field(
    "index:content", Messages.TaskListIndex_field_content, "longText", "content", new AbstractTaskSchema.Flag[0]);
  public static final AbstractTaskSchema.Field FIELD_PERSON = new AbstractTaskSchema.Field(
    "index:person", Messages.TaskListIndex_field_person, "person", "person", new AbstractTaskSchema.Flag[0]);
  public static final AbstractTaskSchema.Field FIELD_TASK_KEY = getInstanceTASK_KEY;
  public static final AbstractTaskSchema.Field FIELD_SUMMARY = getInstanceSUMMARY;
  
  private class MaintainIndexJob
    extends Job
  {
    public MaintainIndexJob()
    {
      super();
      setUser(false);
      setSystem(false);
      setPriority(30);
    }
    
    public IStatus run(IProgressMonitor m)
    {
      if (m.isCanceled()) {
        return Status.CANCEL_STATUS;
      }
      try
      {
        TaskListIndex.this.maintainIndex(m);
      }
      catch (CoreException e)
      {
        MultiStatus logStatus = new MultiStatus("org.eclipse.mylyn.tasks.index.core", 0, 
          "Failed to update task list index", e);
        logStatus.add(e.getStatus());
        StatusHandler.log(logStatus);
      }
      return Status.OK_STATUS;
    }
  }
  
  private final Set<AbstractTaskSchema.Field> specialFields = new HashSet();
  private final Set<AbstractTaskSchema.Field> indexedFields = new LinkedHashSet();
  private Directory directory;
  private MaintainIndexJob maintainIndexJob;
  private final Map<ITask, TaskData> reindexQueue;
  private IndexReader indexReader;
  private volatile boolean rebuildIndex;
  private String lastPatternString;
  private Set<String> lastResults;
  private AbstractTaskSchema.Field defaultField;
  private final TaskList taskList;
  private final TaskDataManager dataManager;
  private final IRepositoryManager repositoryManager;
  private long startupDelay;
  private long reindexDelay;
  private int maxMatchSearchHits;
  private final ReadWriteLock indexReaderLock;
  
  private static enum MaintainIndexType
  {
    STARTUP,  REINDEX;
  }
  
  private TaskListIndex(TaskList taskList, TaskDataManager dataManager, IRepositoryManager repositoryManager)
  {
    specialFields.add(FIELD_IDENTIFIER);
    specialFields.add(FIELD_REPOSITORY_URL);
    specialFields.add(FIELD_CONTENT);
    specialFields.add(FIELD_PERSON);
    
    addIndexedField(FIELD_IDENTIFIER);
    addIndexedField(FIELD_TASK_KEY);
    addIndexedField(FIELD_REPOSITORY_URL);
    addIndexedField(FIELD_SUMMARY);
    addIndexedField(FIELD_CONTENT);
    addIndexedField(getInstanceUSER_ASSIGNED);
    addIndexedField(getInstanceUSER_REPORTER);
    addIndexedField(FIELD_PERSON);
    addIndexedField(getInstanceCOMPONENT);
    addIndexedField(getInstanceDATE_COMPLETION);
    addIndexedField(getInstanceDATE_CREATION);
    addIndexedField(getInstanceDATE_DUE);
    addIndexedField(getInstanceDATE_MODIFICATION);
    addIndexedField(getInstanceDESCRIPTION);
    addIndexedField(getInstanceKEYWORDS);
    addIndexedField(getInstancePRODUCT);
    addIndexedField(getInstanceRESOLUTION);
    addIndexedField(getInstanceSEVERITY);
    addIndexedField(getInstanceSTATUS);
    
    reindexQueue = new HashMap();
    
    rebuildIndex = false;
    
    defaultField = FIELD_SUMMARY;
    
    startupDelay = 6000L;
    
    reindexDelay = 3000L;
    
    maxMatchSearchHits = 1500;
    
    indexReaderLock = new ReentrantReadWriteLock(true);
    
    Assert.isNotNull(taskList);
    Assert.isNotNull(dataManager);
    Assert.isNotNull(repositoryManager);
    
    this.taskList = taskList;
    this.dataManager = dataManager;
    this.repositoryManager = repositoryManager;
  }
  
  private void addIndexedField(AbstractTaskSchema.Field field)
  {
    Assert.isNotNull(field);
    Assert.isNotNull(field.getIndexKey());
    indexedFields.add(field);
  }
  
  public ITaskList getTaskList()
  {
    return taskList;
  }
  
  public ITaskDataManager getDataManager()
  {
    return dataManager;
  }
  
  public IRepositoryManager getRepositoryManager()
  {
    return repositoryManager;
  }
  
  public TaskListIndex(TaskList taskList, TaskDataManager dataManager, IRepositoryManager repositoryManager, File indexLocation)
  {
    this(taskList, dataManager, repositoryManager, indexLocation, 6000L);
  }
  
  public TaskListIndex(TaskList taskList, TaskDataManager dataManager, IRepositoryManager repositoryManager, File indexLocation, long startupDelay)
  {
    this(taskList, dataManager, repositoryManager);
    Assert.isTrue((startupDelay >= 0L) && (startupDelay <= 60000L));
    Assert.isNotNull(indexLocation);
    
    this.startupDelay = startupDelay;
    setLocationInternal(indexLocation);
    initialize();
  }
  
  public TaskListIndex(TaskList taskList, TaskDataManager dataManager, IRepositoryManager repositoryManager, Directory directory)
  {
    this(taskList, dataManager, repositoryManager);
    this.directory = directory;
    initialize();
  }
  
  public long getReindexDelay()
  {
    return reindexDelay;
  }
  
  public void setReindexDelay(long reindexDelay)
  {
    Assert.isTrue(reindexDelay >= 0L);
    this.reindexDelay = reindexDelay;
  }
  
  public void setLocation(File indexLocation)
  {
    try
    {
      waitUntilIdle();
    }
    catch (InterruptedException localInterruptedException) {}
    setLocationInternal(indexLocation);
    rebuildIndex = true;
    scheduleIndexMaintenance(MaintainIndexType.STARTUP);
  }
  
  private void setLocationInternal(File indexLocation)
  {
    boolean newLocationExists = indexLocation.exists();
    if ((!newLocationExists) && 
      (!indexLocation.mkdirs())) {
      StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.index.core", 
        "Cannot create task list index folder: " + indexLocation));
    }
    Lock writeLock = indexReaderLock.writeLock();
    writeLock.lock();
    try
    {
      synchronized (this)
      {
        if (indexReader != null)
        {
          try
          {
            indexReader.close();
          }
          catch (IOException localIOException1) {}
          indexReader = null;
        }
        if ((indexLocation.exists()) && (indexLocation.isDirectory()))
        {
          if (directory != null) {
            try
            {
              directory.close();
            }
            catch (IOException e)
            {
              StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.index.core", 
                "Cannot close index: " + e.getMessage(), e));
            }
          }
          try
          {
            directory = new NIOFSDirectory(indexLocation);
          }
          catch (IOException e)
          {
            StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.index.core", 
              "Cannot create task list index", e));
          }
        }
      }
    }
    finally
    {
      writeLock.unlock();
    }
    writeLock.unlock();
  }
  
  public AbstractTaskSchema.Field getDefaultField()
  {
    return defaultField;
  }
  
  public void setDefaultField(AbstractTaskSchema.Field defaultField)
  {
    Assert.isNotNull(defaultField);
    Assert.isNotNull(defaultField.getIndexKey());
    Assert.isTrue(indexedFields.contains(defaultField));
    this.defaultField = defaultField;
    synchronized (this)
    {
      lastResults = null;
    }
  }
  
  public Set<AbstractTaskSchema.Field> getIndexedFields()
  {
    return Collections.unmodifiableSet(indexedFields);
  }
  
  public int getMaxMatchSearchHits()
  {
    return maxMatchSearchHits;
  }
  
  public void setMaxMatchSearchHits(int maxMatchSearchHits)
  {
    this.maxMatchSearchHits = maxMatchSearchHits;
  }
  
  private void initialize()
  {
    if (!rebuildIndex)
    {
      IndexReader indexReader = null;
      try
      {
        indexReader = getIndexReader();
      }
      catch (Exception localException) {}
      if (indexReader == null) {
        rebuildIndex = true;
      }
    }
    maintainIndexJob = new MaintainIndexJob();
    dataManager.addListener(this);
    taskList.addChangeListener(this);
    repositoryManager.addListener(this);
    
    scheduleIndexMaintenance(MaintainIndexType.STARTUP);
  }
  
  private void scheduleIndexMaintenance(MaintainIndexType type)
  {
    long delay = 0L;
    switch (type)
    {
    case REINDEX: 
      delay = startupDelay;
      break;
    case STARTUP: 
      delay = reindexDelay;
    }
    if (delay == 0L)
    {
      maintainIndexJob.cancel();
      try
      {
        maintainIndexJob.join();
      }
      catch (InterruptedException localInterruptedException) {}
      try
      {
        maintainIndex(new NullProgressMonitor());
      }
      catch (CoreException e)
      {
        MultiStatus logStatus = new MultiStatus("org.eclipse.mylyn.tasks.index.core", 0, 
          "Failed to update task list index", e);
        logStatus.add(e.getStatus());
        StatusHandler.log(logStatus);
      }
    }
    else
    {
      maintainIndexJob.schedule(delay);
    }
  }
  
  /* Error */
  public boolean matches(ITask task, String patternString)
  {
    // Byte code:
    //   0: aload_2
    //   1: getstatic 973	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:COMMAND_RESET_INDEX	Ljava/lang/Object;
    //   4: invokevirtual 1021	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   7: ifeq +7 -> 14
    //   10: aload_0
    //   11: invokevirtual 1103	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:reindex	()V
    //   14: aload_0
    //   15: getfield 979	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:indexReaderLock	Ljava/util/concurrent/locks/ReadWriteLock;
    //   18: invokeinterface 1177 1 0
    //   23: astore_3
    //   24: aload_3
    //   25: invokeinterface 1175 1 0
    //   30: aload_0
    //   31: invokespecial 1108	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:getIndexReader	()Lorg/apache/lucene/index/IndexReader;
    //   34: astore 4
    //   36: aload 4
    //   38: ifnull +320 -> 358
    //   41: aload_0
    //   42: dup
    //   43: astore 7
    //   45: monitorenter
    //   46: aload_0
    //   47: getfield 977	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:lastResults	Ljava/util/Set;
    //   50: ifnull +25 -> 75
    //   53: aload_0
    //   54: getfield 974	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:lastPatternString	Ljava/lang/String;
    //   57: ifnull +18 -> 75
    //   60: aload_0
    //   61: getfield 974	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:lastPatternString	Ljava/lang/String;
    //   64: aload_2
    //   65: invokevirtual 1021	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   68: ifeq +7 -> 75
    //   71: iconst_0
    //   72: goto +4 -> 76
    //   75: iconst_1
    //   76: istore 6
    //   78: aload 7
    //   80: monitorexit
    //   81: goto +7 -> 88
    //   84: aload 7
    //   86: monitorexit
    //   87: athrow
    //   88: iload 6
    //   90: ifeq +175 -> 265
    //   93: aload_0
    //   94: aload_2
    //   95: putfield 974	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:lastPatternString	Ljava/lang/String;
    //   98: new 470	java/util/HashSet
    //   101: dup
    //   102: invokespecial 1031	java/util/HashSet:<init>	()V
    //   105: astore 5
    //   107: new 497	org/apache/lucene/search/IndexSearcher
    //   110: dup
    //   111: aload 4
    //   113: invokespecial 1059	org/apache/lucene/search/IndexSearcher:<init>	(Lorg/apache/lucene/index/IndexReader;)V
    //   116: astore 7
    //   118: aload_0
    //   119: aload_2
    //   120: invokespecial 1115	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:computeQuery	(Ljava/lang/String;)Lorg/apache/lucene/search/Query;
    //   123: astore 8
    //   125: aload 7
    //   127: aload 8
    //   129: aload_0
    //   130: getfield 967	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:maxMatchSearchHits	I
    //   133: invokevirtual 1060	org/apache/lucene/search/IndexSearcher:search	(Lorg/apache/lucene/search/Query;I)Lorg/apache/lucene/search/TopDocs;
    //   136: astore 9
    //   138: aload 9
    //   140: getfield 955	org/apache/lucene/search/TopDocs:scoreDocs	[Lorg/apache/lucene/search/ScoreDoc;
    //   143: dup
    //   144: astore 13
    //   146: arraylength
    //   147: istore 12
    //   149: iconst_0
    //   150: istore 11
    //   152: goto +44 -> 196
    //   155: aload 13
    //   157: iload 11
    //   159: aaload
    //   160: astore 10
    //   162: aload 4
    //   164: aload 10
    //   166: getfield 954	org/apache/lucene/search/ScoreDoc:doc	I
    //   169: invokevirtual 1045	org/apache/lucene/index/IndexReader:document	(I)Lorg/apache/lucene/document/Document;
    //   172: astore 14
    //   174: aload 5
    //   176: aload 14
    //   178: getstatic 987	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:FIELD_IDENTIFIER	Lorg/eclipse/mylyn/tasks/core/data/AbstractTaskSchema$Field;
    //   181: invokevirtual 1138	org/eclipse/mylyn/tasks/core/data/AbstractTaskSchema$Field:getIndexKey	()Ljava/lang/String;
    //   184: invokevirtual 1039	org/apache/lucene/document/Document:get	(Ljava/lang/String;)Ljava/lang/String;
    //   187: invokeinterface 1171 2 0
    //   192: pop
    //   193: iinc 11 1
    //   196: iload 11
    //   198: iload 12
    //   200: if_icmplt -45 -> 155
    //   203: goto +50 -> 253
    //   206: astore 8
    //   208: new 512	org/eclipse/core/runtime/Status
    //   211: dup
    //   212: iconst_4
    //   213: ldc_w 452
    //   216: ldc_w 446
    //   219: aload 8
    //   221: invokespecial 1074	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   224: invokestatic 1081	org/eclipse/mylyn/commons/core/StatusHandler:log	(Lorg/eclipse/core/runtime/IStatus;)V
    //   227: aload 7
    //   229: invokevirtual 1058	org/apache/lucene/search/IndexSearcher:close	()V
    //   232: goto +39 -> 271
    //   235: pop
    //   236: goto +35 -> 271
    //   239: astore 15
    //   241: aload 7
    //   243: invokevirtual 1058	org/apache/lucene/search/IndexSearcher:close	()V
    //   246: goto +4 -> 250
    //   249: pop
    //   250: aload 15
    //   252: athrow
    //   253: aload 7
    //   255: invokevirtual 1058	org/apache/lucene/search/IndexSearcher:close	()V
    //   258: goto +13 -> 271
    //   261: pop
    //   262: goto +9 -> 271
    //   265: aload_0
    //   266: getfield 977	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:lastResults	Ljava/util/Set;
    //   269: astore 5
    //   271: aload_0
    //   272: dup
    //   273: astore 7
    //   275: monitorenter
    //   276: aload_0
    //   277: getfield 980	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:indexReader	Lorg/apache/lucene/index/IndexReader;
    //   280: aload 4
    //   282: if_acmpne +14 -> 296
    //   285: aload_0
    //   286: aload_2
    //   287: putfield 974	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:lastPatternString	Ljava/lang/String;
    //   290: aload_0
    //   291: aload 5
    //   293: putfield 977	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:lastResults	Ljava/util/Set;
    //   296: aload 7
    //   298: monitorexit
    //   299: goto +7 -> 306
    //   302: aload 7
    //   304: monitorexit
    //   305: athrow
    //   306: aload_1
    //   307: invokeinterface 1184 1 0
    //   312: astore 7
    //   314: aload 5
    //   316: ifnull +19 -> 335
    //   319: aload 5
    //   321: aload 7
    //   323: invokeinterface 1172 2 0
    //   328: ifeq +7 -> 335
    //   331: iconst_1
    //   332: goto +4 -> 336
    //   335: iconst_0
    //   336: istore 17
    //   338: aload_3
    //   339: invokeinterface 1176 1 0
    //   344: iload 17
    //   346: ireturn
    //   347: astore 16
    //   349: aload_3
    //   350: invokeinterface 1176 1 0
    //   355: aload 16
    //   357: athrow
    //   358: aload_3
    //   359: invokeinterface 1176 1 0
    //   364: iconst_0
    //   365: ireturn
    // Line number table:
    //   Java source line #548	-> byte code offset #0
    //   Java source line #549	-> byte code offset #10
    //   Java source line #551	-> byte code offset #14
    //   Java source line #552	-> byte code offset #24
    //   Java source line #555	-> byte code offset #30
    //   Java source line #556	-> byte code offset #36
    //   Java source line #560	-> byte code offset #41
    //   Java source line #561	-> byte code offset #46
    //   Java source line #562	-> byte code offset #53
    //   Java source line #561	-> byte code offset #76
    //   Java source line #560	-> byte code offset #78
    //   Java source line #564	-> byte code offset #88
    //   Java source line #565	-> byte code offset #93
    //   Java source line #567	-> byte code offset #98
    //   Java source line #569	-> byte code offset #107
    //   Java source line #571	-> byte code offset #118
    //   Java source line #572	-> byte code offset #125
    //   Java source line #573	-> byte code offset #138
    //   Java source line #574	-> byte code offset #162
    //   Java source line #575	-> byte code offset #174
    //   Java source line #573	-> byte code offset #193
    //   Java source line #577	-> byte code offset #206
    //   Java source line #578	-> byte code offset #208
    //   Java source line #579	-> byte code offset #216
    //   Java source line #578	-> byte code offset #221
    //   Java source line #582	-> byte code offset #227
    //   Java source line #583	-> byte code offset #235
    //   Java source line #580	-> byte code offset #239
    //   Java source line #582	-> byte code offset #241
    //   Java source line #583	-> byte code offset #249
    //   Java source line #586	-> byte code offset #250
    //   Java source line #582	-> byte code offset #253
    //   Java source line #583	-> byte code offset #261
    //   Java source line #586	-> byte code offset #262
    //   Java source line #589	-> byte code offset #265
    //   Java source line #591	-> byte code offset #271
    //   Java source line #592	-> byte code offset #276
    //   Java source line #593	-> byte code offset #285
    //   Java source line #594	-> byte code offset #290
    //   Java source line #591	-> byte code offset #296
    //   Java source line #597	-> byte code offset #306
    //   Java source line #598	-> byte code offset #314
    //   Java source line #602	-> byte code offset #338
    //   Java source line #598	-> byte code offset #344
    //   Java source line #601	-> byte code offset #347
    //   Java source line #602	-> byte code offset #349
    //   Java source line #603	-> byte code offset #355
    //   Java source line #602	-> byte code offset #358
    //   Java source line #604	-> byte code offset #364
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	366	0	this	TaskListIndex
    //   0	366	1	task	ITask
    //   0	366	2	patternString	String
    //   23	336	3	readLock	Lock
    //   34	247	4	indexReader	IndexReader
    //   105	70	5	hits	Set<String>
    //   269	51	5	hits	Set<String>
    //   76	3	6	needIndexHit	boolean
    //   88	1	6	needIndexHit	boolean
    //   43	42	7	Ljava/lang/Object;	Object
    //   116	138	7	indexSearcher	org.apache.lucene.search.IndexSearcher
    //   273	30	7	Ljava/lang/Object;	Object
    //   312	10	7	taskIdentifier	String
    //   123	5	8	query	Query
    //   206	14	8	e	IOException
    //   136	3	9	results	org.apache.lucene.search.TopDocs
    //   160	5	10	scoreDoc	org.apache.lucene.search.ScoreDoc
    //   150	51	11	i	int
    //   147	54	12	j	int
    //   144	12	13	arrayOfScoreDoc	org.apache.lucene.search.ScoreDoc[]
    //   172	5	14	document	Document
    //   239	12	15	localObject1	Object
    //   347	9	16	localObject2	Object
    //   336	9	17	bool1	boolean
    //   235	1	24	localIOException1	IOException
    //   249	1	25	localIOException2	IOException
    //   261	1	26	localIOException3	IOException
    // Exception table:
    //   from	to	target	type
    //   46	81	84	finally
    //   84	87	84	finally
    //   118	203	206	java/io/IOException
    //   227	232	235	java/io/IOException
    //   118	227	239	finally
    //   241	246	249	java/io/IOException
    //   253	258	261	java/io/IOException
    //   276	299	302	finally
    //   302	305	302	finally
    //   30	338	347	finally
  }
  
  public void reindex()
  {
    rebuildIndex = true;
    scheduleIndexMaintenance(MaintainIndexType.REINDEX);
  }
  
  public void waitUntilIdle()
    throws InterruptedException
  {
    if ((!Platform.isRunning()) && (reindexDelay != 0L)) {
      Logger.getLogger(TaskListIndex.class.getName()).warning(
        "Index job joining may not work properly when Eclipse platform is not running");
    }
    maintainIndexJob.join();
  }
  
  /* Error */
  public void find(String patternString, TaskCollector collector, int resultsLimit)
  {
    // Byte code:
    //   0: aload_1
    //   1: invokestatic 1066	org/eclipse/core/runtime/Assert:isNotNull	(Ljava/lang/Object;)V
    //   4: aload_2
    //   5: invokestatic 1066	org/eclipse/core/runtime/Assert:isNotNull	(Ljava/lang/Object;)V
    //   8: iload_3
    //   9: ifle +7 -> 16
    //   12: iconst_1
    //   13: goto +4 -> 17
    //   16: iconst_0
    //   17: invokestatic 1065	org/eclipse/core/runtime/Assert:isTrue	(Z)Z
    //   20: pop
    //   21: aload_0
    //   22: getfield 979	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:indexReaderLock	Ljava/util/concurrent/locks/ReadWriteLock;
    //   25: invokeinterface 1177 1 0
    //   30: astore 4
    //   32: aload 4
    //   34: invokeinterface 1175 1 0
    //   39: aload_0
    //   40: invokespecial 1108	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:getIndexReader	()Lorg/apache/lucene/index/IndexReader;
    //   43: astore 5
    //   45: aload 5
    //   47: ifnull +186 -> 233
    //   50: new 497	org/apache/lucene/search/IndexSearcher
    //   53: dup
    //   54: aload 5
    //   56: invokespecial 1059	org/apache/lucene/search/IndexSearcher:<init>	(Lorg/apache/lucene/index/IndexReader;)V
    //   59: astore 6
    //   61: aload_0
    //   62: aload_1
    //   63: invokespecial 1115	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:computeQuery	(Ljava/lang/String;)Lorg/apache/lucene/search/Query;
    //   66: astore 7
    //   68: aload 6
    //   70: aload 7
    //   72: iload_3
    //   73: invokevirtual 1060	org/apache/lucene/search/IndexSearcher:search	(Lorg/apache/lucene/search/Query;I)Lorg/apache/lucene/search/TopDocs;
    //   76: astore 8
    //   78: aload 8
    //   80: getfield 955	org/apache/lucene/search/TopDocs:scoreDocs	[Lorg/apache/lucene/search/ScoreDoc;
    //   83: dup
    //   84: astore 12
    //   86: arraylength
    //   87: istore 11
    //   89: iconst_0
    //   90: istore 10
    //   92: goto +60 -> 152
    //   95: aload 12
    //   97: iload 10
    //   99: aaload
    //   100: astore 9
    //   102: aload 5
    //   104: aload 9
    //   106: getfield 954	org/apache/lucene/search/ScoreDoc:doc	I
    //   109: invokevirtual 1045	org/apache/lucene/index/IndexReader:document	(I)Lorg/apache/lucene/document/Document;
    //   112: astore 13
    //   114: aload 13
    //   116: getstatic 987	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:FIELD_IDENTIFIER	Lorg/eclipse/mylyn/tasks/core/data/AbstractTaskSchema$Field;
    //   119: invokevirtual 1138	org/eclipse/mylyn/tasks/core/data/AbstractTaskSchema$Field:getIndexKey	()Ljava/lang/String;
    //   122: invokevirtual 1039	org/apache/lucene/document/Document:get	(Ljava/lang/String;)Ljava/lang/String;
    //   125: astore 14
    //   127: aload_0
    //   128: getfield 982	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:taskList	Lorg/eclipse/mylyn/internal/tasks/core/TaskList;
    //   131: aload 14
    //   133: invokevirtual 1094	org/eclipse/mylyn/internal/tasks/core/TaskList:getTask	(Ljava/lang/String;)Lorg/eclipse/mylyn/internal/tasks/core/AbstractTask;
    //   136: astore 15
    //   138: aload 15
    //   140: ifnull +9 -> 149
    //   143: aload_2
    //   144: aload 15
    //   146: invokevirtual 1135	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex$TaskCollector:collect	(Lorg/eclipse/mylyn/tasks/core/ITask;)V
    //   149: iinc 10 1
    //   152: iload 10
    //   154: iload 11
    //   156: if_icmplt -61 -> 95
    //   159: goto +50 -> 209
    //   162: astore 7
    //   164: new 512	org/eclipse/core/runtime/Status
    //   167: dup
    //   168: iconst_4
    //   169: ldc_w 452
    //   172: ldc_w 446
    //   175: aload 7
    //   177: invokespecial 1074	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   180: invokestatic 1081	org/eclipse/mylyn/commons/core/StatusHandler:log	(Lorg/eclipse/core/runtime/IStatus;)V
    //   183: aload 6
    //   185: invokevirtual 1058	org/apache/lucene/search/IndexSearcher:close	()V
    //   188: goto +45 -> 233
    //   191: pop
    //   192: goto +41 -> 233
    //   195: astore 16
    //   197: aload 6
    //   199: invokevirtual 1058	org/apache/lucene/search/IndexSearcher:close	()V
    //   202: goto +4 -> 206
    //   205: pop
    //   206: aload 16
    //   208: athrow
    //   209: aload 6
    //   211: invokevirtual 1058	org/apache/lucene/search/IndexSearcher:close	()V
    //   214: goto +19 -> 233
    //   217: pop
    //   218: goto +15 -> 233
    //   221: astore 17
    //   223: aload 4
    //   225: invokeinterface 1176 1 0
    //   230: aload 17
    //   232: athrow
    //   233: aload 4
    //   235: invokeinterface 1176 1 0
    //   240: return
    // Line number table:
    //   Java source line #639	-> byte code offset #0
    //   Java source line #640	-> byte code offset #4
    //   Java source line #641	-> byte code offset #8
    //   Java source line #643	-> byte code offset #21
    //   Java source line #644	-> byte code offset #32
    //   Java source line #646	-> byte code offset #39
    //   Java source line #647	-> byte code offset #45
    //   Java source line #648	-> byte code offset #50
    //   Java source line #650	-> byte code offset #61
    //   Java source line #651	-> byte code offset #68
    //   Java source line #652	-> byte code offset #78
    //   Java source line #653	-> byte code offset #102
    //   Java source line #654	-> byte code offset #114
    //   Java source line #655	-> byte code offset #127
    //   Java source line #656	-> byte code offset #138
    //   Java source line #657	-> byte code offset #143
    //   Java source line #652	-> byte code offset #149
    //   Java source line #660	-> byte code offset #162
    //   Java source line #661	-> byte code offset #164
    //   Java source line #662	-> byte code offset #172
    //   Java source line #661	-> byte code offset #177
    //   Java source line #665	-> byte code offset #183
    //   Java source line #666	-> byte code offset #191
    //   Java source line #663	-> byte code offset #195
    //   Java source line #665	-> byte code offset #197
    //   Java source line #666	-> byte code offset #205
    //   Java source line #669	-> byte code offset #206
    //   Java source line #665	-> byte code offset #209
    //   Java source line #666	-> byte code offset #217
    //   Java source line #669	-> byte code offset #218
    //   Java source line #671	-> byte code offset #221
    //   Java source line #672	-> byte code offset #223
    //   Java source line #673	-> byte code offset #230
    //   Java source line #672	-> byte code offset #233
    //   Java source line #674	-> byte code offset #240
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	241	0	this	TaskListIndex
    //   0	241	1	patternString	String
    //   0	241	2	collector	TaskCollector
    //   0	241	3	resultsLimit	int
    //   30	204	4	readLock	Lock
    //   43	60	5	indexReader	IndexReader
    //   59	151	6	indexSearcher	org.apache.lucene.search.IndexSearcher
    //   66	5	7	query	Query
    //   162	14	7	e	IOException
    //   76	3	8	results	org.apache.lucene.search.TopDocs
    //   100	5	9	scoreDoc	org.apache.lucene.search.ScoreDoc
    //   90	67	10	i	int
    //   87	70	11	j	int
    //   84	12	12	arrayOfScoreDoc	org.apache.lucene.search.ScoreDoc[]
    //   112	3	13	document	Document
    //   125	7	14	taskIdentifier	String
    //   136	9	15	task	AbstractTask
    //   195	12	16	localObject1	Object
    //   221	10	17	localObject2	Object
    //   191	1	19	localIOException1	IOException
    //   205	1	20	localIOException2	IOException
    //   217	1	21	localIOException3	IOException
    // Exception table:
    //   from	to	target	type
    //   61	159	162	java/io/IOException
    //   183	188	191	java/io/IOException
    //   61	183	195	finally
    //   197	202	205	java/io/IOException
    //   209	214	217	java/io/IOException
    //   39	221	221	finally
  }
  
  private Query computeQuery(String patternString)
  {
    String upperPatternString = patternString.toUpperCase();
    
    boolean hasBooleanSpecifiers = (upperPatternString.contains(" OR ")) || (upperPatternString.contains(" AND ")) || 
      (upperPatternString.contains(" NOT "));
    if ((patternString.indexOf(':') == -1) && (!hasBooleanSpecifiers) && (defaultField.equals(FIELD_SUMMARY)) && 
      (patternString.indexOf('"') == -1)) {
      return new PrefixQuery(new Term(defaultField.getIndexKey(), patternString));
    }
    QueryParser qp = new QueryParser(Version.LUCENE_CURRENT, defaultField.getIndexKey(), new TaskAnalyzer());
    try
    {
      q = qp.parse(patternString);
    }
    catch (ParseException localParseException)
    {
      Query q;
      return new PrefixQuery(new Term(defaultField.getIndexKey(), patternString));
    }
    Query q;
    if ((q instanceof BooleanQuery))
    {
      BooleanQuery query = (BooleanQuery)q;
      BooleanClause[] arrayOfBooleanClause;
      int j = (arrayOfBooleanClause = query.getClauses()).length;
      for (int i = 0; i < j; i++)
      {
        BooleanClause clause = arrayOfBooleanClause[i];
        if ((clause.getQuery() instanceof TermQuery))
        {
          TermQuery termQuery = (TermQuery)clause.getQuery();
          clause.setQuery(new PrefixQuery(termQuery.getTerm()));
        }
        if (!hasBooleanSpecifiers) {
          clause.setOccur(BooleanClause.Occur.MUST);
        }
      }
    }
    else if ((q instanceof TermQuery))
    {
      return new PrefixQuery(((TermQuery)q).getTerm());
    }
    return q;
  }
  
  /* Error */
  public void close()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 983	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:dataManager	Lorg/eclipse/mylyn/internal/tasks/core/data/TaskDataManager;
    //   4: aload_0
    //   5: invokevirtual 1096	org/eclipse/mylyn/internal/tasks/core/data/TaskDataManager:removeListener	(Lorg/eclipse/mylyn/internal/tasks/core/data/ITaskDataManagerListener;)V
    //   8: aload_0
    //   9: getfield 982	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:taskList	Lorg/eclipse/mylyn/internal/tasks/core/TaskList;
    //   12: aload_0
    //   13: invokevirtual 1092	org/eclipse/mylyn/internal/tasks/core/TaskList:removeChangeListener	(Lorg/eclipse/mylyn/internal/tasks/core/ITaskListChangeListener;)V
    //   16: aload_0
    //   17: getfield 985	org/eclipse/mylyn/internal/tasks/index/core/TaskListIndex:repositoryManager	Lorg/eclipse/mylyn/tasks/core/IRepositoryManager;
    //   20: aload_0
    //  
1 2 3

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd