Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Unified Diff: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/OutlineImpl.java

Issue 517043002: Re-implementation of the analysis.outline in the java layer, this uses the generated types, and rem… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase with bleeding_edge Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/OutlineImpl.java
diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/OutlineImpl.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/OutlineImpl.java
deleted file mode 100644
index 005c8c16b9fd7b5e452a9d120016a4ca518f1a40..0000000000000000000000000000000000000000
--- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/internal/OutlineImpl.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2014, the Dart project authors.
- *
- * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.dart.server.internal;
-
-import com.google.dart.server.Outline;
-import com.google.dart.server.generated.types.Element;
-import com.google.dart.server.utilities.general.ObjectUtilities;
-
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * A concrete implementation of {@link Outline}.
- *
- * @coverage dart.server
- */
-public class OutlineImpl implements Outline {
- private final Outline parent;
- private final Element element;
- private final int offset;
- private final int length;
- private Outline[] children = Outline.EMPTY_ARRAY;
-
- public OutlineImpl(Outline parent, Element element, int offset, int length) {
- this.parent = parent;
- this.element = element;
- this.offset = offset;
- this.length = length;
- }
-
- @Override
- public boolean containsInclusive(int offsetValue) {
- return offset <= offsetValue && offsetValue <= offset + length;
- }
-
- @Override
- public boolean equals(Object object) {
- if (object == this) {
- return true;
- }
- if (!(object instanceof OutlineImpl)) {
- return false;
- }
- OutlineImpl other = (OutlineImpl) object;
- if (ObjectUtilities.equals(other.parent, parent)
- && ObjectUtilities.equals(other.element, element)
- && other.children.length == children.length) {
- for (int i = 0; i < children.length; i++) {
- if (!ObjectUtilities.equals(other.children[i], children)) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
- @Override
- public Outline[] getChildren() {
- return children;
- }
-
- @Override
- public Element getElement() {
- return element;
- }
-
- @Override
- public int getLength() {
- return length;
- }
-
- @Override
- public int getOffset() {
- return offset;
- }
-
- @Override
- public Outline getParent() {
- return parent;
- }
-
- @Override
- public int hashCode() {
- int parentHashCode = parent != null ? parent.hashCode() : 0;
- return ObjectUtilities.combineHashCodes(parentHashCode, element.getName().hashCode());
- }
-
- public void setChildren(Outline[] children) {
- this.children = children;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("[element=");
- builder.append(element.toString());
- builder.append(", children=[");
- builder.append(StringUtils.join(children, ", "));
- builder.append("]]");
- return builder.toString();
- }
-}

Powered by Google App Engine
This is Rietveld 408576698