code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Pure
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
public static AttributeValueImpl parse(String text) {
final AttributeValueImpl value = new AttributeValueImpl(text);
if (text != null && !text.isEmpty()) {
Object binValue;
for (final AttributeType type : AttributeType.values()) {
try {
bin... | java |
@Pure
public static int compareValues(AttributeValue arg0, AttributeValue arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return Integer.MAX_VALUE;
}
if (arg1 == null) {
return Integer.MIN_VALUE;
}
Object v0;
Object v1;
try {
v0 = arg0.getValue();
} catch (Exception except... | java |
@Pure
@SuppressWarnings({"unchecked", "rawtypes", "checkstyle:returncount", "checkstyle:npathcomplexity"})
private static int compareRawValues(Object arg0, Object arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return Integer.MAX_VALUE;
}
if (arg1 == null) {
return Integer.MIN_VALUE;
... | java |
protected void setInternalValue(Object value, AttributeType type) {
this.value = value;
this.assigned = this.value != null;
this.type = type;
} | java |
private static Date extractDate(String text, Locale locale) {
DateFormat fmt;
for (int style = 0; style <= 3; ++style) {
// Date and time parsing
for (int style2 = 0; style2 <= 3; ++style2) {
fmt = DateFormat.getDateTimeInstance(style, style2, locale);
try {
return fmt.parse(text);
} catch (P... | java |
@Pure
public static boolean isDbaseFile(File file) {
return FileType.isContentType(
file,
MimeName.MIME_DBASE_FILE.getMimeConstant());
} | java |
protected void stroke(ZoomableGraphicsContext gc, T element) {
final double radius = element.getRadius();
final double diameter = radius * radius;
final double minx = element.getX() - radius;
final double miny = element.getY() - radius;
gc.strokeOval(minx, miny, diameter, diameter);
} | java |
protected void fill(ZoomableGraphicsContext gc, T element) {
final double radius = element.getRadius();
final double diameter = radius * radius;
final double minx = element.getX() - radius;
final double miny = element.getY() - radius;
gc.fillOval(minx, miny, diameter, diameter);
} | java |
@Pure
public static String getFirstFreeBushaltName(BusItinerary busItinerary) {
if (busItinerary == null) {
return null;
}
int nb = busItinerary.size();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (busItinerary.getBusHalt(name) !=... | java |
public boolean setBusStop(BusStop busStop) {
final BusStop old = getBusStop();
if ((busStop == null && old != null)
|| (busStop != null && !busStop.equals(old))) {
if (old != null) {
old.removeBusHalt(this);
}
this.busStop = busStop == null ? null : new WeakReference<>(busStop);
if (busStop != nu... | java |
@Pure
public RoadSegment getRoadSegment() {
final BusItinerary itinerary = getContainer();
if (itinerary != null && this.roadSegmentIndex >= 0 && this.roadSegmentIndex < itinerary.getRoadSegmentCount()) {
return itinerary.getRoadSegmentAt(this.roadSegmentIndex);
}
return null;
} | java |
@Pure
public Direction1D getRoadSegmentDirection() {
final BusItinerary itinerary = getContainer();
if (itinerary != null && this.roadSegmentIndex >= 0 && this.roadSegmentIndex < itinerary.getRoadSegmentCount()) {
return itinerary.getRoadSegmentDirection(this.roadSegmentIndex);
}
return null;
} | java |
public void setType(BusItineraryHaltType type) {
if (type != null && type != this.type) {
this.type = type;
firePrimitiveChanged();
}
} | java |
@Pure
public boolean insideBusHub() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.insideBusHub();
}
return false;
} | java |
@Pure
public Iterable<BusHub> busHubs() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.busHubs();
}
return Collections.emptyList();
} | java |
@Pure
public Iterator<BusHub> busHubIterator() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.busHubIterator();
}
return Collections.emptyIterator();
} | java |
@Pure
public GeoLocationPoint getGeoPosition() {
final Point2d p = getPosition2D();
if (p != null) {
return new GeoLocationPoint(p.getX(), p.getY());
}
return null;
} | java |
@Pure
public double distanceToBusStop() {
final Point2d p1 = getPosition2D();
if (p1 != null) {
final BusStop stop = getBusStop();
if (stop != null) {
final Point2d p2 = stop.getPosition2D();
if (p2 != null) {
return p1.getDistance(p2);
}
}
}
return Double.NaN;
} | java |
@Pure
public double distance(Point2D<?, ?> point) {
assert point != null;
final GeoLocationPoint p = getGeoPosition();
if (p != null) {
return Point2D.getDistancePointPoint(p.getX(), p.getY(), point.getX(), point.getY());
}
return Double.NaN;
} | java |
@Pure
public double distance(BusItineraryHalt halt) {
assert halt != null;
final GeoLocationPoint p = getGeoPosition();
final GeoLocationPoint p2 = halt.getGeoPosition();
if (p != null && p2 != null) {
return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY());
}
return Double.NaN;
... | java |
@Pure
public double distance(BusStop busStop) {
assert busStop != null;
final GeoLocationPoint p = getGeoPosition();
final GeoLocationPoint p2 = busStop.getGeoPosition();
if (p != null && p2 != null) {
return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY());
}
return Double.NaN;
... | java |
public static <NodeT extends ConstituentNode<NodeT, ?>> HeadFinder<NodeT> createChinesePTBFromResources()
throws IOException {
final boolean headInitial = true;
final CharSource resource = Resources
.asCharSource(EnglishAndChineseHeadRules.class.getResource("ch_heads.sun.txt"),
Charset... | java |
public void write(Tree<?, ?> tree) throws IOException {
this.writer.append("digraph G"); //$NON-NLS-1$
this.writer.append(Integer.toString(this.graphIndex++));
this.writer.append(" {\n"); //$NON-NLS-1$
if (tree != null) {
// Write the node attributes
Iterator<? e... | java |
@Pure
public static boolean containsCapsulePoint(
double capsule1Ax, double capsule1Ay, double capsule1Az, double capsule1Bx, double capsule1By, double capsule1Bz, double capsule1Radius,
double px, double py, double pz) {
double distPointToCapsuleSegment = AbstractSegment3F.distanceSquaredSegmentPoint(
cap... | java |
@Pure
public static boolean intersectsCapsuleAlignedBox(
double mx1, double my1, double mz1,
double mx2, double my2, double mz2,
double radius,
double minx, double miny, double minz,
double maxx, double maxy, double maxz) {
Point3f closest1 = AlignedBox3f.computeClosestPoint(
minx, miny, minz, ma... | java |
@Pure
public static boolean intersectsCapsuleCapsule(
double capsule1Ax, double capsule1Ay, double capsule1Az, double capsule1Bx, double capsule1By, double capsule1Bz, double capsule1Radius,
double capsule2Ax, double capsule2Ay, double capsule2Az, double capsule2Bx, double capsule2By, double capsule2Bz, double c... | java |
protected void ensureAIsLowerPoint() {
CoordinateSystem3D cs = CoordinateSystem3D.getDefaultCoordinateSystem();
boolean swap = false;
if (cs.isZOnUp()) {
swap = (this.getMedial1().getZ() > this.getMedial2().getZ());
} else if (cs.isYOnUp()){
swap = (this.getMedial1().getY() > this.getMedial2().getY());
... | java |
public static Vector3ifx convert(Tuple3D<?> tuple) {
if (tuple instanceof Vector3ifx) {
return (Vector3ifx) tuple;
}
return new Vector3ifx(tuple.getX(), tuple.getY(), tuple.getZ());
} | java |
@Override
protected HashMap readFile(HashMap brMap) throws IOException {
HashMap ret = new HashMap();
ArrayList<HashMap> sites = readSoilSites(brMap, new HashMap());
// compressData(sites);
ret.put("soils", sites);
return ret;
} | java |
public static Point3d convert(Tuple3D<?> tuple) {
if (tuple instanceof Point3d) {
return (Point3d) tuple;
}
return new Point3d(tuple.getX(), tuple.getY(), tuple.getZ());
} | java |
@Pure
public final N getChildAt(OctTreeZone zone) {
if (zone != null) {
return getChildAt(zone.ordinal());
}
return null;
} | java |
@SuppressWarnings("checkstyle:magicnumber")
private boolean setChild6(N newChild) {
if (this.child6 == newChild) {
return false;
}
if (this.child6 != null) {
this.child6.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(5, this.child5);
}
if (newChild != nul... | java |
@SuppressWarnings("checkstyle:magicnumber")
private boolean setChild7(N newChild) {
if (this.child7 == newChild) {
return false;
}
if (this.child7 != null) {
this.child7.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(6, this.child7);
}
if (newChild != nul... | java |
@SuppressWarnings("checkstyle:magicnumber")
private boolean setChild8(N newChild) {
if (this.child8 == newChild) {
return false;
}
if (this.child8 != null) {
this.child8.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(7, this.child8);
}
if (newChild != nul... | java |
protected synchronized void executeMojo(File targetDir) throws MojoExecutionException {
if (this.generateTargets.contains(targetDir)
&& targetDir.isDirectory()) {
getLog().debug("Skiping " + targetDir + " because is was already generated"); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
this.generateTargets.add... | java |
@Pure
public static org.arakhne.afc.vmutil.caller.Caller getCaller() {
synchronized (Caller.class) {
if (caller == null) {
caller = new StackTraceCaller();
}
return caller;
}
} | java |
@Pure
public P getElementAt(int index) {
if (index >= 0 && index < this.referenceElementCount) {
int idx = 0;
for (final GridCellElement<P> element : this.elements) {
if (element.isReferenceCell(this)) {
if (idx == index) {
return element.get();
}
++idx;
}
}
}
throw new Inde... | java |
@Pure
public Iterator<P> iterator(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds) {
return new BoundsIterator<>(this.elements.iterator(), bounds);
} | java |
public boolean addElement(GridCellElement<P> element) {
if (element != null && this.elements.add(element)) {
if (element.addCellLink(this)) {
++this.referenceElementCount;
}
return true;
}
return false;
} | java |
public GridCellElement<P> removeElement(P element) {
final GridCellElement<P> elt = remove(element);
if (elt != null) {
if (elt.removeCellLink(this)) {
--this.referenceElementCount;
}
}
return elt;
} | java |
@SuppressWarnings({ "rawtypes" })
public MapElement getElementUnderMouse(GisPane<?> pane, double x, double y) {
final GISContainer model = pane.getDocumentModel();
final Point2d mousePosition = pane.toDocumentPosition(x, y);
final Rectangle2d selectionArea = pane.toDocumentRect(x - 2, y - 2, 5, 5);
return getE... | java |
protected E getSelectedEnumFromRadioButtons()
{
for (final E enumValue : this.radioButtonMap.keySet())
{
final JRadioButton btn = this.radioButtonMap.get(enumValue);
if (btn.isSelected())
{
return enumValue;
}
}
return null;
} | java |
private void setSelectedRadioButton(final E enumValue)
{
if (enumValue != null)
{
final JRadioButton radioButton = this.radioButtonMap.get(enumValue);
radioButton.setSelected(true);
}
else
{
for (final JRadioButton radioButton : this.radioButtonMap.values())
{
radioButton.setSelected(false);
... | java |
public static String toEnvironmentVariableName(String bootiqueVariable) {
if (Strings.isNullOrEmpty(bootiqueVariable)) {
return null;
}
final StringBuilder name = new StringBuilder();
final Pattern pattern = Pattern.compile("((?:[a-z0_9_]+)|(?:[A-Z]+[^A-Z]*))"); //$NON-NLS-1$
for (final String component : ... | java |
void processEvent(DelayQueue<Delayed> delayQueue) {
// wait for key to be signaled
WatchKey key;
try {
key = watcher.poll(250, TimeUnit.MILLISECONDS);
} catch (InterruptedException | ClosedWatchServiceException x) {
return;
}
if(key == null) {
return;
}
Path dir... | java |
public static BufferedImage concatenateImages(final List<BufferedImage> imgCollection,
final int width, final int height, final int imageType,
final Direction concatenationDirection)
{
final BufferedImage img = new BufferedImage(width, height, imageType);
int x = 0;
int y = 0;
for (final BufferedImage bi :... | java |
public static void createPdf(final OutputStream result, final List<BufferedImage> images)
throws DocumentException, IOException
{
final Document document = new Document();
PdfWriter.getInstance(document, result);
for (final BufferedImage image : images)
{
final ByteArrayOutputStream baos = new ByteArrayOu... | java |
public static byte[] resize(final BufferedImage originalImage, final Method scalingMethod,
final Mode resizeMode, final String formatName, final int targetWidth,
final int targetHeight)
{
try
{
final BufferedImage resizedImage = Scalr.resize(originalImage, scalingMethod,
resizeMode, targetWidth, targetH... | java |
public static byte[] resize(final BufferedImage originalImage, final String formatName,
final int targetWidth, final int targetHeight)
{
return resize(originalImage, Scalr.Method.QUALITY, Scalr.Mode.FIT_EXACT, formatName,
targetWidth, targetHeight);
} | java |
public static byte[] toByteArray(final BufferedImage bi, final String formatName)
throws IOException
{
try (ByteArrayOutputStream baos = new ByteArrayOutputStream())
{
ImageIO.write(bi, formatName, baos);
baos.flush();
final byte[] byteArray = baos.toByteArray();
return byteArray;
}
} | java |
@Pure
protected Rectangle2d calcBounds() {
final Rectangle2d bb = new Rectangle2d();
boolean first = true;
Rectangle2afp<?, ?, ?, ?, ?, ?> b;
// Child bounds
N child;
for (int i = 0; i < getChildCount(); ++i) {
child = getChildAt(i);
if (child != null) {
b = child.getBounds();
if (b != null)... | java |
public boolean setContainer(C container) {
this.mapContainer = container == null ? null : new WeakReference<>(container);
return true;
} | java |
@Pure
public Object getTopContainer() {
if (this.mapContainer == null) {
return null;
}
final C container = this.mapContainer.get();
if (container == null) {
return null;
}
if (container instanceof GISContentElement<?>) {
return ((GISContentElement<?>) container).getTopContainer();
}
return co... | java |
@Override
@Pure
public UUID getUUID() {
if (this.uid == null) {
this.uid = UUID.randomUUID();
}
return this.uid;
} | java |
@SuppressWarnings("checkstyle:npathcomplexity")
public static Node writeBusNetwork(BusNetwork busNetwork, XMLBuilder builder, XMLResources resources) throws IOException {
final Element element = builder.createElement(NODE_BUSNETWORK);
writeGISElementAttributes(element, busNetwork, builder, resources);
final Int... | java |
public static BusNetwork readBusNetwork(Element xmlNode, RoadNetwork roadNetwork,
PathBuilder pathBuilder, XMLResources resources) throws IOException {
final UUID id = getAttributeUUID(xmlNode, NODE_BUSNETWORK, ATTR_ID);
final BusNetwork busNetwork = new BusNetwork(id, roadNetwork);
final Node stopsNode = ge... | java |
public long readBELong() throws IOException {
return EndianNumbers.toBELong(read(), read(), read(), read(), read(), read(), read(), read());
} | java |
public long readLELong() throws IOException {
return EndianNumbers.toLELong(read(), read(), read(), read(), read(), read(), read(), read());
} | java |
@SuppressWarnings("unchecked")
@Pure
public static Iterator<Drawer<?>> getAllDrawers() {
if (services == null) {
services = ServiceLoader.load(Drawer.class);
}
return services.iterator();
} | java |
@SuppressWarnings("unchecked")
@Pure
public static <T> Drawer<T> getDrawerFor(Class<? extends T> type) {
assert type != null : AssertMessages.notNullParameter();
final Drawer<?> bufferedType = buffer.get(type);
Drawer<T> defaultChoice = null;
if (bufferedType != null) {
defaultChoice = (Drawer<T>) buffered... | java |
public DoubleProperty arcWidthProperty() {
if (this.arcWidth == null) {
this.arcWidth = new DependentSimpleDoubleProperty<ReadOnlyDoubleProperty>(
this, MathFXAttributeNames.ARC_WIDTH, widthProperty()) {
@Override
protected void invalidated(ReadOnlyDoubleProperty dependency) {
final double value ... | java |
public DoubleProperty arcHeightProperty() {
if (this.arcHeight == null) {
this.arcHeight = new DependentSimpleDoubleProperty<ReadOnlyDoubleProperty>(
this, MathFXAttributeNames.ARC_HEIGHT, heightProperty()) {
@Override
protected void invalidated(ReadOnlyDoubleProperty dependency) {
final double v... | java |
@Pure
public Rectangle2d toBounds2D() {
int startIndex = this.id.indexOf('#');
if (startIndex <= 0) {
return null;
}
try {
int endIndex = this.id.indexOf(';', startIndex);
if (endIndex <= startIndex) {
return null;
}
final long minx = Long.parseLong(this.id.substring(startIndex + 1, endInde... | java |
@Pure
public String getInternalId() {
final int endIndex = this.id.indexOf('#');
if (endIndex <= 0) {
return null;
}
return this.id.substring(0, endIndex);
} | java |
private final long checkSessionTimeout() {
long nextTimeout = 0;
if (configuration.getCheckSessionTimeoutInterval() > 0) {
gate.lock();
try {
if (selectTries * 1000 >= configuration
.getCheckSessionTimeoutInterval()) {
nextTimeout = configuration
.getCheckSessionTimeoutInterval()... | java |
public static Vector1d convert(Tuple1d<?> tuple) {
if (tuple instanceof Vector1d) {
return (Vector1d) tuple;
}
return new Vector1d(tuple.getSegment(), tuple.getX(), tuple.getY());
} | java |
protected static URL getContributorURL(Contributor contributor, Log log) {
URL url = null;
if (contributor != null) {
String rawUrl = contributor.getUrl();
if (rawUrl != null && !EMPTY_STRING.equals(rawUrl)) {
try {
url = new URL(rawUrl);
} catch (Throwable exception) {
url = null;
}
... | java |
public final void dirCopy(File in, File out, boolean skipHiddenFiles) throws IOException {
assert in != null;
assert out != null;
getLog().debug(in.toString() + "->" + out.toString()); //$NON-NLS-1$
getLog().debug("Ignore hidden files: " + skipHiddenFiles); //$NON-NLS-1$
out.mkdirs();
final LinkedList<File>... | java |
public final void dirRemove(File dir) throws IOException {
if (dir != null) {
getLog().debug("Deleting tree: " + dir.toString()); //$NON-NLS-1$
final LinkedList<File> candidates = new LinkedList<>();
candidates.add(dir);
File[] children;
final BuildContext buildContext = getBuildContext();
while (!c... | java |
public static final String getLString(Class<?> source, String label, Object... params) {
final ResourceBundle rb = ResourceBundle.getBundle(source.getCanonicalName());
String text = rb.getString(label);
text = text.replaceAll("[\\n\\r]", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
text = text.replaceAll("\\t", "\t"); //... | java |
public static final String removePathPrefix(File prefix, File file) {
final String r = file.getAbsolutePath().replaceFirst(
"^" //$NON-NLS-1$
+ Pattern.quote(prefix.getAbsolutePath()),
EMPTY_STRING);
if (r.startsWith(File.separator)) {
return r.substring(File.separator.length());
}
return r;
} | java |
public final synchronized ExtendedArtifact searchArtifact(File file) {
final String filename = removePathPrefix(getBaseDirectory(), file);
getLog().debug("Retreiving module for " + filename); //$NON-NLS-1$
File theFile = file;
File pomDirectory = null;
while (theFile != null && pomDirectory == null) {
if... | java |
public final Artifact resolveArtifact(Artifact mavenArtifact) throws MojoExecutionException {
final org.eclipse.aether.artifact.Artifact aetherArtifact = createArtifact(mavenArtifact);
final ArtifactRequest request = new ArtifactRequest();
request.setArtifact(aetherArtifact);
request.setRepositories(getRemoteRe... | java |
public final Artifact resolveArtifact(String groupId, String artifactId, String version) throws MojoExecutionException {
return resolveArtifact(createArtifact(groupId, artifactId, version));
} | java |
public final Artifact createArtifact(String groupId, String artifactId, String version) {
return createArtifact(groupId, artifactId, version, "runtime", "jar"); //$NON-NLS-1$ //$NON-NLS-2$
} | java |
protected static final org.eclipse.aether.artifact.Artifact createArtifact(Artifact artifact) {
return new DefaultArtifact(
artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getClassifier(),
artifact.getType(),
artifact.getVersion());
} | java |
protected final Artifact createArtifact(org.eclipse.aether.artifact.Artifact artifact) {
return createArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion());
} | java |
public final Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type) {
VersionRange versionRange = null;
if (version != null) {
versionRange = VersionRange.createFromVersion(version);
}
String desiredScope = scope;
if (Artifact.SCOPE_TEST.equals(desiredScope))... | java |
protected final void assertNotNull(String message, Object obj) {
if (getLog().isDebugEnabled()) {
getLog().debug(
"\t(" //$NON-NLS-1$
+ getLogType(obj)
+ ") " //$NON-NLS-1$
+ message
+ " = " //$NON-NLS-1$
+ obj);
}
if (obj == null) {
throw new AssertionError("assertNotNull: " +... | java |
public static String join(String joint, String... values) {
final StringBuilder b = new StringBuilder();
for (final String value : values) {
if (value != null && !EMPTY_STRING.equals(value)) {
if (b.length() > 0) {
b.append(joint);
}
b.append(value);
}
}
return b.toString();
} | java |
public MavenProject getMavenProject(Artifact artifact) {
try {
final MavenSession session = getMavenSession();
final MavenProject current = session.getCurrentProject();
final MavenProject prj = getMavenProjectBuilder().buildFromRepository(
artifact,
current.getRemoteArtifactRepositories(),
ses... | java |
@SuppressWarnings("checkstyle:nestedifdepth")
protected final List<GraphIterationElement<ST, PT>> getNextSegments(boolean avoid_visited_segments,
GraphIterationElement<ST, PT> element) {
assert this.allowManyReplies || this.visited != null;
if (element != null) {
final ST segment = element.getSegment();
f... | java |
public final GraphIterationElement<ST, PT> nextElement() {
if (!this.courseModel.isEmpty()) {
final GraphIterationElement<ST, PT> theElement = this.courseModel.removeNextIterationElement();
if (theElement != null) {
final List<GraphIterationElement<ST, PT>> list = getNextSegments(true, theElement);
fina... | java |
protected GraphIterationElement<ST, PT> newIterationElement(
ST previous_segment, ST segment,
PT point,
double distanceToReach,
double distanceToConsume) {
return new GraphIterationElement<>(
previous_segment, segment,
point,
distanceToReach,
distanceToConsume);
} | java |
public void ignoreElementsAfter(GraphIterationElement<ST, PT> element) {
final List<GraphIterationElement<ST, PT>> nexts = getNextSegments(false, element);
this.courseModel.removeIterationElements(nexts);
} | java |
@Override
public void removeChild(final ITreeNode<T> child)
{
if (children != null)
{
children.remove(child);
}
else
{
children = new ArrayList<>();
}
} | java |
public static String getDefaultMapElementNodeName(Class<? extends MapElement> type) {
if (MapPolyline.class.isAssignableFrom(type)) {
return NODE_POLYLINE;
}
if (MapPoint.class.isAssignableFrom(type)) {
return NODE_POINT;
}
if (MapPolygon.class.isAssignableFrom(type)) {
return NODE_POLYGON;
}
if ... | java |
public static void writeGISElementAttributes(Element element, GISElement primitive, XMLBuilder builder,
XMLResources resources) throws IOException {
XMLAttributeUtil.writeAttributeContainer(element, primitive, builder, resources, false);
element.setAttribute(XMLUtil.ATTR_NAME, primitive.getName());
element.set... | java |
public static void readGISElementAttributes(Element element, GISElement primitive, PathBuilder pathBuilder,
XMLResources resources) throws IOException {
XMLAttributeUtil.readAttributeContainer(element, primitive, pathBuilder, resources, false);
primitive.setName(XMLUtil.getAttributeValueWithDefault(element, null... | java |
@SuppressWarnings("unchecked")
@Override
public Set<LeftT> alignedToRightItem(final Object rightItem) {
if (rightToLeft.containsKey(rightItem)) {
return rightToLeft.get((RightT)rightItem);
} else {
return ImmutableSet.of();
}
} | java |
@SuppressWarnings("unchecked")
@Override
public Set<RightT> alignedToLeftItem(final Object leftItem) {
if (leftToRight.containsKey(leftItem)) {
return leftToRight.get((LeftT)leftItem);
} else {
return ImmutableSet.of();
}
} | java |
public static void ensureParentDirectoryExists(File f) throws IOException {
final File parent = f.getParentFile();
if (parent != null) {
java.nio.file.Files.createDirectories(parent.toPath());
}
} | java |
public static ImmutableList<File> loadFileList(final Iterable<String> fileNames)
throws IOException {
final ImmutableList.Builder<File> ret = ImmutableList.builder();
for (String filename : fileNames) {
if (!filename.isEmpty()) {
ret.add(new File(filename.trim()));
}
}
return... | java |
public static void writeFileList(Iterable<File> files, CharSink sink) throws IOException {
writeUnixLines(FluentIterable.from(files)
.transform(toAbsolutePathFunction()), sink);
} | java |
public static void writeSymbolToFileMap(Map<Symbol, File> symbolToFileMap, CharSink sink) throws IOException {
writeSymbolToFileEntries(symbolToFileMap.entrySet(), sink);
} | java |
public static void writeSymbolToFileEntries(final Iterable<Map.Entry<Symbol, File>> entries,
final CharSink sink) throws IOException {
writeUnixLines(
transform(
MapUtils.transformValues(entries, toAbsolutePathFunction()),
TO_TAB_SEPARATED_ENTRY),
sink);
} | java |
public static void writeIntegerToStart(final File f, final int num) throws IOException {
final RandomAccessFile fixupFile = new RandomAccessFile(f, "rw");
fixupFile.writeInt(num);
fixupFile.close();
} | java |
public static File siblingDirectory(final File f, final String siblingDirName) {
checkNotNull(f);
checkNotNull(siblingDirName);
checkArgument(!siblingDirName.isEmpty());
final File parent = f.getParentFile();
if (parent != null) {
return new File(parent, siblingDirName);
} else {
th... | java |
public static Predicate<File> endsWithPredicate(final String suffix) {
checkArgument(!suffix.isEmpty());
return new EndsWithPredicate(suffix);
} | java |
public static Predicate<File> isDirectoryPredicate() {
return new Predicate<File>() {
@Override
public boolean apply(final File input) {
return input.isDirectory();
}
};
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.