_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q14600 | SGraphSegment.setUserDataAt | train | public void setUserDataAt(int index, Object data) {
if (this.userData == null) {
throw new IndexOutOfBoundsException();
}
this.userData.set(index, data);
} | java | {
"resource": ""
} |
q14601 | SGraphSegment.getAllUserData | train | @Pure
public Collection<Object> getAllUserData() {
if (this.userData == null) {
return Collections.emptyList();
}
return Collections.unmodifiableCollection(this.userData);
} | java | {
"resource": ""
} |
q14602 | UsageProvider.displayUsage | train | public static void displayUsage(String cmdLineSyntax, Options options) {
HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.printHelp(cmdLineSyntax, options);
} | java | {
"resource": ""
} |
q14603 | DrawMessage.initGraphics2D | train | private Graphics2D initGraphics2D(final Graphics g)
{
Graphics2D g2;
g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2.setColor(this.color);
return g2;
} | java | {
"resource": ""
} |
q14604 | StringToEnum.decode | train | @Override
public T decode(final String s) {
checkNotNull(s);
try {
return Enum.valueOf(type, s);
} catch (final IllegalArgumentException ignored) {
}
try {
return Enum.valueOf(type, s.toUpperCase());
} catch (final IllegalArgumentException ignored) {
}
try {
return Enum.valueOf(type, s.toLowerCase());
} catch (final IllegalArgumentException ignored) {
}
throw new ConversionException(
"Unable to instantiate a " + type + " from value " + s + ". Valid values: " + Joiner
.on(", ").join(EnumSet.allOf(type)));
} | java | {
"resource": ""
} |
q14605 | GraphIterationElementComparator.compareConnections | train | @Pure
protected int compareConnections(PT p1, PT p2) {
assert p1 != null && p2 != null;
return p1.hashCode() - p2.hashCode();
} | java | {
"resource": ""
} |
q14606 | GenericShuffleJXTable.addAllLeftRowsToRightTable | train | public void addAllLeftRowsToRightTable()
{
rightTable.getGenericTableModel().addList(leftTable.getGenericTableModel().getData());
leftTable.getGenericTableModel().clear();
} | java | {
"resource": ""
} |
q14607 | GenericShuffleJXTable.addAllRightRowsToLeftTable | train | public void addAllRightRowsToLeftTable()
{
leftTable.getGenericTableModel().addList(rightTable.getGenericTableModel().getData());
rightTable.getGenericTableModel().clear();
} | java | {
"resource": ""
} |
q14608 | GenericShuffleJXTable.shuffleSelectedLeftRowsToRightTable | train | public void shuffleSelectedLeftRowsToRightTable()
{
final int[] selectedRows = leftTable.getSelectedRows();
final int lastIndex = selectedRows.length - 1;
for (int i = lastIndex; -1 < i; i--)
{
final int selectedRow = selectedRows[i];
final T row = leftTable.getGenericTableModel().removeAt(selectedRow);
rightTable.getGenericTableModel().add(row);
}
} | java | {
"resource": ""
} |
q14609 | OptionsFileLoader.loadOptions | train | public static List<String> loadOptions(String optionFileName) {
List<String> args = new ArrayList<String>();
File optionFile = new File(optionFileName);
StringWriter stringWriter = new StringWriter();
try {
InputStream inputStream = new FileInputStream(optionFile);
IOUtils.copy(inputStream, stringWriter);
} catch (FileNotFoundException e) {
System.err.println("Error reading options file: " + e.getMessage());
System.exit(1);
} catch (IOException e) {
System.err.println("Error reading options file: " + e.getMessage());
System.exit(1);
}
String string = stringWriter.toString();
StringTokenizer stringTokenizer = new StringTokenizer(string);
while (stringTokenizer.hasMoreTokens()) {
args.add(stringTokenizer.nextToken());
}
return args;
} | java | {
"resource": ""
} |
q14610 | ShapeFileFilter.isShapeFile | train | @Pure
public static boolean isShapeFile(URL file) {
return FileType.isContentType(
file,
MimeName.MIME_SHAPE_FILE.getMimeConstant());
} | java | {
"resource": ""
} |
q14611 | SynopsisHelpGeneratorModule.provideHelpGenerator | train | @SuppressWarnings("static-method")
@Provides
@Singleton
public HelpGenerator provideHelpGenerator(
ApplicationMetadata metadata, Injector injector, Terminal terminal) {
int maxColumns = terminal.getColumns();
if (maxColumns < TTY_MIN_COLUMNS) {
maxColumns = TTY_DEFAULT_COLUMNS;
}
String argumentSynopsis;
try {
argumentSynopsis = injector.getInstance(Key.get(String.class, ApplicationArgumentSynopsis.class));
} catch (Exception exception) {
argumentSynopsis = null;
}
String detailedDescription;
try {
detailedDescription = injector.getInstance(Key.get(String.class, ApplicationDetailedDescription.class));
} catch (Exception exception) {
detailedDescription = null;
}
return new SynopsisHelpGenerator(metadata, argumentSynopsis, detailedDescription, maxColumns);
} | java | {
"resource": ""
} |
q14612 | ZoomableCanvas.getDocumentGraphicsContext2D | train | public ZoomableGraphicsContext getDocumentGraphicsContext2D() {
if (this.documentGraphicsContext == null) {
final CenteringTransform transform = new CenteringTransform(
invertedAxisXProperty(),
invertedAxisYProperty(),
viewportBoundsProperty());
this.documentGraphicsContext = new ZoomableGraphicsContext(
getGraphicsContext2D(),
scaleValueProperty(),
documentBoundsProperty(),
viewportBoundsProperty(),
widthProperty(),
heightProperty(),
drawableElementBudgetProperty(),
transform);
}
return this.documentGraphicsContext;
} | java | {
"resource": ""
} |
q14613 | ZoomableCanvas.fireDrawingStart | train | protected void fireDrawingStart() {
final ListenerCollection<EventListener> list = this.listeners;
if (list != null) {
for (final DrawingListener listener : list.getListeners(DrawingListener.class)) {
listener.onDrawingStart();
}
}
} | java | {
"resource": ""
} |
q14614 | ZoomableCanvas.fireDrawingEnd | train | protected void fireDrawingEnd() {
final ListenerCollection<EventListener> list = this.listeners;
if (list != null) {
for (final DrawingListener listener : list.getListeners(DrawingListener.class)) {
listener.onDrawingEnd();
}
}
} | java | {
"resource": ""
} |
q14615 | BusLayerConstants.getPreferredLineDrawAlgorithm | train | @Pure
public static BusLayerDrawerType getPreferredLineDrawAlgorithm() {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
final String algo = prefs.get("DRAWING_ALGORITHM", null); //$NON-NLS-1$
if (algo != null && algo.length() > 0) {
try {
return BusLayerDrawerType.valueOf(algo);
} catch (Throwable exception) {
//
}
}
}
return BusLayerDrawerType.OVERLAP;
} | java | {
"resource": ""
} |
q14616 | BusLayerConstants.setPreferredLineDrawingAlgorithm | train | public static void setPreferredLineDrawingAlgorithm(BusLayerDrawerType algorithm) {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
if (algorithm == null) {
prefs.remove("DRAWING_ALGORITHM"); //$NON-NLS-1$
} else {
prefs.put("DRAWING_ALGORITHM", algorithm.name()); //$NON-NLS-1$
}
}
} | java | {
"resource": ""
} |
q14617 | BusLayerConstants.getSelectionColor | train | @Pure
public static int getSelectionColor() {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
final String str = prefs.get("SELECTION_COLOR", null); //$NON-NLS-1$
if (str != null) {
try {
return Integer.valueOf(str);
} catch (Throwable exception) {
//
}
}
}
return DEFAULT_SELECTION_COLOR;
} | java | {
"resource": ""
} |
q14618 | BusLayerConstants.setSelectionColor | train | public static void setSelectionColor(Integer color) {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
if (color == null || color == DEFAULT_SELECTION_COLOR) {
prefs.remove("SELECTION_COLOR"); //$NON-NLS-1$
} else {
prefs.put("SELECTION_COLOR", color.toString()); //$NON-NLS-1$
}
try {
prefs.flush();
} catch (BackingStoreException exception) {
//
}
}
} | java | {
"resource": ""
} |
q14619 | BusLayerConstants.isBusStopDrawable | train | @Pure
public static boolean isBusStopDrawable() {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
return prefs.getBoolean("DRAW_BUS_STOPS", DEFAULT_BUS_STOP_DRAWING); //$NON-NLS-1$
}
return DEFAULT_BUS_STOP_DRAWING;
} | java | {
"resource": ""
} |
q14620 | BusLayerConstants.isBusStopNamesDrawable | train | @Pure
public static boolean isBusStopNamesDrawable() {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
return prefs.getBoolean("DRAW_BUS_STOPS_NAMES", DEFAULT_BUS_STOP_NAMES_DRAWING); //$NON-NLS-1$
}
return DEFAULT_BUS_STOP_NAMES_DRAWING;
} | java | {
"resource": ""
} |
q14621 | BusLayerConstants.setBusStopNamesDrawable | train | public static void setBusStopNamesDrawable(Boolean isNamesDrawable) {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
if (isNamesDrawable == null) {
prefs.remove("DRAW_BUS_STOPS_NAMES"); //$NON-NLS-1$
} else {
prefs.putBoolean("DRAW_BUS_STOPS_NAMES", isNamesDrawable.booleanValue()); //$NON-NLS-1$
}
try {
prefs.sync();
} catch (BackingStoreException exception) {
//
}
}
} | java | {
"resource": ""
} |
q14622 | BusLayerConstants.isBusStopNoHaltBindingDrawable | train | @Pure
public static boolean isBusStopNoHaltBindingDrawable() {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
return prefs.getBoolean("DRAW_NO_BUS_HALT_BIND", DEFAULT_NO_BUS_HALT_BIND); //$NON-NLS-1$
}
return DEFAULT_NO_BUS_HALT_BIND;
} | java | {
"resource": ""
} |
q14623 | BusLayerConstants.setBusStopNoHaltBindingDrawable | train | public static void setBusStopNoHaltBindingDrawable(Boolean isDrawable) {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
if (isDrawable == null) {
prefs.remove("DRAW_NO_BUS_HALT_BIND"); //$NON-NLS-1$
} else {
prefs.putBoolean("DRAW_NO_BUS_HALT_BIND", isDrawable.booleanValue()); //$NON-NLS-1$
}
try {
prefs.sync();
} catch (BackingStoreException exception) {
//
}
}
} | java | {
"resource": ""
} |
q14624 | BusLayerConstants.isBusStopNoHaltBindingNamesDrawable | train | @Pure
public static boolean isBusStopNoHaltBindingNamesDrawable() {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
return prefs.getBoolean("DRAW_NO_BUS_HALT_BIND_NAMES", DEFAULT_NO_BUS_HALT_BIND_NAMES); //$NON-NLS-1$
}
return DEFAULT_NO_BUS_HALT_BIND_NAMES;
} | java | {
"resource": ""
} |
q14625 | BusLayerConstants.isAttributeExhibitable | train | @Pure
public static boolean isAttributeExhibitable() {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
return prefs.getBoolean("EXHIBIT_ATTRIBUTES", DEFAULT_ATTRIBUTE_EXHIBITION); //$NON-NLS-1$
}
return DEFAULT_ATTRIBUTE_EXHIBITION;
} | java | {
"resource": ""
} |
q14626 | BusLayerConstants.setAttributeExhibitable | train | public static void setAttributeExhibitable(Boolean isExhibit) {
final Preferences prefs = Preferences.userNodeForPackage(BusLayerConstants.class);
if (prefs != null) {
if (isExhibit == null) {
prefs.remove("EXHIBIT_ATTRIBUTES"); //$NON-NLS-1$
} else {
prefs.putBoolean("EXHIBIT_ATTRIBUTES", isExhibit.booleanValue()); //$NON-NLS-1$
}
try {
prefs.sync();
} catch (BackingStoreException exception) {
//
}
}
} | java | {
"resource": ""
} |
q14627 | JsonLdModule.configure | train | public JsonLdModule configure(ConfigParam param, String value) {
Objects.requireNonNull(param);
configuration.set(param, value);
return this;
} | java | {
"resource": ""
} |
q14628 | QuadTreeNode.setFirstChild | train | public boolean setFirstChild(N newChild) {
final N oldChild = this.nNorthWest;
if (oldChild == newChild) {
return false;
}
if (oldChild != null) {
oldChild.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(0, oldChild);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
this.nNorthWest = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(0, newChild);
}
return true;
} | java | {
"resource": ""
} |
q14629 | QuadTreeNode.setSecondChild | train | public boolean setSecondChild(N newChild) {
final N oldChild = this.nNorthEast;
if (oldChild == newChild) {
return false;
}
if (oldChild != null) {
oldChild.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(1, oldChild);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
this.nNorthEast = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(1, newChild);
}
return true;
} | java | {
"resource": ""
} |
q14630 | QuadTreeNode.setThirdChild | train | public boolean setThirdChild(N newChild) {
final N oldChild = this.nSouthWest;
if (oldChild == newChild) {
return false;
}
if (oldChild != null) {
oldChild.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(2, oldChild);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
this.nSouthWest = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(2, newChild);
}
return true;
} | java | {
"resource": ""
} |
q14631 | QuadTreeNode.setFourthChild | train | public boolean setFourthChild(N newChild) {
final N oldChild = this.nSouthEast;
if (oldChild == newChild) {
return false;
}
if (oldChild != null) {
oldChild.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(3, oldChild);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
this.nSouthEast = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(3, newChild);
}
return true;
} | java | {
"resource": ""
} |
q14632 | QuadTreeNode.setChildAt | train | public boolean setChildAt(QuadTreeZone zone, N newChild) {
switch (zone) {
case NORTH_WEST:
return setFirstChild(newChild);
case NORTH_EAST:
return setSecondChild(newChild);
case SOUTH_WEST:
return setThirdChild(newChild);
case SOUTH_EAST:
return setFourthChild(newChild);
default:
}
return false;
} | java | {
"resource": ""
} |
q14633 | Path3dfx.remove | train | @SuppressWarnings({"checkstyle:magicnumber", "checkstyle:cyclomaticcomplexity"})
public boolean remove(Point3D<?, ?> point) {
if (this.types != null && !this.types.isEmpty() && this.coords != null && !this.coords.isEmpty()) {
for (int i = 0, j = 0; i < this.coords.size() && j < this.types.size(); j++) {
final Point3dfx currentPoint = this.coords.get(i);
switch (this.types.get(j)) {
case MOVE_TO:
//$FALL-THROUGH$
case LINE_TO:
if (point.equals(currentPoint)) {
this.coords.remove(i);
this.types.remove(j);
return true;
}
i++;
break;
case CURVE_TO:
final Point3dfx p2 = this.coords.get(i + 1);
final Point3dfx p3 = this.coords.get(i + 2);
if ((point.equals(currentPoint))
|| (point.equals(p2))
|| (point.equals(p3))) {
this.coords.remove(i, i + 3);
this.types.remove(j);
return true;
}
i += 3;
break;
case QUAD_TO:
final Point3dfx pt = this.coords.get(i + 1);
if ((point.equals(currentPoint))
|| (point.equals(pt))) {
this.coords.remove(i, i + 2);
this.types.remove(j);
return true;
}
i += 2;
break;
case ARC_TO:
throw new IllegalStateException();
//$CASES-OMITTED$
default:
break;
}
}
}
return false;
} | java | {
"resource": ""
} |
q14634 | EDLLoader.loadEDLMentionsByDocFrom | train | public ImmutableListMultimap<Symbol, EDLMention> loadEDLMentionsByDocFrom(CharSource source) throws IOException {
final ImmutableList<EDLMention> edlMentions = loadEDLMentionsFrom(source);
final ImmutableListMultimap.Builder<Symbol, EDLMention> byDocs =
ImmutableListMultimap.<Symbol, EDLMention>builder()
.orderKeysBy(SymbolUtils.byStringOrdering());
for (final EDLMention edlMention : edlMentions) {
byDocs.put(edlMention.documentID(), edlMention);
}
return byDocs.build();
} | java | {
"resource": ""
} |
q14635 | DssatControllerOutput.writeSingleExp | train | private void writeSingleExp(String arg0, Map result, DssatCommonOutput output, String file) {
futFiles.put(file, executor.submit(new DssatTranslateRunner(output, result, arg0)));
} | java | {
"resource": ""
} |
q14636 | Vector3i.convert | train | public static Vector3i convert(Tuple3D<?> tuple) {
if (tuple instanceof Vector3i) {
return (Vector3i) tuple;
}
return new Vector3i(tuple.getX(), tuple.getY(), tuple.getZ());
} | java | {
"resource": ""
} |
q14637 | BusHub.getFirstFreeBusHubName | train | @Pure
public static String getFirstFreeBusHubName(BusNetwork busnetwork) {
int nb = busnetwork.getBusHubCount();
String name;
do {
++nb;
name = Locale.getString(
"NAME_TEMPLATE", //$NON-NLS-1$
Integer.toString(nb));
}
while (busnetwork.getBusHub(name) != null);
return name;
} | java | {
"resource": ""
} |
q14638 | BusHub.getGeoLocation | train | @Override
@Pure
public GeoLocation getGeoLocation() {
final Rectangle2d b = getBoundingBox();
if (b == null) {
return new GeoLocationNowhere(getUUID());
}
return new GeoLocationPoint(b.getCenterX(), b.getCenterY());
} | java | {
"resource": ""
} |
q14639 | BusHub.distance | train | @Pure
public double distance(double x, double y) {
double dist = Double.POSITIVE_INFINITY;
if (isValidPrimitive()) {
for (final BusStop stop : this.busStops) {
final double d = stop.distance(x, y);
if (!Double.isNaN(d) && d < dist) {
dist = d;
}
}
}
return Double.isInfinite(dist) ? Double.NaN : dist;
} | java | {
"resource": ""
} |
q14640 | BusHub.addBusStop | train | boolean addBusStop(BusStop busStop, boolean fireEvents) {
if (busStop == null) {
return false;
}
if (this.busStops.indexOf(busStop) != -1) {
return false;
}
if (!this.busStops.add(busStop)) {
return false;
}
busStop.addBusHub(this);
resetBoundingBox();
if (fireEvents) {
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_ADDED,
busStop,
this.busStops.size() - 1,
null,
null,
null));
checkPrimitiveValidity();
}
return true;
} | java | {
"resource": ""
} |
q14641 | BusHub.removeAllBusStops | train | public void removeAllBusStops() {
for (final BusStop busStop : this.busStops) {
busStop.removeBusHub(this);
}
this.busStops.clear();
resetBoundingBox();
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.ALL_STOPS_REMOVED,
null,
-1,
null,
null,
null));
checkPrimitiveValidity();
} | java | {
"resource": ""
} |
q14642 | BusHub.removeBusStop | train | public boolean removeBusStop(BusStop busStop) {
final int index = this.busStops.indexOf(busStop);
if (index >= 0) {
this.busStops.remove(index);
busStop.removeBusHub(this);
resetBoundingBox();
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_REMOVED,
busStop,
index,
null,
null,
null));
checkPrimitiveValidity();
return true;
}
return false;
} | java | {
"resource": ""
} |
q14643 | BusHub.busStopsArray | train | @Pure
public BusStop[] busStopsArray() {
return Collections.unmodifiableList(this.busStops).toArray(new BusStop[this.busStops.size()]);
} | java | {
"resource": ""
} |
q14644 | AbstractMapPointDrawer.defineSmallRectangle | train | protected void defineSmallRectangle(ZoomableGraphicsContext gc, T element) {
final double ptsSize = element.getPointSize() / 2.;
final double x = element.getX() - ptsSize;
final double y = element.getY() - ptsSize;
final double mx = element.getX() + ptsSize;
final double my = element.getY() + ptsSize;
gc.moveTo(x, y);
gc.lineTo(mx, y);
gc.lineTo(mx, my);
gc.lineTo(x, my);
gc.closePath();
} | java | {
"resource": ""
} |
q14645 | MapLayer.setUUID | train | @Override
public final void setUUID(UUID id) {
final UUID oldId = getUUID();
if ((oldId != null && !oldId.equals(id)) || (oldId == null && id != null)) {
super.setUUID(oldId);
fireElementChanged();
}
} | java | {
"resource": ""
} |
q14646 | MapLayer.addLayerListener | train | public final void addLayerListener(MapLayerListener listener) {
if (this.listeners == null) {
this.listeners = new ListenerCollection<>();
}
this.listeners.add(MapLayerListener.class, listener);
} | java | {
"resource": ""
} |
q14647 | MapLayer.removeLayerListener | train | public final void removeLayerListener(MapLayerListener listener) {
if (this.listeners != null) {
this.listeners.remove(MapLayerListener.class, listener);
if (this.listeners.isEmpty()) {
this.listeners = null;
}
}
} | java | {
"resource": ""
} |
q14648 | MapLayer.onAttributeChangeEvent | train | @Override
public void onAttributeChangeEvent(AttributeChangeEvent event) {
super.onAttributeChangeEvent(event);
fireLayerAttributeChangedEvent(new MapLayerAttributeChangeEvent(this, event));
fireElementChanged();
if (ATTR_VISIBLE.equals(event.getName())) {
final AttributeValue nValue = event.getValue();
boolean cvalue;
try {
cvalue = nValue.getBoolean();
} catch (Exception exception) {
cvalue = isVisible();
}
if (cvalue) {
final GISLayerContainer<?> container = getContainer();
if (container instanceof GISBrowsable) {
((GISBrowsable) container).setVisible(cvalue, false);
}
}
}
} | java | {
"resource": ""
} |
q14649 | MapLayer.isClickable | train | @Pure
public boolean isClickable() {
final AttributeValue val = getAttributeProvider().getAttribute(ATTR_CLICKABLE);
if (val != null) {
try {
return val.getBoolean();
} catch (AttributeException e) {
//
}
}
return true;
} | java | {
"resource": ""
} |
q14650 | MapLayer.isTemporaryLayer | train | @Pure
public final boolean isTemporaryLayer() {
MapLayer layer = this;
GISLayerContainer<?> container;
while (layer != null) {
if (layer.isTemp) {
return true;
}
container = layer.getContainer();
layer = container instanceof MapLayer ? (MapLayer) container : null;
}
return false;
} | java | {
"resource": ""
} |
q14651 | MapLayer.isRemovable | train | @Pure
public boolean isRemovable() {
final AttributeValue val = getAttributeProvider().getAttribute(ATTR_REMOVABLE);
if (val != null) {
try {
return val.getBoolean();
} catch (AttributeException e) {
//
}
}
return true;
} | java | {
"resource": ""
} |
q14652 | Sphere3d.setProperties | train | public void setProperties(Point3d center, DoubleProperty radius1) {
setProperties(center.xProperty,center.yProperty,center.zProperty, radius1);
} | java | {
"resource": ""
} |
q14653 | Sphere3d.getCenterWithoutProperties | train | @Pure
public Point3f getCenterWithoutProperties() {
return new Point3f(this.cxProperty.doubleValue(), this.cyProperty.doubleValue(), this.czProperty.doubleValue());
} | java | {
"resource": ""
} |
q14654 | Sphere3d.setCenterProperties | train | public void setCenterProperties(Point3d center) {
this.cxProperty = center.xProperty;
this.cyProperty = center.yProperty;
this.czProperty = center.zProperty;
} | java | {
"resource": ""
} |
q14655 | Sphere3d.setCenterProperties | train | public void setCenterProperties(DoubleProperty x, DoubleProperty y, DoubleProperty z) {
this.cxProperty = x;
this.cyProperty = y;
this.czProperty = z;
} | java | {
"resource": ""
} |
q14656 | Sphere3d.setRadiusProperty | train | public void setRadiusProperty(DoubleProperty radius1) {
this.radiusProperty = radius1;
this.radiusProperty.set(Math.abs(this.radiusProperty.get()));
} | java | {
"resource": ""
} |
q14657 | EREEventMention.typeFunction | train | public static Function<EREEventMention, TYPE> typeFunction() {
return new Function<EREEventMention, TYPE>() {
@Override
public TYPE apply(final EREEventMention input) {
return input.getType();
}
};
} | java | {
"resource": ""
} |
q14658 | BrowserControlExtensions.displayURLonStandardBrowser | train | public static Object displayURLonStandardBrowser(final Component parentComponent,
final String url)
{
Object obj = null;
try
{
if (System.getProperty(SYSTEM_PROPERTY_OS_NAME).startsWith(OS.MAC.getOs()))
{
obj = openURLinMacOS(url);
}
else if (System.getProperty(SYSTEM_PROPERTY_OS_NAME).startsWith(OS.WINDOWS.getOs()))
{
obj = openURLinWindowsOS(url);
}
else
{ // if operate syste is Unix or Linux
obj = openURLinUnixOS(url);
}
}
catch (final Exception e)
{
JOptionPane.showMessageDialog(parentComponent,
"An exception occured attempting to run the default web browser\n" + e.toString());
}
return obj;
} | java | {
"resource": ""
} |
q14659 | BrowserControlExtensions.openURLinMacOS | train | private static Object openURLinMacOS(final String url) throws ClassNotFoundException,
NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
final Class<?> fileManagerClass = Class.forName(MAC_FILE_MANAGER);
final Method openURL = fileManagerClass.getDeclaredMethod("openURL",
new Class[] { String.class });
return openURL.invoke(null, new Object[] { url });
} | java | {
"resource": ""
} |
q14660 | BrowserControlExtensions.openURLinUnixOS | train | private static Boolean openURLinUnixOS(final String url)
throws InterruptedException, IOException, Exception
{
Boolean executed = false;
for (final Browsers browser : Browsers.values())
{
if (!executed)
{
executed = Runtime.getRuntime()
.exec(new String[] { UNIX_COMMAND_WHICH, browser.getBrowserName() })
.waitFor() == 0;
if (executed)
{
Runtime.getRuntime().exec(new String[] { browser.getBrowserName(), url });
}
}
}
if (!executed)
{
throw new Exception(Arrays.toString(Browsers.values()));
}
return executed;
} | java | {
"resource": ""
} |
q14661 | BrowserControlExtensions.openURLinWindowsOS | train | private static Process openURLinWindowsOS(final String url) throws IOException
{
String cmd = null;
cmd = WINDOWS_PATH + " " + WINDOWS_FLAG + " ";
return Runtime.getRuntime().exec(cmd + url);
} | java | {
"resource": ""
} |
q14662 | TreeElementPanel.onInitializeGroupLayout | train | protected void onInitializeGroupLayout()
{
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup().addContainerGap()
.addComponent(scrTree, javax.swing.GroupLayout.PREFERRED_SIZE, 384,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
layout.setVerticalGroup(layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup().addContainerGap()
.addComponent(scrTree, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
.addContainerGap()));
} | java | {
"resource": ""
} |
q14663 | VersionProvider.displayVersionInfo | train | public static void displayVersionInfo(String command) {
String version = ProxyInitStrategy.class.getPackage()
.getImplementationVersion();
if (version == null) {
version = "N/A";
}
System.out.format("%s v. %s (%s)\n", command, version,
getAPIVersionString());
} | java | {
"resource": ""
} |
q14664 | AbstractOrientedBox3F.intersectsOrientedBoxCapsule | train | @Pure
public static boolean intersectsOrientedBoxCapsule(
double centerx,double centery,double centerz,
double axis1x, double axis1y, double axis1z,
double axis2x, double axis2y, double axis2z,
double axis3x, double axis3y, double axis3z,
double extentAxis1, double extentAxis2, double extentAxis3,
double capsule1Ax, double capsule1Ay, double capsule1Az, double capsule1Bx, double capsule1By, double capsule1Bz, double capsule1Radius) {
Point3f closestFromA = new Point3f();
Point3f closestFromB = new Point3f();
computeClosestFarestOBBPoints(
capsule1Ax, capsule1Ay, capsule1Az,
centerx, centery, centerz,
axis1x, axis1y, axis1z,
axis2x, axis2y, axis2z,
axis3x, axis3y, axis3z,
extentAxis1, extentAxis2, extentAxis3,
closestFromA, null);
computeClosestFarestOBBPoints(
capsule1Bx, capsule1By, capsule1Bz,
centerx, centery, centerz,
axis1x, axis1y, axis1z,
axis2x, axis2y, axis2z,
axis3x, axis3y, axis3z,
extentAxis1, extentAxis2, extentAxis3,
closestFromB,null);
double distance = AbstractSegment3F.distanceSquaredSegmentSegment(
capsule1Ax, capsule1Ay, capsule1Az,
capsule1Bx, capsule1By, capsule1Bz,
closestFromA.getX(), closestFromA.getY(), closestFromA.getZ(),
closestFromB.getX(), closestFromB.getY(), closestFromB.getZ());
return (distance <= (capsule1Radius * capsule1Radius));
} | java | {
"resource": ""
} |
q14665 | AbstractOrientedBox3F.setFromPointCloud | train | public void setFromPointCloud(Iterable<? extends Point3D> pointCloud) {
Vector3f r = new Vector3f();
Vector3f s = new Vector3f();
Vector3f t = new Vector3f();
Point3f c = new Point3f();
double[] extents = new double[3];
computeOBBCenterAxisExtents(
pointCloud,
r, s, t,
c,
extents);
set(c.getX(), c.getY(), c.getZ(),
r.getX(), r.getY(), r.getZ(),
s.getX(), s.getY(), s.getZ(),
extents[0], extents[1], extents[2]);
} | java | {
"resource": ""
} |
q14666 | AbstractOrientedBox3F.rotate | train | public void rotate(Quaternion rotation) {
Transform3D m = new Transform3D();
m.transform(this.getFirstAxis());
m.transform(this.getSecondAxis());
m.transform(this.getThirdAxis());
this.setFirstAxisExtent(this.getFirstAxis().length());
this.setSecondAxisExtent(this.getSecondAxis().length());
this.setThirdAxisExtent(this.getThirdAxis().length());
this.getFirstAxis().normalize();
this.getSecondAxis().normalize();
this.getThirdAxis().normalize();
} | java | {
"resource": ""
} |
q14667 | AbstractOrientedBox3F.rotate | train | public void rotate(Quaternion rotation, Point3D pivot) {
if (pivot!=null) {
// Change the center
Transform3D m1 = new Transform3D();
m1.setTranslation(-pivot.getX(), -pivot.getY(), -pivot.getZ());
Transform3D m2 = new Transform3D();
m2.setRotation(rotation);
Transform3D m3 = new Transform3D();
m3.setTranslation(pivot.getX(), pivot.getY(), pivot.getZ());
Transform3D r = new Transform3D();
r.mul(m1, m2);
r.mul(m3);
r.transform(this.getCenter());
}
rotate(rotation);
} | java | {
"resource": ""
} |
q14668 | AbstractMapPolylineDrawer.definePath | train | protected void definePath(ZoomableGraphicsContext gc, T element) {
gc.beginPath();
final PathIterator2afp<PathElement2d> pathIterator = element.toPath2D().getPathIterator();
switch (pathIterator.getWindingRule()) {
case EVEN_ODD:
gc.setFillRule(FillRule.EVEN_ODD);
break;
case NON_ZERO:
gc.setFillRule(FillRule.NON_ZERO);
break;
default:
throw new IllegalStateException();
}
while (pathIterator.hasNext()) {
final PathElement2d pelement = pathIterator.next();
switch (pelement.getType()) {
case LINE_TO:
gc.lineTo(pelement.getToX(), pelement.getToY());
break;
case MOVE_TO:
gc.moveTo(pelement.getToX(), pelement.getToY());
break;
case CLOSE:
gc.closePath();
break;
case CURVE_TO:
gc.bezierCurveTo(
pelement.getCtrlX1(), pelement.getCtrlY1(),
pelement.getCtrlX2(), pelement.getCtrlY2(),
pelement.getToX(), pelement.getToY());
break;
case QUAD_TO:
gc.quadraticCurveTo(
pelement.getCtrlX1(), pelement.getCtrlY1(),
pelement.getToX(), pelement.getToY());
break;
case ARC_TO:
//TODO: implements arcTo
gc.lineTo(pelement.getToX(), pelement.getToY());
break;
default:
break;
}
}
} | java | {
"resource": ""
} |
q14669 | BusStop.getFirstFreeBusStopName | train | @Pure
public static String getFirstFreeBusStopName(BusNetwork busNetwork) {
if (busNetwork == null) {
return null;
}
int nb = busNetwork.getBusStopCount();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (busNetwork.getBusStop(name) != null);
return name;
} | java | {
"resource": ""
} |
q14670 | BusStop.notifyDependencies | train | private void notifyDependencies() {
if (getContainer() != null) {
for (final BusHub hub : busHubs()) {
hub.checkPrimitiveValidity();
}
for (final BusItineraryHalt halt : getBindedBusHalts()) {
halt.checkPrimitiveValidity();
}
}
} | java | {
"resource": ""
} |
q14671 | BusStop.setPosition | train | public void setPosition(GeoLocationPoint position) {
if ((this.position == null && position != null)
|| (this.position != null && !this.position.equals(position))) {
this.position = position;
fireShapeChanged();
checkPrimitiveValidity();
}
} | java | {
"resource": ""
} |
q14672 | BusStop.distance | train | @Pure
public double distance(double x, double y) {
if (isValidPrimitive()) {
final GeoLocationPoint p = getGeoPosition();
return Point2D.getDistancePointPoint(p.getX(), p.getY(), x, y);
}
return Double.NaN;
} | java | {
"resource": ""
} |
q14673 | BusStop.distance | train | @Pure
public double distance(BusStop stop) {
if (isValidPrimitive() && stop.isValidPrimitive()) {
final GeoLocationPoint p = getGeoPosition();
final GeoLocationPoint p2 = stop.getGeoPosition();
return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY());
}
return Double.NaN;
} | java | {
"resource": ""
} |
q14674 | BusStop.addBusHub | train | void addBusHub(BusHub hub) {
if (this.hubs == null) {
this.hubs = new WeakArrayList<>();
}
this.hubs.add(hub);
} | java | {
"resource": ""
} |
q14675 | BusStop.removeBusHub | train | void removeBusHub(BusHub hub) {
if (this.hubs != null) {
this.hubs.remove(hub);
if (this.hubs.isEmpty()) {
this.hubs = null;
}
}
} | java | {
"resource": ""
} |
q14676 | BusStop.addBusHalt | train | void addBusHalt(BusItineraryHalt halt) {
if (this.halts == null) {
this.halts = new WeakArrayList<>();
}
this.halts.add(halt);
} | java | {
"resource": ""
} |
q14677 | BusStop.removeBusHalt | train | void removeBusHalt(BusItineraryHalt halt) {
if (this.halts != null) {
this.halts.remove(halt);
if (this.halts.isEmpty()) {
this.halts = null;
}
}
} | java | {
"resource": ""
} |
q14678 | BusStop.getBindedBusHalts | train | @Pure
public Iterable<BusItineraryHalt> getBindedBusHalts() {
if (this.halts == null) {
return Collections.emptyList();
}
return Collections.unmodifiableCollection(this.halts);
} | java | {
"resource": ""
} |
q14679 | Vector2ifx.convert | train | public static Vector2ifx convert(Tuple2D<?> tuple) {
if (tuple instanceof Vector2ifx) {
return (Vector2ifx) tuple;
}
return new Vector2ifx(tuple.getX(), tuple.getY());
} | java | {
"resource": ""
} |
q14680 | AttributeImpl.compareAttrs | train | @Pure
public static int compareAttrs(Attribute arg0, Attribute arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return 1;
}
if (arg1 == null) {
return -1;
}
final String n0 = arg0.getName();
final String n1 = arg1.getName();
final int cmp = compareAttrNames(n0, n1);
if (cmp == 0) {
return compareValues(arg0, arg1);
}
return cmp;
} | java | {
"resource": ""
} |
q14681 | AttributeImpl.compareAttrNames | train | @Pure
public static int compareAttrNames(String arg0, String arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return Integer.MAX_VALUE;
}
if (arg1 == null) {
return Integer.MIN_VALUE;
}
return arg0.compareToIgnoreCase(arg1);
} | java | {
"resource": ""
} |
q14682 | MapLayerAttributeChangeEvent.isTemporaryChange | train | @Pure
public boolean isTemporaryChange() {
final Object src = getSource();
if (src instanceof MapLayer) {
return ((MapLayer) src).isTemporaryLayer();
}
return false;
} | java | {
"resource": ""
} |
q14683 | SubGraph.getParentGraph | train | @Pure
protected final Graph<ST, PT> getParentGraph() {
return this.parentGraph == null ? null : this.parentGraph.get();
} | java | {
"resource": ""
} |
q14684 | SubGraph.build | train | public final void build(GraphIterator<ST, PT> iterator, SubGraphBuildListener<ST, PT> listener) {
assert iterator != null;
final Set<ComparableWeakReference<PT>> reachedPoints = new TreeSet<>();
GraphIterationElement<ST, PT> element;
ST segment;
PT point;
PT firstPoint = null;
this.parentGraph = new WeakReference<>(iterator.getGraph());
this.segments.clear();
this.pointNumber = 0;
this.terminalPoints.clear();
while (iterator.hasNext()) {
element = iterator.nextElement();
point = element.getPoint();
segment = element.getSegment();
// First reached segment
if (this.segments.isEmpty()) {
firstPoint = point;
}
this.segments.add(segment);
if (listener != null) {
listener.segmentAdded(this, element);
}
// Register terminal points
point = segment.getOtherSidePoint(point);
final ComparableWeakReference<PT> ref = new ComparableWeakReference<>(point);
if (element.isTerminalSegment()) {
if (!reachedPoints.contains(ref)) {
this.terminalPoints.add(ref);
if (listener != null) {
listener.terminalPointReached(this, point, segment);
}
}
} else {
this.terminalPoints.remove(ref);
reachedPoints.add(ref);
if (listener != null) {
listener.nonTerminalPointReached(this, point, segment);
}
}
}
if (firstPoint != null) {
final ComparableWeakReference<PT> ref = new ComparableWeakReference<>(firstPoint);
if (!reachedPoints.contains(ref)) {
this.terminalPoints.add(ref);
}
}
this.pointNumber = this.terminalPoints.size() + reachedPoints.size();
reachedPoints.clear();
} | java | {
"resource": ""
} |
q14685 | TreeDataEvent.getAddedValues | train | @Pure
public List<Object> getAddedValues() {
if (this.newValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.newValues);
} | java | {
"resource": ""
} |
q14686 | TreeDataEvent.getRemovedValues | train | @Pure
public List<Object> getRemovedValues() {
if (this.oldValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.oldValues);
} | java | {
"resource": ""
} |
q14687 | TreeDataEvent.getCurrentValues | train | @Pure
public List<Object> getCurrentValues() {
if (this.allValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.allValues);
} | java | {
"resource": ""
} |
q14688 | CollectionUtils.transformedCopy | train | public static <A, B> ImmutableMultiset<B> transformedCopy(Multiset<A> ms,
Function<A, B> func) {
final ImmutableMultiset.Builder<B> ret = ImmutableMultiset.builder();
for (final Multiset.Entry<A> entry : ms.entrySet()) {
final B transformedElement = func.apply(entry.getElement());
ret.addCopies(transformedElement, entry.getCount());
}
return ret.build();
} | java | {
"resource": ""
} |
q14689 | CollectionUtils.mutableTransformedCopy | train | public static <A, B> Multiset<B> mutableTransformedCopy(Multiset<A> ms,
Function<A, B> func) {
final Multiset<B> ret = HashMultiset.create();
for (final Multiset.Entry<A> entry : ms.entrySet()) {
final B transformedElement = func.apply(entry.getElement());
ret.add(transformedElement, entry.getCount());
}
return ret;
} | java | {
"resource": ""
} |
q14690 | CollectionUtils.allSameSize | train | public static boolean allSameSize(List<Collection<?>> collections) {
if (collections.isEmpty()) {
return true;
}
final int referenceSize = collections.get(0).size();
for (final Collection<?> col : collections) {
if (col.size() != referenceSize) {
return false;
}
}
return true;
} | java | {
"resource": ""
} |
q14691 | CollectionUtils.coerceNullToEmpty | train | public static <T> List<T> coerceNullToEmpty(List<T> list) {
return MoreObjects.firstNonNull(list, ImmutableList.<T>of());
} | java | {
"resource": ""
} |
q14692 | StringBindingListener.update | train | protected void update(DocumentEvent event)
{
String text;
try
{
text = event.getDocument().getText(event.getDocument().getStartPosition().getOffset(),
event.getDocument().getEndPosition().getOffset() - 1);
model.setObject(text);
}
catch (BadLocationException e1)
{
log.log(Level.SEVERE,
"some portion of the given range was not a valid part of the document. "
+ "The location in the exception is the first bad position encountered.",
e1);
}
} | java | {
"resource": ""
} |
q14693 | Android.makeAndroidApplicationName | train | @Pure
public static String makeAndroidApplicationName(String applicationName) {
final String fullName;
if (applicationName.indexOf('.') >= 0) {
fullName = applicationName;
} else {
fullName = "org.arakhne.partnership." + applicationName; //$NON-NLS-1$
}
return fullName;
} | java | {
"resource": ""
} |
q14694 | Android.getContextClassLoader | train | @Pure
public static ClassLoader getContextClassLoader() throws AndroidException {
synchronized (Android.class) {
final ClassLoader cl = (contextClassLoader == null) ? null : contextClassLoader.get();
if (cl != null) {
return cl;
}
}
final Object context = getContext();
try {
final Method method = context.getClass().getMethod("getClassLoader"); //$NON-NLS-1$
final Object classLoader = method.invoke(context);
final ClassLoader cl = (ClassLoader) classLoader;
synchronized (Android.class) {
contextClassLoader = new WeakReference<>(cl);
}
return cl;
} catch (Exception e) {
throw new AndroidException(e);
}
} | java | {
"resource": ""
} |
q14695 | DialogExtensions.showExceptionDialog | train | public static void showExceptionDialog(Exception exception, Component parentComponent,
String... additionalMessages)
{
String title = exception.getLocalizedMessage();
StringBuilder sb = new StringBuilder();
sb.append("<html><body width='650'>");
sb.append("<h2>");
sb.append(exception.getLocalizedMessage());
sb.append("</h2>");
sb.append("<p>");
sb.append(exception.getMessage());
Stream.of(additionalMessages).forEach(am -> sb.append("<p>" + am));
String htmlMessage = sb.toString();
JOptionPane.showMessageDialog(parentComponent, htmlMessage, title,
JOptionPane.ERROR_MESSAGE);
} | java | {
"resource": ""
} |
q14696 | BootstrapInspector.forSummarizer | train | @SuppressWarnings("unchecked")
public static <ObsT, SummaryT> Builder<ObsT, SummaryT> forSummarizer(
final ObservationSummarizer<? super ObsT, ? extends SummaryT> observationSummarizer,
int numSamples,
final Random rng) {
return new Builder<ObsT, SummaryT>(
(ObservationSummarizer<ObsT, SummaryT>) observationSummarizer, numSamples, rng);
} | java | {
"resource": ""
} |
q14697 | PrintConfigCommandModule.providePrintConfigCommand | train | @SuppressWarnings("static-method")
@Provides
@Singleton
public PrintConfigCommand providePrintConfigCommand(
Provider<BootLogger> bootLogger,
Provider<ModulesMetadata> modulesMetadata,
Injector injector) {
return new PrintConfigCommand(bootLogger, modulesMetadata, injector);
} | java | {
"resource": ""
} |
q14698 | MapElement.fireShapeChanged | train | protected final void fireShapeChanged() {
resetBoundingBox();
if (isEventFirable()) {
final GISElementContainer<?> container = getContainer();
if (container != null) {
container.onMapElementGraphicalAttributeChanged();
}
}
} | java | {
"resource": ""
} |
q14699 | MapElement.boundsIntersects | train | @Pure
protected final boolean boundsIntersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
final Rectangle2d bounds = getBoundingBox();
assert bounds != null;
return bounds.intersects(rectangle);
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.