/* * [WhiteSpace.java] * * Summary: abstract base to describe Whitespace, i.e. space, NL, Start, Stop. * * Copyright: (c) 2004-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 2.0 2009-04-19 tidy comments, more accurate colour names */ package com.mindprod.jtokens; import java.awt.Color; import java.awt.Font; import static com.mindprod.jtokens.TokenFonts.MONO_FONTS; import static com.mindprod.jtokens.TokenFonts.NORMAL_FONT_SIZE_IN_POINTS; /** * abstract base to describe Whitespace, i.e. space, NL, Start, Stop. * * @author Roedy Green, Canadian Mind Products * @version 2.0 2009-04-19 tidy comments, more accurate colour names * @since 2004-04-24 */ public abstract class WhiteSpace extends Noise { /** * version number for the class */ static final long serialVersionUID = 2L; @SuppressWarnings( { "ConstantNamingConvention" } ) private static final Font font = bestFont( MONO_FONTS, Font.PLAIN, NORMAL_FONT_SIZE_IN_POINTS ); /** * Constructor, usually null * * @param text the whitespace. Will be converted to space count. */ WhiteSpace( String text ) { super( text ); } /** * @inheritDoc */ public Font getFont() { return font; } /** * @inheritDoc */ public Color getForeground() { return Color.WHITE;// will be invisible anyway. } /** * @inheritDoc */ public String getHTML() { return getText(); } /** * Can this token be collapsed with following space or with a following identical token? * * @return true if can be collapsed simply by combining text */ public boolean isCollapsible() { return false; } }