001/* 002 * This file is part of the Tuning Fork Visualization Platform 003 * (http://sourceforge.net/projects/tuningforkvp) 004 * 005 * Copyright (c) 2005 - 2008 IBM Corporation. 006 * All rights reserved. This program and the accompanying materials 007 * are made available under the terms of the Eclipse Public License v1.0 008 * which accompanies this distribution, and is available at 009 * http://www.eclipse.org/legal/epl-v10.html 010 * 011 * Contributors: 012 * IBM Corporation - initial API and implementation 013 */ 014 015package com.ibm.tuningfork.tracegen.types; 016 017/** 018 * A scalar type (e.g. the type of a field of an event). 019 */ 020public final class ScalarType { 021 022 /** 023 * The scalar type representing a Java integer. 024 */ 025 public static final ScalarType INT = new ScalarType("int", "Java int"); 026 027 /** 028 * The scalar type representing a Java long. 029 */ 030 public static final ScalarType LONG = new ScalarType("long", "Java long"); 031 032 /** 033 * The scalar type representing a Java double. 034 */ 035 public static final ScalarType DOUBLE = new ScalarType("double", "Java double"); 036 037 /** 038 * The scalar type representing a Java String. 039 */ 040 public static final ScalarType STRING = new ScalarType("string", "Java String"); 041 042 private final String name; 043 private final String description; 044 045 private ScalarType(final String name, final String description) { 046 this.name = name; 047 this.description = description; 048 } 049 050 /** 051 * Return the name of this type. 052 * 053 * @return The name of the type. 054 */ 055 public final String getName() { 056 return name; 057 } 058 059 /** 060 * Return the description of this type. 061 * 062 * @return The description of the type. 063 */ 064 public final String getDescription() { 065 return description; 066 } 067 068 /** 069 * Return a string representing this scalar type. 070 * 071 * @return The string representing this scalar type. 072 */ 073 @Override 074 public final String toString() { 075 return name; 076 } 077}