Refactor#4
Merged
Merged
Conversation
2. BookSorter Class - compare method 3. It does not know what role it plays with existing parameter names.
2. BookSorter Class - compare Method 3. I don't know that the name of the book is the same when you see "result == 0".
2. ComputerParcelable Class - equals Method 3.I tied the related conditional statements together.(improved readability) I extracted the function for each conditional statement. (Improved understandability)
2. FileListSorter Class - compare Method 3.The comment in the method was deleted because it was the code commenting part that was before.(Improved readability) I extracted the function for each conditional statement. (Improved understandability)
line. 168 1. Extract Variable 2. Utils - DataUtils - void removeBook(int) 3. (books.size() > i), this expression is not understandable. line. 174 1. Add Error Exception 2. Utils - DataUtils - void removeBook(int) 3. There is no exception if 'i' has out of bounds.
line. 214 1. Extract Variable 2. Utils - DataUtils - void removeSever(int) 3. (servers.size() > i), this expression is not understandable. line. 219 1. Add Error Exception 2. Utils - DataUtils - void removeServer(int) 3. There is no exception if 'i' has out of bounds.
line. 232 1. Duplicate code 2. Utils - DataUtils - void addBook(final String, boolean) 3. addBook is duplicated
2. FileUtils - openunknown two methods
3. a file not supported by Amaze and a file from OTG's openunkown method codes overlap a lot.
So, I extracted the code and made it simple. (Improved understandability)
GzipExtractor.java void extractEntry(..) : outputDir -> outputDirectory, buf -> buffer, len -> length RarExtractor.java extractWithFilter(..) : arrayList -> fileHeaderArrayList void extractEntry(..) : outputDir -> outputDirectory, buf -> buffer, len -> length TarExtractor.java void extractEntry(..) : outputDir -> outputDirectory, buf -> buffer, len -> length ZipExtractor.java extractWithFilter(..) : entry -> entryIndex, entry1 -> entryArray void extractEntry(..) : outputDir -> outputDirectory, buf -> buffer, len -> length After then make similar lines to methods in extractEntry() of each extractor class. make class BufferWriter, OutputCloseBufferWriter, IOCloseBufferWriter make method getOutputFile(@nonnull Context context, String outputDirectory, String name) other similar lines alse exist but, they don't have same parameter types with simple behaviors so if i make them methods, it will be more complicated, I think.
2. FileUtils Class - fileToContentUri method extract to IconUtil class
3. The purpose of fileToContentUri method is to look for a uri, not a calculation based on the icon.
Therefore, it was extracted by IconUtils class.
2. FileUtils Class - openFile method 3. Comment is not available because it is the previous code. So, Delete it.
line 289 ~ 304 1. Extract Variable 2. Utils - DataUtils - void setServers, setBooks, setAccounts 3. More Readable Code !
1. Extract Variable 2. Utils - DataUtils - void removeBook, removeServer 3. These are more readable..
1. Extract Variable 2. Utils - DataUtils - void setGridfiles, setListfiles 3. More Readable Code !
1. Duplicate code 2. Utils - DataUtils - int contains(String[], ArrayList<String[]>) 3. 'contains(string[] ArrayList<String[])' is duplicated with the code in containsServer(String)
2. EncryptDecryptUtils -> EncryptUtil and DecryptUtil
3. Since the encryption and decryption processes are different, I have re-created the other two classes.
1. extract method
2. DecryptUtil - decryptFile method
3. Toasts are overlap a lot. This part is extracted.
For the understandability of decryptFile method, methods were extracted for each case.
2. GenericCopyUtil Class -> inputStreamStructure and ouputStreamStructure Class 3. inputStream and ouputStream are difference. So I extract two structure class. 1. extract method 2. GenericCopyUtil Class - startCopy method 3. The if statement is too complex. So Each if statement was extracted by other methods.
line 66, 70 1. rename 2. Utils - DataUtils - containsBooks, containsServer 3. parameter name is not understandable line 80. 90 1. Extract Variable, rename 2. Utils - DataUtils - contains 3. 'x[0].eqauls.a[0]' is not understandable.
2. EncryptDecryptUtils, DecryptUtil, EncryptUtil Class 3. Renamed for understandability.
BookSorter, ComputerParcelable, FileListSorter Class refactoring
Rename in filesystem/compressed/extreatcontents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.