Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
77 | 2 | 0 | 1.000 | class_body_declarations[3] |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 77 | 236 | plugins/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/jdwp/JdwpCommandPacket.java |
2 | 77 | 237 | plugins/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/spy/JdwpCommandPacket.java |
| ||||
/** * Retrieves constant mappings. */ public static void getConstantMaps() { if (fgCommandMap != null) { return; } Field[] fields = JdwpCommandPacket.class .getDeclaredFields(); // First get the set names. Map setNames = new HashMap(fields.length); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; if ((field.getModifiers()& Modifier.PUBLIC) == 0 || (field.getModifiers()& Modifier.STATIC) == 0 || (field.getModifiers()& Modifier.FINAL) == 0) continue ; try { String name = field.getName(); // If it is not a set, continue. if ( !name.startsWith("CSET_")) { //$NON-NLS-1$ continue ; } int value = field.getInt(null); setNames.put(new Integer(value), removePrefix(name)); } catch (IllegalAccessException e) { // Will not occur for own class. } catch (IllegalArgumentException e) { // Should not occur. // We should take care that all public static final constants // in this class are numbers that are convertible to int. } } // Get the commands. fgCommandMap = new HashMap(); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; if ((field.getModifiers()& Modifier.PUBLIC) == 0 || (field.getModifiers()& Modifier.STATIC) == 0 || (field.getModifiers()& Modifier.FINAL) == 0) { continue ; } try { String name = field.getName(); // If it is a set, continue. if (name.startsWith("CSET_")) { //$NON-NLS-1$ continue ; } Integer val = (Integer) field.get(null); int value = val.intValue(); int set = value >>> 8; String setName = (String) setNames.get(new Integer(set)); String entryName = setName + " - " + removePrefix(name); //$NON-NLS-1$ fgCommandMap.put(val, entryName); } catch (IllegalAccessException e) { // Will not occur for own class. } } } /** * @return Returns a map with string representations of error codes. */ public static Map commandMap() { getConstantMaps(); return fgCommandMap; } /** * @return Returns string without XXX_ prefix. */ public static String removePrefix(String str) { int i = str.indexOf('_'); if (i < 0) { return str; } return str.substring(i + 1); } |
| ||||
/** * Retrieves constant mappings. */ public static void getConstantMaps() { if (fgCommandMap != null) { return; } Field[] fields = JdwpCommandPacket.class .getDeclaredFields(); // First get the set names. Map setNames = new HashMap(fields.length); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; if ((field.getModifiers()& Modifier.PUBLIC) == 0 || (field.getModifiers()& Modifier.STATIC) == 0 || (field.getModifiers()& Modifier.FINAL) == 0) continue ; try { String name = field.getName(); // If it is not a set, continue. if ( !name.startsWith("CSET_")) { //$NON-NLS-1$ continue ; } int value = field.getInt(null); setNames.put(new Integer(value), removePrefix(name)); } catch (IllegalAccessException e) { // Will not occur for own class. } catch (IllegalArgumentException e) { // Should not occur. // We should take care that all public static final constants // in this class are numbers that are convertible to int. } } // Get the commands. fgCommandMap = new HashMap(); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; if ((field.getModifiers()& Modifier.PUBLIC) == 0 || (field.getModifiers()& Modifier.STATIC) == 0 || (field.getModifiers()& Modifier.FINAL) == 0) { continue ; } try { String name = field.getName(); // If it is a set, continue. if (name.startsWith("CSET_")) { //$NON-NLS-1$ continue ; } Integer val = (Integer) field.get(null); int value = val.intValue(); int set = value >>> 8; String setName = (String) setNames.get(new Integer(set)); String entryName = setName + " - " + removePrefix(name); //$NON-NLS-1$ fgCommandMap.put(val, entryName); } catch (IllegalAccessException e) { // Will not occur for own class. } } } /** * @return Returns a map with string representations of error codes. */ public static Map commandMap() { getConstantMaps(); return fgCommandMap; } /** * @return Returns string without XXX_ prefix. */ public static String removePrefix(String str) { int i = str.indexOf('_'); if (i < 0) { return str; } return str.substring(i + 1); } |
| |||
/** * Retrieves constant mappings. */ public static void getConstantMaps() { if (fgCommandMap != null) { return; } Field[] fields = JdwpCommandPacket.class .getDeclaredFields(); // First get the set names. Map setNames = new HashMap(fields.length); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; if ((field.getModifiers()&Modifier.PUBLIC) == 0 || (field.getModifiers()&Modifier.STATIC) == 0 || (field.getModifiers()&Modifier.FINAL) == 0) continue ; try { String name = field.getName(); // If it is not a set, continue. if ( !name.startsWith("CSET_")) { //$NON-NLS-1$ continue ; } int value = field.getInt(null); setNames.put(new Integer(value), removePrefix(name)); } catch (IllegalAccessException e) { // Will not occur for own class. } catch (IllegalArgumentException e) { // Should not occur. // We should take care that all public static final constants // in this class are numbers that are convertible to int. } } // Get the commands. fgCommandMap = new HashMap(); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; if ((field.getModifiers()&Modifier.PUBLIC) == 0 || (field.getModifiers()&Modifier.STATIC) == 0 || (field.getModifiers()&Modifier.FINAL) == 0) { continue ; } try { String name = field.getName(); // If it is a set, continue. if (name.startsWith("CSET_")) { //$NON-NLS-1$ continue ; } Integer val = (Integer) field.get(null); int value = val.intValue(); int set = value >>> 8; String setName = (String) setNames.get(new Integer(set)); String entryName = setName + " - " + removePrefix(name); //$NON-NLS-1$ fgCommandMap.put(val, entryName); } catch (IllegalAccessException e) { // Will not occur for own class. } } } /** * @return Returns a map with string representations of error codes. */ public static Map commandMap() { getConstantMaps(); return fgCommandMap; } /** * @return Returns string without XXX_ prefix. */ public static String removePrefix(String str) { int i = str.indexOf('_'); if (i < 0) { return str; } return str.substring(i + 1); } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
None |