meta list => map
This commit is contained in:
snoop 2017-04-25 16:15:21 +09:00
parent af1d09351c
commit 735944f018

View File

@ -3,6 +3,7 @@ package com.loafle.overflow.crawler.result;
import com.loafle.overflow.crawler.config.Item;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -13,7 +14,7 @@ public class OFResultSet {
private Item item;
private List<List<String>> rows;
private List<String> meta;
private Map<String, Integer> meta = null;
public List<List<String>> getRows() {
return rows;
@ -32,12 +33,16 @@ public class OFResultSet {
}
public List<String> getMeta() {
return meta;
}
public void setMeta(List<String> meta) {
this.meta = meta;
if(this.meta == null) {
this.meta = new HashMap<>();
}
for(int indexI = 0; indexI < meta.size(); ++indexI) {
this.meta.put(meta.get(indexI), indexI);
}
}
public OFResultSet(Item item) {
@ -47,7 +52,7 @@ public class OFResultSet {
public OFResultSet(Item item,List<String> meta) {
this.item = item;
this.rows = new ArrayList<>();
this.meta = meta;
this.setMeta(meta);
}
public void addRow(List<String> row) {
@ -65,6 +70,11 @@ public class OFResultSet {
}
public Map<String, String> parseCol() {
return null;
}