extensions/net.sf.basedb.varsearch/trunk/src/net/sf/basedb/varsearch/analyze/HgvsCdnaTokenizer.java

Code
Comments
Other
Rev Date Author Line
6122 08 Feb 21 nicklas 1 package net.sf.basedb.varsearch.analyze;
6122 08 Feb 21 nicklas 2
6122 08 Feb 21 nicklas 3 import org.apache.lucene.analysis.util.CharTokenizer;
6122 08 Feb 21 nicklas 4
6122 08 Feb 21 nicklas 5 /**
6122 08 Feb 21 nicklas 6   Tokenizer implementation specialized for HGVS.c values.
6122 08 Feb 21 nicklas 7   It will remove the prefix 'c.' and keep the rest of the 
6122 08 Feb 21 nicklas 8   value. The implementation is list-aware and will also
6122 08 Feb 21 nicklas 9   split on comma and space. Values that start with '*' 
6122 08 Feb 21 nicklas 10   also require special attantion since '*' is not allowed 
6122 08 Feb 21 nicklas 11   (unless escaped) as the first character in a query.
6122 08 Feb 21 nicklas 12   
6122 08 Feb 21 nicklas 13   @author nicklas
6122 08 Feb 21 nicklas 14 */
6122 08 Feb 21 nicklas 15 public class HgvsCdnaTokenizer
6122 08 Feb 21 nicklas 16   extends CharTokenizer
6122 08 Feb 21 nicklas 17 {
6122 08 Feb 21 nicklas 18
6122 08 Feb 21 nicklas 19   public HgvsCdnaTokenizer() 
6122 08 Feb 21 nicklas 20   {}
6122 08 Feb 21 nicklas 21   
6122 08 Feb 21 nicklas 22   @Override
6122 08 Feb 21 nicklas 23   protected boolean isTokenChar(int c) 
6122 08 Feb 21 nicklas 24   {
6122 08 Feb 21 nicklas 25     return c != 'c' && c != '.' && c != ',' && c != ' ' && c != '*';
6122 08 Feb 21 nicklas 26   }
6122 08 Feb 21 nicklas 27   
6122 08 Feb 21 nicklas 28 }