|
From: <caw...@us...> - 2007-04-12 19:40:48
|
Revision: 2300
http://svn.sourceforge.net/rubyeclipse/?rev=2300&view=rev
Author: cawilliams
Date: 2007-04-12 12:40:45 -0700 (Thu, 12 Apr 2007)
Log Message:
-----------
Rolling back branch to beginning (r2143)
Modified Paths:
--------------
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/parser/IProblem.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/LoadpathEntry.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolder.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/CharOperation.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Messages.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java
Removed Paths:
-------------
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/SourceElementParser.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/ast/
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/env/
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/impl/
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/lookup/
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/parser/
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/CompoundNameVector.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfIntValues.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfLong.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfObject.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleLookupTable.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleNameVector.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleSet.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/index/
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/AbstractSearchScope.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/BasicSearchEngine.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/IndexQueryRequestor.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/IndexSelector.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/PatternSearchJob.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/RubySearchDocument.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/RubySearchParticipant.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/RubySearchScope.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/RubyWorkspaceScope.java
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/processing/
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/HandleFactory.java
Modified: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -317,7 +317,6 @@
private static final boolean VERBOSE = false;
- public static final boolean DEBUG = false;
private SymbolIndex symbolIndex;
private ISymbolFinder symbolFinder;
Modified: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/parser/IProblem.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/parser/IProblem.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/parser/IProblem.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -34,23 +34,6 @@
public interface IProblem {
/**
- * Problem Categories
- * The high bits of a problem ID contains information about the category of a problem.
- * For example, (problemID & TypeRelated) != 0, indicates that this problem is type related.
- *
- * A problem category can help to implement custom problem filters. Indeed, when numerous problems
- * are listed, focusing on import related problems first might be relevant.
- *
- * When a problem is tagged as Internal, it means that no change other than a local source code change
- * can fix the corresponding problem. A type related problem could be addressed by changing the type
- * involved in it.
- */
- int TypeRelated = 0x01000000;
-
- int ForbiddenReference = TypeRelated + 307;
- int DiscouragedReference = TypeRelated + 280;
-
- /**
* Answer a localized, human-readable message string which describes the
* problem.
*
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/SourceElementParser.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/SourceElementParser.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/SourceElementParser.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,5 +0,0 @@
-package org.rubypeople.rdt.internal.compiler;
-
-public class SourceElementParser {
-
-}
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/CompoundNameVector.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/CompoundNameVector.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/CompoundNameVector.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.rubypeople.rdt.internal.compiler.util;
-
-import org.rubypeople.rdt.internal.core.util.CharOperation;
-
-public final class CompoundNameVector {
- static int INITIAL_SIZE = 10;
-
- public int size;
- int maxSize;
- char[][][] elements;
-public CompoundNameVector() {
- maxSize = INITIAL_SIZE;
- size = 0;
- elements = new char[maxSize][][];
-}
-public void add(char[][] newElement) {
- if (size == maxSize) // knows that size starts <= maxSize
- System.arraycopy(elements, 0, (elements = new char[maxSize *= 2][][]), 0, size);
- elements[size++] = newElement;
-}
-public void addAll(char[][][] newElements) {
- if (size + newElements.length >= maxSize) {
- maxSize = size + newElements.length; // assume no more elements will be added
- System.arraycopy(elements, 0, (elements = new char[maxSize][][]), 0, size);
- }
- System.arraycopy(newElements, 0, elements, size, newElements.length);
- size += newElements.length;
-}
-public boolean contains(char[][] element) {
- for (int i = size; --i >= 0;)
- if (CharOperation.equals(element, elements[i]))
- return true;
- return false;
-}
-public char[][] elementAt(int index) {
- return elements[index];
-}
-public char[][] remove(char[][] element) {
- // assumes only one occurrence of the element exists
- for (int i = size; --i >= 0;)
- if (element == elements[i]) {
- // shift the remaining elements down one spot
- System.arraycopy(elements, i + 1, elements, i, --size - i);
- elements[size] = null;
- return element;
- }
- return null;
-}
-public void removeAll() {
- for (int i = size; --i >= 0;)
- elements[i] = null;
- size = 0;
-}
-public String toString() {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < size; i++) {
- buffer.append(CharOperation.toString(elements[i])).append("\n"); //$NON-NLS-1$
- }
- return buffer.toString();
-}
-}
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfIntValues.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfIntValues.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfIntValues.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.rubypeople.rdt.internal.compiler.util;
-
-import org.rubypeople.rdt.internal.core.util.CharOperation;
-
-/**
- * Hashtable of {char[] --> int}
- */
-public final class HashtableOfIntValues implements Cloneable {
-
- public static final int NO_VALUE = Integer.MIN_VALUE;
-
- // to avoid using Enumerations, walk the individual tables skipping nulls
- public char[] keyTable[];
- public int valueTable[];
-
- public int elementSize; // number of elements in the table
- int threshold;
-
- public HashtableOfIntValues() {
- this(13);
- }
-
- public HashtableOfIntValues(int size) {
-
- this.elementSize = 0;
- this.threshold = size; // size represents the expected number of elements
- int extraRoom = (int) (size * 1.75f);
- if (this.threshold == extraRoom)
- extraRoom++;
- this.keyTable = new char[extraRoom][];
- this.valueTable = new int[extraRoom];
- }
-
- public Object clone() throws CloneNotSupportedException {
- HashtableOfIntValues result = (HashtableOfIntValues) super.clone();
- result.elementSize = this.elementSize;
- result.threshold = this.threshold;
-
- int length = this.keyTable.length;
- result.keyTable = new char[length][];
- System.arraycopy(this.keyTable, 0, result.keyTable, 0, length);
-
- length = this.valueTable.length;
- result.valueTable = new int[length];
- System.arraycopy(this.valueTable, 0, result.valueTable, 0, length);
- return result;
- }
-
- public boolean containsKey(char[] key) {
- int length = keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key))
- return true;
- if (++index == length) {
- index = 0;
- }
- }
- return false;
- }
-
- public int get(char[] key) {
- int length = keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key))
- return valueTable[index];
- if (++index == length) {
- index = 0;
- }
- }
- return NO_VALUE;
- }
-
- public int put(char[] key, int value) {
- int length = keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key))
- return valueTable[index] = value;
- if (++index == length) {
- index = 0;
- }
- }
- keyTable[index] = key;
- valueTable[index] = value;
-
- // assumes the threshold is never equal to the size of the table
- if (++elementSize > threshold)
- rehash();
- return value;
- }
-
- public int removeKey(char[] key) {
- int length = keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) {
- int value = valueTable[index];
- elementSize--;
- keyTable[index] = null;
- valueTable[index] = NO_VALUE;
- rehash();
- return value;
- }
- if (++index == length) {
- index = 0;
- }
- }
- return NO_VALUE;
- }
-
- private void rehash() {
-
- HashtableOfIntValues newHashtable = new HashtableOfIntValues(elementSize * 2); // double the number of expected elements
- char[] currentKey;
- for (int i = keyTable.length; --i >= 0;)
- if ((currentKey = keyTable[i]) != null)
- newHashtable.put(currentKey, valueTable[i]);
-
- this.keyTable = newHashtable.keyTable;
- this.valueTable = newHashtable.valueTable;
- this.threshold = newHashtable.threshold;
- }
-
- public int size() {
- return elementSize;
- }
-
- public String toString() {
- String s = ""; //$NON-NLS-1$
- char[] key;
- for (int i = 0, length = valueTable.length; i < length; i++)
- if ((key = keyTable[i]) != null)
- s += new String(key) + " -> " + valueTable[i] + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-}
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfLong.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfLong.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfLong.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.rubypeople.rdt.internal.compiler.util;
-
-
- /**
- * Hashtable for non-zero long keys.
- */
-
-public final class HashtableOfLong {
- // to avoid using Enumerations, walk the individual tables skipping nulls
- public long[] keyTable;
- public Object[] valueTable;
-
- public int elementSize; // number of elements in the table
- int threshold;
-public HashtableOfLong() {
- this(13);
-}
-public HashtableOfLong(int size) {
- this.elementSize = 0;
- this.threshold = size; // size represents the expected number of elements
- int extraRoom = (int) (size * 1.75f);
- if (this.threshold == extraRoom)
- extraRoom++;
- this.keyTable = new long[extraRoom];
- this.valueTable = new Object[extraRoom];
-}
-public boolean containsKey(long key) {
- int length = keyTable.length,
- index = ((int)(key >>> 32)) % length;
- long currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key)
- return true;
- if (++index == length) {
- index = 0;
- }
- }
- return false;
-}
-public Object get(long key) {
- int length = keyTable.length,
- index = ((int)(key >>> 32)) % length;
- long currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key) return valueTable[index];
- if (++index == length) {
- index = 0;
- }
- }
- return null;
-}
-public Object put(long key, Object value) {
- int length = keyTable.length,
- index = ((int)(key >>> 32)) % length;
- long currentKey;
- while ((currentKey = keyTable[index]) != 0) {
- if (currentKey == key) return valueTable[index] = value;
- if (++index == length) {
- index = 0;
- }
- }
- keyTable[index] = key;
- valueTable[index] = value;
-
- // assumes the threshold is never equal to the size of the table
- if (++elementSize > threshold)
- rehash();
- return value;
-}
-private void rehash() {
- HashtableOfLong newHashtable = new HashtableOfLong(elementSize * 2); // double the number of expected elements
- long currentKey;
- for (int i = keyTable.length; --i >= 0;)
- if ((currentKey = keyTable[i]) != 0)
- newHashtable.put(currentKey, valueTable[i]);
-
- this.keyTable = newHashtable.keyTable;
- this.valueTable = newHashtable.valueTable;
- this.threshold = newHashtable.threshold;
-}
-public int size() {
- return elementSize;
-}
-public String toString() {
- String s = ""; //$NON-NLS-1$
- Object object;
- for (int i = 0, length = valueTable.length; i < length; i++)
- if ((object = valueTable[i]) != null)
- s += keyTable[i] + " -> " + object.toString() + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
-}
-}
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfObject.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfObject.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfObject.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.rubypeople.rdt.internal.compiler.util;
-
-import org.rubypeople.rdt.internal.core.util.CharOperation;
-
-/**
- * Hashtable of {char[] --> Object }
- */
-public final class HashtableOfObject implements Cloneable {
-
- // to avoid using Enumerations, walk the individual tables skipping nulls
- public char[] keyTable[];
- public Object valueTable[];
-
- public int elementSize; // number of elements in the table
- int threshold;
-
- public HashtableOfObject() {
- this(13);
- }
-
- public HashtableOfObject(int size) {
-
- this.elementSize = 0;
- this.threshold = size; // size represents the expected number of elements
- int extraRoom = (int) (size * 1.75f);
- if (this.threshold == extraRoom)
- extraRoom++;
- this.keyTable = new char[extraRoom][];
- this.valueTable = new Object[extraRoom];
- }
-
- public void clear() {
- for (int i = this.keyTable.length; --i >= 0;) {
- this.keyTable[i] = null;
- this.valueTable[i] = null;
- }
- this.elementSize = 0;
- }
-
- public Object clone() throws CloneNotSupportedException {
- HashtableOfObject result = (HashtableOfObject) super.clone();
- result.elementSize = this.elementSize;
- result.threshold = this.threshold;
-
- int length = this.keyTable.length;
- result.keyTable = new char[length][];
- System.arraycopy(this.keyTable, 0, result.keyTable, 0, length);
-
- length = this.valueTable.length;
- result.valueTable = new Object[length];
- System.arraycopy(this.valueTable, 0, result.valueTable, 0, length);
- return result;
- }
-
- public boolean containsKey(char[] key) {
- int length = keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key))
- return true;
- if (++index == length) {
- index = 0;
- }
- }
- return false;
- }
-
- public Object get(char[] key) {
- int length = keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key))
- return valueTable[index];
- if (++index == length) {
- index = 0;
- }
- }
- return null;
- }
-
- public Object put(char[] key, Object value) {
- int length = keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key))
- return valueTable[index] = value;
- if (++index == length) {
- index = 0;
- }
- }
- keyTable[index] = key;
- valueTable[index] = value;
-
- // assumes the threshold is never equal to the size of the table
- if (++elementSize > threshold)
- rehash();
- return value;
- }
-
- public Object removeKey(char[] key) {
- int length = keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) {
- Object value = valueTable[index];
- elementSize--;
- keyTable[index] = null;
- valueTable[index] = null;
- rehash();
- return value;
- }
- if (++index == length) {
- index = 0;
- }
- }
- return null;
- }
-
- private void rehash() {
-
- HashtableOfObject newHashtable = new HashtableOfObject(elementSize * 2); // double the number of expected elements
- char[] currentKey;
- for (int i = keyTable.length; --i >= 0;)
- if ((currentKey = keyTable[i]) != null)
- newHashtable.put(currentKey, valueTable[i]);
-
- this.keyTable = newHashtable.keyTable;
- this.valueTable = newHashtable.valueTable;
- this.threshold = newHashtable.threshold;
- }
-
- public int size() {
- return elementSize;
- }
-
- public String toString() {
- String s = ""; //$NON-NLS-1$
- Object object;
- for (int i = 0, length = valueTable.length; i < length; i++)
- if ((object = valueTable[i]) != null)
- s += new String(keyTable[i]) + " -> " + object.toString() + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
- }
-}
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleLookupTable.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleLookupTable.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleLookupTable.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.rubypeople.rdt.internal.compiler.util;
-
-/**
- * A simple lookup table is a non-synchronized Hashtable, whose keys
- * and values are Objects. It also uses linear probing to resolve collisions
- * rather than a linked list of hash table entries.
- */
-public final class SimpleLookupTable implements Cloneable {
-
-// to avoid using Enumerations, walk the individual tables skipping nulls
-public Object[] keyTable;
-public Object[] valueTable;
-public int elementSize; // number of elements in the table
-public int threshold;
-
-public SimpleLookupTable() {
- this(13);
-}
-
-public SimpleLookupTable(int size) {
- this.elementSize = 0;
- this.threshold = size; // size represents the expected number of elements
- int extraRoom = (int) (size * 1.5f);
- if (this.threshold == extraRoom)
- extraRoom++;
- this.keyTable = new Object[extraRoom];
- this.valueTable = new Object[extraRoom];
-}
-
-public Object clone() throws CloneNotSupportedException {
- SimpleLookupTable result = (SimpleLookupTable) super.clone();
- result.elementSize = this.elementSize;
- result.threshold = this.threshold;
-
- int length = this.keyTable.length;
- result.keyTable = new Object[length];
- System.arraycopy(this.keyTable, 0, result.keyTable, 0, length);
-
- length = this.valueTable.length;
- result.valueTable = new Object[length];
- System.arraycopy(this.valueTable, 0, result.valueTable, 0, length);
- return result;
-}
-
-public boolean containsKey(Object key) {
- int length = keyTable.length;
- int index = (key.hashCode() & 0x7FFFFFFF) % length;
- Object currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.equals(key)) return true;
- if (++index == length) index = 0;
- }
- return false;
-}
-
-public Object get(Object key) {
- int length = keyTable.length;
- int index = (key.hashCode() & 0x7FFFFFFF) % length;
- Object currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.equals(key)) return valueTable[index];
- if (++index == length) index = 0;
- }
- return null;
-}
-
-public Object keyForValue(Object valueToMatch) {
- if (valueToMatch != null)
- for (int i = 0, l = keyTable.length; i < l; i++)
- if (keyTable[i] != null && valueToMatch.equals(valueTable[i]))
- return keyTable[i];
- return null;
-}
-
-public Object put(Object key, Object value) {
- int length = keyTable.length;
- int index = (key.hashCode() & 0x7FFFFFFF) % length;
- Object currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.equals(key)) return valueTable[index] = value;
- if (++index == length) index = 0;
- }
- keyTable[index] = key;
- valueTable[index] = value;
-
- // assumes the threshold is never equal to the size of the table
- if (++elementSize > threshold) rehash();
- return value;
-}
-
-public Object removeKey(Object key) {
- int length = keyTable.length;
- int index = (key.hashCode() & 0x7FFFFFFF) % length;
- Object currentKey;
- while ((currentKey = keyTable[index]) != null) {
- if (currentKey.equals(key)) {
- elementSize--;
- Object oldValue = valueTable[index];
- keyTable[index] = null;
- valueTable[index] = null;
- if (keyTable[index + 1 == length ? 0 : index + 1] != null)
- rehash(); // only needed if a possible collision existed
- return oldValue;
- }
- if (++index == length) index = 0;
- }
- return null;
-}
-
-public void removeValue(Object valueToRemove) {
- boolean rehash = false;
- for (int i = 0, l = valueTable.length; i < l; i++) {
- Object value = valueTable[i];
- if (value != null && value.equals(valueToRemove)) {
- elementSize--;
- keyTable[i] = null;
- valueTable[i] = null;
- if (!rehash && keyTable[i + 1 == l ? 0 : i + 1] != null)
- rehash = true; // only needed if a possible collision existed
- }
- }
- if (rehash) rehash();
-}
-
-private void rehash() {
- SimpleLookupTable newLookupTable = new SimpleLookupTable(elementSize * 2); // double the number of expected elements
- Object currentKey;
- for (int i = keyTable.length; --i >= 0;)
- if ((currentKey = keyTable[i]) != null)
- newLookupTable.put(currentKey, valueTable[i]);
-
- this.keyTable = newLookupTable.keyTable;
- this.valueTable = newLookupTable.valueTable;
- this.elementSize = newLookupTable.elementSize;
- this.threshold = newLookupTable.threshold;
-}
-
-public String toString() {
- String s = ""; //$NON-NLS-1$
- Object object;
- for (int i = 0, l = valueTable.length; i < l; i++)
- if ((object = valueTable[i]) != null)
- s += keyTable[i].toString() + " -> " + object.toString() + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
- return s;
-}
-}
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleNameVector.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleNameVector.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleNameVector.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.rubypeople.rdt.internal.compiler.util;
-
-import org.rubypeople.rdt.internal.core.util.CharOperation;
-
-public final class SimpleNameVector {
-
- static int INITIAL_SIZE = 10;
-
- public int size;
- int maxSize;
- char[][] elements;
-
- public SimpleNameVector() {
-
- this.maxSize = INITIAL_SIZE;
- this.size = 0;
- this.elements = new char[this.maxSize][];
- }
-
- public void add(char[] newElement) {
-
- if (this.size == this.maxSize) // knows that size starts <= maxSize
- System.arraycopy(this.elements, 0, (this.elements = new char[this.maxSize *= 2][]), 0, this.size);
- this.elements[size++] = newElement;
- }
-
- public void addAll(char[][] newElements) {
-
- if (this.size + newElements.length >= this.maxSize) {
- this.maxSize = this.size + newElements.length; // assume no more elements will be added
- System.arraycopy(this.elements, 0, (this.elements = new char[this.maxSize][]), 0, this.size);
- }
- System.arraycopy(newElements, 0, this.elements, this.size, newElements.length);
- this.size += newElements.length;
- }
-
- public void copyInto(Object[] targetArray){
-
- System.arraycopy(this.elements, 0, targetArray, 0, this.size);
- }
-
- public boolean contains(char[] element) {
-
- for (int i = this.size; --i >= 0;)
- if (CharOperation.equals(element, this.elements[i]))
- return true;
- return false;
- }
-
- public char[] elementAt(int index) {
- return this.elements[index];
- }
-
- public char[] remove(char[] element) {
-
- // assumes only one occurrence of the element exists
- for (int i = this.size; --i >= 0;)
- if (element == this.elements[i]) {
- // shift the remaining elements down one spot
- System.arraycopy(this.elements, i + 1, this.elements, i, --this.size - i);
- this.elements[this.size] = null;
- return element;
- }
- return null;
- }
-
- public void removeAll() {
-
- for (int i = this.size; --i >= 0;)
- this.elements[i] = null;
- this.size = 0;
- }
-
- public int size(){
-
- return this.size;
- }
-
- public String toString() {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < this.size; i++) {
- buffer.append(this.elements[i]).append("\n"); //$NON-NLS-1$
- }
- return buffer.toString();
- }
-}
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleSet.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleSet.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleSet.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.rubypeople.rdt.internal.compiler.util;
-
-/**
- * A simple lookup table is a non-synchronized Hashtable, whose keys
- * and values are Objects. It also uses linear probing to resolve collisions
- * rather than a linked list of hash table entries.
- */
-public final class SimpleSet implements Cloneable {
-
-// to avoid using Enumerations, walk the individual values skipping nulls
-public Object[] values;
-public int elementSize; // number of elements in the table
-public int threshold;
-
-public SimpleSet() {
- this(13);
-}
-
-public SimpleSet(int size) {
- if (size < 3) size = 3;
- this.elementSize = 0;
- this.threshold = size + 1; // size is the expected number of elements
- this.values = new Object[2 * size + 1];
-}
-
-public Object add(Object object) {
- int length = this.values.length;
- int index = (object.hashCode() & 0x7FFFFFFF) % length;
- Object current;
- while ((current = this.values[index]) != null) {
- if (current.equals(object)) return this.values[index] = object;
- if (++index == length) index = 0;
- }
- this.values[index] = object;
-
- // assumes the threshold is never equal to the size of the table
- if (++this.elementSize > this.threshold) rehash();
- return object;
-}
-
-public void asArray(Object[] copy) {
- if (this.elementSize != copy.length)
- throw new IllegalArgumentException();
- int index = this.elementSize;
- for (int i = 0, l = this.values.length; i < l && index > 0; i++)
- if (this.values[i] != null)
- copy[--index] = this.values[i];
-}
-
-public void clear() {
- for (int i = this.values.length; --i >= 0;)
- this.values[i] = null;
- this.elementSize = 0;
-}
-
-public Object clone() throws CloneNotSupportedException {
- SimpleSet result = (SimpleSet) super.clone();
- result.elementSize = this.elementSize;
- result.threshold = this.threshold;
-
- int length = this.values.length;
- result.values = new Object[length];
- System.arraycopy(this.values, 0, result.values, 0, length);
- return result;
-}
-
-public boolean includes(Object object) {
- int length = values.length;
- int index = (object.hashCode() & 0x7FFFFFFF) % length;
- Object current;
- while ((current = values[index]) != null) {
- if (current.equals(object)) return true;
- if (++index == length) index = 0;
- }
- return false;
-}
-
-public Object remove(Object object) {
- int length = values.length;
- int index = (object.hashCode() & 0x7FFFFFFF) % length;
- Object current;
- while ((current = values[index]) != null) {
- if (current.equals(object)) {
- elementSize--;
- Object oldValue = values[index];
- values[index] = null;
- if (values[index + 1 == length ? 0 : index + 1] != null)
- rehash(); // only needed if a possible collision existed
- return oldValue;
- }
- if (++index == length) index = 0;
- }
- return null;
-}
-
-private void rehash() {
- SimpleSet newSet = new SimpleSet(elementSize * 2); // double the number of expected elements
- Object current;
- for (int i = values.length; --i >= 0;)
- if ((current = values[i]) != null)
- newSet.add(current);
-
- this.values = newSet.values;
- this.elementSize = newSet.elementSize;
- this.threshold = newSet.threshold;
-}
-
-public String toString() {
- String s = ""; //$NON-NLS-1$
- Object object;
- for (int i = 0, l = values.length; i < l; i++)
- if ((object = values[i]) != null)
- s += object.toString() + "\n"; //$NON-NLS-1$
- return s;
-}
-}
Modified: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -4,11 +4,7 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import org.rubypeople.rdt.internal.core.util.CharOperation;
-
public class Util {
public interface Displayable {
@@ -119,92 +115,4 @@
});
}
- /**
- * Returns the contents of the given file as a char array.
- * When encoding is null, then the platform default one is used
- * @throws IOException if a problem occured reading the file.
- */
- public static char[] getFileCharContent(File file, String encoding) throws IOException {
- InputStream stream = null;
- try {
- stream = new FileInputStream(file);
- return getInputStreamAsCharArray(stream, (int) file.length(), encoding);
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- }
-
- /**
- * Returns the given input stream's contents as a character array.
- * If a length is specified (ie. if length != -1), this represents the number of bytes in the stream.
- * Note this doesn't close the stream.
- * @throws IOException if a problem occured reading the stream.
- */
- public static char[] getInputStreamAsCharArray(InputStream stream, int length, String encoding)
- throws IOException {
- InputStreamReader reader = null;
- try {
- reader = encoding == null
- ? new InputStreamReader(stream)
- : new InputStreamReader(stream, encoding);
- } catch (UnsupportedEncodingException e) {
- // encoding is not supported
- reader = new InputStreamReader(stream);
- }
- char[] contents;
- int totalRead = 0;
- if (length == -1) {
- contents = CharOperation.NO_CHAR;
- } else {
- // length is a good guess when the encoding produces less or the same amount of characters than the file length
- contents = new char[length]; // best guess
- }
-
- while (true) {
- int amountRequested;
- if (totalRead < length) {
- // until known length is met, reuse same array sized eagerly
- amountRequested = length - totalRead;
- } else {
- // reading beyond known length
- int current = reader.read();
- if (current < 0) break;
-
- amountRequested = Math.max(stream.available(), DEFAULT_READING_SIZE); // read at least 8K
-
- // resize contents if needed
- if (totalRead + 1 + amountRequested > contents.length)
- System.arraycopy(contents, 0, contents = new char[totalRead + 1 + amountRequested], 0, totalRead);
-
- // add current character
- contents[totalRead++] = (char) current; // coming from totalRead==length
- }
- // read as many chars as possible
- int amountRead = reader.read(contents, totalRead, amountRequested);
- if (amountRead < 0) break;
- totalRead += amountRead;
- }
-
- // Do not keep first character for UTF-8 BOM encoding
- int start = 0;
- if (totalRead > 0 && UTF_8.equals(encoding)) {
- if (contents[0] == 0xFEFF) { // if BOM char then skip
- totalRead--;
- start = 1;
- }
- }
-
- // resize contents if necessary
- if (totalRead < contents.length)
- System.arraycopy(contents, start, contents = new char[totalRead], 0, totalRead);
-
- return contents;
- }
-
}
Modified: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/LoadpathEntry.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/LoadpathEntry.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/LoadpathEntry.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -16,7 +16,6 @@
import org.rubypeople.rdt.core.IRubyModelStatus;
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.RubyCore;
-import org.rubypeople.rdt.internal.compiler.env.AccessRuleSet;
import org.rubypeople.rdt.internal.core.util.CharOperation;
import org.rubypeople.rdt.internal.core.util.Messages;
import org.w3c.dom.DOMException;
@@ -85,8 +84,6 @@
* The extra attributes
*/
ILoadpathAttribute[] extraAttributes;
-
- private AccessRuleSet accessRuleSet;
public LoadpathEntry(IProject project) {
this(ILoadpathEntry.CPE_PROJECT, project.getFullPath(), INCLUDE_ALL, EXCLUDE_NONE, NO_EXTRA_ATTRIBUTES, true);
@@ -627,8 +624,4 @@
public ILoadpathAttribute[] getExtraAttributes() {
return extraAttributes;
}
-
- public AccessRuleSet getAccessRuleSet() {
- return this.accessRuleSet;
- }
}
Modified: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -81,8 +81,6 @@
import org.rubypeople.rdt.internal.compiler.util.HashtableOfObjectToInt;
import org.rubypeople.rdt.internal.core.buffer.BufferManager;
import org.rubypeople.rdt.internal.core.builder.RubyBuilder;
-import org.rubypeople.rdt.internal.core.search.RubyWorkspaceScope;
-import org.rubypeople.rdt.internal.core.search.indexing.IndexManager;
import org.rubypeople.rdt.internal.core.util.Messages;
import org.rubypeople.rdt.internal.core.util.Util;
import org.rubypeople.rdt.internal.core.util.WeakHashSet;
@@ -192,13 +190,6 @@
private static boolean verbose = false;
public static boolean CP_RESOLVE_VERBOSE = false;
public static boolean ZIP_ACCESS_VERBOSE = false;
-
- public IndexManager indexManager = null;
-
- /*
- * The unique workspace scope
- */
- public RubyWorkspaceScope workspaceScope;
// Preferences
HashSet optionNames = new HashSet(20);
@@ -250,7 +241,6 @@
*/
private RubyModelManager() {
// singleton: prevent others from creating a new instance
- if (Platform.isRunning()) this.indexManager = new IndexManager();
}
/**
@@ -260,13 +250,6 @@
return MANAGER;
}
- public RubyWorkspaceScope getWorkspaceScope() {
- if (this.workspaceScope == null) {
- this.workspaceScope = new RubyWorkspaceScope();
- }
- return this.workspaceScope;
- }
-
/**
* Initialize preferences lookups for JavaCore plugin.
*/
@@ -1116,10 +1099,6 @@
workspace.removeResourceChangeListener(this.deltaState);
workspace.removeSaveParticipant(javaCore);
- if (this.indexManager != null){ // no more indexing
- this.indexManager.shutdown();
- }
-
// wait for the initialization job to finish
try {
Platform.getJobManager().join(RubyCore.PLUGIN_ID, null);
@@ -1150,13 +1129,13 @@
// clean up indexes on workspace full save
// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=52347)
- IndexManager manager = this.indexManager;
- if (manager != null
- // don't force initialization of workspace scope as we could be shutting down
- // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=93941)
- && this.workspaceScope != null) {
- manager.cleanUpIndexes();
- }
+// IndexManager manager = this.indexManager;
+// if (manager != null
+// // don't force initialization of workspace scope as we could be shutting down
+// // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=93941)
+// && this.workspaceScope != null) {
+// manager.cleanUpIndexes();
+// }
}
IProject savedProject = context.getProject();
@@ -2644,8 +2623,4 @@
}
}
- public IndexManager getIndexManager() {
- return this.indexManager;
- }
-
}
Modified: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -2208,10 +2208,10 @@
}
public ISourceFolderRoot getSourceFolderRoot(String string) {
- return getSourceFolderRoot0(RubyProject.canonicalizedPath(new Path(string)));
+ return getPackageFragmentRoot0(RubyProject.canonicalizedPath(new Path(string)));
}
- public ISourceFolderRoot getSourceFolderRoot0(IPath path) {
+ private ISourceFolderRoot getPackageFragmentRoot0(IPath path) {
return new ExternalSourceFolderRoot(path, this);
}
@@ -2431,7 +2431,7 @@
IPath path = new Path(rootPath);
RubyElement root;
if(path.isAbsolute()) {
- root = (RubyElement) getSourceFolderRoot0(path);
+ root = (RubyElement) getPackageFragmentRoot0(path);
} else
root = (RubyElement)getSourceFolderRoot(path);
if (token != null && token.charAt(0) == JEM_SOURCE_FOLDER) {
Modified: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolder.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolder.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolder.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -23,7 +23,7 @@
public class SourceFolder extends Openable implements ISourceFolder {
- public String[] names;
+ String[] names;
public SourceFolder(SourceFolderRoot parent, String[] names) {
super(parent);
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/AbstractSearchScope.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/AbstractSearchScope.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/AbstractSearchScope.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.rubypeople.rdt.internal.core.search;
-
-import org.rubypeople.rdt.core.IRubyElementDelta;
-import org.rubypeople.rdt.core.search.IRubySearchScope;
-
-public abstract class AbstractSearchScope implements IRubySearchScope {
-
-/**
- * @see IRubySearchScope#includesBinaries()
- * @deprecated
- */
-public boolean includesBinaries() {
- return true;
-}
-
-/**
- * @see IRubySearchScope#includesClasspaths()
- * @deprecated
- */
-public boolean includesClasspaths() {
- return true;
-}
-
-/* (non-Rubydoc)
- * Process the given delta and refresh its internal state if needed.
- * Returns whether the internal state was refreshed.
- */
-public abstract void processDelta(IRubyElementDelta delta);
-
-/**
- * @see IRubySearchScope#setIncludesBinaries(boolean)
- * @deprecated
- */
-public void setIncludesBinaries(boolean includesBinaries) {
- // implements interface method
-}
-
-/**
- * @see IRubySearchScope#setIncludesClasspaths(boolean)
- * @deprecated
- */
-public void setIncludesClasspaths(boolean includesClasspaths) {
- // implements interface method
-}
-
-}
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/BasicSearchEngine.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/BasicSearchEngine.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/BasicSearchEngine.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,29 +0,0 @@
-package org.rubypeople.rdt.internal.core.search;
-
-import org.rubypeople.rdt.core.search.IRubySearchScope;
-import org.rubypeople.rdt.core.search.SearchEngine;
-import org.rubypeople.rdt.core.search.SearchParticipant;
-import org.rubypeople.rdt.internal.core.RubyModelManager;
-
-public class BasicSearchEngine {
-
- public static final boolean VERBOSE = false;
-
- /**
- * @see SearchEngine#createWorkspaceScope() for detailed comment.
- */
- public static IRubySearchScope createWorkspaceScope() {
- return RubyModelManager.getRubyModelManager().getWorkspaceScope();
- }
-
- /**
- * Returns a new default Ruby search participant.
- *
- * @return a new default Ruby search participant
- * @since 3.0
- */
- public static SearchParticipant getDefaultSearchParticipant() {
- return new RubySearchParticipant();
- }
-
-}
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/IndexQueryRequestor.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/IndexQueryRequestor.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/IndexQueryRequestor.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.rubypeople.rdt.internal.core.search;
-
-import org.rubypeople.rdt.core.search.SearchParticipant;
-import org.rubypeople.rdt.core.search.SearchPattern;
-import org.rubypeople.rdt.internal.compiler.env.AccessRuleSet;
-
-/**
- * TODO add spec
- */
-public abstract class IndexQueryRequestor {
-
- // answer false if requesting cancel
- public abstract boolean acceptIndexMatch(String documentPath, SearchPattern indexRecord, SearchParticipant participant, AccessRuleSet access);
-
-}
Deleted: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/IndexSelector.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/IndexSelector.java 2007-04-12 13:55:24 UTC (rev 2299)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/IndexSelector.java 2007-04-12 19:40:45 UTC (rev 2300)
@@ -1,205 +0,0 @@
-package org.rubypeople.rdt.internal.core.search;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.rubypeople.rdt.core.ILoadpathEntry;
-import org.rubypeople.rdt.core.IRubyElement;
-import org.rubypeople.rdt.core.IRubyModel;
-import org.rubypeople.rdt.core.IRubyProject;
-import org.rubypeople.rdt.core.RubyModelException;
-import org.rubypeople.rdt.core.search.IRubySearchScope;
-import org.rubypeople.rdt.core.search.SearchPattern;
-import org.rubypeople.rdt.internal.compiler.util.SimpleSet;
-import org.rubypeople.rdt.internal.core.ExternalSourceFolderRoot;
-import org.rubypeople.rdt.internal.core.RubyModelManager;
-import org.rubypeople.rdt.internal.core.RubyProject;
-import org.rubypeople.rdt.internal.core.search.indexing.IndexManager;
-import org.rubypeople.rdt.internal.core.search.matching.MatchLocator;
-
-public class IndexSelector {
- IRubySearchScope searchScope;
- SearchPattern pattern;
- IPath[] indexLocations; // cache of the keys for looking index up
-
-public IndexSelector(
- IRubySearchScope searchScope,
- SearchPattern pattern) {
-
- this.searchScope = searchScope;
- this.pattern = pattern;
-}
-/**
- * Returns whether elements of the given project or jar can see the given focus (an IRubyProject or
- * a JarPackageFragmentRot) either because the focus is part of the project or the jar, or because it is
- * accessible throught the project's classpath
- */
-public static boolean canSeeFocus(IRubyElement focus, boolean isPolymorphicSearch, IPath projectOrJarPath) {
- try {
- ILoadpathEntry[] focusEntries = null;
- if (isPolymorphicSearch) {
- RubyProject focusProject = focus instanceof ExternalSourceFolderRoot ? (RubyProject) focus.getParent() : (RubyProject) focus;
- focusEntries = focusProject.getExpandedLoadpath(true);
- }
- IRubyModel model = focus.getRubyModel();
- IRubyProject project = getRubyProject(projectOrJarPath, model);
- if (project != null)
- return canSeeFocus(focus, (RubyProject) project, focusEntries);
-
- // projectOrJarPath is a jar
- // it can see the focus only if it is on the classpath of a project that can see the focus
- IRubyProject[] allProjects = model.getRubyProjects();
- for (int i = 0, length = allProjects.length; i < length; i++) {
- RubyProject otherProject = (RubyProject) allProjects[i];
- ILoadpathEntry[] entries = otherProject.getResolvedLoadpath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/);
- for (int j = 0, length2 = entries.length; j < length2; j++) {
- ILoadpathEntry entry = entries[j];
- if (entry.getEntryKind() == ILoadpathEntry.CPE_LIBRARY && entry.getPath().equals(projectOrJarPath))
- if (canSeeFocus(focus, otherProject, focusEntries))
- return true;
- }
- }
- return false;
- } catch (RubyModelException e) {
- return false;
- }
-}
-public static boolean canSeeFocus(IRubyElement focus, RubyProject javaProject, ILoadpathEntry[] focusEntriesForPolymorphicSearch) {
- try {
- if (focus.equals(javaProject))
- return true;
-
- if (focusEntriesForPolymorphicSearch != null) {
- // look for refering project
- IPath projectPath = javaProject.getProject().getFullPath();
- for (int i = 0, length = focusEntriesForPolymorphicSearch.length; i < length; i++) {
- ILoadpathEntry entry = focusEntriesForPolymorphicSearch[i];
- if (entry.getEntryKind() == ILoadpathEntry.CPE_PROJECT && entry.getPath().equals(projectPath))
- return true;
- }
- }
- if (focus instanceof ExternalSourceFolderRoot) {
- // focus is part of a jar
- IPath focusPath = focus.getPath();
- ILoadpathEntry[] entries = javaProject.getExpandedLoadpath(true);
- for (int i = 0, length = entries.length; i < length; i++) {
- ILoadpathEntry entry = entries[i];
- if (entry.getEntryKind() == ILoadpathEntry.CPE_LIBRARY && entry.getPath().equals(focusPath))
- return true;
- }
- return false;
- }
- // look for dependent projects
- IPath focusPath = ((RubyProject) focus).getProject().getFullPath();
- ILoadpathEntry[] entries = javaProject.getExpandedLoadpath(true);
- for (int i = 0, length = entries.length; i < length; i++) {
- ILoadpathEntry entry = entries[i];
- if (entry.getEntryKind() == ILoadpathEntry.CPE_PROJECT && entry.getPath().equals(focusPath))
- return true;
- }
- return false;
- } catch (RubyModelException e) {
- return false;
- }
-}
-/*
- * Compute the list of paths which are keying index files.
- */
-private void initializeIndexLocations() {
- IPath[] projectsAndJars = this.searchScope.enclosingProjectsAndJars();
- IndexManager manager = RubyModelManager.getRubyModelManager().getIndexManager();
- SimpleSet locations = new SimpleSet();
- IRubyElement focus = MatchLocator.projectOrJarFocus(this.pattern);
- if (focus == null) {
- for (int i = 0; i < projectsAndJars.length; i++)
- locations.add(manager.computeIndexLocation(projectsAndJars[i]));
- } else {
- try {
- // find the projects from projectsAndJars that see the focus then walk those projects looking for the jars from projectsAndJars
- int length = projectsAndJars.length;
- RubyProject[] projectsCanSeeFocus = new RubyProject[length];
- SimpleSet visitedProjects = new SimpleSet(length);
- int projectIndex = 0;
- SimpleSet jarsToCheck = new SimpleSet(length);
- ILoadpathEntry[] focusEntries = null;
- if (this.pattern != null && MatchLocator.isPolymorphicSearch(this.pattern)) { // isPolymorphicSearch
- RubyProject focusProject = focus instanceof ExternalSourceFolderRoot ? (RubyProject) focus.getParent() : (RubyProject) focus;
- focusEntries = focusProject.getExpandedLoadpath(true);
- }
- IRubyModel model = RubyModelManager.getRubyModelManager().getRubyModel();
- for (int i = 0; i < length; i++) {
- IPath path = projectsAndJars[i];
- RubyProject project = (RubyProject) getRubyProject(path, model);
- if (project != null) {
- visitedProjects.add(project);
- if (canSeeFocus(focus, project, focusEntries)) {
- locations.add(manager.computeIndexLocation(path));
- projectsCanSeeFocus[projectIndex++] = project;
- }
- } else {
- jarsToCheck.add(path);
- }
- }
- for (int i = 0; i < projectIndex && jarsToCheck.elementSize > 0; i++) {
- ILoadpathEntry[] entries = projectsCanSeeFocus[i].getResolvedLoadpath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/);
- for (int j = entries.length; --j >= 0;) {
- ILoadpathEntry entry = entries[j];
- if (entry.getEntryKind() == ILoadpathEntry.CPE_LIBRARY) {
- IPath path = entry.getPath();
- if (jarsToCheck.includes(path)) {
- locations.add(manager.computeIndexLocation(entry.getPath()));
- jarsToCheck.remove(path);
- }
- }
- }
- }
- // jar files can be included in the search scope without including one of the projects that references them, so scan all projects that have not been visited
- if (jarsToCheck.elementSize > 0) {
- IRubyProject[] allProjects = model.getRubyProjects();
- for (int i = 0, l = allProjects.length; i < l && jarsToCheck.elementSize > 0; i++) {
- RubyProject project = (RubyProject) allProjects[i];
- if (!visitedProjects.includes(project)) {
- IL...
[truncated message content] |