001package Torello.JavaDoc.SyntaxHiLite;
002
003import Torello.Java.StrPrint;
004import java.io.File;
005
006
007public class HLC32 extends AbstractHashCodeHLC<Integer>
008{
009    public HLC32(String cacheSaveDirectory)
010    { super(cacheSaveDirectory, Integer.class); }
011
012    public Integer computeCacheKey(
013            final String    codeTypeParam,
014            final boolean   includeLineNumbers,
015            final byte      styleNum,
016            final String    sourceCodeAsString
017        )
018    {
019        return
020            codeTypeParam.hashCode() +
021            (includeLineNumbers ? 1 : 0) +
022            styleNum +
023            sourceCodeAsString.hashCode();
024    }
025
026
027    String getSubDirName(Integer hashCode)
028    {
029        final int absVal = (hashCode.intValue() < 0)
030            ? -hashCode.intValue()
031            : hashCode.intValue();
032
033        return
034            this.cacheSaveDirectory + 
035            StrPrint.zeroPad10e4(absVal % AbstractHashCodeHLC.NUM_DIRS) + File.separator;
036    }
037}