001: /*
002: * Primitive Collections for Java.
003: * Copyright (C) 2002 S�ren Bak
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: */
019: package com.uwyn.rife.pcj.map;
020:
021: /**
022: * This class implements methods for retrieving default values for
023: * each of the primitive types. The default values are returned by
024: * the maps' <tt>get()</tt>-methods when a specified key does not
025: * map to any value.
026: *
027: * <p>Note: Later versions may provide the ability to configure
028: * the default values returned by maps.
029: *
030: * @author Søren Bak
031: * @version 1.0 2002/29/12
032: * @since 1.0
033: */
034: public class MapDefaults {
035:
036: /**
037: * Returns a default boolean value (<tt>false</tt>).
038: *
039: * @return a default boolean value (<tt>false</tt>).
040: */
041: public static boolean defaultBoolean() {
042: return false;
043: }
044:
045: /**
046: * Returns a default char value (<tt>'\0'</tt>).
047: *
048: * @return a default char value (<tt>'\0'</tt>).
049: */
050: public static char defaultChar() {
051: return '\0';
052: }
053:
054: /**
055: * Returns a default byte value (<tt>0</tt>).
056: *
057: * @return a default byte value (<tt>0</tt>).
058: */
059: public static byte defaultByte() {
060: return 0;
061: }
062:
063: /**
064: * Returns a default short value (<tt>0</tt>).
065: *
066: * @return a default short value (<tt>0</tt>).
067: */
068: public static short defaultShort() {
069: return 0;
070: }
071:
072: /**
073: * Returns a default int value (<tt>0</tt>).
074: *
075: * @return a default int value (<tt>0</tt>).
076: */
077: public static int defaultInt() {
078: return 0;
079: }
080:
081: /**
082: * Returns a default long value (<tt>0L</tt>).
083: *
084: * @return a default long value (<tt>0L</tt>).
085: */
086: public static long defaultLong() {
087: return 0;
088: }
089:
090: /**
091: * Returns a default float value (<tt>0.0f</tt>).
092: *
093: * @return a default float value (<tt>0.0f</tt>).
094: */
095: public static float defaultFloat() {
096: return 0.0f;
097: }
098:
099: /**
100: * Returns a default double value (<tt>0.0</tt>).
101: *
102: * @return a default double value (<tt>0.0</tt>).
103: */
104: public static double defaultDouble() {
105: return 0.0;
106: }
107:
108: }
|