
com.aggrepoint.utils.linkedtable.DefaultMinusMerger Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aputils Show documentation
Show all versions of aputils Show documentation
Common utilities used by both Dao and Winlet project
The newest version!
package com.aggrepoint.utils.linkedtable;
import com.aggrepoint.utils.TypeCast;
public class DefaultMinusMerger implements INodeMerger {
private static final DefaultMinusMerger INSTANCE = new DefaultMinusMerger();
private DefaultMinusMerger() {
}
public static DefaultMinusMerger getInstance() {
return INSTANCE;
}
public T merge(T from, T to) {
if (from == null)
return to;
if (to == null)
return from;
if (from instanceof Double) {
double vfrom = 0.0d;
if (from != null)
vfrom = TypeCast.cast(from);
double vto = 0.0d;
if (to != null)
vto = TypeCast.cast(to);
return TypeCast.cast(new Double(vto - vfrom));
} else if (from instanceof Integer) {
int vfrom = 0;
if (from != null)
vfrom = TypeCast.cast(from);
int vto = 0;
if (to != null)
vto = TypeCast.cast(to);
return TypeCast.cast(new Double(vto - vfrom));
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy