package bluej.stride.framedjava.slots;
import java.util.function.Function;
class PosAndDist
{
private final CaretPos pos;
private final double dist;
public PosAndDist()
{
pos = null; dist = -1;
}
public PosAndDist(CaretPos pos, double dist)
{
this.pos = pos;
this.dist = dist;
}
public static PosAndDist nearest(PosAndDist a, PosAndDist b)
{
if (a.pos == null || a.dist == -1) return b;
if (b.pos == null || b.dist == -1) return a;
if (a.dist <= b.dist)
return a;
else{ return b;
}
}
public PosAndDist copyAdjustPos(Function<CaretPos, CaretPos> f)
{
return new PosAndDist(f.apply(pos), dist);
}
public CaretPos getPos()
{
return pos;
}
}
. - PosAndDist
. PosAndDist
. PosAndDist
. nearest
. copyAdjustPos
. getPos
50 neLoCode
+ 0 LoComm