method2testcases stringlengths 118 6.63k |
|---|
### Question:
GlusterFileChannel extends FileChannel { void guardClosed() throws ClosedChannelException { if (closed) { throw new ClosedChannelException(); } } @Override int read(ByteBuffer byteBuffer); @Override long read(ByteBuffer[] byteBuffers, int offset, int length); @Override int write(ByteBuffer byteBuffer); @... |
### Question:
GlusterFileChannel extends FileChannel { @Override public long position() throws IOException { guardClosed(); return position; } @Override int read(ByteBuffer byteBuffer); @Override long read(ByteBuffer[] byteBuffers, int offset, int length); @Override int write(ByteBuffer byteBuffer); @Override long wri... |
### Question:
GlusterFileChannel extends FileChannel { @Override public void force(boolean b) throws IOException { guardClosed(); int fsync = GLFS.glfs_fsync(fileptr); if (0 != fsync) { throw new IOException("Unable to fsync"); } } @Override int read(ByteBuffer byteBuffer); @Override long read(ByteBuffer[] byteBuffers... |
### Question:
GlusterFileChannel extends FileChannel { @Override protected void implCloseChannel() throws IOException { if (!closed) { int close = GLFS.glfs_close(fileptr); if (0 != close) { throw new IOException("Close returned nonzero"); } closed = true; } } @Override int read(ByteBuffer byteBuffer); @Override long ... |
### Question:
GlusterFileChannel extends FileChannel { @Override public long size() throws IOException { stat stat = new stat(); int retval = GLFS.glfs_fstat(fileptr, stat); if (0 != retval) { throw new IOException("fstat failed"); } return stat.st_size; } @Override int read(ByteBuffer byteBuffer); @Override long read... |
### Question:
GlusterWatchKey implements WatchKey { public boolean update() { DirectoryStream<Path> paths; try { paths = Files.newDirectoryStream(path); } catch (IOException e) { return false; } List<Path> files = new LinkedList<>(); boolean newEvents = false; for (Path f : paths) { newEvents |= processExistingFile(fil... |
### Question:
GlusterWatchKey implements WatchKey { boolean processExistingFile(List<Path> files, Path f) { if (Files.isDirectory(f)) { return false; } files.add(f); long lastModified; try { lastModified = Files.getLastModifiedTime(f).toMillis(); } catch (IOException e) { return false; } GlusterWatchEvent event = event... |
### Question:
GlusterWatchService implements WatchService { @Override public void close() throws IOException { if (running) { running = false; for (GlusterWatchKey k : paths) { k.cancel(); } } } WatchKey registerPath(GlusterPath path, WatchEvent.Kind... kinds); @Override void close(); @Override WatchKey poll(); @Overr... |
### Question:
GlusterWatchKey implements WatchKey { boolean checkDeleted(List<Path> files, Path f) { GlusterWatchEvent event = events.get(f); if (!files.contains(f) && !StandardWatchEventKinds.ENTRY_DELETE.name().equals(event.kind().name())) { event.setLastModified((new Date()).getTime()); event.setKind(StandardWatchEv... |
### Question:
GlusterWatchKey implements WatchKey { boolean checkCreated(Path f, long lastModified) { GlusterWatchEvent event = new GlusterWatchEvent(f.getFileName()); event.setLastModified(lastModified); events.put(f, event); return (lastModified > lastPolled); } @Override boolean isValid(); boolean update(); @Overri... |
### Question:
GlusterWatchKey implements WatchKey { boolean checkModified(GlusterWatchEvent event, long lastModified) { if (lastModified > event.getLastModified()) { event.setLastModified(lastModified); if (event.kind().name().equals(StandardWatchEventKinds.ENTRY_DELETE.name())) { event.setKind(StandardWatchEventKinds.... |
### Question:
GlusterWatchKey implements WatchKey { boolean kindsContains(WatchEvent.Kind kind) { for (WatchEvent.Kind k : kinds) { if (k.name().equals(kind.name())) { return true; } } return false; } @Override boolean isValid(); boolean update(); @Override synchronized List<WatchEvent<?>> pollEvents(); @Override sync... |
### Question:
GlusterWatchKey implements WatchKey { @Override synchronized public List<WatchEvent<?>> pollEvents() { if (!ready) { return new LinkedList<>(); } ready = false; return findPendingEvents(); } @Override boolean isValid(); boolean update(); @Override synchronized List<WatchEvent<?>> pollEvents(); @Override ... |
### Question:
GlusterWatchKey implements WatchKey { LinkedList<WatchEvent<?>> findPendingEvents() { long maxModifiedTime = lastPolled; LinkedList<WatchEvent<?>> pendingEvents = new LinkedList<>(); for (Path p : events.keySet()) { long lastModified = queueEventIfPending(pendingEvents, p); maxModifiedTime = Math.max(maxM... |
### Question:
GlusterWatchKey implements WatchKey { @Override synchronized public boolean reset() { if (!valid || ready) { return false; } else { ready = true; return true; } } @Override boolean isValid(); boolean update(); @Override synchronized List<WatchEvent<?>> pollEvents(); @Override synchronized boolean reset()... |
### Question:
GlusterWatchKey implements WatchKey { @Override public void cancel() { valid = false; } @Override boolean isValid(); boolean update(); @Override synchronized List<WatchEvent<?>> pollEvents(); @Override synchronized boolean reset(); @Override void cancel(); @Override Watchable watchable(); }### Answer:
@... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public String getScheme() { return GLUSTER; } @Override String getScheme(); @Override FileSystem newFileSystem(URI uri, Map<String, ?> stringMap); @Override FileSystem getFileSystem(URI uri); @Override Path getPath(URI uri); @Override Seeka... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public FileSystem newFileSystem(URI uri, Map<String, ?> stringMap) throws IOException { String authorityString = uri.getAuthority(); String[] authority = parseAuthority(authorityString); String volname = authority[1]; long volptr = glfsNew(v... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { String[] parseAuthority(String authority) { if (!authority.contains(":")) { throw new IllegalArgumentException("URI must be of the form 'gluster: } String[] aarr = authority.split(":"); if (aarr.length != 2 || aarr[0].isEmpty() || aarr[1].isEmpty()) {... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { long glfsNew(String volname) { long volptr = glfs_new(volname); if (0 == volptr) { throw new IllegalArgumentException("Failed to create new client for volume: " + volname); } return volptr; } @Override String getScheme(); @Override FileSystem newFile... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { void glfsSetVolfileServer(String host, long volptr) { int setServer = glfs_set_volfile_server(volptr, TCP, host, GLUSTERD_PORT); if (0 != setServer) { throw new IllegalArgumentException("Failed to set server address: " + host); } } @Override String g... |
### Question:
GlusterWatchService implements WatchService { WatchKey popPending() { Iterator<GlusterWatchKey> iterator = pendingPaths.iterator(); try { GlusterWatchKey key = iterator.next(); iterator.remove(); return key; } catch (NoSuchElementException e) { return null; } } WatchKey registerPath(GlusterPath path, Wat... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { void glfsInit(String authorityString, long volptr) { int init = glfs_init(volptr); if (0 != init) { throw new IllegalArgumentException("Failed to initialize glusterfs client: " + authorityString); } } @Override String getScheme(); @Override FileSyste... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public FileSystem getFileSystem(URI uri) { if (!cache.containsKey(uri.getAuthority())) { throw new FileSystemNotFoundException("No cached filesystem for: " + uri.getAuthority()); } return cache.get(uri.getAuthority()); } @Override String ge... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException { return newFileChannelHelper(path, options, attrs); } @Override String getScheme(); @Override FileSystem newFileS... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> openOptions, FileAttribute<?>... fileAttributes) throws IOException { return newFileChannelHelper(path, openOptions, fileAttributes); } @Override String getSchem... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { FileChannel newFileChannelHelper(Path path, Set<? extends OpenOption> options, FileAttribute<?>[] attrs) throws IOException { GlusterFileChannel channel = new GlusterFileChannel(); channel.init((GlusterFileSystem) getFileSystem(path.toUri()), path, op... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public Path getPath(URI uri) { if (!uri.getScheme().equals(getScheme())) { throw new IllegalArgumentException("No support for scheme: " + uri.getScheme()); } try { FileSystem fileSystem = getFileSystem(uri); return fileSystem.getPath(uri.get... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... linkOptions) throws IOException { if (type.equals(DosFileAttributes.class)) { throw new UnsupportedOperationException(type + " attribute type is ... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { boolean directoryIsEmpty(Path path) throws IOException { try (DirectoryStream<Path> stream = newDirectoryStream(path, null)) { if (stream.iterator().hasNext()) { return false; } return true; } } @Override String getScheme(); @Override FileSystem newF... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public void delete(Path path) throws IOException { if (!Files.exists(path)) { throw new NoSuchFileException(path.toString()); } if (Files.isDirectory(path)) { if(!directoryIsEmpty(path)) { throw new DirectoryNotEmptyException(path.toString()... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public boolean isHidden(Path path) throws IOException { return ((GlusterPath) path.getFileName()).getParts()[0].startsWith("."); } @Override String getScheme(); @Override FileSystem newFileSystem(URI uri, Map<String, ?> stringMap); @Overrid... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public void checkAccess(Path path, AccessMode... accessModes) throws IOException { long volptr = ((GlusterFileSystem) path.getFileSystem()).getVolptr(); String pathString = ((GlusterPath) path).getString(); stat stat = new stat(); int ret = ... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { long getTotalSpace(long volptr) throws IOException { statvfs buf = new statvfs(); GLFS.glfs_statvfs(volptr, "/", buf); return buf.f_bsize * buf.f_blocks; } @Override String getScheme(); @Override FileSystem newFileSystem(URI uri, Map<String, ?> strin... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { long getUsableSpace(long volptr) throws IOException { statvfs buf = new statvfs(); GLFS.glfs_statvfs(volptr, "/", buf); return buf.f_bsize * buf.f_bavail; } @Override String getScheme(); @Override FileSystem newFileSystem(URI uri, Map<String, ?> stri... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { long getUnallocatedSpace(long volptr) throws IOException { statvfs buf = new statvfs(); GLFS.glfs_statvfs(volptr, "/", buf); return buf.f_bsize * buf.f_bfree; } @Override String getScheme(); @Override FileSystem newFileSystem(URI uri, Map<String, ?> ... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { void copyFileContent(Path path, Path path2) throws IOException { Set<StandardOpenOption> options = new HashSet<>(); options.add(StandardOpenOption.READ); byte[] readBytes = new byte[8192]; FileChannel channel = newFileChannel(path, options); ByteBuffe... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public DirectoryStream<Path> newDirectoryStream(Path path, DirectoryStream.Filter<? super Path> filter) throws IOException { if (!Files.isDirectory(path)) { throw new NotDirectoryException("Not a directory! " + path.toString()); } GlusterPat... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) throws IOException { String linkPath = link.toString(); if (Files.exists(link, LinkOption.NOFOLLOW_LINKS)) { throw new FileAlreadyExistsException(linkPath); } ... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public void createDirectory(Path path, FileAttribute<?>... fileAttributes) throws IOException { if (Files.exists(path)) { throw new FileAlreadyExistsException(path.toString()); } if (!Files.exists(path.getParent())) { throw new IOException()... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public FileStore getFileStore(Path path) throws IOException { if (Files.exists(path)) { return path.getFileSystem().getFileStores().iterator().next(); } else { throw new NoSuchFileException(path.toString()); } } @Override String getScheme()... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { @Override public boolean isSameFile(Path path, Path path2) throws IOException { if (path.equals(path2)) { return true; } if (!path.getFileSystem().equals(path2.getFileSystem())) { return false; } guardFileExists(path); guardFileExists(path2); stat sta... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { stat statPath(Path path) throws IOException { stat stat = new stat(); String pathString = ((GlusterPath) path).getString(); int ret = GLFS.glfs_stat(((GlusterFileSystem) path.getFileSystem()).getVolptr(), pathString, stat); if (ret != 0) { throw new I... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { void guardFileExists(Path path) throws NoSuchFileException { if (!Files.exists(path)) { throw new NoSuchFileException(path.toString()); } } @Override String getScheme(); @Override FileSystem newFileSystem(URI uri, Map<String, ?> stringMap); @Override... |
### Question:
GlusterFileSystemProvider extends FileSystemProvider { void guardAbsolutePath(Path p) { if (!p.isAbsolute()) { throw new UnsupportedOperationException("Relative paths not supported: " + p); } } @Override String getScheme(); @Override FileSystem newFileSystem(URI uri, Map<String, ?> stringMap); @Override ... |
### Question:
GlusterFileSystem extends FileSystem { @Override public FileSystemProvider provider() { return provider; } @Override FileSystemProvider provider(); @Override void close(); @Override boolean isOpen(); @Override boolean isReadOnly(); @Override String getSeparator(); @Override Iterable<Path> getRootDirector... |
### Question:
GlusterFileSystem extends FileSystem { @Override public void close() throws IOException { if (isOpen()) { int fini = provider.close(volptr); if (0 != fini) { throw new IOException("Unable to close filesystem: " + volname); } volptr = -1; } } @Override FileSystemProvider provider(); @Override void close()... |
### Question:
RegisterEmailActivity extends AppCompatBase implements
CheckEmailFragment.CheckEmailListener { @Override public void onNewUser(User user) { TextInputLayout emailLayout = (TextInputLayout) findViewById(R.id.email_layout); if (mActivityHelper.getFlowParams().allowNewEmailAccounts) { RegisterEmailFra... |
### Question:
PhoneNumber { public static boolean isValid(PhoneNumber phoneNumber) { return phoneNumber != null && !EMPTY_PHONE_NUMBER.equals(phoneNumber) && !TextUtils .isEmpty(phoneNumber.getPhoneNumber()) && !TextUtils.isEmpty(phoneNumber .getCountryCode()) && !TextUtils.isEmpty(phoneNumber.getCountryIso()); } Phone... |
### Question:
PhoneNumber { public static boolean isCountryValid(PhoneNumber phoneNumber) { return phoneNumber != null && !EMPTY_PHONE_NUMBER.equals(phoneNumber) && !TextUtils .isEmpty(phoneNumber.getCountryCode()) && !TextUtils.isEmpty(phoneNumber .getCountryIso()); } PhoneNumber(String phoneNumber, String countryIso,... |
### Question:
BucketedTextChangeListener implements TextWatcher { @SuppressLint("SetTextI18n") @Override public void onTextChanged(CharSequence s, int ignoredParam1, int ignoredParam2, int ignoredParam3) { final String numericContents = s.toString().replaceAll(" ", "").replaceAll(placeHolder, ""); final int enteredCont... |
### Question:
SpacedEditText extends AppCompatEditText { @Override public void setText(CharSequence text, BufferType type) { originalText = new SpannableStringBuilder(text); final SpannableStringBuilder spacedOutString = getSpacedOutString(text); super.setText(spacedOutString, BufferType.SPANNABLE); } SpacedEditText(Co... |
### Question:
PhoneVerificationActivity extends AppCompatBase { public static Intent createIntent(Context context, FlowParameters flowParams, String phone) { return BaseHelper.createBaseIntent(context, PhoneVerificationActivity.class, flowParams) .putExtra(ExtraConstants.EXTRA_PHONE, phone); } static Intent createInte... |
### Question:
PhoneVerificationActivity extends AppCompatBase { @VisibleForTesting(otherwise = VisibleForTesting.NONE) protected AlertDialog getAlertDialog() { return mAlertDialog; } static Intent createIntent(Context context, FlowParameters flowParams, String phone); @Override void onBackPressed(); void submitConfirm... |
### Question:
PhoneVerificationActivity extends AppCompatBase { void verifyPhoneNumber(String phoneNumber, boolean forceResend) { sendCode(phoneNumber, forceResend); if (forceResend) { showLoadingDialog(getString(R.string.resending)); } else { showLoadingDialog(getString(R.string.verifying)); } } static Intent createI... |
### Question:
PhoneNumberUtils { protected static PhoneNumber getPhoneNumber(@NonNull String providedPhoneNumber) { String countryCode = DEFAULT_COUNTRY_CODE; String countryIso = DEFAULT_LOCALE.getCountry(); String phoneNumber = providedPhoneNumber; if (providedPhoneNumber.startsWith("+")) { countryCode = countryCodeFo... |
### Question:
PhoneNumberUtils { @Nullable public static Integer getCountryCode(String countryIso) { return countryIso == null ? null : CountryCodeByIsoMap.get(countryIso.toUpperCase(Locale.getDefault())); } @Nullable static Integer getCountryCode(String countryIso); }### Answer:
@Test public void testGetCountryCode(... |
### Question:
PhoneNumberUtils { @Nullable static String formatPhoneNumber(@NonNull String phoneNumber, @NonNull CountryInfo countryInfo) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return android.telephony.PhoneNumberUtils .formatNumberToE164(phoneNumber, countryInfo.locale.getCountry()); } return p... |
### Question:
PhoneNumberUtils { @NonNull static CountryInfo getCurrentCountryInfo(@NonNull Context context) { Locale locale = getSimBasedLocale(context); if (locale == null) { locale = getOSLocale(); } if (locale == null) { return DEFAULT_COUNTRY; } Integer countryCode = PhoneNumberUtils.getCountryCode(locale.getCount... |
### Question:
FileTaskAccessor implements TaskAccessor { @Override public List<Task> loadTasks() { List<Task> tasks = new ArrayList<>(); File[] taskFiles = FileAccessSupport.getTaskFiles(DEFAULT_TASK_PATH); for (File taskFile : taskFiles) { Task task = FileParser.parseTask(taskFile, false); tasks.add(task); } return ta... |
### Question:
DescriptorExtractor { public static List<FieldDescriptor> extract(AbstractFieldsSnippet snippet) { try { Method getFieldDescriptors = AbstractFieldsSnippet.class.getDeclaredMethod("getFieldDescriptors"); getFieldDescriptors.setAccessible(true); return (List<FieldDescriptor>) getFieldDescriptors.invoke(sni... |
### Question:
FieldDescriptors { public FieldDescriptors and(FieldDescriptor... additionalDescriptors) { return andWithPrefix("", additionalDescriptors); } FieldDescriptors(FieldDescriptor... fieldDescriptors); FieldDescriptors and(FieldDescriptor... additionalDescriptors); FieldDescriptors andWithPrefix(String pathPre... |
### Question:
FieldDescriptors { public FieldDescriptors andWithPrefix(String pathPrefix, FieldDescriptor... additionalDescriptors) { List<FieldDescriptor> combinedDescriptors = new ArrayList<>(fieldDescriptors); combinedDescriptors.addAll(applyPathPrefix(pathPrefix, Arrays.asList(additionalDescriptors))); return new F... |
### Question:
BujintMojo extends AbstractMojo { String nowTimeImageUrl() throws Exception { String time = DateFormatUtils.format(new Date(), "hhmm"); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet("http: httpget.setHeader("Referer", "http: HttpResponse resp... |
### Question:
BujintMojo extends AbstractMojo { String getImagePath(String str) throws Exception { DOMParser parser = new DOMParser(); parser.parse(new InputSource(new StringReader(str))); NodeList nodeList = XPathAPI.selectNodeList(parser.getDocument(), "/HTML/BODY/TABLE/TR/TH[1]/IMG"); String path = null; for (int i ... |
### Question:
BujintMojo extends AbstractMojo { BufferedImage getFittingImage(String url) throws Exception { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = buildDefaultHttpMessage(new HttpGet(url)); httpget.setHeader("Referer", "http: HttpResponse response = httpclient.execute(httpget); Buffe... |
### Question:
BujintMojo extends AbstractMojo { public void execute() throws MojoExecutionException { try { String imgUrl = nowTimeImageUrl(); if (imgUrl == null) { return; } getLog().info("\n" + getAsciiArt(getFittingImage(imgUrl))); } catch (Exception e) { e.printStackTrace(); throw new MojoExecutionException("なんかエラー... |
### Question:
XLSXSample { public void makeXlsxFile() throws Exception { String fileName = "test.xlsx"; FileOutputStream fileOut = new FileOutputStream(fileName); Workbook wb = new XSSFWorkbook(); Sheet sheet = wb.createSheet("test"); Row row = sheet.createRow((short)0); Cell cell = row.createCell(0); cell.setCellValue... |
### Question:
DatabaseAccess { public void dbSelect() throws Exception { Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql: Connection con = DriverManager.getConnection(url, "np", "npnpnp"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(getPlainSQL()); rs.close(); stmt.clo... |
### Question:
DataAccessSampleLogic { public void insertData() { Connection con = null; Statement stmt = null; try { con = ds.getConnection(); stmt = con.createStatement(); int count = sampleLogic.plus(1, 5); for (int i = 0; i < count; i++) { stmt.executeUpdate("INSERT INTO EMP (id, name) values (" + i + ", 'test')"); ... |
### Question:
DataAccessSampleLogic { public List<EmpDto> getEmpAllRecord() { Connection con = null; Statement stmt = null; ResultSet rs = null; try { con = ds.getConnection(); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM EMP"); List<EmpDto> list = new ArrayList<EmpDto>(); while (rs.next()) { Emp... |
### Question:
DIMACSExporter extends AbstractBaseExporter<V, E> implements GraphExporter<V, E> { public DIMACSFormat getFormat() { return format; } DIMACSExporter(); DIMACSExporter(ComponentNameProvider<V> vertexIDProvider); DIMACSExporter(ComponentNameProvider<V> vertexIDProvider, DIMACSFormat format); @Override voi... |
### Question:
Coreness implements VertexScoringAlgorithm<V, Integer> { @Override public Integer getVertexScore(V v) { if (!g.containsVertex(v)) { throw new IllegalArgumentException("Cannot return score of unknown vertex"); } lazyRun(); return scores.get(v); } Coreness(Graph<V, E> g); @Override Map<V, Integer> getScores... |
### Question:
GraphWalk implements GraphPath<V, E> { public GraphWalk<V, E> reverse() { return this.reverse(null); } GraphWalk(Graph<V, E> graph, V startVertex, V endVertex, List<E> edgeList, double weight); GraphWalk(Graph<V, E> graph, List<V> vertexList, double weight); GraphWalk(
Graph<V, E> graph, V start... |
### Question:
MaskSubgraph extends AbstractGraph<V, E> implements Serializable { @Override public GraphType getType() { return baseType.asUnmodifiable(); } MaskSubgraph(Graph<V, E> base, Predicate<V> vertexMask, Predicate<E> edgeMask); @Override E addEdge(V sourceVertex, V targetVertex); @Override boolean addEdge(V sou... |
### Question:
DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { public Iterator<V> iterator() { return new TopoIterator(); } DirectedAcyclicGraph(Class<? extends E> edgeClass); DirectedAcyclicGraph(Class<? extends E> edgeClass, boolean weighted); DirectedAcyclicGraph(EdgeFactory<V, E> ef... |
### Question:
DirectedAcyclicGraph extends SimpleDirectedGraph<V, E> implements Iterable<V> { @Override public E addEdge(V sourceVertex, V targetVertex) { assertVertexExist(sourceVertex); assertVertexExist(targetVertex); E result; try { updateDag(sourceVertex, targetVertex); result = super.addEdge(sourceVertex, targetV... |
### Question:
GeneralizedPetersenGraphGenerator implements GraphGenerator<V, E, List<V>> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, List<V>> resultMap) { List<V> verticesU = new ArrayList<>(n); List<V> verticesV = new ArrayList<>(n); for (int i = 0; i < n; i++... |
### Question:
LinearizedChordDiagramGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { List<V> nodes = new ArrayList<>(2 * n * m); for (int t = 0; t < n; t++) { V vt = vertexFactory.createVertex(); if (... |
### Question:
Graph6Sparse6Importer extends AbstractBaseImporter<V,E> implements GraphImporter<V,E> { @Override public void importGraph(Graph<V, E> g, Reader input) throws ImportException { BufferedReader in; if (input instanceof BufferedReader) { in = (BufferedReader) input; } else { in = new BufferedReader(input); } ... |
### Question:
BarabasiAlbertGraphGenerator implements GraphGenerator<V, E, V> { @Override public void generateGraph( Graph<V, E> target, VertexFactory<V> vertexFactory, Map<String, V> resultMap) { Set<V> oldNodes = new HashSet<>(target.vertexSet()); Set<V> newNodes = new HashSet<>(); new CompleteGraphGenerator<V, E>(m0... |
### Question:
Graphs { public static <V, E> void addOutgoingEdges(Graph<V, E> graph, V source, Iterable<V> targets) { if (!graph.containsVertex(source)) { graph.addVertex(source); } for (V target : targets) { if (!graph.containsVertex(target)) { graph.addVertex(target); } graph.addEdge(source, target); } } static E ad... |
### Question:
ComplementGraphGenerator implements GraphGenerator<V, E, V> { public void generateGraph(Graph<V, E> target) { this.generateGraph(target, null, null); } ComplementGraphGenerator(Graph<V, E> graph); ComplementGraphGenerator(Graph<V, E> graph, boolean generateSelfLoops); void generateGraph(Graph<V, E> targe... |
### Question:
Graphs { public static <V, E> void addIncomingEdges(Graph<V, E> graph, V target, Iterable<V> sources) { if (!graph.containsVertex(target)) { graph.addVertex(target); } for (V source : sources) { if (!graph.containsVertex(source)) { graph.addVertex(source); } graph.addEdge(source, target); } } static E ad... |
### Question:
GraphMLImporter extends AbstractBaseImporter<V, E> implements GraphImporter<V, E> { @Override public void importGraph(Graph<V, E> graph, Reader input) throws ImportException { try { XMLReader xmlReader = createXMLReader(); GraphMLHandler handler = new GraphMLHandler(); xmlReader.setContentHandler(handler)... |
### Question:
GraphMetrics { public static <V, E> double getDiameter(Graph<V, E> graph) { return new GraphMeasurer<>(graph).getDiameter(); } static double getDiameter(Graph<V, E> graph); static double getRadius(Graph<V, E> graph); static int getGirth(Graph<V, E> graph); }### Answer:
@Test public void testGraphDiamete... |
### Question:
GraphMetrics { public static <V, E> double getRadius(Graph<V, E> graph) { return new GraphMeasurer<>(graph).getRadius(); } static double getDiameter(Graph<V, E> graph); static double getRadius(Graph<V, E> graph); static int getGirth(Graph<V, E> graph); }### Answer:
@Test public void testGraphRadius() { ... |
### Question:
Graphs { public static <V, E> E addEdgeWithVertices(Graph<V, E> g, V sourceVertex, V targetVertex) { g.addVertex(sourceVertex); g.addVertex(targetVertex); return g.addEdge(sourceVertex, targetVertex); } static E addEdge(Graph<V, E> g, V sourceVertex, V targetVertex, double weight); static E addEdgeWithVe... |
### Question:
TopologicalOrderIterator extends AbstractGraphIterator<V, E> { @Override public boolean hasNext() { if (cur != null) { return true; } cur = advance(); if (cur != null && nListeners != 0) { fireVertexTraversed(createVertexTraversalEvent(cur)); } return cur != null; } TopologicalOrderIterator(Graph<V, E> gr... |
### Question:
TopologicalOrderIterator extends AbstractGraphIterator<V, E> { @Override public void setCrossComponentTraversal(boolean crossComponentTraversal) { if (!crossComponentTraversal) { throw new IllegalArgumentException("Iterator is always cross-component"); } } TopologicalOrderIterator(Graph<V, E> graph); @Dep... |
### Question:
BaseBronKerboschCliqueFinder implements MaximalCliqueEnumerationAlgorithm<V, E> { public Iterator<Set<V>> maximumIterator() { lazyRun(); return allMaximalCliques.stream().filter(c -> c.size() == maxSize).iterator(); } BaseBronKerboschCliqueFinder(Graph<V, E> graph, long timeout, TimeUnit unit); @Override ... |
### Question:
BaseBronKerboschCliqueFinder implements MaximalCliqueEnumerationAlgorithm<V, E> { @Override public Iterator<Set<V>> iterator() { lazyRun(); return allMaximalCliques.iterator(); } BaseBronKerboschCliqueFinder(Graph<V, E> graph, long timeout, TimeUnit unit); @Override Iterator<Set<V>> iterator(); Iterator<S... |
### Question:
Pair implements Serializable { public Pair(A a, B b) { this.first = a; this.second = b; } Pair(A a, B b); A getFirst(); B getSecond(); boolean hasElement(E e); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Pair<A, B> of(A a, B b); }### Answer:
@Test pub... |
### Question:
AliasMethodSampler { public int next() { double u = rng.nextDouble() * prob.length; int j = (int) Math.floor(u); if (comparator.compare(u - j, prob[j]) <= 0) { return j; } else { return alias[j]; } } AliasMethodSampler(double[] p); AliasMethodSampler(double[] p, long seed); AliasMethodSampler(double[] p... |
### Question:
NeighborCache implements GraphListener<V, E> { public Set<V> neighborsOf(V v) { return fetch(v, neighbors, k -> new Neighbors<>(Graphs.neighborListOf(graph, v))); } NeighborCache(Graph<V, E> graph); Set<V> predecessorsOf(V v); Set<V> successorsOf(V v); Set<V> neighborsOf(V v); List<V> neighborListOf(V v);... |
### Question:
NeighborCache implements GraphListener<V, E> { public List<V> neighborListOf(V v) { Neighbors<V> nbrs = neighbors.get(v); if (nbrs == null) { nbrs = new Neighbors<>(Graphs.neighborListOf(graph, v)); neighbors.put(v, nbrs); } return nbrs.getNeighborList(); } NeighborCache(Graph<V, E> graph); Set<V> predece... |
### Question:
TarjanLowestCommonAncestor { public V calculate(V start, V a, V b) { List<LcaRequestResponse<V>> list = new LinkedList<>(); list.add(new LcaRequestResponse<>(a, b)); return calculate(start, list).get(0); } TarjanLowestCommonAncestor(Graph<V, E> g); V calculate(V start, V a, V b); List<V> calculate(V start... |
### Question:
KuhnMunkresMinimalWeightBipartitePerfectMatching implements MatchingAlgorithm<V, E> { @Override public Matching<V, E> getMatching() { if (partition1.size() != partition2.size()) { throw new IllegalArgumentException( "Graph supplied isn't complete bipartite with equally sized partitions!"); } if (!GraphTes... |
### Question:
VF2GraphIsomorphismInspector extends VF2AbstractIsomorphismInspector<V, E> { @Override public VF2GraphMappingIterator<V, E> getMappings() { return new VF2GraphMappingIterator<>( ordering1, ordering2, vertexComparator, edgeComparator); } VF2GraphIsomorphismInspector(
Graph<V, E> graph1, Graph<V, E>... |
### Question:
SaturationDegreeColoring implements VertexColoringAlgorithm<V> { @Override @SuppressWarnings("unchecked") public Coloring<V> getColoring() { int n = graph.vertexSet().size(); int maxColor = -1; Map<V, Integer> colors = new HashMap<>(n); Map<V, BitSet> adjColors = new HashMap<>(n); Map<V, Integer> saturati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.