Mercurial > hg > blitz_stable
view src/org/dancres/blitz/entry/Types.java @ 27:511648fa4d64 Version 2.1
Version to 2.1
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Mon, 04 Jan 2010 13:00:40 +0000 |
parents | 3dc0c5604566 |
children |
line wrap: on
line source
package org.dancres.blitz.entry; import java.io.IOException; public class Types { /** Despite appearances, this method doesn't ever need to be called within a DiskTxn because it will only ever be invoked as the indirect result of a write. A write forces loading/creation of the appropriate EntryRepository and <B>then</B> generates an event which can wake up the notify system or blocked match requests. */ public static boolean isSubtype(String aType, String aSubtype) { if (aType.equals(aSubtype)) return true; EntryRepository myRepos = null; try { myRepos = EntryRepositoryFactory.get().find(aType); } catch (IOException anIOE) { // We only ever operate off in-memory entry repos so we never // hit disk which means we won't get a Dbe } if (myRepos != null) { String[] theSubtypes = myRepos.getSubtypes(); for (int i = 0 ; i < theSubtypes.length; i++) { if (theSubtypes[i].equals(aSubtype)) return true; } } return false; } }