All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ibt.ortc.extensibility.DispatchedMessages Maven / Gradle / Ivy

There is a newer version: 2.1.44
Show newest version
package ibt.ortc.extensibility;

import java.util.HashMap;

class DispatchedMessages {
	private static final int LIMIT = 1024;
	private int currentIdx;
	private String[] ids;
	private HashMap hMap;
	
	public DispatchedMessages(){
		this.currentIdx = 0;
		this.ids = new String[LIMIT];
		this.hMap = new HashMap();
	}
	
	protected void addMessageId(String messageId){
		currentIdx++;
		if(currentIdx>=LIMIT)
			currentIdx = 0;
		if(ids[currentIdx] != null){
			hMap.remove(ids[currentIdx]);
		}
		hMap.put(messageId, currentIdx);
		ids[currentIdx] = messageId;
	}
	
	protected boolean checkIfDispatched(String messageId){
		return hMap.containsKey(messageId);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy