Creating an image library/patterns in java
I'm pretty new to Java so please bear with me.
I've got a folder where I store all the screenshots that I use for my tests. Rather than defining the patterns one by one like this:
saveLocation = new Pattern(
I'd like to create all the patterns in one go, so my friend came up with this, though it doesnt work as intended:
File folder = new File("D:
File[] listOfFiles = folder.listFiles();
Pattern pattern[] = new Pattern[
for(int i = 0; i < listOfFiles.length; ++i){
pattern[i] = new Pattern( listOfFiles[
}
So what I get for e.g. first image
pattern[0] = new Pattern(
What I'd like to get is something like this:
pattern(firstimage) = new Pattern ("D:/SIKULI/
_______
So I decided to use the HashMap to create:
key = file name
value = path
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public class ImageMap {
public static void main(String[] args) {
File folder = new File("D:
Map<
}
private static Map<String,String> toMap(File[] table){
Map<
for(int i = 0; i < table.length; i++){
imageMap.
}
return imageMap;
}
}
The output here is:
Key = back.png
Value = D:\SIKULI\
And the problem here is - how do i go about creating patterns that will take the key as part of their name
Pattern Pattern(Key) = new Pattern(value);
e.g.
Pattern Pattern(Back.png) = new Pattern( "D:\SIKULI\
This example obviously wont work but I hope you get what I mean and can help me with this issue! :)
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- RaiMan
- Solved:
- Last query:
- Last reply: