File path: /jruby-1.4.0/src/org/jruby/RubyZlib.java | File path: /jruby-1.4.0/src/org/jruby/RubyZlib.java | |||
Method name: IRubyObject crc32(IRubyObject, IRubyObject[])
|
Method name: IRubyObject adler32(IRubyObject, IRubyObject[])
|
|||
Number of AST nodes: 11 | Number of AST nodes: 11 | |||
1 | args = Arity.scanArgs(recv.getRuntime(),args,0,2);↵ | 1 | args = Arity.scanArgs(recv.getRuntime(),args,0,2);↵ | |
2 | long crc = 0;↵ | 2 | int adler = 1;↵ | |
3 | ByteList bytes = null;↵ | 3 | ByteList bytes = null;↵ | |
4 | ↵ | |||
5 | if (!args[0].isNil()) bytes = args[0].convertToString().getByteList();↵ | 4 | if (!args[0].isNil()) bytes = args[0].convertToString().getByteList();↵ | |
6 | if (!args[1].isNil()) crc = RubyNumeric.num2long(args[1]);↵ | 5 | if (!args[1].isNil()) adler = RubyNumeric.fix2int(args[1]);↵ | |
7 | CRC32Ext ext = new CRC32Ext((int)crc);↵ | 6 | Adler32Ext ext = new Adler32Ext(adler);↵ | |
8 | if (bytes != null) {↵ | 7 | if (bytes != null) {↵ | |
9 | ext.update(bytes.unsafeBytes(), bytes.begin(), bytes.length());↵ | 8 | ext.update(bytes.unsafeBytes(), bytes.begin(), bytes.length());↵ | |
10 | }↵ | 9 | // it's safe since adler.update doesn't modify the array↵ | |
11 | ↵ | 10 | }↵ | |
12 | return recv.getRuntime().newFixnum(ext.getValue()); | 11 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.7 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 52 |
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 2.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | args = Arity.scanArgs(recv.getRuntime(), args, 0, 2); | 1 | args = Arity.scanArgs(recv.getRuntime(), args, 0, 2); | ||||||||||||
| 2 | int adler = 1; | |||||||||||||
2 | long crc = 0; | | |||||||||||||
3 | ByteList bytes = null; | 3 | ByteList bytes = null; | ||||||||||||
4 | if (!args[0].isNil()) | 4 | if (!args[0].isNil()) | ||||||||||||
5 | bytes = args[0].convertToString().getByteList(); | 5 | bytes = args[0].convertToString().getByteList(); | ||||||||||||
6 | if (!args[1].isNil()) | 6 | if (!args[1].isNil()) | ||||||||||||
| 7 | adler = RubyNumeric.fix2int(args[1]); | |||||||||||||
7 | crc = RubyNumeric.num2long(args[1]); | | |||||||||||||
| 8 | Adler32Ext ext = new Adler32Ext(adler); | |||||||||||||
8 | CRC32Ext ext = new CRC32Ext((int)crc); | | |||||||||||||
9 | if (bytes != null) | 9 | if (bytes != null) | ||||||||||||
10 | ext.update(bytes.unsafeBytes(), bytes.begin(), bytes.length()); |
| 10 | ext.update(bytes.unsafeBytes(), bytes.begin(), bytes.length()); | |||||||||||
11 | return recv.getRuntime().newFixnum(ext.getValue()); |
| 11 | return recv.getRuntime().newFixnum(ext.getValue()); |
Row | Violation |
---|---|
1 | Type org.jruby.util.CRC32Ext of variable ext does not match with type org.jruby.util.Adler32Ext of variable ext |
2 | Type org.jruby.util.CRC32Ext of variable ext does not match with type org.jruby.util.Adler32Ext of variable ext |