summaryrefslogtreecommitdiff
path: root/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/CompileContext.java
blob: 09758a5e2191bcae05c2b74cdfb0952f39759d61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.intellij.structuralsearch.impl.matcher.compiler;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.structuralsearch.MatchOptions;
import com.intellij.structuralsearch.impl.matcher.CompiledPattern;

/**
 * Created by IntelliJ IDEA.
 * User: maxim
 * Date: 17.11.2004
 * Time: 19:26:37
 * To change this template use File | Settings | File Templates.
 */
public class CompileContext {
  private OptimizingSearchHelper searchHelper;
  
  private CompiledPattern pattern;
  private MatchOptions options;
  private Project project;

  public void clear() {
    if (searchHelper!=null) searchHelper.clear();

    project = null;
    pattern = null;
    options = null;
  }

  public void init(final CompiledPattern _result, final MatchOptions _options, final Project _project, final boolean _findMatchingFiles) {
    options = _options;
    project = _project;
    pattern = _result;

    searchHelper = ApplicationManager.getApplication().isUnitTestMode() ?
                   new TestModeOptimizingSearchHelper(this) :
                   new FindInFilesOptimizingSearchHelper(this, _findMatchingFiles, _project);
  }

  public OptimizingSearchHelper getSearchHelper() {
    return searchHelper;
  }

  void setSearchHelper(OptimizingSearchHelper searchHelper) {
    this.searchHelper = searchHelper;
  }

  public CompiledPattern getPattern() {
    return pattern;
  }

  void setPattern(CompiledPattern pattern) {
    this.pattern = pattern;
  }

  MatchOptions getOptions() {
    return options;
  }

  void setOptions(MatchOptions options) {
    this.options = options;
  }

  Project getProject() {
    return project;
  }

  void setProject(Project project) {
    this.project = project;
  }
}