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

Unified Diff: editor/tools/plugins/com.xored.glance.ui/src/com/xored/glance/ui/sources/Match.java

Issue 17431004: New UI for Find command: find-as-you-type. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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.xored.glance.ui/src/com/xored/glance/ui/sources/Match.java
===================================================================
--- editor/tools/plugins/com.xored.glance.ui/src/com/xored/glance/ui/sources/Match.java (revision 0)
+++ editor/tools/plugins/com.xored.glance.ui/src/com/xored/glance/ui/sources/Match.java (revision 0)
@@ -0,0 +1,84 @@
+/**
+ *
+ */
+package com.xored.glance.ui.sources;
+
+/**
+ * @author Yuri Strot
+ */
+public class Match implements Comparable<Match> {
+
+ public static final Match[] EMPTY = new Match[0];
+
+ public Match(ITextBlock block, int offset, int length) {
+ this.block = block;
+ this.offset = offset;
+ this.length = length;
+ }
+
+ /**
+ * @return the block
+ */
+ public ITextBlock getBlock() {
+ return block;
+ }
+
+ /**
+ * @return the offset
+ */
+ public int getOffset() {
+ return offset;
+ }
+
+ /**
+ * @return the length
+ */
+ public int getLength() {
+ return length;
+ }
+
+ public int compareTo(Match match) {
+ if (block != null && match.block != null) {
+ int diff = block.compareTo(match.block);
+ if (diff != 0)
+ return diff;
+ }
+ return offset - match.offset;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((block == null) ? 0 : block.hashCode());
+ result = prime * result + length;
+ result = prime * result + offset;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Match other = (Match) obj;
+ if (block == null) {
+ if (other.block != null)
+ return false;
+ } else if (!block.equals(other.block))
+ return false;
+ if (length != other.length)
+ return false;
+ if (offset != other.offset)
+ return false;
+ return true;
+ }
+
+ private ITextBlock block;
+ private int offset;
+ private int length;
+
+}

Powered by Google App Engine
This is Rietveld 408576698