method2testcases stringlengths 118 6.63k |
|---|
### Question:
ForwardMessage extends SendableMessageRequest<Message> { public static ForwardMessageBuilder forMessage(Message<?> message) { Objects.requireNonNull(message, "message cannot be null"); return builder() .chatId(message.getChat().getChatId()) .messageId(message.getMessageId()); } @Builder protected Forward... |
### Question:
EditMessageLiveLocation extends SendableInlineRequest<Message> { public static EditMessageLiveLocationBuilder forInlineMessage(String inlineMessageId) { Objects.requireNonNull(inlineMessageId, "inline message ID cannot be null"); return builder().inlineMessageId(inlineMessageId); } @Builder protected Edi... |
### Question:
EditMessageCaption extends EditMessageRequest<Message> { public static EditMessageCaptionBuilder forMessage(CaptionableMessage<?> message) { Objects.requireNonNull(message, "message cannot be null"); return builder() .chatId(message.getChat().getChatId()) .messageId(message.getMessageId()); } @Builder Ed... |
### Question:
EditMessageCaption extends EditMessageRequest<Message> { public static EditMessageCaptionBuilder forInlineMessage(String inlineMessageId) { Objects.requireNonNull(inlineMessageId, "inline message ID cannot be null"); return builder().inlineMessageId(inlineMessageId); } @Builder EditMessageCaption(Consume... |
### Question:
ProjectServiceImpl implements ProjectService { @Override public ProjectAccessControl getProjectAccessControl(Project project){ List<UserTask> userTasks = modelService.getTasksBy(project, new ProcessModelType(), UserTask.class); Set<String> users = extractFromTasks(this::selectUsers, userTasks); Set<String... |
### Question:
ReferenceIdOverrider implements ReferenceOverrider { @Override public void override(UserTask userTask) { String oldFormKey = userTask.getFormKey(); String newFormKey = modelIdentifiers.get(oldFormKey); if (newFormKey != null) { userTask.setFormKey(newFormKey); } } ReferenceIdOverrider(Map<String, String> ... |
### Question:
ModelServiceImpl implements ModelService { @Override public <T extends Task> List<T> getTasksBy(Project project, ModelType processModelType, @NonNull Class<T> clazz) { Assert.notNull(clazz, "Class task type it must not be null"); return getProcessesBy(project, processModelType) .stream() .map(Process::get... |
### Question:
ProcessModelContentConverter implements ModelContentConverter<BpmnProcessModelContent> { @Override public FileContent overrideModelId(FileContent fileContent, Map<String, String> modelIdentifiers) { FileContent newFileContent; Optional<BpmnProcessModelContent> processModelContent = this.convertToModelCont... |
### Question:
ProcessModelContentConverter implements ModelContentConverter<BpmnProcessModelContent> { public void overrideAllProcessDefinition(BpmnProcessModelContent processModelContent, ReferenceIdOverrider referenceIdOverrider) { processModelContent.getBpmnModel().getProcesses().forEach(process -> { overrideAllIdRe... |
### Question:
PathPrunner implements Consumer<Swagger> { @Override public void accept(Swagger swagger) { if(swagger.getPaths() == null) return; prunePaths(swagger); if(swagger.getDefinitions() == null || types.isEmpty()) return; new TypePruner(swagger).prune(); } PathPrunner(String... excludePrefixes); PathPrunner with... |
### Question:
RemoveUnusedDefinitions implements Consumer<Swagger> { @Override public void accept(Swagger swagger) { int initial = swagger.getDefinitions().size(); Pruner pruner = new Pruner(buildHierarchy(swagger)); while(pruner.hasPruneable()) { Stream<String> prune = pruner.prune(); Map<String, Model> defs = swagger... |
### Question:
BeaconMapBackground { public static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull Point firstReferencePoint, @NonNull Location secondReferenceLocation, @NonNull Point secondReferencePoint) { double distanceInPixels = getPixelDistance(firstReferencePoint, secondReferencePoint);... |
### Question:
AdvertisingPacketFactory { protected AP createAdvertisingPacketWithSubFactories(byte[] advertisingData) { for (AdvertisingPacketFactory<AP> advertisingPacketFactory : subFactoryMap.values()) { if (advertisingPacketFactory.canCreateAdvertisingPacketWithSubFactories(advertisingData)) { return advertisingPac... |
### Question:
AdvertisingPacketFactoryManager { public AdvertisingPacketFactory getAdvertisingPacketFactory(byte[] advertisingData) { AdvertisingPacketFactory factory = null; for (AdvertisingPacketFactory advertisingPacketFactory : advertisingPacketFactories) { factory = advertisingPacketFactory.getAdvertisingPacketFac... |
### Question:
BeaconUtil { public static double getSmallestDistance(List<? extends Beacon> beaconList) { Beacon beacon = getClosestBeacon(beaconList); return (beacon == null) ? Double.MAX_VALUE : beacon.getDistance(); } static float getAdvertisingRange(int transmissionPower); static double getSmallestDistance(List<? e... |
### Question:
BeaconUtil { public static Beacon getClosestBeacon(List<? extends Beacon> beaconList) { if (beaconList.isEmpty()) { return null; } return getClosestBeacon(beaconList, beaconList.get(0).createSuggestedWindowFilter()); } static float getAdvertisingRange(int transmissionPower); static double getSmallestDist... |
### Question:
BeaconMapBackground { public static double getBearing(@NonNull Location firstReferenceLocation, @NonNull Point firstReferencePoint, @NonNull Location secondReferenceLocation, @NonNull Point secondReferencePoint) { double locationBearing = getBearing(firstReferenceLocation, secondReferenceLocation); double... |
### Question:
BeaconUtil { public static int calculateRssi(float distance, float calibratedRssi, int calibratedDistance, float pathLossParameter) { return calculateRssi(distance, BeaconDistanceCalculator.getCalibratedRssiAtOneMeter(calibratedRssi, calibratedDistance), pathLossParameter); } static float getAdvertisingR... |
### Question:
IBeacon extends Beacon<P> { public UUID getProximityUuid() { return proximityUuid; } IBeacon(); @Override BeaconLocationProvider<IBeacon<P>> createLocationProvider(); @Override void applyPropertiesFromAdvertisingPacket(P advertisingPacket); @Override String toString(); UUID getProximityUuid(); void setPro... |
### Question:
IBeacon extends Beacon<P> { public int getMajor() { return major; } IBeacon(); @Override BeaconLocationProvider<IBeacon<P>> createLocationProvider(); @Override void applyPropertiesFromAdvertisingPacket(P advertisingPacket); @Override String toString(); UUID getProximityUuid(); void setProximityUuid(UUID p... |
### Question:
IBeacon extends Beacon<P> { public int getMinor() { return minor; } IBeacon(); @Override BeaconLocationProvider<IBeacon<P>> createLocationProvider(); @Override void applyPropertiesFromAdvertisingPacket(P advertisingPacket); @Override String toString(); UUID getProximityUuid(); void setProximityUuid(UUID p... |
### Question:
Beacon { public P getOldestAdvertisingPacket() { synchronized (advertisingPackets) { if (!hasAnyAdvertisingPacket()) { return null; } return advertisingPackets.get(0); } } Beacon(); @Deprecated static Beacon from(AdvertisingPacket advertisingPacket); boolean hasLocation(); Location getLocation(); static L... |
### Question:
BeaconMapBackground { public static Point getShiftedPoint(@NonNull Point referencePoint, double distanceInPixels, double bearing) { double angleInRadians = Math.toRadians(bearing + 90); return new Point( (int) (referencePoint.x - (distanceInPixels * Math.cos(angleInRadians))), (int) (referencePoint.y - (d... |
### Question:
Beacon { public ArrayList<P> getAdvertisingPacketsFromLast(long amount, TimeUnit timeUnit) { return getAdvertisingPacketsBetween(System.currentTimeMillis() - timeUnit.toMillis(amount), System.currentTimeMillis()); } Beacon(); @Deprecated static Beacon from(AdvertisingPacket advertisingPacket); boolean has... |
### Question:
Beacon { public ArrayList<P> getAdvertisingPacketsSince(long timestamp) { return getAdvertisingPacketsBetween(timestamp, System.currentTimeMillis()); } Beacon(); @Deprecated static Beacon from(AdvertisingPacket advertisingPacket); boolean hasLocation(); Location getLocation(); static List<Location> getLoc... |
### Question:
Beacon { public ArrayList<P> getAdvertisingPacketsBefore(long timestamp) { return getAdvertisingPacketsBetween(0, timestamp); } Beacon(); @Deprecated static Beacon from(AdvertisingPacket advertisingPacket); boolean hasLocation(); Location getLocation(); static List<Location> getLocations(List<? extends Be... |
### Question:
SphericalMercatorProjection { public static double latitudeToY(double latitude) { return Math.log(Math.tan(Math.PI / 4 + Math.toRadians(latitude) / 2)) * EARTH_RADIUS; } static double yToLatitude(double y); static double xToLongitude(double x); static double latitudeToY(double latitude); static double lo... |
### Question:
SphericalMercatorProjection { public static double longitudeToX(double longitude) { return Math.toRadians(longitude) * EARTH_RADIUS; } static double yToLatitude(double y); static double xToLongitude(double x); static double latitudeToY(double latitude); static double longitudeToX(double longitude); stati... |
### Question:
SphericalMercatorProjection { public static double yToLatitude(double y) { return Math.toDegrees(Math.atan(Math.exp(y / EARTH_RADIUS)) * 2 - Math.PI / 2); } static double yToLatitude(double y); static double xToLongitude(double x); static double latitudeToY(double latitude); static double longitudeToX(do... |
### Question:
SphericalMercatorProjection { public static double xToLongitude(double x) { return Math.toDegrees(x / EARTH_RADIUS); } static double yToLatitude(double y); static double xToLongitude(double x); static double latitudeToY(double latitude); static double longitudeToX(double longitude); static Location ecefT... |
### Question:
SphericalMercatorProjection { public static double[] geodeticToEcef(double[] geodetic) { double[] ecef = new double[3]; double latitude = geodetic[0]; double longitude = geodetic[1]; double altitude = geodetic[2]; double n = EARTH_RADIUS / Math.sqrt(1 - E2 * Math.sin(latitude) * Math.sin(latitude)); ecef[... |
### Question:
SphericalMercatorProjection { public static double[] ecefToGeodetic(double[] ecef) { double zp, w2, w, r2, r, s2, c2, s, c, ss, g, rg, rf, u, v, m, f, p, x, y, z; double[] geodetic = new double[3]; x = ecef[0]; y = ecef[1]; z = ecef[2]; zp = Math.abs(z); w2 = x * x + y * y; w = Math.sqrt(w2); r2 = w2 + z ... |
### Question:
Location { public double getAngleTo(Location location) { return getRotationAngleInDegrees(this, location); } Location(); Location(double latitude, double longitude); Location(double latitude, double longitude, double altitude); Location(double latitude, double longitude, double altitude, double elevati... |
### Question:
Location { public double getDistanceTo(Location location) { return LocationDistanceCalculator.calculateDistanceBetween(this, location); } Location(); Location(double latitude, double longitude); Location(double latitude, double longitude, double altitude); Location(double latitude, double longitude, do... |
### Question:
Multilateration { public LeastSquaresOptimizer.Optimum findOptimum() { double[][] positions = getPositions(beacons); double[] distances = getDistances(beacons); return findOptimum(positions, distances); } Multilateration(List<Beacon> beacons); static double[][] getPositions(List<Beacon> beacons); static d... |
### Question:
BeaconDistanceCalculator { public static float calculateDistance(float rssi, float calibratedRssi, int calibratedDistance, float pathLossParameter) { return calculateDistance(rssi, getCalibratedRssiAtOneMeter(calibratedRssi, calibratedDistance), pathLossParameter); } static float calculateDistanceTo(Beac... |
### Question:
DistanceUtil { public static Location speedFilter(Location oldLocation, Location newLocation, double maximumSpeed) { double distance = oldLocation.getDistanceTo(newLocation); long timestampDelta = newLocation.getTimestamp() - oldLocation.getTimestamp(); double currentSpeed = 0; if (timestampDelta != 0) { ... |
### Question:
DistanceUtil { public static long getReasonableSmallerEvenDistance(double distance) { return getClosestEvenDistance(distance, getMaximumEvenIncrement(distance)); } static long getClosestEvenDistance(double distance, int evenIncrement); static long getReasonableSmallerEvenDistance(double distance); static... |
### Question:
BeaconMapBackground { public Location getTopLeftLocation() { return topLeftLocation; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull... |
### Question:
DistanceUtil { public static int getMaximumEvenIncrement(double distance) { if (distance < 10) { return 1; } return (int) Math.pow(10, Math.floor(Math.log10(distance))); } static long getClosestEvenDistance(double distance, int evenIncrement); static long getReasonableSmallerEvenDistance(double distance)... |
### Question:
DistanceUtil { public static long getClosestEvenDistance(double distance, int evenIncrement) { return Math.round(distance / evenIncrement) * evenIncrement; } static long getClosestEvenDistance(double distance, int evenIncrement); static long getReasonableSmallerEvenDistance(double distance); static int g... |
### Question:
LocationDistanceCalculator { public static double calculateDistanceBetween(Location fromLocation, Location toLocation) { return calculateDistanceBetween( fromLocation.getLatitude(), fromLocation.getLongitude(), fromLocation.getAltitude(), toLocation.getLatitude(), toLocation.getLongitude(), toLocation.get... |
### Question:
LocationUtil { public static Location calculateMeanLocation(Location... locations) { return calculateMeanLocation(Arrays.asList(locations)); } static Location calculateMeanLocationFromLast(List<Location> locationList, long amount, TimeUnit timeUnit); static Location calculateMeanLocation(Location... loca... |
### Question:
BeaconMapBackground { public Location getBottomRightLocation() { return bottomRightLocation; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, ... |
### Question:
LocationUtil { public static List<Location> getLocationsBetween(List<Location> locationList, long minimumTimestamp, long maximumTimestamp) { List<Location> matchingLocations = new ArrayList<>(); for (Location location : locationList) { if (location.getTimestamp() < minimumTimestamp || location.getTimestam... |
### Question:
AngleUtil { public static double calculateMeanAngle(double[] angles) { if (angles == null || angles.length == 0) { return 0; } if (angles.length == 1) { return angles[0]; } float sumSin = 0; float sumCos = 0; for (double angle : angles) { sumSin += Math.sin(Math.toRadians(angle)); sumCos += Math.cos(Math.... |
### Question:
BeaconMapBackground { public Point getTopLeftPoint() { return topLeftPoint; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull Point fi... |
### Question:
BeaconMapBackground { public Point getBottomRightPoint() { return bottomRightPoint; } private BeaconMapBackground(Bitmap imageBitmap); Location getLocation(@NonNull Point point); Point getPoint(@NonNull Location location); static float getMetersPerPixel(@NonNull Location firstReferenceLocation, @NonNull ... |
### Question:
AdvertisingPacketFactory { protected boolean canCreateAdvertisingPacketWithSubFactories(byte[] advertisingData) { for (AdvertisingPacketFactory<AP> advertisingPacketFactory : subFactoryMap.values()) { if (advertisingPacketFactory.canCreateAdvertisingPacketWithSubFactories(advertisingData)) { return true; ... |
### Question:
AdvertisingPacketFactory { abstract boolean canCreateAdvertisingPacket(byte[] advertisingData); AdvertisingPacketFactory(Class<AP> packetClass); AdvertisingPacketFactory<AP> getAdvertisingPacketFactory(Class advertisingPacketClass); AdvertisingPacketFactory<AP> getAdvertisingPacketFactory(byte[] advertisi... |
### Question:
SplashPresenter extends BasePresenter<V> implements SplashMvpPresenter<V> { @Override public void onAttach(V mvpView) { super.onAttach(mvpView); startActivityWithDelay(); } @Inject SplashPresenter(SchedulerProvider schedulerProvider,
CompositeDisposable compositeDisposable,
... |
### Question:
CommonUtils { public static Long getNegativeLong(int number) { return ( - (long) number); } private CommonUtils(); static ProgressDialog showLoadingDialog(Context context); static boolean isEmailValid(String email); static String getTimeStamp(); static Long getNegativeLong(int number); }### Answer:
@Tes... |
### Question:
CommonUtils { public static boolean isEmailValid(String email) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(email); retur... |
### Question:
AardvarkHelpMode extends GosuMode { static void printHelp(PrintWriter out) { out.println("Usage:"); out.println(" vark [-f FILE] [options] [targets...]"); out.println(); out.println("Options:"); IArgKeyList keys = Launch.factory().createArgKeyList(); for (IArgKey key : AardvarkOptions.getArgKeys()) { keys... |
### Question:
GlusterWatchService implements WatchService { public WatchKey registerPath(GlusterPath path, WatchEvent.Kind... kinds) { if (!running) { throw new ClosedWatchServiceException(); } for (GlusterWatchKey k : paths) { if (k.getPath().equals(path)) { k.setKinds(kinds); return k; } } GlusterWatchKey key = new G... |
### Question:
GlusterFileSystem extends FileSystem { @Override public boolean isOpen() { return volptr > 0; } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Ove... |
### Question:
GlusterFileSystem extends FileSystem { @Override public boolean isReadOnly() { return false; } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); @Over... |
### Question:
GlusterFileSystem extends FileSystem { @Override public String getSeparator() { return SEPARATOR; } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories(); ... |
### Question:
GlusterFileSystem extends FileSystem { @Override public Iterable<Path> getRootDirectories() { GlusterPath root = new GlusterPath(this, "/"); List<Path> list = new ArrayList<Path>(1); list.add(root); return Collections.unmodifiableList(list); } @Override FileSystemProvider provider(); @Override void close... |
### Question:
GlusterFileSystem extends FileSystem { @Override public Iterable<FileStore> getFileStores() { GlusterFileStore store = new GlusterFileStore(this); List<FileStore> stores = new ArrayList<FileStore>(1); stores.add(store); return Collections.unmodifiableList(stores); } @Override FileSystemProvider provider(... |
### Question:
GlusterFileSystem extends FileSystem { @Override public Path getPath(String s, String... strings) { boolean absolute = s.startsWith("/"); if (absolute) { s = s.substring(1); } String[] parts; if (null != strings && strings.length > 0) { parts = new String[1 + strings.length]; parts[0] = s; System.arraycop... |
### Question:
GlusterFileSystem extends FileSystem { public String toString() { return provider.getScheme() + ": } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirectories();... |
### Question:
GlusterFileSystem extends FileSystem { @Override public PathMatcher getPathMatcher(String s) { if (!s.contains(":")) { throw new IllegalArgumentException("PathMatcher requires input syntax:expression"); } String[] parts = s.split(":", 2); Pattern pattern; if ("glob".equals(parts[0])) { pattern = GlobPatte... |
### Question:
GlusterWatchService implements WatchService { @Override public WatchKey poll() { if (!running) { throw new ClosedWatchServiceException(); } WatchKey pending = popPending(); if (null != pending) { return pending; } for (GlusterWatchKey k : paths) { if (k.isValid() && k.isReady() && k.update()) { pendingPat... |
### Question:
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public GlusterPath next() { if (nextPath == null) { throw new NoSuchElementException("No more entries"); } return nextPath; } @Override boolean hasNext(); @Override GlusterPath next(); @Override void remove(); }### Answer:
@Test(expec... |
### Question:
GlusterDirectoryIterator implements Iterator<GlusterPath> { @Override public void remove() { throw new UnsupportedOperationException(); } @Override boolean hasNext(); @Override GlusterPath next(); @Override void remove(); }### Answer:
@Test(expected = UnsupportedOperationException.class) public void tes... |
### Question:
GlusterPath implements Path { @Override public boolean isAbsolute() { return absolute; } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override Path getFileNa... |
### Question:
GlusterPath implements Path { @Override public Path getRoot() { if (absolute) { return fileSystem.getRootDirectories().iterator().next(); } else { return null; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Overri... |
### Question:
GlusterPath implements Path { @Override public URI toUri() { try { GlusterFileSystem fs = getFileSystem(); String authority = fs.getHost() + ":" + fs.getVolname(); return new URI(fs.provider().getScheme(), authority, toString(), null, null); } catch (URISyntaxException e) { throw new IllegalStateException... |
### Question:
GlusterPath implements Path { @Override public Path getFileName() { if (parts.length == 0 || parts[0].isEmpty()) { return null; } else { return new GlusterPath(fileSystem, parts[parts.length - 1]); } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, Stri... |
### Question:
GlusterPath implements Path { @Override public Path getParent() { if (parts.length <= 1 || parts[0].isEmpty()) { if (absolute) { return getRoot(); } else { return null; } } else { return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, parts.length - 1), absolute); } } GlusterPath(GlusterFileSyste... |
### Question:
GlusterPath implements Path { @Override public int getNameCount() { if (parts.length <= 1 && parts[0].isEmpty()) { if (absolute) { return 0; } else { throw new IllegalStateException("Only the root path should have one empty part"); } } else { return parts.length; } } GlusterPath(GlusterFileSystem fileSyst... |
### Question:
GlusterWatchService implements WatchService { @Override public WatchKey take() { while (running) { WatchKey key = poll(); if (key != null) { return key; } try { Thread.sleep(PERIOD); } catch (InterruptedException e) { } } throw new ClosedWatchServiceException(); } WatchKey registerPath(GlusterPath path, ... |
### Question:
GlusterPath implements Path { @Override public Path getName(int i) { if (i < 0 || i >= parts.length || (0 == i && parts.length <= 1 && parts[0].isEmpty())) { throw new IllegalArgumentException("invalid name index"); } return new GlusterPath(fileSystem, Arrays.copyOfRange(parts, 0, i + 1), absolute); } Glu... |
### Question:
GlusterPath implements Path { @Override public Path subpath(int i, int i2) { if ((0 == i && parts.length <= 1 && parts[0].isEmpty()) || i < 0 || i2 < 0 || i >= parts.length || i2 > parts.length || i > i2) { throw new IllegalArgumentException("invalid indices"); } return new GlusterPath(fileSystem, Arrays.... |
### Question:
GlusterPath implements Path { @Override public boolean startsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpt... |
### Question:
GlusterPath implements Path { @Override public boolean endsWith(Path path) { GlusterPath otherPath = (GlusterPath) path; if (this.equals(otherPath)) { return true; } if (otherPath.getParts().length > parts.length) { return false; } if (absolute && otherPath.isAbsolute() && otherPath.getParts()[0].isEmpty(... |
### Question:
GlusterPath implements Path { @Override public Path normalize() { List<String> newParts = new LinkedList<String>(); for (String part : parts) { if (part.equals("..")) { newParts.remove(newParts.size() - 1); } else if (!part.equals(".") && !part.isEmpty()) { newParts.add(part); } } return new GlusterPath(f... |
### Question:
GlusterPath implements Path { @Override public Path resolve(Path path) { GlusterPath otherPath = (GlusterPath) path; if (!fileSystem.equals(otherPath.getFileSystem())) { throw new IllegalArgumentException("Can not resolve other path because it's on a different filesystem"); } if (otherPath.isAbsolute() ||... |
### Question:
GlusterPath implements Path { @Override public Path resolveSibling(Path path) { return getParent().resolve(path); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(... |
### Question:
GlusterWatchService implements WatchService { long timeoutToMillis(long timeout, TimeUnit unit) { switch (unit) { case DAYS: return (timeout * MILLIS_PER_DAY); case HOURS: return (timeout * MILLIS_PER_HOUR); case MINUTES: return (timeout * MILLIS_PER_MINUTE); case SECONDS: return (timeout * MILLIS_PER_SEC... |
### Question:
GlusterPath implements Path { @Override public Path toAbsolutePath() { if (!absolute) { throw new UnsupportedOperationException(); } else { return this; } } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override bool... |
### Question:
GlusterPath implements Path { @Override public Iterator<Path> iterator() { List<Path> list = new ArrayList<Path>(parts.length); if (parts.length >= 1 && !parts[0].isEmpty()) { for (String p : parts) { list.add(new GlusterPath(fileSystem, p)); } } return Collections.unmodifiableList(list).iterator(); } Glu... |
### Question:
GlusterPath implements Path { @Override public int compareTo(Path path) { if (!getClass().equals(path.getClass())) { throw new ClassCastException(); } if (!fileSystem.equals(path.getFileSystem())) { throw new IllegalArgumentException("Can not compare other path because it's on a different filesystem"); } ... |
### Question:
GlusterPath implements Path { public String toString() { return getString(); } GlusterPath(GlusterFileSystem fileSystem, String path); GlusterPath(GlusterFileSystem fileSystem, String[] parts, boolean absolute); @Override boolean isAbsolute(); @Override Path getRoot(); @Override Path getFileName(); @Ove... |
### Question:
GlusterDirectoryStream implements DirectoryStream<Path> { public void open(GlusterPath path) { dir = path; if (dirHandle == 0) { dirHandle = GLFS.glfs_opendir(path.getFileSystem().getVolptr(), path.getString()); } else { throw new IllegalStateException("Already open!"); } } @Override Iterator<Path> itera... |
### Question:
GlusterPath implements Path { public String getString() { if (null != pathString) { return pathString; } else { StringBuilder sb = new StringBuilder((absolute ? fileSystem.getSeparator() : "")); for (String p : parts) { sb.append(p).append(fileSystem.getSeparator()); } sb.deleteCharAt(sb.length() - 1); re... |
### Question:
GlusterPath implements Path { void guardRegisterWatchService(WatchService watchService) { Class<? extends WatchService> watchServiceClass = watchService.getClass(); if (!GlusterWatchService.class.equals(watchServiceClass)) { throw new UnsupportedOperationException("GlusterPaths can only be watched by Glus... |
### Question:
GlusterFileStore extends FileStore { @Override public String name() { return fileSystem.getVolname(); } @Override String name(); @Override String type(); @Override boolean isReadOnly(); @Override long getTotalSpace(); @Override long getUsableSpace(); @Override long getUnallocatedSpace(); @Override boolea... |
### Question:
GlusterFileStore extends FileStore { @Override public String type() { return GLUSTERFS; } @Override String name(); @Override String type(); @Override boolean isReadOnly(); @Override long getTotalSpace(); @Override long getUsableSpace(); @Override long getUnallocatedSpace(); @Override boolean supportsFile... |
### Question:
GlusterFileStore extends FileStore { @Override public boolean isReadOnly() { return false; } @Override String name(); @Override String type(); @Override boolean isReadOnly(); @Override long getTotalSpace(); @Override long getUsableSpace(); @Override long getUnallocatedSpace(); @Override boolean supportsF... |
### Question:
GlusterFileStore extends FileStore { @Override public long getTotalSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getTotalSpace(fileSystem.getVolptr()); } @Override String name(); @Override String type(); @Override bool... |
### Question:
GlusterFileStore extends FileStore { @Override public long getUsableSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUsableSpace(fileSystem.getVolptr()); } @Override String name(); @Override String type(); @Override bo... |
### Question:
GlusterFileStore extends FileStore { @Override public long getUnallocatedSpace() throws IOException { GlusterFileSystemProvider provider = (GlusterFileSystemProvider) fileSystem.provider(); return provider.getUnallocatedSpace(fileSystem.getVolptr()); } @Override String name(); @Override String type(); @O... |
### Question:
GlusterDirectoryStream implements DirectoryStream<Path> { @Override public Iterator<Path> iterator() { if (null != iterator || closed) { throw new IllegalStateException("Already iterating!"); } GlusterDirectoryIterator iterator = new GlusterDirectoryIterator(); iterator.setStream(this); iterator.setFilter... |
### Question:
GlusterDirectoryStream implements DirectoryStream<Path> { @Override public void close() throws IOException { if (!closed) { GLFS.glfs_close(dirHandle); closed = true; } } @Override Iterator<Path> iterator(); @Override void close(); void open(GlusterPath path); }### Answer:
@Test public void testClose_wh... |
### Question:
GlusterFileChannel extends FileChannel { int parseOptions(Set<? extends OpenOption> options) { int opt = 0; for (OpenOption o : options) { if (!optionMap.containsKey(o)) { throw new UnsupportedOperationException("Option " + o + " is not supported at this time"); } opt |= optionMap.get(o); } return opt; } ... |
### Question:
GlusterFileChannel extends FileChannel { @Override public int read(ByteBuffer byteBuffer) throws IOException { guardClosed(); byte[] bytes = byteBuffer.array(); long read = GLFS.glfs_read(fileptr, bytes, bytes.length, 0); if (read < 0) { throw new IOException(UtilJNI.strerror()); } position += read; byteB... |
### Question:
GlusterFileChannel extends FileChannel { long readHelper(ByteBuffer[] byteBuffers, int offset, int length) throws IOException { long totalRead = 0L; boolean endOfStream = false; for (int i = offset; i < length + offset && !endOfStream; i++) { byte[] bytes = byteBuffers[i].array(); int remaining; while ((r... |
### Question:
GlusterFileChannel extends FileChannel { @Override public int write(ByteBuffer byteBuffer) throws IOException { guardClosed(); byte[] buf = byteBuffer.array(); int written = GLFS.glfs_write(fileptr, buf, buf.length, 0); if (written < 0) { throw new IOException(UtilJNI.strerror()); } position += written; b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.