Home | History | Annotate | Download | only in ResultObjects
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package com.android.cts.verifier.sensors.sixdof.Utils.ResultObjects;
     17 
     18 import com.android.cts.verifier.sensors.sixdof.Dialogs.AccuracyResultDialog;
     19 import com.android.cts.verifier.sensors.sixdof.Dialogs.BaseResultsDialog;
     20 
     21 import java.util.HashMap;
     22 
     23 /**
     24  * Handles the results from the tests
     25  */
     26 public class ResultObject {
     27     private HashMap<BaseResultsDialog.ResultType, Boolean> mResults;
     28 
     29     /**
     30      * Constructor for this class.
     31      *
     32      * @param results List to indicate whether a test has failed or passed.
     33      */
     34     public ResultObject(HashMap<BaseResultsDialog.ResultType, Boolean> results) {
     35         mResults = results;
     36     }
     37 
     38     /**
     39      * Returns true if all tests pass and false for anything else.
     40      */
     41     public boolean hasPassed() {
     42         for (Boolean result : mResults.values()) {
     43             if (!result) {
     44                 return false;
     45             }
     46         }
     47         return true;
     48     }
     49 
     50     /**
     51      * Returns List to indicate whether a test has failed or passed.
     52      */
     53     public HashMap<AccuracyResultDialog.ResultType, Boolean> getResults() {
     54         return new HashMap<>(mResults);
     55     }
     56 }
     57