@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub BookItem item = this.getItem(position); View view = LayoutInflater.from(getContext()).inflate(this._resid, null); TextView bookname = (TextView) view.findViewById(R.id.book_name); TextView bookauthor = (TextView) view.findViewById(R.id.book_author); TextView bookstat = (TextView) view.findViewById(R.id.book_stat); bookstat.setText(item.getBookStatusStr()); bookname.setText(item.getBookName()); bookauthor.setText(item.getBookAuthor()); return view; }
/** * Merge results from each search engine. If an engine does not know the value for a field, the * following engine result is called */ public void mergeResults() { for (IsbnNumber isbn : isbnList) { BookItem book = new BookItem(isbn); for (IsbnModule module : priorityList) { book.automaticMerge(module.getBookItem(isbn), valuesPriority); } for (Entry<String, List<IsbnModule>> entry : valuesPriority.entrySet()) { book.setValue(entry.getKey(), null); for (IsbnModule module : entry.getValue()) { if (priorityList.contains(module)) { Object value = module.getBookItem(isbn).getValue(entry.getKey()); if (value != null) { book.setValue(entry.getKey(), value); break; } } } } bookResult.add(book); } }
/** Print a debug for each module answers */ public void debugPrintModuleResults() { for (IsbnModule module : priorityList) { System.out.println("/--" + module.getModuleName()); for (BookItem book : module.getBookItemList()) { System.out.print( "Title=" + pA(book.getTitle()) + ", NbPages=" + book.getNbPages() + ", Isbn=" + book.getIsbn().getIsbn13()); if (book.getAuthorList() != null) System.out.print(", Authors=" + book.getAuthorList().toString()); System.out.println(); } System.out.println("--/"); } }