Home | History | Annotate | Download | only in item
      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.loganalysis.item;
     17 
     18 import java.util.Arrays;
     19 import java.util.HashSet;
     20 import java.util.Set;
     21 
     22 /**
     23  * An {@link IItem} used to TransitionDelayInfo.
     24  */
     25 public class TransitionDelayItem extends GenericItem {
     26 
     27     /** Constant for JSON output */
     28     public static final String COMPONENT_NAME = "COMPONENT_NAME";
     29     /** Constant for JSON output */
     30     public static final String START_WINDOW_DELAY = "START_WINDOW_DELAY";
     31     /** Constant for JSON output */
     32     public static final String TRANSITION_DELAY = "TRANSITION_DELAY";
     33     /** Constant for JSON output */
     34     public static final String DATE_TIME = "DATE_TIME";
     35     /** Constant for JSON output */
     36     public static final String WINDOW_DRAWN_DELAY = "WINDOW_DRAWN_DELAY";
     37 
     38     private static final Set<String> ATTRIBUTES =
     39             new HashSet<String>(
     40                     Arrays.asList(
     41                             COMPONENT_NAME,
     42                             START_WINDOW_DELAY,
     43                             TRANSITION_DELAY,
     44                             DATE_TIME,
     45                             WINDOW_DRAWN_DELAY));
     46 
     47     /**
     48      * The constructor for {@link TransitionDelayItem}.
     49      */
     50     public TransitionDelayItem() {
     51         super(ATTRIBUTES);
     52     }
     53 
     54     public String getComponentName() {
     55         return (String) getAttribute(COMPONENT_NAME);
     56     }
     57 
     58     public void setComponentName(String componentName) {
     59         setAttribute(COMPONENT_NAME, componentName);
     60     }
     61 
     62     public Long getStartingWindowDelay() {
     63         return getAttribute(START_WINDOW_DELAY) != null ? (Long) getAttribute(START_WINDOW_DELAY)
     64                 : null;
     65     }
     66 
     67     public void setStartingWindowDelay(long startingWindowDelay) {
     68         setAttribute(START_WINDOW_DELAY, startingWindowDelay);
     69     }
     70 
     71     public Long getTransitionDelay() {
     72         return (Long) getAttribute(TRANSITION_DELAY);
     73     }
     74 
     75     public void setTransitionDelay(long transitionDelay) {
     76         setAttribute(TRANSITION_DELAY, transitionDelay);
     77     }
     78 
     79     /**
     80      * @return date and time (MM-DD HH:MM:SS.mmm) in string format parsed from events log
     81      *         and used in AUPT test.
     82      */
     83     public String getDateTime() {
     84         return (String) getAttribute(DATE_TIME);
     85     }
     86 
     87     public void setDateTime(String dateTime) {
     88         setAttribute(DATE_TIME, dateTime);
     89     }
     90 
     91     public Long getWindowDrawnDelay() {
     92         return getAttribute(WINDOW_DRAWN_DELAY) != null
     93                 ? (Long) getAttribute(WINDOW_DRAWN_DELAY)
     94                 : null;
     95     }
     96 
     97     public void setWindowDrawnDelay(long windowDrawnDelay) {
     98         setAttribute(WINDOW_DRAWN_DELAY, windowDrawnDelay);
     99     }
    100 }
    101