15229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood/* 25229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * Copyright (C) 2010 The Android Open Source Project 35229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * 45229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * Licensed under the Apache License, Version 2.0 (the "License"); 55229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * you may not use this file except in compliance with the License. 65229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * You may obtain a copy of the License at 75229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * 85229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * http://www.apache.org/licenses/LICENSE-2.0 95229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * 105229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * Unless required by applicable law or agreed to in writing, software 115229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * distributed under the License is distributed on an "AS IS" BASIS, 125229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 135229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * See the License for the specific language governing permissions and 145229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * limitations under the License. 155229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood */ 165229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodpackage com.android.quicksearchbox; 175229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 185229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodimport java.util.Collection; 195229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodimport java.util.HashMap; 205229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 215229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood/** 225229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood * Mock suggestion extras backed by a map. 235229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood */ 245229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwoodpublic class MockSuggestionExtras extends AbstractSuggestionExtras { 255229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 265229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood HashMap<String, Object> mMap; 275229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 285229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood public MockSuggestionExtras() { 2927691bfcdcf3d2918b45bfadd57b08547c317ce5Mathew Inwood super(null); 305229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood mMap = new HashMap<String, Object>(); 315229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood } 325229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 335229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood public MockSuggestionExtras put(String name, Object value) { 345229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood mMap.put(name, value); 355229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood return this; 365229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood } 375229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 3827691bfcdcf3d2918b45bfadd57b08547c317ce5Mathew Inwood @Override 3927691bfcdcf3d2918b45bfadd57b08547c317ce5Mathew Inwood public String doGetExtra(String columnName) { 405229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood Object o = mMap.get(columnName); 415229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood return o == null ? null : o.toString(); 425229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood } 435229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 4427691bfcdcf3d2918b45bfadd57b08547c317ce5Mathew Inwood @Override 4527691bfcdcf3d2918b45bfadd57b08547c317ce5Mathew Inwood public Collection<String> doGetExtraColumnNames() { 465229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood return mMap.keySet(); 475229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood } 485229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood 495229b06f00d20aac76cd8519b37f2a579d61c54fMathew Inwood} 50