TargetFeatureComputer { public String toStringValues(FeatureVector features) { StringBuilder buf = new StringBuilder(); byte[] bytes = features.getByteValuedDiscreteFeatures(); short[] shorts = features.getShortValuedDiscreteFeatures(); float[] floats = features.getContinuousFeatures(); if (bytes.length != byteValuedDiscreteFeatureProcessors.length || shorts.length != shortValuedDiscreteFeatureProcessors.length || floats.length != continuousFeatureProcessors.length) { throw new IllegalArgumentException("Number of features in argument does not match number of feature processors"); } for (int i = 0; i < bytes.length; i++) { if (buf.length() > 0) buf.append(" "); buf.append(byteValuedDiscreteFeatureProcessors[i].getValues()[(int) bytes[i] & 0xff]); } for (int i = 0; i < shorts.length; i++) { if (buf.length() > 0) buf.append(" "); buf.append(shortValuedDiscreteFeatureProcessors[i].getValues()[(int) shorts[i]]); } for (int i = 0; i < floats.length; i++) { if (buf.length() > 0) buf.append(" "); buf.append(floats[i]); } return buf.toString(); } TargetFeatureComputer(FeatureProcessorManager manager, String featureProcessorNames); FeatureDefinition getFeatureDefinition(); FeatureVector computeFeatureVector(Target target); String toStringValues(FeatureVector features); ByteValuedFeatureProcessor[] getByteValuedFeatureProcessors(); ShortValuedFeatureProcessor[] getShortValuedFeatureProcessors(); ContinuousFeatureProcessor[] getContinuousFeatureProcessors(); String getAllFeatureProcessorNames(); String getByteValuedFeatureProcessorNames(); String getShortValuedFeatureProcessorNames(); String getContinuousFeatureProcessorNames(); String getAllFeatureProcessorNamesAndValues(); String getByteValuedFeatureProcessorNamesAndValues(); String getShortValuedFeatureProcessorNamesAndValues(); String getContinuousFeatureProcessorNamesAndValues(); String getPauseSymbol();  }
@Test public void testToStringValues() { String[] values = processor.getValues(); ByteStringTranslator translator = new ByteStringTranslator(values); for (String expected : values) { byte feature = translator.get(expected); FeatureVector vector = new FeatureVector(new byte[] { feature }, new short[] {}, new float[] {}, 0); String actual = computer.toStringValues(vector); assertEquals(expected, actual); } }