code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Pure
public boolean isReferenceCell(GridCell<P> cell) {
return !this.cells.isEmpty() && this.cells.get(0) == cell;
} | java |
public static <E> ImmutableList<E> shuffledCopy(List<? extends E> list, Random rng) {
final ArrayList<E> shuffled = Lists.newArrayList(list);
Collections.shuffle(shuffled, rng);
return ImmutableList.copyOf(shuffled);
} | java |
protected synchronized void replaceInFileBuffered(File sourceFile, File targetFile, ReplacementType replacementType,
File[] classpath, boolean detectEncoding) throws MojoExecutionException {
if (this.replacementTreatedFiles.contains(targetFile)
&& targetFile.exists()) {
getLog().debug("Skiping " + targetFil... | java |
@SuppressWarnings("checkstyle:nestedifdepth")
protected synchronized String replaceAuthor(File sourceFile, int sourceLine, String text,
ExtendedArtifact artifact, ReplacementType replacementType) throws MojoExecutionException {
String result = text;
final Pattern p = buildMacroPatternWithGroup(Macros.MACRO_AUTH... | java |
@SuppressWarnings("checkstyle:nestedifdepth")
protected synchronized String replaceProp(File sourceFile, int sourceLine, String text,
MavenProject project, ReplacementType replacementType) throws MojoExecutionException {
String result = text;
final Pattern p = buildMacroPatternWithGroup(Macros.MACRO_PROP);
fi... | java |
protected void setSourceDirectoryForAllMojo(File newSourceDirectory) {
final List<String> sourceRoots = this.mavenProject.getCompileSourceRoots();
getLog().debug("Old source roots: " + sourceRoots.toString()); //$NON-NLS-1$
final Iterator<String> iterator = sourceRoots.iterator();
final String removableSourcePa... | java |
public static Optional<OffsetRange<CharOffset>> charOffsetsOfWholeString(String s) {
if (s.isEmpty()) {
return Optional.absent();
}
return Optional.of(charOffsetRange(0, s.length() - 1));
} | java |
public boolean contains(final OffsetType x) {
return x.asInt() >= startInclusive().asInt() && x.asInt() <= endInclusive().asInt();
} | java |
@Pure
public static int getColorFromName(String colorName, int defaultValue) {
final Integer value = COLOR_MATCHES.get(Strings.nullToEmpty(colorName).toLowerCase());
if (value != null) {
return value.intValue();
}
return defaultValue;
} | java |
@Pure
public static String getColorNameFromValue(int colorValue) {
for (final Entry<String, Integer> entry : COLOR_MATCHES.entrySet()) {
final int knownValue = entry.getValue().intValue();
if (colorValue == knownValue) {
return entry.getKey();
}
}
return null;
} | java |
@Pure
public double getLength() {
double length = 0;
for (final RoadPath p : this.paths) {
length += p.getLength();
}
return length;
} | java |
@Pure
public int indexOf(RoadSegment segment) {
int count = 0;
int index;
for (final RoadPath p : this.paths) {
index = p.indexOf(segment);
if (index >= 0) {
return count + index;
}
count += p.size();
}
return -1;
} | java |
@Pure
public int lastIndexOf(RoadSegment segment) {
int count = 0;
int index;
int lastIndex = -1;
for (final RoadPath p : this.paths) {
index = p.lastIndexOf(segment);
if (index >= 0) {
lastIndex = count + index;
}
count += p.size();
}
return lastIndex;
} | java |
@Pure
public RoadSegment getRoadSegmentAt(int index) {
if (index >= 0) {
int b = 0;
for (final RoadPath p : this.paths) {
final int e = b + p.size();
if (index < e) {
return p.get(index - b);
}
b = e;
}
}
throw new IndexOutOfBoundsException();
} | java |
@Pure
public RoadPath getPathForRoadSegmentAt(int index) {
if (index >= 0) {
int b = 0;
for (final RoadPath p : this.paths) {
final int e = b + p.size();
if (index < e) {
return p;
}
b = e;
}
}
throw new IndexOutOfBoundsException();
} | java |
public RoadSegment removeRoadSegmentAt(int index) {
if (index >= 0) {
int b = 0;
for (final RoadPath p : this.paths) {
int end = b + p.size();
if (index < end) {
end = index - b;
return removeRoadSegmentAt(p, end, null);
}
b = end;
}
}
throw new IndexOutOfBoundsException();
} | java |
private RoadSegment removeRoadSegmentAt(RoadPath path, int index, PathIterator iterator) {
final int pathIndex = this.paths.indexOf(path);
assert pathIndex >= 0 && pathIndex < this.paths.size();
assert index >= 0 && index < path.size();
final RoadPath syncPath;
final RoadSegment sgmt;
if (index == 0 || inde... | java |
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity",
"checkstyle:nestedifdepth"})
public RoadPath addAndGetPath(RoadPath end) {
RoadPath selectedPath = null;
if (end != null && !end.isEmpty()) {
RoadConnection first = end.getFirstPoint();
RoadConnection last = end.getLastPoin... | java |
boolean setParentNodeReference(N newParent, boolean fireEvent) {
final N oldParent = getParentNode();
if (newParent == oldParent) {
return false;
}
this.parent = (newParent == null) ? null : new WeakReference<>(newParent);
if (!fireEvent) {
return true;
}
firePropertyParentChanged(oldParent, newPare... | java |
void firePropertyChildAdded(TreeNodeAddedEvent event) {
if (this.nodeListeners != null) {
for (final TreeNodeListener listener : this.nodeListeners) {
if (listener != null) {
listener.treeNodeChildAdded(event);
}
}
}
final N parentNode = getParentNode();
assert parentNode != this;
if (paren... | java |
void firePropertyChildRemoved(TreeNodeRemovedEvent event) {
if (this.nodeListeners != null) {
for (final TreeNodeListener listener : this.nodeListeners) {
if (listener != null) {
listener.treeNodeChildRemoved(event);
}
}
}
final N parentNode = getParentNode();
if (parentNode != null) {
par... | java |
public static Function<Iterable<?>, String> joinFunction(final Joiner joiner) {
return new Function<Iterable<?>, String>() {
@Override
public String apply(final Iterable<?> list) {
return joiner.join(list);
}
};
} | java |
public static Function<String, String> toLowerCaseFunction(final Locale locale) {
return new Function<String, String>() {
@Override
public String apply(final String s) {
return s.toLowerCase(locale);
}
@Override
public String toString() {
return "toLowercase(" + locale... | java |
public static UnicodeFriendlyString stripAccents(final UnicodeFriendlyString input) {
// this nifty normalization courtesy of http://stackoverflow.com/questions/3322152/is-there-a-way-to-get-rid-of-accents-and-convert-a-whole-string-to-regular-lette
return StringUtils.unicodeFriendly(ACCENT_STRIPPER.matcher(
... | java |
public static int getKeyCode(final char character)
throws IllegalAccessException, NoSuchFieldException
{
final String c = String.valueOf(character).toUpperCase();
final String variableName = "VK_" + c;
final Class<KeyEvent> clazz = KeyEvent.class;
final Field field = clazz.getField(variableName);
final int... | java |
public static void typeCharacter(final Robot robot, final char character)
throws IllegalAccessException, NoSuchFieldException
{
final boolean upperCase = Character.isUpperCase(character);
final int keyCode = getKeyCode(character);
if (upperCase)
{
robot.keyPress(KeyEvent.VK_SHIFT);
}
robot.keyPress(ke... | java |
public static void typeString(final Robot robot, final String input)
throws NoSuchFieldException, IllegalAccessException
{
if (input != null && !input.isEmpty())
{
for (final char character : input.toCharArray())
{
typeCharacter(robot, character);
}
}
} | java |
public <T extends MapLayer> Iterator<T> iterator(Class<T> type) {
return new LayerReaderIterator<>(type);
} | java |
public final <T extends MapLayer> T read(Class<T> type) throws IOException {
// Read the header
if (!this.isHeaderRead) {
this.isHeaderRead = true;
readHeader();
if (this.progression != null) {
this.progression.setProperties(0, 0, this.restToRead, false);
}
}
T selectedObject = null;
if (thi... | java |
@SuppressWarnings({"resource", "checkstyle:magicnumber"})
protected void readHeader() throws IOException {
final ReadableByteChannel in = Channels.newChannel(this.input);
final int limit = HEADER_KEY.getBytes().length + 2;
final ByteBuffer hBuffer = ByteBuffer.allocate(limit);
hBuffer.limit(limit);
// Check... | java |
public LevelOfDetails getLevelOfDetails() {
if (this.lod == null) {
final double meterSize = doc2fxSize(1);
if (meterSize <= LOW_DETAILLED_METER_SIZE) {
this.lod = LevelOfDetails.LOW;
} else if (meterSize >= HIGH_DETAILLED_METER_SIZE) {
this.lod = LevelOfDetails.HIGH;
} else {
this.lod = Level... | java |
@SuppressWarnings({ "checkstyle:magicnumber", "static-method" })
@Pure
public Color rgb(int color) {
final int red = (color & 0x00FF0000) >> 16;
final int green = (color & 0x0000FF00) >> 8;
final int blue = color & 0x000000FF;
return Color.rgb(red, green, blue);
} | java |
@Pure
public double doc2fxX(double x) {
return this.centeringTransform.toCenterX(x) * this.scale.get() + this.canvasWidth.get() / 2.;
} | java |
@Pure
public double fx2docX(double x) {
return this.centeringTransform.toGlobalX((x - this.canvasWidth.get() / 2.) / this.scale.get());
} | java |
@Pure
public double doc2fxY(double y) {
return this.centeringTransform.toCenterY(y) * this.scale.get() + this.canvasHeight.get() / 2.;
} | java |
@Pure
public double fx2docY(double y) {
return this.centeringTransform.toGlobalY((y - this.canvasHeight.get() / 2.) / this.scale.get());
} | java |
@Pure
public double doc2fxAngle(double angle) {
final ZoomableCanvas<?> canvas = getCanvas();
if (canvas.isInvertedAxisX() != canvas.isInvertedAxisY()) {
return -angle;
}
return angle;
} | java |
@Pure
public double fx2docAngle(double angle) {
final ZoomableCanvas<?> canvas = getCanvas();
if (canvas.isInvertedAxisX() != canvas.isInvertedAxisY()) {
return -angle;
}
return angle;
} | java |
public void restore() {
this.gc.restore();
if (this.stateStack != null) {
if (!this.stateStack.isEmpty()) {
final int[] data = this.stateStack.pop();
if (this.stateStack.isEmpty()) {
this.stateStack = null;
}
this.bugdet = data[0];
this.state = data[1];
} else {
this.stateStack = ... | java |
public void fillRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight) {
this.gc.fillRoundRect(
doc2fxX(x), doc2fxY(y),
doc2fxSize(width), doc2fxSize(height),
doc2fxSize(arcWidth), doc2fxSize(arcHeight));
} | java |
public void strokeLine(double x1, double y1, double x2, double y2) {
this.gc.strokeLine(
doc2fxX(x1), doc2fxY(y1),
doc2fxX(x2), doc2fxY(y2));
} | java |
@SuppressWarnings({"static-method", "checkstyle:magicnumber"})
protected GISPolylineSet<RoadPolyline> createInternalDataStructure(Rectangle2afp<?, ?, ?, ?, ?, ?> originalBounds) {
/*return new MapPolylineGridSet<>(100, 100,
originalBounds.getMinX(),
originalBounds.getMinY(),
originalBounds.getWidth(),
... | java |
@SuppressWarnings("unchecked")
@Pure
public Tree<RoadPolyline, ?> getInternalTree() {
if (this.roadSegments instanceof GISTreeSet<?, ?>) {
return ((GISTreeSet<RoadPolyline, ?>) this.roadSegments).getTree();
}
return null;
} | java |
@Pure
public LegalTrafficSide getLegalTrafficSide() {
final String side;
try {
side = getAttributeAsString("LEGAL_TRAFFIC_SIDE"); //$NON-NLS-1$
LegalTrafficSide sd;
try {
sd = LegalTrafficSide.valueOf(side);
} catch (Throwable exception) {
sd = null;
}
if (sd != null) {
return sd;
... | java |
protected void fireSegmentChanged(RoadSegment segment) {
if (this.listeners != null && isEventFirable()) {
for (final RoadNetworkListener listener : this.listeners) {
listener.onRoadSegmentChanged(this, segment);
}
}
} | java |
@Pure
public Iterable<IntegerSegment> toSegmentIterable() {
return new Iterable<IntegerSegment>() {
@Override
public Iterator<IntegerSegment> iterator() {
return new SegmentIterator();
}
};
} | java |
public void set(SortedSet<? extends Number> collection) {
this.values = null;
this.size = 0;
for (final Number number : collection) {
final int e = number.intValue();
if ((this.values != null) && (e == this.values[this.values.length - 1] + 1)) {
// Same group
++this.values[this.values.length - 1];... | java |
@Pure
public SortedSet<Integer> toSortedSet() {
final SortedSet<Integer> theset = new TreeSet<>();
if (this.values != null) {
for (int idxStart = 0; idxStart < this.values.length - 1; idxStart += 2) {
for (int n = this.values[idxStart]; n <= this.values[idxStart + 1]; ++n) {
theset.add(n);
}
}
... | java |
protected String formatDateStr2(String str) {
// Initial Calendar object
Calendar cal = Calendar.getInstance();
str = str.replaceAll("/", "");
try {
// Set date with input value
cal.set(Integer.parseInt(str.substring(0, 4)), Integer.parseInt(str.substring(4, 6)) ... | java |
protected static String formatDateStr(String startDate, String strDays) {
// Initial Calendar object
Calendar cal = Calendar.getInstance();
int days;
startDate = startDate.replaceAll("/", "");
try {
days = Double.valueOf(strDays).intValue();
// Set date w... | java |
protected String getExName(Map result) {
String ret = getValueOr(result, "exname", "");
if (ret.matches("\\w+\\.\\w{2}[Xx]")) {
ret = ret.substring(0, ret.length() - 1).replace(".", "");
}
// TODO need to be updated with a translate rule for other models' exname
if (... | java |
protected String getCrid(Map result) {
HashMap mgnData = getObjectOr(result, "management", new HashMap());
ArrayList<HashMap> events = getObjectOr(mgnData, "events", new ArrayList());
String crid = null;
boolean isPlEventExist = false;
for (HashMap event : events) {
... | java |
protected synchronized String getFileName(Map result, String fileType) {
String exname = getExName(result);
String crid;
if (getValueOr(result, "seasonal_dome_applied", "N").equals("Y")) {
crid = "SN";
} else {
crid = getCrid(result);
}
if (exname.... | java |
protected void decompressData(HashMap m) {
for (Object key : m.keySet()) {
if (m.get(key) instanceof ArrayList) {
// iterate sub array nodes
decompressData((ArrayList) m.get(key));
} else if (m.get(key) instanceof HashMap) {
// iterate sub... | java |
protected void decompressData(ArrayList arr) {
HashMap fstData = null; // The first data record (Map type)
HashMap cprData; // The following data record which will be compressed
for (Object sub : arr) {
if (sub instanceof ArrayList) {
// iterate sub array node... | java |
protected String getPdate(Map result) {
HashMap management = getObjectOr(result, "management", new HashMap());
ArrayList<HashMap> events = getObjectOr(management, "events", new ArrayList<HashMap>());
for (HashMap event : events) {
if (getValueOr(event, "event", "").equals("planting"... | java |
private boolean isContentTypeIn(ZipInputStream stream) throws IOException {
boolean isContentType = false;
if (this.innerFile != null) {
final String strInner = this.innerFile.toString();
InputStream dataStream = null;
ZipEntry zipEntry = stream.getNextEntry();
while (zipEntry != null && dataStream == n... | java |
public void close() throws IOException {
this.accessors.clear();
if (this.reader != null) {
this.reader.close();
this.reader = null;
}
} | java |
@Pure
protected DBaseFileReader getReader() throws IOException {
if (this.reader == null) {
this.reader = new DBaseFileReader(this.url.openStream());
this.reader.readDBFHeader();
this.reader.readDBFFields();
}
return this.reader;
} | java |
@SuppressWarnings("resource")
@Pure
public Collection<String> getAllAttributeNames(int recordNumber) {
try {
final DBaseFileReader dbReader = getReader();
synchronized (dbReader) {
final List<DBaseFileField> fields = dbReader.getDBFFields();
if (fields == null) {
return Collections.emptyList();
... | java |
@SuppressWarnings("resource")
@Pure
public int getAttributeCount() {
try {
final DBaseFileReader dbReader = getReader();
synchronized (dbReader) {
return dbReader.getDBFFieldCount();
}
} catch (IOException exception) {
return 0;
}
} | java |
@SuppressWarnings("resource")
@Pure
public Object getRawValue(int recordNumber, String name, OutputParameter<AttributeType> type) throws AttributeException {
try {
final DBaseFileReader dbReader = getReader();
synchronized (dbReader) {
dbReader.seek(recordNumber);
final DBaseFileRecord record = dbRead... | java |
@Pure
public static int toLEInt(int b1, int b2, int b3, int b4) {
return ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF);
} | java |
@Pure
public static int toBEInt(int b1, int b2, int b3, int b4) {
return ((b1 & 0xFF) << 24) + ((b2 & 0xFF) << 16) + ((b3 & 0xFF) << 8) + (b4 & 0xFF);
} | java |
@Pure
public static long toLELong(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return ((b8 & 0xFF) << 56) + ((b7 & 0xFF) << 48) + ((b6 & 0xFF) << 40) + ((b5 & 0xFF) << 32)
+ ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF);
} | java |
@Pure
@Inline(value = "Double.longBitsToDouble(EndianNumbers.toLELong($1, $2, $3, $4, $5, $6, $7, $8))",
imported = {EndianNumbers.class})
public static double toLEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return Double.longBitsToDouble(toLELong(b1, b2, b3, b4, b5, b6, b7, b8));
} | java |
@Pure
@Inline(value = "Double.longBitsToDouble(EndianNumbers.toBELong($1, $2, $3, $4, $5, $6, $7, $8))",
imported = {EndianNumbers.class})
public static double toBEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return Double.longBitsToDouble(toBELong(b1, b2, b3, b4, b5, b6, b7, b8));
} | java |
@Pure
@Inline(value = "Float.intBitsToFloat(EndianNumbers.toLEInt($1, $2, $3, $4))",
imported = {EndianNumbers.class})
public static float toLEFloat(int b1, int b2, int b3, int b4) {
return Float.intBitsToFloat(toLEInt(b1, b2, b3, b4));
} | java |
@Pure
@Inline(value = "Float.intBitsToFloat(EndianNumbers.toBEInt($1, $2, $3, $4))",
imported = {EndianNumbers.class})
public static float toBEFloat(int b1, int b2, int b3, int b4) {
return Float.intBitsToFloat(toBEInt(b1, b2, b3, b4));
} | java |
@Pure
@Inline(value = "EndianNumbers.parseLEInt(Float.floatToIntBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseLEFloat(float value) {
return parseLEInt(Float.floatToIntBits(value));
} | java |
@Pure
public static byte[] parseLELong(long value) {
return new byte[] {
(byte) (value & 0xFF),
(byte) ((value >> 8) & 0xFF),
(byte) ((value >> 16) & 0xFF),
(byte) ((value >> 24) & 0xFF),
(byte) ((value >> 32) & 0xFF),
(byte) ((value >> 40) & 0xFF),
(byte) ((value >> 48) & 0xFF),
(byte) ((val... | java |
@Pure
@Inline(value = "EndianNumbers.parseLELong(Double.doubleToLongBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseLEDouble(double value) {
return parseLELong(Double.doubleToLongBits(value));
} | java |
@Pure
@Inline(value = "EndianNumbers.parseBEInt(Float.floatToIntBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseBEFloat(float value) {
return parseBEInt(Float.floatToIntBits(value));
} | java |
@Pure
public static byte[] parseBELong(long value) {
return new byte[] {
(byte) ((value >> 56) & 0xFF),
(byte) ((value >> 48) & 0xFF),
(byte) ((value >> 40) & 0xFF),
(byte) ((value >> 32) & 0xFF),
(byte) ((value >> 24) & 0xFF),
(byte) ((value >> 16) & 0xFF),
(byte) ((value >> 8) & 0xFF),
(byt... | java |
@Pure
@Inline(value = "EndianNumbers.parseBELong(Double.doubleToLongBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseBEDouble(double value) {
return parseBELong(Double.doubleToLongBits(value));
} | java |
@SuppressWarnings({ "unchecked", "static-method" })
@Pure
final <O> O unwrap(O obj) {
O unwrapped = obj;
if (obj instanceof TerminalConnection) {
unwrapped = (O) ((TerminalConnection) obj).getWrappedRoadConnection();
} else if (obj instanceof WrapSegment) {
unwrapped = (O) ((WrapSegment) obj).getWrappedSe... | java |
@Pure
public UnitVectorProperty firstAxisProperty() {
if (this.raxis == null) {
this.raxis = new UnitVectorProperty(this, MathFXAttributeNames.FIRST_AXIS, getGeomFactory());
}
return this.raxis;
} | java |
@Pure
public ReadOnlyUnitVectorProperty secondAxisProperty() {
if (this.saxis == null) {
this.saxis = new ReadOnlyUnitVectorWrapper(this, MathFXAttributeNames.SECOND_AXIS, getGeomFactory());
this.saxis.bind(Bindings.createObjectBinding(() -> {
final Vector2dfx firstAxis = firstAxisProperty().get();
ret... | java |
public static String showInfoDialog(final Frame owner, final String message)
{
InfomationDialog mdialog;
String ok = "OK";
mdialog = new InfomationDialog(owner, "Information message", message, ok);
@SuppressWarnings("unlikely-arg-type")
final int index = mdialog.getVButtons().indexOf(ok);
final Button butt... | java |
@Override
protected HashMap readFile(HashMap brMap) throws IOException {
HashMap ret = new HashMap();
HashMap metaData = new HashMap();
ArrayList<HashMap> culArr = readCultivarData(brMap, metaData);
// compressData(sites);
ArrayList<HashMap> expArr = new ArrayList();
H... | java |
public static <LeftRightT> TypeConfusionInspector<LeftRightT> createOutputtingTo(
final String name,
final Function<? super LeftRightT, String> confusionLabeler,
final Equivalence<LeftRightT> confusionEquivalence,
final File outputDir) {
return new TypeConfusionInspector<LeftRightT>(name, co... | java |
@Pure
public double distanceToEnd(Point2D<?, ?> point, double width) {
final Point2d firstPoint = getPointAt(0);
final Point2d lastPoint = getPointAt(-1);
double d1 = firstPoint.getDistance(point);
double d2 = lastPoint.getDistance(point);
d1 -= width;
if (d1 < 0) {
d1 = 0;
}
d2 -= width;
if (d2 <... | java |
@Pure
public final int getNearestEndIndex(double x, double y, OutputParameter<Double> distance) {
final int count = getPointCount();
final Point2d firstPoint = getPointAt(0);
final Point2d lastPoint = getPointAt(count - 1);
final double d1 = Point2D.getDistancePointPoint(firstPoint.getX(), firstPoint.getY(), x... | java |
@Pure
public Point1d getNearestPosition(Point2D<?, ?> pos) {
Point2d pp = null;
final Vector2d v = new Vector2d();
double currentPosition = 0.;
double bestPosition = Double.NaN;
double bestDistance = Double.POSITIVE_INFINITY;
for (final Point2d p : points()) {
if (pp != null) {
double position = Seg... | java |
@Pure
public double getLength() {
if (this.length < 0) {
double segmentLength = 0;
for (final PointGroup group : groups()) {
Point2d previousPts = null;
for (final Point2d pts : group.points()) {
if (previousPts != null) {
segmentLength += previousPts.getDistance(pts);
}
previousPt... | java |
@Pure
public Segment1D<?, ?> getSubSegmentForDistance(double distance) {
final double rd = distance < 0. ? 0. : distance;
double onGoingDistance = 0.;
for (final PointGroup group : groups()) {
Point2d previousPts = null;
for (final Point2d pts : group.points()) {
if (previousPts != null) {
onGoing... | java |
@Pure
public final void toPath2D(Path2d path) {
// loop on parts and build the path to draw
boolean firstPoint;
for (final PointGroup grp : groups()) {
firstPoint = true;
for (final Point2d pts : grp) {
final double x = pts.getX();
final double y = pts.getY();
if (firstPoint) {
path.moveTo... | java |
public static boolean addPathToPath(RoadPath inside, RoadPath elements) {
RoadConnection first = elements.getFirstPoint();
RoadConnection last = elements.getLastPoint();
assert first != null;
assert last != null;
first = first.getWrappedRoadConnection();
last = last.getWrappedRoadConnection();
assert firs... | java |
@Pure
public boolean isConnectableTo(RoadPath path) {
assert path != null;
if (path.isEmpty()) {
return false;
}
RoadConnection first1 = getFirstPoint();
RoadConnection last1 = getLastPoint();
first1 = first1.getWrappedRoadConnection();
last1 = last1.getWrappedRoadConnection();
RoadConnection first2... | java |
@Pure
public RoadConnection getFirstCrossRoad() {
for (final RoadConnection pt : points()) {
if (pt.getConnectedSegmentCount() > 2) {
return pt;
}
}
return null;
} | java |
@Pure
public CrossRoad getFirstJunctionPoint() {
RoadConnection point = getFirstPoint();
double distance = 0;
RoadSegment beforeSegment = null;
RoadSegment afterSegment = null;
int beforeSegmentIndex = -1;
int afterSegmentIndex = -1;
boolean found = false;
if (point != null) {
int index = 0;
for ... | java |
public static String getFirstFreeBusLineName(BusNetwork network) {
if (network == null) {
return null;
}
int nb = network.getBusLineCount();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (network.getBusLine(name) != null);
return n... | java |
public boolean addBusItinerary(BusItinerary busItinerary) {
if (busItinerary == null) {
return false;
}
if (this.itineraries.indexOf(busItinerary) != -1) {
return false;
}
if (!this.itineraries.add(busItinerary)) {
return false;
}
final boolean isValidItinerary = busItinerary.isValidPrimitive();
... | java |
public void removeAllBusItineraries() {
for (final BusItinerary itinerary : this.itineraries) {
itinerary.setContainer(null);
itinerary.setEventFirable(true);
}
this.itineraries.clear();
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ALL_ITINERARIES_REMOVED,
null,
-1,
"shape"... | java |
public boolean removeBusItinerary(BusItinerary itinerary) {
final int index = this.itineraries.indexOf(itinerary);
if (index >= 0) {
return removeBusItinerary(index);
}
return false;
} | java |
public boolean removeBusItinerary(int index) {
try {
final BusItinerary busItinerary = this.itineraries.remove(index);
busItinerary.setContainer(null);
busItinerary.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ITINERARY_REMOVED,
busItinerary,
index,
... | java |
public BusItinerary getBusItinerary(UUID uuid) {
if (uuid == null) {
return null;
}
for (final BusItinerary busItinerary : this.itineraries) {
if (uuid.equals(busItinerary.getUUID())) {
return busItinerary;
}
}
return null;
} | java |
public BusItinerary getBusItinerary(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusItinerary itinerary : this.itineraries) {
if (cmp.compare(nam... | java |
@Override
public final Parameters load(final File configFile) throws IOException {
final Loading loading = new Loading();
loading.topLoad(configFile);
return Parameters.fromMap(loading.ret);
} | java |
@Override
@Pure
protected Class<?> findClass(final String name) throws ClassNotFoundException {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
@Override
public Class<?> run() throws ClassNotFoundException {
final String path = name.replace('.', '/').concat(".c... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.