From 0f47403d0220757fed189b76e2071e25b1025cb8 Mon Sep 17 00:00:00 2001 From: Runemoro Date: Wed, 3 Jun 2020 13:39:42 -0400 Subject: Split GUI code to separate module (#242) * Split into modules * Post merge compile fixes Co-authored-by: modmuss50 --- src/main/java/cuchaz/enigma/analysis/Token.java | 72 ------------------------- 1 file changed, 72 deletions(-) delete mode 100644 src/main/java/cuchaz/enigma/analysis/Token.java (limited to 'src/main/java/cuchaz/enigma/analysis/Token.java') diff --git a/src/main/java/cuchaz/enigma/analysis/Token.java b/src/main/java/cuchaz/enigma/analysis/Token.java deleted file mode 100644 index f0155e5..0000000 --- a/src/main/java/cuchaz/enigma/analysis/Token.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Jeff Martin. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser General Public - * License v3.0 which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl.html - *

- * Contributors: - * Jeff Martin - initial API and implementation - ******************************************************************************/ - -package cuchaz.enigma.analysis; - -public class Token implements Comparable { - - public int start; - public int end; - public String text; - - public Token(int start, int end, String text) { - this.start = start; - this.end = end; - this.text = text; - } - - public int getRenameOffset(String to) { - int length = this.end - this.start; - return to.length() - length; - } - - public void rename(StringBuffer source, String to) { - int oldEnd = this.end; - this.text = to; - this.end = this.start + to.length(); - - source.replace(start, oldEnd, to); - } - - public Token move(int offset) { - Token token = new Token(this.start + offset, this.end + offset, null); - token.text = text; - return token; - } - - public boolean contains(int pos) { - return pos >= start && pos <= end; - } - - @Override - public int compareTo(Token other) { - return start - other.start; - } - - @Override - public boolean equals(Object other) { - return other instanceof Token && equals((Token) other); - } - - @Override - public int hashCode() { - return start * 37 + end; - } - - public boolean equals(Token other) { - return start == other.start && end == other.end && text.equals(other.text); - } - - @Override - public String toString() { - return String.format("[%d,%d]", start, end); - } -} -- cgit v1.2.3