package org.bench4q.share.models.master;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

import org.bench4q.share.models.master.statistics.SampleModel;
import org.bench4q.share.models.monitor.MemoryModel;

/**
 * When asked for memory, this will be response
 * 
 * @author coderfengyun
 * 
 */
@XmlRootElement(name = "MonitorMemoryResponseModel")
public class MonitorMemoryResponseModel implements MonitorResultBase {
	private List<MemoryModel> memoryModels;

	@XmlElementWrapper
	@XmlElement(name = "memoryModel")
	public List<MemoryModel> getMemoryModels() {
		return memoryModels;
	}

	public void setMemoryModels(List<MemoryModel> memoryModels) {
		this.memoryModels = memoryModels;
	}

	public MonitorMemoryResponseModel() {
		this.setMemoryModels(new ArrayList<MemoryModel>());
	}

	public void add(SampleModel model) {
		if (model instanceof MemoryModel) {
			this.getMemoryModels().add((MemoryModel) model);
		}
	}

}
