| 1 | /** |
| 2 | * Copyright 2005-2011 Steve McDuff d-duff@users.sourceforge.net |
| 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 org.deduced.viewer.web.shared; |
| 17 | |
| 18 | /** |
| 19 | * |
| 20 | * Ignored Event Information |
| 21 | * |
| 22 | * @author Steve McDuff |
| 23 | * |
| 24 | */ |
| 25 | public class IgnoredEventInformation |
| 26 | { |
| 27 | |
| 28 | /** |
| 29 | * number of times to ignore this event |
| 30 | */ |
| 31 | private int ignoredCount; |
| 32 | |
| 33 | /** |
| 34 | * time stamp of the last event to ignore |
| 35 | */ |
| 36 | private long ignoredTimeStamp; |
| 37 | |
| 38 | /** |
| 39 | * get Ignored Count |
| 40 | * |
| 41 | * @return the ignored count |
| 42 | */ |
| 43 | public int getIgnoredCount() |
| 44 | { |
| 45 | return ignoredCount; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * get Ignored Time Stamp |
| 50 | * |
| 51 | * @return the Ignored Time Stamp |
| 52 | */ |
| 53 | public long getIgnoredTimeStamp() |
| 54 | { |
| 55 | return ignoredTimeStamp; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * set Ignored Count |
| 60 | * |
| 61 | * @param setIgnoredCount the new ignored count |
| 62 | */ |
| 63 | public void setIgnoredCount( |
| 64 | int setIgnoredCount) |
| 65 | { |
| 66 | ignoredCount = setIgnoredCount; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * set Ignored Time Stamp |
| 71 | * |
| 72 | * @param setIgnoredTimeStamp the new Ignored Time Stamp |
| 73 | */ |
| 74 | public void setIgnoredTimeStamp( |
| 75 | long setIgnoredTimeStamp) |
| 76 | { |
| 77 | ignoredTimeStamp = setIgnoredTimeStamp; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * increment Ignored Count and update the time stamp. |
| 82 | */ |
| 83 | public void incrementIgnoredCount() |
| 84 | { |
| 85 | ++ignoredCount; |
| 86 | |
| 87 | ignoredTimeStamp = Utilities.getTimeStampInMilliseconds(); |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * decrement Ignored Count |
| 92 | * |
| 93 | * @return true if the ignored count has reached zero |
| 94 | */ |
| 95 | public boolean decrementIgnoredCount() |
| 96 | { |
| 97 | if (ignoredCount > 0) |
| 98 | { |
| 99 | --ignoredCount; |
| 100 | } |
| 101 | return ignoredCount == 0; |
| 102 | } |
| 103 | |
| 104 | } |