change cell label representation to class in the Java backend

Minor optimization. Provides slight speedup (~5%) for the rewrite engine. @dwightguth @andreistefanescu please review