Mercurial > hg > blitz_stable
comparison src/org/dancres/blitz/entry/Types.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3dc0c5604566 |
---|---|
1 package org.dancres.blitz.entry; | |
2 | |
3 import java.io.IOException; | |
4 | |
5 public class Types { | |
6 /** | |
7 Despite appearances, this method doesn't ever need to be called | |
8 within a DiskTxn because it will only ever be invoked as the indirect | |
9 result of a write. A write forces loading/creation of the appropriate | |
10 EntryRepository and <B>then</B> generates an event which can wake | |
11 up the notify system or blocked match requests. | |
12 */ | |
13 public static boolean isSubtype(String aType, String aSubtype) { | |
14 | |
15 if (aType.equals(aSubtype)) | |
16 return true; | |
17 | |
18 EntryRepository myRepos = null; | |
19 | |
20 try { | |
21 myRepos = EntryRepositoryFactory.get().find(aType); | |
22 } catch (IOException anIOE) { | |
23 // We only ever operate off in-memory entry repos so we never | |
24 // hit disk which means we won't get a Dbe | |
25 } | |
26 | |
27 if (myRepos != null) { | |
28 String[] theSubtypes = myRepos.getSubtypes(); | |
29 | |
30 for (int i = 0 ; i < theSubtypes.length; i++) { | |
31 if (theSubtypes[i].equals(aSubtype)) | |
32 return true; | |
33 } | |
34 } | |
35 | |
36 return false; | |
37 } | |
38 } |