The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 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 | |
| 17 | package android.drm.mobile1; |
| 18 | |
| 19 | import java.util.Date; |
| 20 | |
| 21 | /** |
| 22 | * This class provides interfaces to access the DRM constraint. |
| 23 | */ |
| 24 | public class DrmConstraintInfo { |
| 25 | /** |
| 26 | * The constraint of count. |
| 27 | */ |
| 28 | private int count; |
| 29 | |
| 30 | /** |
| 31 | * The constraint of start date. |
| 32 | */ |
| 33 | private long startDate; |
| 34 | |
| 35 | /** |
| 36 | * The constraint of end date. |
| 37 | */ |
| 38 | private long endDate; |
| 39 | |
| 40 | /** |
| 41 | * The constraint of interval. |
| 42 | */ |
| 43 | private long interval; |
| 44 | |
| 45 | /** |
| 46 | * Construct the DrmConstraint. |
| 47 | */ |
| 48 | DrmConstraintInfo() { |
| 49 | count = -1; |
| 50 | startDate = -1; |
| 51 | endDate = -1; |
| 52 | interval = -1; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Get the count constraint. |
| 57 | * |
| 58 | * @return the count or -1 if no limit. |
| 59 | */ |
| 60 | public int getCount() { |
| 61 | return count; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Get the start date constraint. |
| 66 | * |
| 67 | * @return the start date or null if no limit. |
| 68 | */ |
| 69 | public Date getStartDate() { |
| 70 | if (startDate == -1) |
| 71 | return null; |
| 72 | |
| 73 | return new Date(startDate); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Get the end date constraint. |
| 78 | * |
| 79 | * @return the end date or null if no limit. |
| 80 | */ |
| 81 | public Date getEndDate() { |
| 82 | if (endDate == -1) |
| 83 | return null; |
| 84 | |
| 85 | return new Date(endDate); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Get the Interval constraint. |
| 90 | * |
| 91 | * @return the interval or -1 if no limit. |
| 92 | */ |
| 93 | public long getInterval() { |
| 94 | return interval; |
| 95 | } |
| 96 | } |