1069-1-2

int getLengthFacet(EDataType eDataType) { return getExtendedMetaData(eDataType).getLengthFacet(); } protected int basicGetLengthFacet(EDataType eDataType) { EAnnotation eAnnotation = getAnnotation(eDataType, false); if (eAnnotation != null) { String lengthLiteral = eAnnotation.getDetails().get("length"); if (lengthLiteral != null) { return Integer.parseInt(lengthLiteral); } } return -1; } public void setLengthFacet(EDataType eDataType, int length) { if (length == -1) { EAnnotation eAnnotation = getAnnotation(eDataType, false); if (eAnnotation != null) { eAnnotation.getDetails().remove("length"); } } else { EAnnotation eAnnotation = getAnnotation(eDataType, true); eAnnotation.getDetails().put("length", Integer.toString(length)); } getExtendedMetaData(eDataType).setLengthFacet(length); } public int getMinLengthFacet(EDataType eDataType) { return getExtendedMetaData(eDataType).getMinLengthFacet(); } protected int basicGetMinLengthFacet(EDataType eDataType) { EAnnotation eAnnotation = getAnnotation(eDataType, false); if (eAnnotation != null) { String minLengthLiteral = eAnnotation.getDetails().get("minLength"); if (minLengthLiteral != null) { return Integer.parseInt(minLengthLiteral); } } return -1; } public void setMinLengthFacet(EDataType eDataType, int length) { if (length == -1) { EAnnotation eAnnotation = getAnnotation(eDataType, false); if (eAnnotation != null) { eAnnotation.getDetails().remove("minLength"); } } else { EAnnotation eAnnotation = getAnnotation(eDataType, true); eAnnotation.getDetails().put("minLength", Integer.toString(length)); } getExtendedMetaData(eDataType).setMinLengthFacet(length); }
int getMinLengthFacet(EDataType eDataType) { return getExtendedMetaData(eDataType).getMinLengthFacet(); } protected int basicGetMinLengthFacet(EDataType eDataType) { EAnnotation eAnnotation = getAnnotation(eDataType, false); if (eAnnotation != null) { String minLengthLiteral = eAnnotation.getDetails().get("minLength"); if (minLengthLiteral != null) { return Integer.parseInt(minLengthLiteral); } } return -1; } public void setMinLengthFacet(EDataType eDataType, int length) { if (length == -1) { EAnnotation eAnnotation = getAnnotation(eDataType, false); if (eAnnotation != null) { eAnnotation.getDetails().remove("minLength"); } } else { EAnnotation eAnnotation = getAnnotation(eDataType, true); eAnnotation.getDetails().put("minLength", Integer.toString(length)); } getExtendedMetaData(eDataType).setMinLengthFacet(length); } public int getMaxLengthFacet(EDataType eDataType) { return getExtendedMetaData(eDataType).getMaxLengthFacet(); } protected int basicGetMaxLengthFacet(EDataType eDataType) { EAnnotation eAnnotation = getAnnotation(eDataType, false); if (eAnnotation != null) { String maxLengthLiteral = eAnnotation.getDetails().get("maxLength"); if (maxLengthLiteral != null) { return Integer.parseInt(maxLengthLiteral); } } return -1; } public void setMaxLengthFacet(EDataType eDataType, int length) { if (length == -1) { EAnnotation eAnnotation = getAnnotation(eDataType, false); if (eAnnotation != null) { eAnnotation.getDetails().remove("maxLength"); } } else { EAnnotation eAnnotation = getAnnotation(eDataType, true); eAnnotation.getDetails().put("maxLength", Integer.toString(length)); } getExtendedMetaData(eDataType).setMaxLengthFacet(length); }

Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java |  | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java
Method name: `` |  | Method name: ``
Number of AST nodes: 0 |  | Number of AST nodes: 0

1

    int getLengthFacet(EDataType eDataType)↵

1

    int getMinLengthFacet(EDataType eDataType)↵

2

      {↵

2

      {↵

3

        return getExtendedMetaData(eDataType).getLengthFacet();↵

3

        return getExtendedMetaData(eDataType).getMinLengthFacet();↵

4

      }↵

4

      }↵

5

      protected int basicGetLengthFacet(EDataType eDataType)↵

5

      protected int basicGetMinLengthFacet(EDataType eDataType)↵

6

      {↵

6

      {↵

7

        EAnnotation eAnnotation = getAnnotation(eDataType, false);↵

7

        EAnnotation eAnnotation = getAnnotation(eDataType, false);↵

8

        if (eAnnotation != null)↵

8

        if (eAnnotation != null)↵

9

        {↵

9

        {↵

10

          String lengthLiteral = eAnnotation.getDetails().get("length");↵

10

          String minLengthLiteral = eAnnotation.getDetails().get("minLength");↵

11

          if (lengthLiteral != null)↵

11

          if (minLengthLiteral != null)↵

12

          {↵

12

          {↵

13

            return Integer.parseInt(lengthLiteral);↵

13

            return Integer.parseInt(minLengthLiteral);↵

14

          }↵

14

          }↵

15

        }↵

15

        }↵

16

        return -1;↵

16

        return -1;↵

17

      }↵

17

      }↵

