Mercurial > hg > blitz_condensed
view src/org/dancres/blitz/stats/OpSwitch.java @ 28:4b2f23b6feca
Add a schema compatibility check to indexer that parallels storage.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 12 Jun 2010 10:11:15 +0100 |
parents | 3dc0c5604566 |
children |
line wrap: on
line source
package org.dancres.blitz.stats; /** Controls the tracking of a particular operation type against a particular type. */ public class OpSwitch implements Switch { public static final int TAKE_OPS = 1; public static final int WRITE_OPS = 2; public static final int READ_OPS = 4; public static final String ALL_TYPES = "*"; private String theType; private int theOp; private boolean isEnabled; /** @param aType specifies a particular entry classname or the wildcard ALL_TYPES @param anOp should be an OR'd combination of TAKE_OPS, WRITE_OPS and READ_OPS */ public OpSwitch(String aType, int anOp, boolean enable) { theType = aType; theOp = anOp; isEnabled = enable; } public String getType() { return theType; } public int getOp() { return theOp; } public boolean isEnabled() { return isEnabled; } public boolean isWildcard() { return theType.equals(ALL_TYPES); } /** Equal if the switch is an OpSwitch and it has the same type and operation. */ public boolean equals(Object anObject) { if (anObject instanceof OpSwitch) { OpSwitch myOther = (OpSwitch) anObject; if (myOther.theType.equals(theType)) { return (myOther.theOp == theOp); } } return false; } }