@Test public void testBitFieldNames() throws Exception { Message m = new Message(null); assertEquals(0, MessageUtil.bitFieldNames(m).size()); m.addField(new Field(m)); assertEquals(1, MessageUtil.bitFieldNames(m).size()); for (int i = 0; i < 31; i++) { m.addField(new Field(m)); } assertEquals(1, MessageUtil.bitFieldNames(m).size()); m.addField(new Field(m)); List<String> bitFieldNames = MessageUtil.bitFieldNames(m); assertEquals(2, bitFieldNames.size()); assertEquals("__bitField0", bitFieldNames.get(0)); assertEquals("__bitField1", bitFieldNames.get(1)); }
public static List<String> bitFieldNames(Message message) { int fieldCount = message.getFieldCount(); if (fieldCount == 0) { return Collections.emptyList(); } List<String> result = new ArrayList<>(); int n = (fieldCount - 1) / 32 + 1; for (int i = 0; i < n; i++) { result.add("__bitField" + i); } return result; }
MessageUtil { public static List<String> bitFieldNames(Message message) { int fieldCount = message.getFieldCount(); if (fieldCount == 0) { return Collections.emptyList(); } List<String> result = new ArrayList<>(); int n = (fieldCount - 1) / 32 + 1; for (int i = 0; i < n; i++) { result.add("__bitField" + i); } return result; } }
MessageUtil { public static List<String> bitFieldNames(Message message) { int fieldCount = message.getFieldCount(); if (fieldCount == 0) { return Collections.emptyList(); } List<String> result = new ArrayList<>(); int n = (fieldCount - 1) / 32 + 1; for (int i = 0; i < n; i++) { result.add("__bitField" + i); } return result; } private  MessageUtil(); }
MessageUtil { public static List<String> bitFieldNames(Message message) { int fieldCount = message.getFieldCount(); if (fieldCount == 0) { return Collections.emptyList(); } List<String> result = new ArrayList<>(); int n = (fieldCount - 1) / 32 + 1; for (int i = 0; i < n; i++) { result.add("__bitField" + i); } return result; } private  MessageUtil(); static boolean hasFields(Message message); static List<String> bitFieldNames(Message message); static String getOneofEnumClassName(Oneof oneof); static String getOneofNotSetConstantName(Oneof oneof); static String getOneofCaseGetterName(Oneof oneof); static String getOneofCaseCleanerName(Oneof oneof); static String getOneofFieldName(Oneof oneof); static String getOneofCaseFieldName(Oneof oneof); }
MessageUtil { public static List<String> bitFieldNames(Message message) { int fieldCount = message.getFieldCount(); if (fieldCount == 0) { return Collections.emptyList(); } List<String> result = new ArrayList<>(); int n = (fieldCount - 1) / 32 + 1; for (int i = 0; i < n; i++) { result.add("__bitField" + i); } return result; } private  MessageUtil(); static boolean hasFields(Message message); static List<String> bitFieldNames(Message message); static String getOneofEnumClassName(Oneof oneof); static String getOneofNotSetConstantName(Oneof oneof); static String getOneofCaseGetterName(Oneof oneof); static String getOneofCaseCleanerName(Oneof oneof); static String getOneofFieldName(Oneof oneof); static String getOneofCaseFieldName(Oneof oneof);  }