Very minor optimizations for the context covariate

This commit is contained in:
Eric Banks 2012-06-12 15:47:32 -04:00
parent 0f79adb2aa
commit 613badc835
1 changed files with 4 additions and 3 deletions

View File

@ -122,10 +122,11 @@ public class ContextCovariate implements StandardCovariate {
* @param contextSize context size to use building the context
* @return the key representing the context
*/
private Long contextWith(byte[] bases, int offset, int contextSize) {
private Long contextWith(final byte[] bases, final int offset, final int contextSize) {
Long result = null;
if (offset - contextSize + 1 >= 0) {
final byte[] context = Arrays.copyOfRange(bases, offset - contextSize + 1, offset + 1);
final int start = offset - contextSize + 1;
if (start >= 0) {
final byte[] context = Arrays.copyOfRange(bases, start, offset + 1);
if (!BaseUtils.containsBase(context, BaseUtils.N))
result = keyFromContext(context);
}