/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: PeriodicGroupMap.java,v 1.3 2009/08/18 21:16:39 ww203982 Exp $
*
*/
/**
* PeriodicGroupMap is a general Map and a scheduleable unit. Elements pairs
* will be grouped by using the time they enter the map. PeriodicGroupMap can
* be scheduled to Timer or TimerPool. For every run period,
* ScheduleableGroupAction will act on the elements which are timeout in the
* map.
*
*/
/**
* Constructor of PeriodicGroupMap.
*
* @param target The ScheduleableGroupAction to run when there is time
* @param runPeriod Run period in ms
* @param timeoutPeriod timeout period in ms
* @param removeElementAfterAction A boolean to indicate whether to remove
* the elements after action
*/
long timeoutPeriod, boolean removeElementAfterAction) {
}
/**
* Constructor of PeriodicGroupMap.
*
* @param target The ScheduleableGroupAction to run when there is time
* @param runPeriod Run period in ms
* @param timeoutPeriod timeout period in ms
* @param removeElementAfterAction A boolean to indicate whether to remove
* the elements after action
* @param map The synchronized map to use
*/
} else {
}
}
/**
* Removes all the elements.
*/
public void clear() {
synchronized (map) {
}
synchronized (thisTurn) {
}
}
}
}
/**
* Checks if the map contains the key.
*
* @param key The key of the element
* @return boolean to indicate whether the map contains the key
*/
}
/**
* Checks if the map contains the value.
*
* @param value The value of the element
* @return boolean to indicate whether the map contains the value
*/
}
/**
* Gets the element assoicated with the key.
*
* @param key The key of the element
* @return Object assoicated with the key
*/
}
/**
* Puts the key and element to the map.
*
* @param key The key to identify the element
* @param value The value of the element
* @return The element the key previously map to
*/
synchronized (map) {
}
}
return oldValue;
}
/**
* Removes the element associated with the key.
*
* @param key The key to identify the element
* @return The element the key map to
*/
synchronized (map) {
if (removeElement(key)) {
}
}
return null;
}
/**
* Puts all the elements in the map to this map.
*
* @param m The map to be added to this map.
*/
}
}
/**
* Returns the size of this map.
*/
public int size() {
}
/**
* Returns the Set of keys of this map.
*
* @return Set of keys of this map
*/
}
/**
* Returns the Collection of values of this map.
*
* @return Collection of values of this map
*/
}
/**
* Returns a Set view of entry in this map.
*
* @return Set view of entry in this map.
*/
}
/**
* Compares whether this map is equal to Object o.
*
* @param o The object to be compared to
* @return boolean to indicate whether they are equal
*/
}
/**
* Returns hash code of the map.
*
* @return hash code of this map
*/
public int hashCode() {
}
/**
* Indicates whether this PeriodicRunnable is empty.
*
* @return A boolean to indicate whether this PeriodicRunnable is empty
*/
public boolean isEmpty() {
}
/**
* Implements for TaskRunnable. Run the function of ScheduleableGroupAction
* on the objects in thisTurn 1 by 1, and interchange thisTurn and nextTurn.
*/
public void run() {
synchronized (map) {
synchronized (thisTurn) {
}
}
}
}
if (i == 0) {
} else {
if (i == containerNeeded) {
} else {
}
}
}
}
}
}