Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

CacheFilePriority.java

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 2002-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: CacheFilePriority.java,v 12.1 2005/06/16 20:22:58 bostic Exp $
00008  */
00009 
00010 package com.sleepycat.db;
00011 
00012 import com.sleepycat.db.internal.DbConstants;
00013 
00014 public final class CacheFilePriority {
00015     public static final CacheFilePriority DEFAULT =
00016         new CacheFilePriority("DEFAULT", DbConstants.DB_PRIORITY_DEFAULT);
00017     public static final CacheFilePriority HIGH =
00018         new CacheFilePriority("HIGH", DbConstants.DB_PRIORITY_HIGH);
00019     public static final CacheFilePriority LOW =
00020         new CacheFilePriority("LOW", DbConstants.DB_PRIORITY_LOW);
00021     public static final CacheFilePriority VERY_HIGH =
00022         new CacheFilePriority("VERY_HIGH", DbConstants.DB_PRIORITY_VERY_HIGH);
00023     public static final CacheFilePriority VERY_LOW =
00024         new CacheFilePriority("VERY_LOW", DbConstants.DB_PRIORITY_VERY_LOW);
00025 
00026     /* package */
00027     static CacheFilePriority fromFlag(int flag) {
00028         switch (flag) {
00029         case DbConstants.DB_PRIORITY_DEFAULT:
00030             return DEFAULT;
00031         case DbConstants.DB_PRIORITY_HIGH:
00032             return HIGH;
00033         case DbConstants.DB_PRIORITY_LOW:
00034             return LOW;
00035         case DbConstants.DB_PRIORITY_VERY_HIGH:
00036             return VERY_HIGH;
00037         case DbConstants.DB_PRIORITY_VERY_LOW:
00038             return VERY_LOW;
00039         default:
00040             throw new IllegalArgumentException(
00041                 "Unknown cache priority: " + flag);
00042         }
00043     }
00044 
00045     private final String priorityName;
00046     private final int flag;
00047 
00048     private CacheFilePriority(final String priorityName, final int flag) {
00049         this.priorityName = priorityName;
00050         this.flag = flag;
00051     }
00052 
00053     public String toString() {
00054         return "CacheFilePriority." + priorityName;
00055     }
00056 
00057     /* package */
00058     int getFlag() {
00059         return flag;
00060     }
00061 }

Generated on Sun Dec 25 12:14:32 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2