com.maxifier.mxcache.impl.caches.def.BooleanCharacterTroveStorage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mxcache-runtime Show documentation
Show all versions of mxcache-runtime Show documentation
Constains all classes necessary for launching a MxCache-instrumentated application
/*
* Copyright (c) 2008-2014 Maxifier Ltd. All Rights Reserved.
*/
package com.maxifier.mxcache.impl.caches.def;
import com.maxifier.mxcache.storage.*;
/**
* Default cache storage for caches that has boolean key.
* Though "Trove" is used in name, but it's actually not a map, it's just a set of two values.
*
* THIS IS GENERATED CLASS! DON'T EDIT IT MANUALLY!
*
* GENERATED FROM B2PTroveStorage.template
*
* @author Andrey Yakoushin ([email protected])
* @author Alexander Kochurov ([email protected])
*/
public class BooleanCharacterTroveStorage implements BooleanCharacterStorage {
private char trueValue;
private char falseValue;
private boolean trueSet;
private boolean falseSet;
@Override
public boolean isCalculated(boolean o) {
return o ? trueSet : falseSet;
}
@Override
public char load(boolean o) {
return o ? trueValue : falseValue;
}
@Override
public void save(boolean o, char t) {
if (o) {
trueValue = t;
trueSet = true;
} else {
falseValue = t;
falseSet = true;
}
}
@Override
public void clear() {
trueSet = false;
falseSet = false;
}
@Override
public int size() {
int res = 0;
if (trueSet) {
res++;
}
if (falseSet) {
res++;
}
return res;
}
}