Minor fixes to kodex

This commit is contained in:
Alexander Nozik 2018-01-18 10:47:53 +03:00
parent 1aa7f0edf5
commit a7e4c8ddc6
8 changed files with 19 additions and 15 deletions

View File

@ -1,5 +1,9 @@
buildscript {
ext.kotlin_version = "1.2.20"
}
plugins { plugins {
id "org.jetbrains.kotlin.jvm" version "1.2.10" apply false id "org.jetbrains.kotlin.jvm" version "1.2.20" apply false
} }
allprojects{ allprojects{
@ -21,8 +25,8 @@ allprojects{
} }
dependencies{ dependencies{
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.10" compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:1.2.10" compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
testCompile group: 'junit', name: 'junit', version: '4.+' testCompile group: 'junit', name: 'junit', version: '4.+'
} }

View File

@ -22,7 +22,7 @@ new GrindShell(ctx).eval {
def beta = new NumassBeta(); def beta = new NumassBeta();
def params = MetaMorph.morph(ParamSet, def params = MetaMorph.morphNode(ParamSet,
Grind.buildMeta("params") { Grind.buildMeta("params") {
E0(value: 18575, err: 0.1) E0(value: 18575, err: 0.1)
mnu2(value: 0, err: 0.01) mnu2(value: 0, err: 0.01)

View File

@ -57,7 +57,7 @@ public class LossCalculator {
private LossCalculator() { private LossCalculator() {
cache.put(1, getSingleScatterFunction()); cache.put(1, getSingleScatterFunction());
// cache.put(2, getDoubleScatterFunction()); // immutable.put(2, getDoubleScatterFunction());
} }
public static UnivariateFunction getSingleScatterFunction() { public static UnivariateFunction getSingleScatterFunction() {
@ -253,7 +253,7 @@ public class LossCalculator {
synchronized (this) { synchronized (this) {
cache.computeIfAbsent(order, (i) -> { cache.computeIfAbsent(order, (i) -> {
LoggerFactory.getLogger(getClass()) LoggerFactory.getLogger(getClass())
.debug("Scatter cache of order {} not found. Updating", i); .debug("Scatter immutable of order {} not found. Updating", i);
return getNextLoss(getMargin(i), getLoss(i - 1)); return getNextLoss(getMargin(i), getLoss(i - 1));
}); });
return cache.get(order); return cache.get(order);

View File

@ -88,7 +88,7 @@ public class ModularSpectrum extends AbstractParametricFunction {
public void setTrappingFunction(BivariateFunction trappingFunction) { public void setTrappingFunction(BivariateFunction trappingFunction) {
this.trappingFunction = trappingFunction; this.trappingFunction = trappingFunction;
LoggerFactory.getLogger(getClass()).info("Recalculating modular spectrum cache"); LoggerFactory.getLogger(getClass()).info("Recalculating modular spectrum immutable");
setupCache(); setupCache();
} }
@ -128,7 +128,7 @@ public class ModularSpectrum extends AbstractParametricFunction {
private void updateScatterCache(int order) { private void updateScatterCache(int order) {
if (order >= cacheList.size()) { if (order >= cacheList.size()) {
LoggerFactory.getLogger(getClass()) LoggerFactory.getLogger(getClass())
.debug("Updating scatter cache up to order of '{}'", order); .debug("Updating scatter immutable up to order of '{}'", order);
// здесь можно сэкономить вызовы, начиная с cacheList.size(), но надо это? // здесь можно сэкономить вызовы, начиная с cacheList.size(), но надо это?
for (int i = 1; i < order + 1; i++) { for (int i = 1; i < order + 1; i++) {
BivariateFunction loss = calculator.getLossFunction(i); BivariateFunction loss = calculator.getLossFunction(i);
@ -194,7 +194,7 @@ public class ModularSpectrum extends AbstractParametricFunction {
} }
/** /**
* Set the boundaries and recalculate cache * Set the boundaries and recalculate immutable
* *
* @param cacheMin * @param cacheMin
* @param cacheMax * @param cacheMax
@ -218,7 +218,7 @@ public class ModularSpectrum extends AbstractParametricFunction {
} }
/** /**
* Suppress warnings about cache recalculation * Suppress warnings about immutable recalculation
* @param suppress * @param suppress
*/ */
public void setSuppressWarnings(boolean suppress) { public void setSuppressWarnings(boolean suppress) {

View File

@ -87,7 +87,7 @@ public class NamedSpectrumCaching extends AbstractParametricFunction {
} catch (TransformationNotAvailable ex) { } catch (TransformationNotAvailable ex) {
if (!suppressWarnings) { if (!suppressWarnings) {
LoggerFactory.getLogger(getClass()) LoggerFactory.getLogger(getClass())
.debug("Transformation of cache is not available. Updating cache."); .debug("Transformation of immutable is not available. Updating immutable.");
} }
el = new CacheElement(set, parName); el = new CacheElement(set, parName);
spectrumDerivCache.put(parName, el); spectrumDerivCache.put(parName, el);
@ -169,7 +169,7 @@ public class NamedSpectrumCaching extends AbstractParametricFunction {
} catch (TransformationNotAvailable ex) { } catch (TransformationNotAvailable ex) {
if (!suppressWarnings) { if (!suppressWarnings) {
LoggerFactory.getLogger(getClass()) LoggerFactory.getLogger(getClass())
.debug("Transformation of cache is not available. Updating cache."); .debug("Transformation of immutable is not available. Updating immutable.");
} }
spectrumCache = new CacheElement(set); spectrumCache = new CacheElement(set);
return spectrumCache.value(x); return spectrumCache.value(x);

View File

@ -104,7 +104,7 @@ class AmplitudeView(
} }
/** /**
* Calculate or get spectrum from the cache * Calculate or get spectrum from the immutable
*/ */
private suspend fun getSpectrum(point: NumassPoint): Table { private suspend fun getSpectrum(point: NumassPoint): Table {
return cache.computeIfAbsent(point) { analyzer.getAmplitudeSpectrum(point, Meta.empty()) } return cache.computeIfAbsent(point) { analyzer.getAmplitudeSpectrum(point, Meta.empty()) }

View File

@ -33,7 +33,7 @@ import java.util.stream.Collectors
/** /**
* View for energy spectrum * View for energy spectrum
* @param analyzer * @param analyzer
* @param cache - optional global point cache * @param cache - optional global point immutable
*/ */
class SpectrumView( class SpectrumView(
val analyzer: NumassAnalyzer = SimpleAnalyzer(), val analyzer: NumassAnalyzer = SimpleAnalyzer(),

View File

@ -26,7 +26,7 @@ class ViewerComponentsTest : View(title = "Numass viewer test", icon = ImageView
private val cache: MutableMap<NumassPoint, Table> = ConcurrentHashMap(); private val cache: MutableMap<NumassPoint, Table> = ConcurrentHashMap();
val amp: AmplitudeView by inject(params = mapOf("cache" to cache))//= AmplitudeView(cache = cache) val amp: AmplitudeView by inject(params = mapOf("cache" to cache))//= AmplitudeView(immutable = immutable)
val sp: SpectrumView by inject(params = mapOf("cache" to cache)) val sp: SpectrumView by inject(params = mapOf("cache" to cache))
val hv: HVView by inject() val hv: HVView by inject()