Home | History | Annotate | Download | only in util
      1 /* GENERATED SOURCE. DO NOT MODIFY. */
      2 //  2016 and later: Unicode, Inc. and others.
      3 // License & terms of use: http://www.unicode.org/copyright.html#License
      4 /*
      5  *******************************************************************************
      6  * Copyright (C) 2007, International Business Machines Corporation and         *
      7  * others. All Rights Reserved.                                                *
      8  *******************************************************************************
      9  */
     10 package android.icu.dev.test.util;
     11 
     12 import android.icu.util.Calendar;
     13 
     14 /**
     15  * @author srl
     16  *
     17  */
     18 public class CalendarFieldsSet extends FieldsSet {
     19 
     20     /**
     21      * @param whichEnum
     22      * @param fieldsCount
     23      */
     24     public CalendarFieldsSet() {
     25         super(DebugUtilitiesData.UCalendarDateFields,-1);
     26     }
     27 
     28     public boolean  matches(Calendar cal, CalendarFieldsSet diffSet) {
     29         boolean match = true;
     30         for(int i=0;i<fieldCount();i++) {
     31             if(isSet(i)) {
     32                 int calVal = cal.get(i);
     33                 if(calVal != get(i)) {
     34                     match = false;
     35                     diffSet.set(i, calVal);
     36                 }
     37             }
     38         }
     39         return match;
     40     }
     41 
     42     /**
     43      * set the specified fields on this calendar. Doesn't clear first. Returns any errors the cale
     44      */
     45     public void setOnCalendar(Calendar cal) {
     46         for(int i=0;i<fieldCount();i++) {
     47             if(isSet(i)) {
     48                 cal.set(i, get(i));
     49             }
     50         }
     51     }
     52 
     53     protected void handleParseValue(FieldsSet inheritFrom, int field, String substr) {
     54         if(field == Calendar.MONTH) {
     55             parseValueEnum(DebugUtilitiesData.UCalendarMonths, inheritFrom, field, substr);
     56             // will fallback to default.
     57         } else {
     58             parseValueDefault(inheritFrom, field, substr);
     59         }
     60     }
     61 }
     62