blob: 60b90085e6746002b05825e79621269ca3917c09 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004-2008 Andras Schmidt, Andras Balogh, Istvan Rath and Daniel Varro
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andras Schmidt, Andras Balogh, Istvan Rath - initial API and implementation
*******************************************************************************/
package org.eclipse.viatra2.core.simple.tempdata;
/**
* Factory class for <code>TemporaryData</code> objects. All created temporary
* objects can be managed through this object.
*
* @author Andras Schmidt
*
*/
public class TemporaryDataFactory<T> {
/**
* Create a new temporary data object
*
* @param state
* VPM model state when data is valid
* @param o
* initial data
* @return new temporary data obejct
*/
public TemporaryData<T> create(int state, T o) {
TemporaryData<T> ret = new TemporaryData<T>(state, o);
// tempDatas.add(ret);
return ret;
}
/**
* Create a new temporary data object that contains no valid data
*
* @return new temporary data obejct
*/
public TemporaryData<T> create() {
TemporaryData<T> ret = new TemporaryData<T>();
// tempDatas.add(ret);
return ret;
}
//private ArrayList<TemporaryData> tempDatas = new ArrayList<TemporaryData>();
/**
* Discard all temporary data. (This method is used to see how much memory
* cached data eats, you can also see how many VPM elements were queried
* since the last discard)
*
* @return number of temporary datas stored before discrding.
*/
public int discardAll() {
int ret = 0;
// for (int i = 0; i < tempDatas.size(); ++i) {
// ret += ((TemporaryData<?>) tempDatas.get(i)).discard();
// }
return ret;
}
}