blob: 2a44927b2f78ed97b59954b8f691ce8dab1a274c [file] [log] [blame]
package org.eclipse.jdt.internal.core.search.matching;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import java.io.IOException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.internal.compiler.ast.AstNode;
import org.eclipse.jdt.internal.core.index.impl.IndexInput;
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.internal.core.search.IIndexSearchRequestor;
import org.eclipse.jdt.internal.core.index.IEntryResult;
public class PackageDeclarationPattern extends SearchPattern {
char[] pkgName;
public PackageDeclarationPattern(char[] pkgName, int matchMode, boolean isCaseSensitive) {
super(matchMode, isCaseSensitive);
this.pkgName = pkgName;
}
/**
* @see SearchPattern#decodeIndexEntry
*/
protected void decodeIndexEntry(IEntryResult entryResult) {
// not used
}
/**
* @see SearchPattern#feedIndexRequestor
*/
public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, IndexInput input, IJavaSearchScope scope) throws java.io.IOException {
// not used
}
/**
* see SearchPattern#findMatches
*/
public void findIndexMatches(IndexInput input, IIndexSearchRequestor requestor, int detailLevel, IProgressMonitor progressMonitor, IJavaSearchScope scope) throws IOException {
// package declarations are not indexed
}
/**
* @see SearchPattern#indexEntryPrefix
*/
public char[] indexEntryPrefix() {
// not used
return null;
}
/**
* @see SearchPattern#matchContainer
*/
protected int matchContainer() {
// used only in the case of a OrPattern
return 0;
}
/**
* @see SearchPattern#matchIndexEntry
*/
protected boolean matchIndexEntry() {
// used only in the case of a OrPattern
return true;
}
public String toString(){
StringBuffer buffer = new StringBuffer(20);
buffer.append("PackageDeclarationPattern: <"); //$NON-NLS-1$
if (this.pkgName != null) buffer.append(this.pkgName);
buffer.append(">, "); //$NON-NLS-1$
switch(matchMode){
case EXACT_MATCH :
buffer.append("exact match, "); //$NON-NLS-1$
break;
case PREFIX_MATCH :
buffer.append("prefix match, "); //$NON-NLS-1$
break;
case PATTERN_MATCH :
buffer.append("pattern match, "); //$NON-NLS-1$
break;
}
if (isCaseSensitive)
buffer.append("case sensitive"); //$NON-NLS-1$
else
buffer.append("case insensitive"); //$NON-NLS-1$
return buffer.toString();
}
/**
* @see SearchPattern#matchLevel(AstNode, boolean)
*/
public int matchLevel(AstNode node, boolean resolve) {
// used only in the case of a OrPattern
return ACCURATE_MATCH;
}
}