styles[COMMENT_EOL] = new Style(comment, null, commentFont); styles[COMMENT_MULTILINE] = new Style(comment, null, commentFont); styles[COMMENT_DOCUMENTATION] = new Style(docComment, null, commentFont); styles[COMMENT_KEYWORD] = new Style(new Color(255,152,0), null, commentFont); styles[COMMENT_MARKUP] = new Style(Color.gray, null, commentFont); styles[RESERVED_WORD] = new Style(keyword, null, keywordFont); styles[RESERVED_WORD_2] = new Style(keyword, null, keywordFont); styles[FUNCTION] = new Style(function); styles[LITERAL_BOOLEAN] = new Style(literalNumber); styles[LITERAL_NUMBER_DECIMAL_INT] = new Style(literalNumber); styles[LITERAL_NUMBER_FLOAT] = new Style(literalNumber); styles[LITERAL_NUMBER_HEXADECIMAL] = new Style(literalNumber); styles[LITERAL_STRING_DOUBLE_QUOTE] = new Style(literalString); styles[LITERAL_CHAR] = new Style(literalString); styles[LITERAL_BACKQUOTE] = new Style(literalString); styles[DATA_TYPE] = new Style(dataType, null, keywordFont); styles[VARIABLE] = new Style(variable); styles[REGEX] = new Style(regex); styles[ANNOTATION] = new Style(Color.gray); styles[IDENTIFIER] = new Style(null); styles[WHITESPACE] = new Style(Color.gray); styles[SEPARATOR] = new Style(Color.RED); styles[OPERATOR] = new Style(operator); styles[PREPROCESSOR] = new Style(preprocessor); styles[MARKUP_TAG_DELIMITER] = new Style(Color.RED); styles[MARKUP_TAG_NAME] = new Style(Color.BLUE); styles[MARKUP_TAG_ATTRIBUTE] = new Style(new Color(63,127,127)); styles[MARKUP_TAG_ATTRIBUTE_VALUE]= new Style(literalString); styles[MARKUP_COMMENT] = new Style(markupComment, null, commentFont);
/** * Returns a deep copy of this color scheme. * * @return The copy. */ @Override public Object clone() { SyntaxScheme shcs = null; try { shcs = (SyntaxScheme)super.clone(); } catch (CloneNotSupportedException cnse) { // Never happens cnse.printStackTrace(); return null; } shcs.styles = new Style[styles.length]; for (int i=0; i<styles.length; i++) { Style s = styles[i]; if (s!=null) { shcs.styles[i] = (Style)s.clone(); } } return shcs; }
/** * Returns whether or not two syntax schemes are equal. * * @param o2 The object with which to compare this syntax scheme. * @return Whether or not these two syntax schemes represent the same * scheme. */ @Override public boolean equals(Object o2) { if (o2 instanceof Style) { Style ss2 = (Style)o2; if (this.underline==ss2.underline && areEqual(foreground, ss2.foreground) && areEqual(background, ss2.background) && areEqual(font, ss2.font) && areEqual(fontMetrics, ss2.fontMetrics)) { return true; } } return false; }
/** * This is implemented to be consistent with {@link #equals(Object)}. * This is a requirement to keep FindBugs happy. * * @return The hash code for this object. */ @Override public int hashCode() { // Keep me fast. Iterating over *all* syntax schemes contained is // probably much slower than a "bad" hash code here. int hashCode = 0; int count = styles.length; for (int i=0; i<count; i++) { if (styles[i]!=null) { hashCode ^= styles[i].hashCode(); break; } } return hashCode; }
/** * Tests whether this color scheme is the same as another color scheme. * * @param otherScheme The color scheme to compare to. * @return <code>true</code> if this color scheme and * <code>otherScheme</code> are the same scheme; * <code>false</code> otherwise. */ @Override public boolean equals(Object otherScheme) { // No need for null check; instanceof takes care of this for us, // i.e. "if (!(null instanceof Foo))" evaluates to "true". if (!(otherScheme instanceof SyntaxScheme)) { return false; } Style[] otherSchemes = ((SyntaxScheme)otherScheme).styles; int length = styles.length; for (int i=0; i<length; i++) { if (styles[i]==null) { if (otherSchemes[i]!=null) { return false; } } else if (!styles[i].equals(otherSchemes[i])) { return false; } } return true; }
/** * This is implemented to be consistent with {@link #equals(Object)}. * This is a requirement to keep FindBugs happy. * * @return The hash code for this object. */ @Override public int hashCode() { // Keep me fast. Iterating over *all* syntax schemes contained is // probably much slower than a "bad" hash code here. int hashCode = 0; int count = styles.length; for (int i=0; i<count; i++) { if (styles[i]!=null) { hashCode ^= styles[i].hashCode(); break; } } return hashCode; }
/** * Tests whether this color scheme is the same as another color scheme. * * @param otherScheme The color scheme to compare to. * @return <code>true</code> if this color scheme and * <code>otherScheme</code> are the same scheme; * <code>false</code> otherwise. */ @Override public boolean equals(Object otherScheme) { // No need for null check; instanceof takes care of this for us, // i.e. "if (!(null instanceof Foo))" evaluates to "true". if (!(otherScheme instanceof SyntaxScheme)) { return false; } Style[] otherSchemes = ((SyntaxScheme)otherScheme).styles; int length = styles.length; for (int i=0; i<length; i++) { if (styles[i]==null) { if (otherSchemes[i]!=null) { return false; } } else if (!styles[i].equals(otherSchemes[i])) { return false; } } return true; }
Integer.parseInt(tokens[pos+6])); // size scheme.styles[i] = new Style(fg, bg, font, underline);
/** * Returns a deep copy of this color scheme. * * @return The copy. */ @Override public Object clone() { SyntaxScheme shcs = null; try { shcs = (SyntaxScheme)super.clone(); } catch (CloneNotSupportedException cnse) { // Never happens cnse.printStackTrace(); return null; } shcs.styles = new Style[styles.length]; for (int i=0; i<styles.length; i++) { Style s = styles[i]; if (s!=null) { shcs.styles[i] = (Style)s.clone(); } } return shcs; }
/** * This is implemented to be consistent with {@link #equals(Object)}. * This is a requirement to keep FindBugs happy. * * @return The hash code for this object. */ public int hashCode() { // Keep me fast. Iterating over *all* syntax schemes contained is // probably much slower than a "bad" hash code here. int hashCode = 0; int count = styles.length; for (int i=0; i<count; i++) { if (styles[i]!=null) { hashCode = styles[i].hashCode(); break; } } return hashCode; }
/** * Returns whether or not two syntax schemes are equal. * * @param o2 The object with which to compare this syntax scheme. * @return Whether or not these two syntax schemes represent the same * scheme. */ public boolean equals(Object o2) { if (o2 instanceof Style) { Style ss2 = (Style)o2; if (this.underline==ss2.underline && areEqual(foreground, ss2.foreground) && areEqual(background, ss2.background) && areEqual(font, ss2.font) && areEqual(fontMetrics, ss2.fontMetrics)) return true; } return false; }
/** * Tests whether this color scheme is the same as another color scheme. * * @param otherScheme The color scheme to compare to. * @return <code>true</code> if this color scheme and * <code>otherScheme</code> are the same scheme; * <code>false</code> otherwise. */ public boolean equals(Object otherScheme) { // No need for null check; instanceof takes care of this for us, // i.e. "if (!(null instanceof Foo))" evaluates to "true". if (!(otherScheme instanceof SyntaxScheme)) { return false; } Style[] otherSchemes = ((SyntaxScheme)otherScheme).styles; int length = styles.length; for (int i=0; i<length; i++) { if (styles[i]==null) { if (otherSchemes[i]!=null) { return false; } } else if (!styles[i].equals(otherSchemes[i])) { return false; } } return true; }
styles[Token.COMMENT_EOL] = new Style(comment, null, commentFont); styles[Token.COMMENT_MULTILINE] = new Style(comment, null, commentFont); styles[Token.COMMENT_DOCUMENTATION] = new Style(docComment, null, commentFont); styles[Token.RESERVED_WORD] = new Style(keyword, null, keywordFont); styles[Token.FUNCTION] = new Style(function, null); styles[Token.LITERAL_BOOLEAN] = new Style(literalNumber, null); styles[Token.LITERAL_NUMBER_DECIMAL_INT] = new Style(literalNumber, null); styles[Token.LITERAL_NUMBER_FLOAT] = new Style(literalNumber, null); styles[Token.LITERAL_NUMBER_HEXADECIMAL] = new Style(literalNumber, null); styles[Token.LITERAL_STRING_DOUBLE_QUOTE] = new Style(literalString, null); styles[Token.LITERAL_CHAR] = new Style(literalString, null); styles[Token.LITERAL_BACKQUOTE] = new Style(literalString, null); styles[Token.DATA_TYPE] = new Style(new Color(0,128,128), null); styles[Token.VARIABLE] = new Style(new Color(255,153,0), null); styles[Token.IDENTIFIER] = new Style(null, null); styles[Token.WHITESPACE] = new Style(null, null); styles[Token.SEPARATOR] = new Style(Color.RED, null); styles[Token.OPERATOR] = new Style(new Color(128,64,64), null); styles[Token.PREPROCESSOR] = new Style(new Color(128,128,128), null); styles[Token.ERROR_IDENTIFIER] = new Style(error, null); styles[Token.ERROR_NUMBER_FORMAT] = new Style(error, null); styles[Token.ERROR_STRING_DOUBLE] = new Style(error, null); styles[Token.ERROR_CHAR] = new Style(error, null);
/** * Returns a deep copy of this color scheme. * * @return The copy. */ public Object clone() { SyntaxScheme shcs = null; try { shcs = (SyntaxScheme)super.clone(); } catch (CloneNotSupportedException cnse) { // Never happens cnse.printStackTrace(); return null; } shcs.styles = new Style[Token.NUM_TOKEN_TYPES]; for (int i=0; i<Token.NUM_TOKEN_TYPES; i++) { Style s = styles[i]; if (s!=null) { shcs.styles[i] = (Style)s.clone(); } } return shcs; }
/** * This is implemented to be consistent with {@link #equals(Object)}. * This is a requirement to keep FindBugs happy. * * @return The hash code for this object. */ public int hashCode() { // Keep me fast. Iterating over *all* syntax schemes contained is // probably much slower than a "bad" hash code here. int hashCode = 0; int count = styles.length; for (int i=0; i<count; i++) { if (styles[i]!=null) { hashCode ^= styles[i].hashCode(); break; } } return hashCode; }
/** * Returns whether or not two syntax schemes are equal. * * @param o2 The object with which to compare this syntax scheme. * @return Whether or not these two syntax schemes represent the same * scheme. */ @Override public boolean equals(Object o2) { if (o2 instanceof Style) { Style ss2 = (Style)o2; if (this.underline==ss2.underline && areEqual(foreground, ss2.foreground) && areEqual(background, ss2.background) && areEqual(font, ss2.font) && areEqual(fontMetrics, ss2.fontMetrics)) { return true; } } return false; }
/** * Tests whether this color scheme is the same as another color scheme. * * @param otherScheme The color scheme to compare to. * @return <code>true</code> if this color scheme and * <code>otherScheme</code> are the same scheme; * <code>false</code> otherwise. */ public boolean equals(Object otherScheme) { // No need for null check; instanceof takes care of this for us, // i.e. "if (!(null instanceof Foo))" evaluates to "true". if (!(otherScheme instanceof SyntaxScheme)) { return false; } Style[] otherSchemes = ((SyntaxScheme)otherScheme).styles; int length = styles.length; for (int i=0; i<length; i++) { if (styles[i]==null) { if (otherSchemes[i]!=null) { return false; } } else if (!styles[i].equals(otherSchemes[i])) { return false; } } return true; }
styles[Token.COMMENT_EOL] = new Style(comment, null, commentFont); styles[Token.COMMENT_MULTILINE] = new Style(comment, null, commentFont); styles[Token.COMMENT_DOCUMENTATION] = new Style(docComment, null, commentFont); styles[Token.RESERVED_WORD] = new Style(keyword, null, keywordFont); styles[Token.FUNCTION] = new Style(function, null); styles[Token.LITERAL_BOOLEAN] = new Style(literalNumber, null); styles[Token.LITERAL_NUMBER_DECIMAL_INT] = new Style(literalNumber, null); styles[Token.LITERAL_NUMBER_FLOAT] = new Style(literalNumber, null); styles[Token.LITERAL_NUMBER_HEXADECIMAL] = new Style(literalNumber, null); styles[Token.LITERAL_STRING_DOUBLE_QUOTE] = new Style(literalString, null); styles[Token.LITERAL_CHAR] = new Style(literalString, null); styles[Token.LITERAL_BACKQUOTE] = new Style(literalString, null); styles[Token.DATA_TYPE] = new Style(new Color(0,128,128), null); styles[Token.VARIABLE] = new Style(new Color(255,153,0), null); styles[Token.IDENTIFIER] = new Style(null, null); styles[Token.WHITESPACE] = new Style(Color.gray, null); styles[Token.SEPARATOR] = new Style(Color.RED, null); styles[Token.OPERATOR] = new Style(new Color(128,64,64), null); styles[Token.PREPROCESSOR] = new Style(new Color(128,128,128), null); styles[Token.MARKUP_TAG_DELIMITER] = new Style(Color.RED, null); styles[Token.MARKUP_TAG_NAME] = new Style(Color.BLUE, null); styles[Token.MARKUP_TAG_ATTRIBUTE] = new Style(new Color(63,127,127), null); styles[Token.ERROR_IDENTIFIER] = new Style(error, null); styles[Token.ERROR_NUMBER_FORMAT] = new Style(error, null); styles[Token.ERROR_STRING_DOUBLE] = new Style(error, null); styles[Token.ERROR_CHAR] = new Style(error, null);
/** * Returns a deep copy of this color scheme. * * @return The copy. */ public Object clone() { SyntaxScheme shcs = null; try { shcs = (SyntaxScheme)super.clone(); } catch (CloneNotSupportedException cnse) { // Never happens cnse.printStackTrace(); return null; } shcs.styles = new Style[Token.NUM_TOKEN_TYPES]; for (int i=0; i<Token.NUM_TOKEN_TYPES; i++) { Style s = styles[i]; if (s!=null) { shcs.styles[i] = (Style)s.clone(); } } return shcs; }
/** * Returns whether or not two syntax schemes are equal. * * @param o2 The object with which to compare this syntax scheme. * @return Whether or not these two syntax schemes represent the same * scheme. */ public boolean equals(Object o2) { if (o2!=null && o2 instanceof Style) { Style ss2 = (Style)o2; if (this.underline==ss2.underline && areEqual(foreground, ss2.foreground) && areEqual(background, ss2.background) && areEqual(font, ss2.font) && areEqual(fontMetrics, ss2.fontMetrics)) return true; } return false; }