CloneSet152


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
77201.000class_body_declarations[3]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
177236
plugins/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/jdwp/JdwpCommandPacket.java
277237
plugins/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/spy/JdwpCommandPacket.java
Clone Instance
1
Line Count
77
Source Line
236
Source File
plugins/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/jdwp/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);
        }


Clone Instance
2
Line Count
77
Source Line
237
Source File
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);
        }


Clone AbstractionParameter Count: 0Parameter Bindings

/**
         * 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 Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
None