/* * [NumericLiteral.java] * * Summary: Describes one numeric literal token for display. * * 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.TokenColourScheme.JAVA_FOREGROUND_FOR_NUMERIC_LITERAL; import static com.mindprod.jtokens.TokenFonts.EMPHASIS_FONT_SIZE_IN_POINTS; import static com.mindprod.jtokens.TokenFonts.MONO_FONTS; /** * Describes one numeric literal token for display. * * @author Roedy Green, Canadian Mind Products * @version 2.0 2009-04-19 tidy comments, more accurate colour names * @since 2004 */ public class NumericLiteral extends Literal { /** * Describes one numeric literal token for display. *

* version number for the class */ static final long serialVersionUID = 1L; /** * Font to render a Numeric literal */ @SuppressWarnings( { "ConstantNamingConvention" } ) private static final Font font = bestFont( MONO_FONTS, Font.PLAIN, EMPHASIS_FONT_SIZE_IN_POINTS ); /** * Construct * * @param s string representation of a numeric literal text, e.g. 1234L */ public NumericLiteral( String s ) { super( s ); } /** * Constructor * * @param c char representation of the literal. */ @SuppressWarnings( { "WeakerAccess" } ) public NumericLiteral( char c ) { super( c ); } /** * font to render this token. * * @return Font, in the correct size. */ public Font getFont() { return font; } /** * foreground colour to render this token. * * @return Color object. */ public Color getForeground() { return JAVA_FOREGROUND_FOR_NUMERIC_LITERAL; } /** * get the text surrounded by CSS html * * @return text to render this token in html */ public String getHTML() { return "" + getRawHTML() + ""; } }