code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
private static IndexEnvironment setupIndexer(File outputDirectory, int memory,
boolean storeDocs) throws Exception {
final IndexEnvironment env = new IndexEnvironment();
env.setMemory(memory * ONE_MEGABYTE);
final Specification spec = env.getFileClassSpec("trectext");
env.addFileClass(spec);
e... | java |
@SuppressWarnings("unchecked")
void registerConsumer(Inspector<? super OutT> subInspector) {
consumers.add((Inspector<OutT>) subInspector);
} | java |
@Pure
public static int classifies(AbstractGISTreeSetNode<?, ?> node, GeoLocation location) {
if (node.getZone() == IcosepQuadTreeZone.ICOSEP) {
return classifiesIcocep(node.verticalSplit, node.horizontalSplit, location.toBounds2D());
}
return classifiesNonIcocep(node.verticalSplit, node.horizontalSplit, loca... | java |
@Pure
static boolean contains(int region, double cutX, double cutY, double pointX, double pointY) {
switch (IcosepQuadTreeZone.values()[region]) {
case SOUTH_WEST:
return pointX <= cutX && pointY <= cutY;
case SOUTH_EAST:
return pointX >= cutX && pointY <= cutY;
case NORTH_WEST:
return pointX <= cutX ... | java |
@Pure
private static boolean isOutsideNodeBuildingBounds(AbstractGISTreeSetNode<?, ?> node,
Rectangle2afp<?, ?, ?, ?, ?, ?> location) {
final Rectangle2d b2 = getNormalizedNodeBuildingBounds(node, location);
if (b2 == null) {
return false;
}
return Rectangle2afp.classifiesRectangleRectangle(
b2.getMi... | java |
private static Rectangle2d union(AbstractGISTreeSetNode<?, ?> node, Rectangle2afp<?, ?, ?, ?, ?, ?> shape) {
final Rectangle2d b = getNodeBuildingBounds(node);
b.setUnion(shape);
normalize(b, shape);
return b;
} | java |
@Pure
public static Rectangle2d getNodeBuildingBounds(AbstractGISTreeSetNode<?, ?> node) {
assert node != null;
final double w = node.nodeWidth / 2.;
final double h = node.nodeHeight / 2.;
final IcosepQuadTreeZone zone = node.getZone();
final double lx;
final double ly;
if (zone == null) {
// Is root ... | java |
private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
N createNode(N parent, IcosepQuadTreeZone region, GISTreeSetNodeFactory<P, N> builder) {
Rectangle2d area = parent.getAreaBounds();
if (region == IcosepQuadTreeZone.ICOSEP) {
return builder.newNode(
IcosepQuadTreeZone.ICOSEP... | java |
private static Rectangle2d
computeIcosepSubarea(IcosepQuadTreeZone region, Rectangle2d area) {
if (area == null || area.isEmpty()) {
return area;
}
final double demiWidth = area.getWidth() / 2.;
final double demiHeight = area.getHeight() / 2.;
switch (region) {
case ICOSEP:
return area;
case SOUTH... | java |
private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
Point2d computeCutPoint(IcosepQuadTreeZone region, N parent) {
final double w = parent.nodeWidth / 4.;
final double h = parent.nodeHeight / 4.;
final double x;
final double y;
switch (region) {
case SOUTH_WEST:
x = parent.v... | java |
private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
N rearrangeTree(AbstractGISTreeSet<P, N> tree, N node, Rectangle2afp<?, ?, ?, ?, ?, ?> desiredBounds,
GISTreeSetNodeFactory<P, N> builder) {
// Search for the node that completely contains the desired area
N topNode = node.getPare... | java |
protected synchronized void addShapeGeometryChangeListener(ShapeGeometryChangeListener listener) {
assert listener != null : AssertMessages.notNullParameter();
if (this.geometryListeners == null) {
this.geometryListeners = new WeakArrayList<>();
}
this.geometryListeners.add(listener);
} | java |
protected synchronized void removeShapeGeometryChangeListener(ShapeGeometryChangeListener listener) {
assert listener != null : AssertMessages.notNullParameter();
if (this.geometryListeners != null) {
this.geometryListeners.remove(listener);
if (this.geometryListeners.isEmpty()) {
this.geometryListeners =... | java |
protected synchronized void fireGeometryChange() {
if (this.geometryListeners == null) {
return;
}
final ShapeGeometryChangeListener[] array = new ShapeGeometryChangeListener[this.geometryListeners.size()];
this.geometryListeners.toArray(array);
for (final ShapeGeometryChangeListener listener : array) {
... | java |
protected void setupListeners() {
addDrawingListener(new DrawingListener() {
private long time;
@Override
public void onDrawingStart() {
this.time = System.currentTimeMillis();
getCorner().setColor(Color.ORANGERED);
}
@Override
public void onDrawingEnd() {
getCorner().setColor(null);
... | java |
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity", "checkstyle:nestedifdepth"})
protected void setupMousing() {
final ZoomableCanvas<T> canvas = getDocumentCanvas();
canvas.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
this.pressX = e.getX();
this.pressY = e.getY();
thi... | java |
protected void setupKeying() {
setOnKeyPressed(event -> {
switch (event.getCode()) {
case LEFT:
moveLeft(event.isShiftDown(), event.isControlDown(), false);
event.consume();
break;
case RIGHT:
moveRight(event.isShiftDown(), event.isControlDown(), false);
event.consume();
break;
cas... | java |
public void moveLeft(boolean isUnit, boolean isLarge, boolean isVeryLarge) {
double inc = isUnit ? this.hbar.getUnitIncrement()
: (isLarge ? LARGE_MOVE_FACTOR
: (isVeryLarge ? VERY_LARGE_MOVE_FACTOR : STANDARD_MOVE_FACTOR)) * this.hbar.getBlockIncrement();
if (!isInvertedAxisX()) {
inc = -inc;
}
th... | java |
public void moveUp(boolean isUnit, boolean isLarge, boolean isVeryLarge) {
double inc = isUnit ? this.vbar.getUnitIncrement()
: (isLarge ? LARGE_MOVE_FACTOR
: (isVeryLarge ? VERY_LARGE_MOVE_FACTOR : STANDARD_MOVE_FACTOR)) * this.vbar.getBlockIncrement();
if (!isInvertedAxisY()) {
inc = -inc;
}
this... | java |
public ObjectProperty<Logger> loggerProperty() {
if (this.logger == null) {
this.logger = new SimpleObjectProperty<Logger>(this, LOGGER_PROPERTY, Logger.getLogger(getClass().getName())) {
@Override
protected void invalidated() {
final Logger log = get();
if (log == null) {
set(Logger.getLog... | java |
public ObjectProperty<MouseButton> panButtonProperty() {
if (this.panButton == null) {
this.panButton = new StyleableObjectProperty<MouseButton>(DEFAULT_PAN_BUTTON) {
@SuppressWarnings("synthetic-access")
@Override
protected void invalidated() {
final MouseButton button = get();
if (button ==... | java |
public DoubleProperty panSensitivityProperty() {
if (this.panSensitivity == null) {
this.panSensitivity = new StyleableDoubleProperty(DEFAULT_PAN_SENSITIVITY) {
@Override
public void invalidated() {
if (get() <= MIN_PAN_SENSITIVITY) {
set(MIN_PAN_SENSITIVITY);
}
}
@Override
pub... | java |
public double getPanSensitivity(boolean unitSensitivityModifier, boolean hugeSensivityModifier) {
if (unitSensitivityModifier) {
return DEFAULT_PAN_SENSITIVITY;
}
final double sens = getPanSensitivity();
if (hugeSensivityModifier) {
return sens * LARGE_MOVE_FACTOR;
}
return sens;
} | java |
public static void setGlobalSplineApproximationRatio(Double distance) {
if (distance == null || Double.isNaN(distance.doubleValue())) {
globalSplineApproximation = GeomConstants.SPLINE_APPROXIMATION_RATIO;
} else {
globalSplineApproximation = Math.max(0, distance);
}
} | java |
public ESRIBounds createUnion(ESRIBounds bounds) {
final ESRIBounds eb = new ESRIBounds();
eb.minx = (bounds.minx < this.minx) ? bounds.minx : this.minx;
eb.maxx = (bounds.maxx < this.maxx) ? this.maxx : bounds.maxx;
eb.miny = (bounds.miny < this.miny) ? bounds.miny : this.miny;
eb.maxy = (bounds.maxy < this.... | java |
public void add(ESRIPoint point) {
if (point.getX() < this.minx) {
this.minx = point.getX();
}
if (point.getX() > this.maxx) {
this.maxx = point.getX();
}
if (point.getY() < this.miny) {
this.miny = point.getY();
}
if (point.getY() > this.maxy) {
this.maxy = point.getY();
}
if (point.getZ(... | java |
@Pure
public Rectangle2d toRectangle2d() {
final Rectangle2d bounds = new Rectangle2d();
bounds.setFromCorners(this.minx, this.miny, this.maxx, this.maxy);
return bounds;
} | java |
public void ensureMinMax() {
double t;
if (this.maxx < this.minx) {
t = this.minx;
this.minx = this.maxx;
this.maxx = t;
}
if (this.maxy < this.miny) {
t = this.miny;
this.miny = this.maxy;
this.maxy = t;
}
if (this.maxz < this.minz) {
t = this.minz;
this.minz = this.maxz;
this.ma... | java |
public ESRIBounds getBoundsFromHeader() {
try {
readHeader();
} catch (IOException exception) {
return null;
}
return new ESRIBounds(
this.minx, this.maxx,
this.miny, this.maxy,
this.minz, this.maxz,
this.minm, this.maxm);
} | java |
public E read() throws IOException {
boolean status = false;
try {
// Read header if not already read
readHeader();
// Read the records
E element;
try {
do {
element = readRecord(this.nextExpectedRecordIndex);
if (!postRecordReadingStage(element)) {
element = null;
}
+... | java |
protected void setReadingPosition(int recordIndex, int byteIndex) throws IOException {
if (this.seekEnabled) {
this.nextExpectedRecordIndex = recordIndex;
this.buffer.position(byteIndex);
} else {
throw new SeekOperationDisabledException();
}
} | java |
protected void ensureAvailableBytes(int amount) throws IOException {
if (!this.seekEnabled && amount > this.buffer.remaining()) {
this.bufferPosition += this.buffer.position();
this.buffer.compact();
int limit = this.buffer.position();
final int read = this.stream.read(this.buffer);
if (read < 0) {
... | java |
protected void skipBytes(int amount) throws IOException {
ensureAvailableBytes(amount);
this.buffer.position(this.buffer.position() + amount);
} | java |
@Pure
public Point2D<?, ?> predictTargetPosition(Point2D<?, ?> targetPosition, Vector2D<?, ?> targetLinearMotion) {
return new Point2d(
targetPosition.getX() + targetLinearMotion.getX() * this.predictionDuration,
targetPosition.getY() + targetLinearMotion.getY() * this.predictionDuration);
} | java |
protected void reconnect(Session session) {
if (this.hsClient.isStarted()) {
if (log.isDebugEnabled()) {
log.debug("Add reconnectRequest to connector "
+ session.getRemoteSocketAddress());
}
HandlerSocketSession hSession = (HandlerSocketSession) session;
InetSocketAddress addr = hSession.getRemo... | java |
public AStarSegmentReplacer<ST> setSegmentReplacer(AStarSegmentReplacer<ST> replacer) {
final AStarSegmentReplacer<ST> old = this.segmentReplacer;
this.segmentReplacer = replacer;
return old;
} | java |
public AStarSegmentOrientation<ST, PT> setSegmentOrientationTool(AStarSegmentOrientation<ST, PT> tool) {
final AStarSegmentOrientation<ST, PT> old = this.segmentOrientation;
this.segmentOrientation = tool;
return old;
} | java |
public AStarCostComputer<? super ST, ? super PT> setCostComputer(AStarCostComputer<? super ST, ? super PT> costComputer) {
final AStarCostComputer<? super ST, ? super PT> old = this.costComputer;
this.costComputer = costComputer;
return old;
} | java |
@Pure
protected double estimate(PT p1, PT p2) {
assert p1 != null && p2 != null;
if (this.heuristic == null) {
throw new IllegalStateException(Locale.getString("E1")); //$NON-NLS-1$
}
return this.heuristic.evaluate(p1, p2);
} | java |
@Pure
protected double computeCostFor(ST segment) {
if (this.costComputer != null) {
return this.costComputer.computeCostFor(segment);
}
return segment.getLength();
} | java |
@SuppressWarnings({ "unchecked", "rawtypes" })
@Pure
protected GP newPath(PT startPoint, ST segment) {
if (this.pathFactory != null) {
return this.pathFactory.newPath(startPoint, segment);
}
try {
return (GP) new GraphPath(segment, startPoint);
} catch (Throwable e) {
throw new IllegalStateException(... | java |
protected boolean addToPath(GP path, ST segment) {
if (this.pathFactory != null) {
return this.pathFactory.addToPath(path, segment);
}
assert path != null;
assert segment != null;
try {
return path.add(segment);
} catch (Throwable e) {
throw new IllegalStateException(e);
}
} | java |
@Pure
protected ST replaceSegment(int index, ST segment) {
ST rep = null;
if (this.segmentReplacer != null) {
rep = this.segmentReplacer.replaceSegment(index, segment);
}
if (rep == null) {
rep = segment;
}
return rep;
} | java |
public static Vector2d convert(Tuple2D<?> tuple) {
if (tuple instanceof Vector2d) {
return (Vector2d) tuple;
}
return new Vector2d(tuple.getX(), tuple.getY());
} | java |
public boolean addBusLine(BusLine busLine) {
if (busLine == null) {
return false;
}
if (this.busLines.indexOf(busLine) != -1) {
return false;
}
if (!this.busLines.add(busLine)) {
return false;
}
final boolean isValidLine = busLine.isValidPrimitive();
busLine.setEventFirable(isEventFirable());
... | java |
public void removeAllBusLines() {
for (final BusLine busline : this.busLines) {
busline.setContainer(null);
busline.setEventFirable(true);
}
this.busLines.clear();
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ALL_LINES_REMOVED,
null,
-1,
"shape", //$NON-NLS-1$
null,
... | java |
public boolean removeBusLine(BusLine busLine) {
final int index = this.busLines.indexOf(busLine);
if (index >= 0) {
return removeBusLine(index);
}
return false;
} | java |
public boolean removeBusLine(String name) {
final Iterator<BusLine> iterator = this.busLines.iterator();
BusLine busLine;
int i = 0;
while (iterator.hasNext()) {
busLine = iterator.next();
if (name.equals(busLine.getName())) {
iterator.remove();
busLine.setContainer(null);
busLine.setEventFira... | java |
public boolean removeBusLine(int index) {
try {
final BusLine busLine = this.busLines.remove(index);
busLine.setContainer(null);
busLine.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.LINE_REMOVED,
busLine,
index,
"shape", //$NON-NLS-1$
null,
... | java |
@Pure
public BusLine getBusLine(UUID uuid) {
if (uuid == null) {
return null;
}
for (final BusLine busLine : this.busLines) {
if (uuid.equals(busLine.getUUID())) {
return busLine;
}
}
return null;
} | java |
@Pure
public BusLine getBusLine(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusLine busLine : this.busLines) {
if (cmp.compare(name, busLine.ge... | java |
public boolean addBusStop(BusStop busStop) {
if (busStop == null) {
return false;
}
if (this.validBusStops.contains(busStop)) {
return false;
}
if (ListUtil.contains(this.invalidBusStops, INVALID_STOP_COMPARATOR, busStop)) {
return false;
}
final boolean isValidPrimitive = busStop.isValidPrimiti... | java |
public void removeAllBusStops() {
for (final BusStop busStop : this.validBusStops) {
busStop.setContainer(null);
busStop.setEventFirable(true);
}
for (final BusStop busStop : this.invalidBusStops) {
busStop.setContainer(null);
busStop.setEventFirable(true);
}
this.validBusStops.clear();
this.inv... | java |
public boolean removeBusStop(BusStop busStop) {
if (this.validBusStops.remove(busStop)) {
busStop.setContainer(null);
busStop.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_REMOVED,
busStop,
-1,
"shape", //$NON-NLS-1$
null,
null));
ch... | java |
public boolean removeBusStop(String name) {
Iterator<BusStop> iterator;
BusStop busStop;
iterator = this.validBusStops.iterator();
while (iterator.hasNext()) {
busStop = iterator.next();
if (name.equals(busStop.getName())) {
iterator.remove();
busStop.setContainer(null);
busStop.setEventFirab... | java |
@Pure
public BusStop getBusStop(UUID id) {
if (id == null) {
return null;
}
for (final BusStop busStop : this.validBusStops) {
final UUID busid = busStop.getUUID();
if (id.equals(busid)) {
return busStop;
}
}
for (final BusStop busStop : this.invalidBusStops) {
final UUID busid = busStop.g... | java |
@Pure
public BusStop getBusStop(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusStop busStop : this.validBusStops) {
if (cmp.compare(name, busSt... | java |
@Pure
public Iterator<BusStop> getBusStopsIn(Rectangle2afp<?, ?, ?, ?, ?, ?> clipBounds) {
return Iterators.unmodifiableIterator(
this.validBusStops.iterator(clipBounds));
} | java |
@Pure
public BusStop getNearestBusStop(double x, double y) {
double distance = Double.POSITIVE_INFINITY;
BusStop bestStop = null;
double dist;
for (final BusStop stop : this.validBusStops) {
dist = stop.distance(x, y);
if (dist < distance) {
distance = dist;
bestStop = stop;
}
}
return b... | java |
private boolean addBusHub(BusHub hub) {
if (hub == null) {
return false;
}
if (this.validBusHubs.contains(hub)) {
return false;
}
if (ListUtil.contains(this.invalidBusHubs, INVALID_HUB_COMPARATOR, hub)) {
return false;
}
final boolean isValidPrimitive = hub.isValidPrimitive();
if (isValidPrim... | java |
public void removeAllBusHubs() {
for (final BusHub busHub : this.validBusHubs) {
busHub.setContainer(null);
busHub.setEventFirable(true);
}
for (final BusHub busHub : this.invalidBusHubs) {
busHub.setContainer(null);
busHub.setEventFirable(true);
}
this.validBusHubs.clear();
this.invalidBusHubs.... | java |
public boolean removeBusHub(BusHub busHub) {
if (this.validBusHubs.remove(busHub)) {
busHub.setContainer(null);
busHub.setEventFirable(true);
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.HUB_REMOVED,
busHub,
-1,
null,
null,
null));
checkPrimitiveValidity()... | java |
public boolean removeBusHub(String name) {
Iterator<BusHub> iterator;
BusHub busHub;
iterator = this.validBusHubs.iterator();
while (iterator.hasNext()) {
busHub = iterator.next();
if (name.equals(busHub.getName())) {
iterator.remove();
busHub.setContainer(null);
busHub.setEventFirable(true);... | java |
@Pure
public BusHub getBusHub(UUID uuid) {
if (uuid == null) {
return null;
}
for (final BusHub busHub : this.validBusHubs) {
if (uuid.equals(busHub.getUUID())) {
return busHub;
}
}
for (final BusHub busHub : this.invalidBusHubs) {
if (uuid.equals(busHub.getUUID())) {
return busHub;
}
... | java |
@Pure
public BusHub getBusHub(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusHub busHub : this.validBusHubs) {
if (cmp.compare(name, busHub.get... | java |
@Pure
public Iterator<BusHub> getBusHubsIn(Rectangle2afp<?, ?, ?, ?, ?, ?> clipBounds) {
return Iterators.unmodifiableIterator(
this.validBusHubs.iterator(clipBounds));
} | java |
public void setValue(Object instance, Object value) {
try {
setMethod.invoke(instance, value);
} catch (Exception e) {
throw new PropertyNotFoundException(klass, getType(), fieldName);
}
} | java |
public static Vector3dfx convert(Tuple3D<?> tuple) {
if (tuple instanceof Vector3dfx) {
return (Vector3dfx) tuple;
}
return new Vector3dfx(tuple.getX(), tuple.getY(), tuple.getZ());
} | java |
public void shuffleSelectedRightRowToLeftTableModel(final int selectedRow)
{
if (-1 < selectedRow)
{
final T row = rightTableModel.removeAt(selectedRow);
leftTableModel.add(row);
}
} | java |
public OffsetGroup startReferenceOffsetsForContentOffset(CharOffset contentOffset) {
return characterRegions().get(regionIndexContainingContentOffset(contentOffset))
.startOffsetGroupForPosition(contentOffset);
} | java |
public OffsetGroup endReferenceOffsetsForContentOffset(CharOffset contentOffset) {
return characterRegions().get(regionIndexContainingContentOffset(contentOffset))
.endOffsetGroupForPosition(contentOffset);
} | java |
public final Optional<UnicodeFriendlyString> referenceSubstringByContentOffsets(
final OffsetRange<CharOffset> contentOffsets) {
if (referenceString().isPresent()) {
return Optional.of(referenceString().get().substringByCodePoints(
OffsetGroupRange.from(
startReferenceOffsetsForC... | java |
@SuppressWarnings("checkstyle:localvariablename")
@Pure
public int getLatitudeMinute() {
double p = Math.abs(this.phi);
p = p - (int) p;
return (int) (p * 60.);
} | java |
@SuppressWarnings("checkstyle:localvariablename")
@Pure
public double getLatitudeSecond() {
double p = Math.abs(this.phi);
p = (p - (int) p) * 60.;
p = p - (int) p;
return p * 60.;
} | java |
@SuppressWarnings("checkstyle:localvariablename")
@Pure
public int getLongitudeMinute() {
double l = Math.abs(this.lambda);
l = l - (int) l;
return (int) (l * 60.);
} | java |
@SuppressWarnings("checkstyle:localvariablename")
@Pure
public double getLongitudeSecond() {
double p = Math.abs(this.lambda);
p = (p - (int) p) * 60.;
p = p - (int) p;
return p * 60.;
} | java |
public static void setPreferredStringRepresentation(GeodesicPositionStringRepresentation representation,
boolean useSymbolicDirection) {
final Preferences prefs = Preferences.userNodeForPackage(GeodesicPosition.class);
if (prefs != null) {
if (representation == null) {
prefs.remove("STRING_REPRESENTATION"... | java |
@Pure
public static GeodesicPositionStringRepresentation getPreferredStringRepresentation(boolean allowNullValue) {
final Preferences prefs = Preferences.userNodeForPackage(GeodesicPosition.class);
if (prefs != null) {
final String v = prefs.get("STRING_REPRESENTATION", null); //$NON-NLS-1$
if (v != null && ... | java |
@Pure
public static boolean getDirectionSymbolInPreferredStringRepresentation() {
final Preferences prefs = Preferences.userNodeForPackage(GeodesicPosition.class);
if (prefs != null) {
return prefs.getBoolean("SYMBOL_IN_STRING_REPRESENTATION", DEFAULT_SYMBOL_IN_STRING_REPRESENTATION); //$NON-NLS-1$
}
return... | java |
public synchronized void addForestListener(ForestListener listener) {
if (this.listeners == null) {
this.listeners = new ArrayList<>();
}
this.listeners.add(listener);
} | java |
public synchronized void removeForestListener(ForestListener listener) {
if (this.listeners != null) {
this.listeners.remove(listener);
if (this.listeners.isEmpty()) {
this.listeners = null;
}
}
} | java |
@SuppressWarnings("static-method")
@Provides
@Singleton
public Log4jIntegrationConfig getLog4jIntegrationConfig(ConfigurationFactory configFactory, Injector injector) {
final Log4jIntegrationConfig config = Log4jIntegrationConfig.getConfiguration(configFactory);
injector.injectMembers(config);
return config;
... | java |
@SuppressWarnings("static-method")
@Singleton
@Provides
public Logger provideRootLogger(ConfigurationFactory configFactory, Provider<Log4jIntegrationConfig> config) {
final Logger root = Logger.getRootLogger();
// Reroute JUL
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
f... | java |
@Override
protected void onInitializeComponents()
{
lpNoProxy = new JLayeredPane();
lpNoProxy.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
lpHostOrIpaddress = new JLayeredPane();
lpHostOrIpaddress.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
rdbtnManualProxyConfiguration ... | java |
@Pure
public static Iterator<BusItineraryHalt> getBusHalts(BusLine busLine) {
assert busLine != null;
return new LineHaltIterator(busLine);
} | java |
@Pure
public static Iterator<BusItineraryHalt> getBusHalts(BusNetwork busNetwork) {
assert busNetwork != null;
return new NetworkHaltIterator(busNetwork);
} | java |
protected Method getActionMethod(Class actionClass, String methodName)
throws NoSuchMethodException {
Method method;
try {
method = actionClass.getMethod(methodName, new Class[0]);
} catch (NoSuchMethodException e) {
// hmm -- OK, try doXxx instead
... | java |
private String cutYear(String str) {
if (str.length() > 3) {
return str.substring(str.length() - 3, str.length());
} else {
return str;
}
} | java |
@Override
public Point3d getPivot() {
Point3d pivot = this.cachedPivot == null ? null : this.cachedPivot.get();
if (pivot==null) {
pivot = getProjection(0., 0., 0.);
this.cachedPivot = new WeakReference<>(pivot);
}
return pivot;
} | java |
private static String decodeHTMLEntities(String string) {
if (string == null) {
return null;
}
try {
return URLDecoder.decode(string, Charset.defaultCharset().displayName());
} catch (UnsupportedEncodingException exception) {
return string;
}
} | java |
private static String encodeHTMLEntities(String string) {
if (string == null) {
return null;
}
try {
return URLEncoder.encode(string, Charset.defaultCharset().displayName());
} catch (UnsupportedEncodingException exception) {
return string;
}
} | java |
@Pure
@Inline(value = "URISchemeType.JAR.isURL($1)", imported = {URISchemeType.class})
public static boolean isJarURL(URL url) {
return URISchemeType.JAR.isURL(url);
} | java |
@Pure
public static URL getJarURL(URL url) {
if (!isJarURL(url)) {
return null;
}
String path = url.getPath();
final int idx = path.lastIndexOf(JAR_URL_FILE_ROOT);
if (idx >= 0) {
path = path.substring(0, idx);
}
try {
return new URL(path);
} catch (MalformedURLException exception) {
return... | java |
@Pure
public static File getJarFile(URL url) {
if (isJarURL(url)) {
final String path = url.getPath();
final int idx = path.lastIndexOf(JAR_URL_FILE_ROOT);
if (idx >= 0) {
return new File(decodeHTMLEntities(path.substring(idx + 1)));
}
}
return null;
} | java |
@Pure
public static boolean isCaseSensitiveFilenameSystem() {
switch (OperatingSystem.getCurrentOS()) {
case AIX:
case ANDROID:
case BSD:
case FREEBSD:
case NETBSD:
case OPENBSD:
case LINUX:
case SOLARIS:
case HPUX:
return true;
//$CASES-OMITTED$
default:
return false;
}
} | java |
@Pure
public static String extension(File filename) {
if (filename == null) {
return null;
}
final String largeBasename = largeBasename(filename);
final int idx = largeBasename.lastIndexOf(getFileExtensionCharacter());
if (idx <= 0) {
return ""; //$NON-NLS-1$
}
return largeBasename.substring(idx);
... | java |
@Pure
public static boolean hasExtension(File filename, String extension) {
if (filename == null) {
return false;
}
assert extension != null;
String extent = extension;
if (!"".equals(extent) && !extent.startsWith(EXTENSION_SEPARATOR)) { //$NON-NLS-1$
extent = EXTENSION_SEPARATOR + extent;
}
final ... | java |
@Pure
public static File getSystemConfigurationDirectoryFor(String software) {
if (software == null || "".equals(software)) { //$NON-NLS-1$
throw new IllegalArgumentException();
}
final OperatingSystem os = OperatingSystem.getCurrentOS();
if (os == OperatingSystem.ANDROID) {
return join(File.listRoots()[... | java |
@Pure
public static String getSystemSharedLibraryDirectoryNameFor(String software) {
final File f = getSystemSharedLibraryDirectoryFor(software);
if (f == null) {
return null;
}
return f.getAbsolutePath();
} | java |
@Pure
public static File convertStringToFile(String filename) {
if (filename == null || "".equals(filename)) { //$NON-NLS-1$
return null;
}
if (isWindowsNativeFilename(filename)) {
return normalizeWindowsNativeFilename(filename);
}
// Test for malformed filenames.
return new File(extractLocalPath(fil... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.