18

      public void setLengthFacet(EDataType eDataType, int length)↵

18

      public void setMinLengthFacet(EDataType eDataType, int length)↵

19

      {↵

19

      {↵

20

        if (length == -1)↵

20

        if (length == -1)↵

21

        {↵

21

        {↵

22

          EAnnotation eAnnotation = getAnnotation(eDataType, false);↵

22

          EAnnotation eAnnotation = getAnnotation(eDataType, false);↵

23

          if (eAnnotation != null)↵

23

          if (eAnnotation != null)↵

24

          {↵

24

          {↵

25

            eAnnotation.getDetails().remove("length");↵

25

            eAnnotation.getDetails().remove("minLength");↵

26

          }↵

26

          }↵

27

        }↵

27

        }↵

28

        else↵

28

        else↵

29

        {↵

29

        {↵

30

          EAnnotation eAnnotation = getAnnotation(eDataType, true);↵

30

          EAnnotation eAnnotation = getAnnotation(eDataType, true);↵

31

          eAnnotation.getDetails().put("length", Integer.toString(length));↵

31

          eAnnotation.getDetails().put("minLength", Integer.toString(length));↵

32

        } ↵

32

        } ↵

33

        getExtendedMetaData(eDataType).setLengthFacet(length);↵

33

        getExtendedMetaData(eDataType).setMinLengthFacet(length);↵

34

      }↵

34

      }↵

35

      public int getMinLengthFacet(EDataType eDataType)↵

35

      public int getMaxLengthFacet(EDataType eDataType)↵

36

      {↵

36

      {↵

37

        return getExtendedMetaData(eDataType).getMinLengthFacet();↵

37

        return getExtendedMetaData(eDataType).getMaxLengthFacet();↵

38

      }↵

38

      }↵

39

      protected int basicGetMinLengthFacet(EDataType eDataType)↵

39

      protected int basicGetMaxLengthFacet(EDataType eDataType)↵

40

      {↵

40

      {↵

41

        EAnnotation eAnnotation = getAnnotation(eDataType, false);↵

41

        EAnnotation eAnnotation = getAnnotation(eDataType, false);↵

42

        if (eAnnotation != null)↵

42

        if (eAnnotation != null)↵

43

        {↵

43

        {↵

44

          String minLengthLiteral = eAnnotation.getDetails().get("minLength");↵

44

          String maxLengthLiteral = eAnnotation.getDetails().get("maxLength");↵

45

          if (minLengthLiteral != null)↵

45

          if (maxLengthLiteral != null)↵

46

          {↵

46

          {↵

47

            return Integer.parseInt(minLengthLiteral);↵

47

            return Integer.parseInt(maxLengthLiteral);↵

48

          }↵

48

          }↵

49

        }↵

49

        }↵

50

        return -1;↵

50

        return -1;↵

51

      }↵

51

      }↵

52

      public void setMinLengthFacet(EDataType eDataType, int length)↵

52

      public void setMaxLengthFacet(EDataType eDataType, int length)↵

53

      {↵

53

      {↵

54

        if (length == -1)↵

54

        if (length == -1)↵

55

        {↵

55

        {↵

56

          EAnnotation eAnnotation = getAnnotation(eDataType, false);↵

56

          EAnnotation eAnnotation = getAnnotation(eDataType, false);↵

57

          if (eAnnotation != null)↵

57

          if (eAnnotation != null)↵

58

          {↵

58

          {↵

59

            eAnnotation.getDetails().remove("minLength");↵

59

            eAnnotation.getDetails().remove("maxLength");↵

60

          }↵

60

          }↵

61

        }↵

61

        }↵

62

        else↵

62

        else↵

63

        {↵

63

        {↵

64

          EAnnotation eAnnotation = getAnnotation(eDataType, true);↵

64

          EAnnotation eAnnotation = getAnnotation(eDataType, true);↵

65

          eAnnotation.getDetails().put("minLength", Integer.toString(length));↵

65

          eAnnotation.getDetails().put("maxLength", Integer.toString(length));↵

66

        } ↵

66

        } ↵

67

        getExtendedMetaData(eDataType).setMinLengthFacet(length);↵

67

        getExtendedMetaData(eDataType).setMaxLengthFacet(length);↵

68

      }

68

      }

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 0
Number of refactorable cases | 0
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0
Clones location |
Number of node comparisons | 0