Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions app/src/main/java/unipd/se18/ocrcamera/BitmapBox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package com.example.imageprocessing;

import android.graphics.Bitmap;
import com.example.imageprocessing.enumClasses.ProcessingResult;
import com.example.imageprocessing.interfaces.BitmapContainer;
import java.util.ArrayList;
import java.util.List;


/**
* Class used to manage the list of bitmaps and errors
* @author Thomas Porro (g1)
*/
class BitmapBox implements BitmapContainer {
private List<Bitmap> container;
private int counter;
private ProcessingResult processingResult;


/**
* Constructor of the class that initialize the bitmaps's list and processingResult
* to a default value
*/
BitmapBox(){
container = new ArrayList<>();
counter = 0;
processingResult = ProcessingResult.PROCESSING_SUCCESSFUL;
}


/**
* Constructor of the class that initialize the bitmaps's list with a single image,
* and initialize processingResult with the desired value
*/
BitmapBox(Bitmap image, ProcessingResult value){
container = new ArrayList<>();
container.add(image);
counter = 0;
processingResult = value;
}


/**
* Constructor of the class that initialize the bitmaps's list and processingResult
* to the desired value
*/
BitmapBox(ProcessingResult value){
container = new ArrayList<>();
counter = 0;
processingResult = value;
}


/**
* Add a bitmap to the list
* @param croppedImage the image we want to add to the list
*/
void addBitmap(Bitmap croppedImage){
container.add(croppedImage);
}


/**
* Set processingResult to the desired value
* @param value the new value of processingResult
*/
void setProcessingResult(ProcessingResult value){
processingResult = value;
}


@Override
public ProcessingResult getProcessingResult(){
return processingResult;
}

@Override
public List<Bitmap> getTextBitmaps() {
return container;
}

@Override
public Bitmap getFirstBitmap(){
if(this.hasNext()) {
return container.get(0);
} else {
return null;
}
}

@Override
public Object next(){
if(this.hasNext()) {
return container.get(counter++);
} else {
return null;
}
}

@Override
public boolean hasNext(){
return counter<container.size();
}

}
16 changes: 16 additions & 0 deletions app/src/main/java/unipd/se18/ocrcamera/ChecklistPorro.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Codereview's checklist:
-Does the code respect the style guide?
-Is the code easy to read?
-Are there enough comments?
-Does the method respect the specs?
-Is the method's name appropriate?
-Is it possible to divide the main method to make easier the tests?
-Are the desing patterns well used?
-Are the access modifiers right?
-Does the variable's names reflect their role in the code?
-Are the exceptions well managed?
-When a code returns a number is it possible to use an enum class?
-Is there any harcoding?

These are the main things I've checked while I do the reviews. I've also checked if there were
a way to improve the code.
Loading