Unnamed: 0
int64
0
6.7k
func
stringlengths
12
89.6k
target
bool
2 classes
project
stringlengths
45
151
6,600
public interface ResultDataContentWriter { void write( JsonGenerator out, Iterable<String> columns, Map<String, Object> row ) throws IOException; }
false
community_server_src_main_java_org_neo4j_server_rest_transactional_ResultDataContentWriter.java
6,601
private enum State { BEFORE_OUTER_ARRAY, IN_BODY, FINISHED }
false
community_server_src_main_java_org_neo4j_server_rest_transactional_StatementDeserializer.java
6,602
public interface TransactionRegistry { public long begin(); public long release( long id, TransactionHandle transactionHandle ); public TransactionHandle acquire( long id ) throws TransactionLifecycleException; public void forget( long id ); public void rollbackAllSuspendedTransactions(); }
false
community_server_src_main_java_org_neo4j_server_rest_transactional_TransactionRegistry.java
6,603
private enum IndexResultOrder { INDEX_ORDER { @Override QueryContext updateQueryContext( QueryContext original ) { return original.sort( Sort.INDEXORDER ); } }, RELEVANCE_ORDER { @Override QueryContext updateQueryContext( QueryContext original ) { return original.sort( Sort.RELEVANCE ); } }, SCORE_ORDER { @Override QueryContext updateQueryContext( QueryContext original ) { return original.sortByScore(); } }, NONE { @Override Representation getRepresentationFor( Representation delegate, float score ) { return delegate; } @Override QueryContext updateQueryContext( QueryContext original ) { return original; } }; Representation getRepresentationFor( Representation delegate, float score ) { if ( delegate instanceof NodeRepresentation ) { return new ScoredNodeRepresentation( (NodeRepresentation) delegate, score ); } if ( delegate instanceof RelationshipRepresentation ) { return new ScoredRelationshipRepresentation( (RelationshipRepresentation) delegate, score ); } return delegate; } abstract QueryContext updateQueryContext( QueryContext original ); }
false
community_server_src_main_java_org_neo4j_server_rest_web_DatabaseActions.java
6,604
private interface PathRepresentationCreator<T extends Path> { PathRepresentation<T> from( T path ); }
false
community_server_src_main_java_org_neo4j_server_rest_web_DatabaseActions.java
6,605
public enum RelationshipDirection { all( Direction.BOTH ), in( Direction.INCOMING ), out( Direction.OUTGOING ); final Direction internal; private RelationshipDirection( Direction internal ) { this.internal = internal; } }
false
community_server_src_main_java_org_neo4j_server_rest_web_DatabaseActions.java
6,606
private enum UniqueIndexType { None, GetOrCreate, CreateOrFail }
false
community_server_src_main_java_org_neo4j_server_rest_web_RestfulGraphDatabase.java
6,607
public interface Surface { String PATH_NODES = "node"; String PATH_NODE_INDEX = "index/node"; String PATH_RELATIONSHIP_INDEX = "index/relationship"; String PATH_EXTENSIONS = "ext"; String PATH_RELATIONSHIP_TYPES = "relationship/types"; String PATH_SCHEMA_INDEX = "schema/index"; String PATH_SCHEMA_CONSTRAINT = "schema/constraint"; String PATH_BATCH = "batch"; String PATH_CYPHER = "cypher"; String PATH_TRANSACTION = "transaction"; String PATH_RELATIONSHIPS = "relationship"; String PATH_LABELS = "labels"; }
false
community_server_src_main_java_org_neo4j_server_rest_web_Surface.java
6,608
public interface TransactionUriScheme { URI txUri( long id ); URI txCommitUri( long id ); }
false
community_server_src_main_java_org_neo4j_server_rest_web_TransactionUriScheme.java
6,609
public interface Job { void run(); }
false
community_server_src_main_java_org_neo4j_server_rrd_Job.java
6,610
public interface JobScheduler { void scheduleAtFixedRate( Runnable job, String jobName, long delay, long period ); }
false
community_server_src_main_java_org_neo4j_server_rrd_JobScheduler.java
6,611
interface RrdSampler { void updateSample(); }
false
community_server_src_main_java_org_neo4j_server_rrd_RrdSampler.java
6,612
public interface Sampleable { String getName(); double getValue(); DsType getType(); }
false
community_server_src_main_java_org_neo4j_server_rrd_Sampleable.java
6,613
public interface TimeSource { long getTime(); }
false
community_server_src_main_java_org_neo4j_server_rrd_TimeSource.java
6,614
public interface ScriptExecutor { public interface Factory { public ScriptExecutor createExecutorForScript( String script ) throws EvaluationException; } /** * Execute the contained script. * @return * @param variables Is variables that should be available to the script. */ public Object execute( Map<String, Object> variables ) throws EvaluationException; }
false
community_server_src_main_java_org_neo4j_server_scripting_ScriptExecutor.java
6,615
public interface Factory { public ScriptExecutor createExecutorForScript( String script ) throws EvaluationException; }
false
community_server_src_main_java_org_neo4j_server_scripting_ScriptExecutor.java
6,616
public static enum Mode { SANDBOXED, UNSAFE }
false
community_server_src_main_java_org_neo4j_server_scripting_javascript_GlobalJavascriptInitializer.java
6,617
public interface WebServer { void init(); void setPort( int portNo ); void setAddress( String addr ); void setEnableHttps( boolean enable ); void setHttpsPort( int portNo ); void setHttpsCertificateInformation( KeyStoreInformation config ); void setHttpLoggingConfiguration( File logbackConfig ); void setMaxThreads( int maxThreads ); void start(); void stop(); void addJAXRSPackages( List<String> packageNames, String serverMountPoint, Collection<Injectable<?>> injectables ); void removeJAXRSPackages( List<String> packageNames, String serverMountPoint ); void addJAXRSClasses( List<String> classNames, String serverMountPoint, Collection<Injectable<?>> injectables ); void removeJAXRSClasses( List<String> classNames, String serverMountPoint ); void addFilter(Filter filter, String pathSpec); void removeFilter(Filter filter, String pathSpec); void addStaticContent( String contentLocation, String serverMountPoint ); void removeStaticContent( String contentLocation, String serverMountPoint ); void invokeDirectly( String targetUri, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException; void setWadlEnabled( boolean wadlEnabled ); void setDefaultInjectables( Collection<InjectableProvider<?>> defaultInjectables ); }
false
community_server_src_main_java_org_neo4j_server_web_WebServer.java
6,618
public interface ConsoleSessionCreator { String name(); ScriptSession newSession( Database database, CypherExecutor cypherExecutor ); }
false
community_server_src_main_java_org_neo4j_server_webadmin_console_ConsoleSessionCreator.java
6,619
public interface ConsoleSessionFactory { ScriptSession createSession( String engineName, Database database ); Iterable<String> supportedEngines(); }
false
community_server_src_main_java_org_neo4j_server_webadmin_console_ConsoleSessionFactory.java
6,620
public interface ScriptSession { /** * @return {@link Pair} of (result,next prompt). */ Pair<String, String> evaluate( String script ); }
false
community_server_src_main_java_org_neo4j_server_webadmin_console_ScriptSession.java
6,621
public interface AdvertisableService { String getName(); String getServerPath(); }
false
community_server_src_main_java_org_neo4j_server_webadmin_rest_AdvertisableService.java
6,622
public enum WebDriverImplementation { Firefox() { public WebDriver createInstance() { return new FirefoxDriver(); } }, Chrome() { public WebDriver createInstance() { WebdriverChromeDriver.ensurePresent(); return new ChromeDriver(); } }, SauceLabsFirefoxWindows() { public WebDriver createInstance() throws MalformedURLException { DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability( "version", "5" ); capabilities.setCapability( "platform", Platform.VISTA ); capabilities.setCapability( "name", "Neo4j Web Testing" ); return WebdriverSauceLabsDriver.createDriver( capabilities ); } }, SauceLabsChromeWindows() { public WebDriver createInstance() throws MalformedURLException { DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability( "platform", Platform.VISTA ); capabilities.setCapability( "name", "Neo4j Web Testing" ); return WebdriverSauceLabsDriver.createDriver( capabilities ); } }, SauceLabsInternetExplorerWindows() { public WebDriver createInstance() throws MalformedURLException { DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability( "platform", Platform.VISTA ); capabilities.setCapability( "name", "Neo4j Web Testing" ); return WebdriverSauceLabsDriver.createDriver( capabilities ); } }; public abstract WebDriver createInstance() throws Exception; }
false
community_server_src_webtest_java_org_neo4j_server_webdriver_WebDriverFacade.java
6,623
public interface App { /** * @return the name of the application. */ String getName(); /** * @param option the name of the option. An option could be like this: * "ls -l" where "l" is an option. * @return the option definition for {@code option}. */ OptionDefinition getOptionDefinition( String option ); /** * @return the available options. */ String[] getAvailableOptions(); /** * The actual code for the application. * @param parser holds the options (w/ or w/o values) as well as arguments. * @param session the client session (sort of like the environment * for the execution). * @param out the output channel for the execution, just like System.out. * @return the result of the execution. It is up to the client to interpret * this string, one example is that all apps returns null and the "exit" * app returns "e" so that the server interprets the "e" as a sign that * it should exit. * @throws Exception if the execution fails. */ Continuation execute( AppCommandParser parser, Session session, Output out ) throws Exception; /** * Returns the server this app runs in. * @return the server this app runs in. */ AppShellServer getServer(); /** * @return a general description of this application. */ String getDescription(); /** * @param option the option to get the description for. * @return a description of a certain option. */ String getDescription( String option ); /** * Put code here which will need to run before the shell server is shut down */ void shutdown(); /** * Tries to complete the {@code partOfLine} with likely candidates, * think of this as a hook for writing TAB-completion. Returned candidates * should contains the supplied part as well as possible completions. * Implementing this is optional and it's OK to just return an empty list. * * @param partOfLine the part of the line which the client wants to complete * using TAB-completion. * @param session the {@link Session} from the client caller. * @return a list of candidates which includes the supplied {@code partOfLine} * as well as possible completions. Returns an empty list if no completions found * or if the implementing class chooses not to implement it properly. */ List<String> completionCandidates( String partOfLine, Session session ) throws ShellException; boolean takesOptions(); }
false
community_shell_src_main_java_org_neo4j_shell_App.java
6,624
public interface AppShellServer extends ShellServer { /** * Finds and returns an {@link App} implementation with a given name. * @param name the name of the app. * @return an {@link App} instance for {@code name}. * @throws RemoteException if an RMI exception occurs. */ App findApp( String name ) throws RemoteException; }
false
community_shell_src_main_java_org_neo4j_shell_AppShellServer.java
6,625
public interface Console { /** * Prints a formatted string to the console (System.out). * @param format the string/format to print. * @param args values used in conjunction with {@code format}. */ void format( String format, Object... args ); /** * @param prompt the prompt to display. * @return the next line read from the console (user input). */ String readLine( String prompt ); }
false
community_shell_src_main_java_org_neo4j_shell_Console.java
6,626
public enum Continuation { INPUT_COMPLETE, INPUT_INCOMPLETE, EXIT; }
false
community_shell_src_main_java_org_neo4j_shell_Continuation.java
6,627
public enum OptionValueType { /** * No value is to be specified. */ NONE( "" ), /** * There may be a value supplied. */ MAY( "(may have value)" ), /** * There must be a supplied value. */ MUST( "(must have value" ), ; private String description; private OptionValueType( String description ) { this.description = description; } /** * @return the description for this option. */ public String getDescription() { return this.description; } }
false
community_shell_src_main_java_org_neo4j_shell_OptionValueType.java
6,628
public interface Output extends Appendable, Remote { /** * Prints a line to the output. * @param object the object to print (the string representation of it). * @throws RemoteException RMI error. */ void print( Serializable object ) throws RemoteException; /** * Prints a new line to the output. * @throws RemoteException RMI error. */ void println() throws RemoteException; /** * Prints a line with new line to the output. * @param object the object to print (the string representation of it). * @throws RemoteException RMI error. */ void println( Serializable object ) throws RemoteException; }
false
community_shell_src_main_java_org_neo4j_shell_Output.java
6,629
public interface ShellClient { Serializable getId(); /** * Grabs the console prompt. */ void grabPrompt(); /** * Evaluates a line and reacts to it. * @param line the line to evaluate. * @return the next command line from the user. * @throws ShellException if something went wrong. */ void evaluate( String line ) throws ShellException; /** * Evaluates a line and reacts to it. * @param line the line to evaluate. * @param out output just for this evaluation. * @return the next command line from the user. * @throws ShellException if something went wrong. */ void evaluate( String line, Output out ) throws ShellException; /** * Tells the client session to end, i.e. exit the {@link #grabPrompt()}. */ void end(); /** * @return the server to communicate with. */ ShellServer getServer(); /** * @return the output instance where output will be passed to. */ Output getOutput(); /** * @return the current prompt. */ String getPrompt(); /** * @return the time (millis) when the most recent connection was made * to the master. */ long timeForMostRecentConnection(); /** * Shuts down any resource needing to shut down. */ void shutdown(); void setSessionVariable( String key, Serializable value ) throws ShellException; }
false
community_shell_src_main_java_org_neo4j_shell_ShellClient.java
6,630
public interface ShellServer extends Remote { /** * @return the name of this server. * @throws RemoteException RMI error. */ String getName() throws RemoteException; /** * Receives a command line (probably from a {@link ShellClient}) and reacts * to it. Output is written to the {@link Output} object. * @param clientID identifying the client. * @param line the command line to react to. * @param out where output should go (like System.out). * @return some result from the execution, it's up to the client to * interpret the result, if any. F.ex. "e" could mean that the client * should exit, in response to a request "exit". * @throws ShellException if there was an error in the * interpretation/execution of the command line. * @throws RemoteException RMI error. */ Response interpretLine( Serializable clientID, String line, Output out ) throws ShellException, RemoteException; /** * Interprets a variable from a client session and returns the * interpreted result. * @param clientID identifying the client. * @param key the variable key. * help the interpretation. * @return the interpreted value. * @throws ShellException if some error should occur. * @throws RemoteException RMI error. */ Serializable interpretVariable( Serializable clientID, String key ) throws ShellException, RemoteException; /** * @param initialSession the initial session variables that the client would * like to override or add to any initial server session variables. * @return a nice welcome for a client. Typically a client connects and * asks for a greeting message to display to the user. * @throws RemoteException RMI error. */ Welcome welcome( Map<String, Serializable> initialSession ) throws RemoteException, ShellException; /** * Notifies this server that the client identified by {@code clientID} is about to * leave, so any session associated with it will be removed. * @param clientID the ID which identifies the client which is leaving. * These IDs are handed out from {@link #welcome(Map)}. * @throws RemoteException RMI error. */ void leave( Serializable clientID ) throws RemoteException; /** * Shuts down the server. * @throws RemoteException RMI error. */ void shutdown() throws RemoteException; /** * Makes this server available at {@code localhost} for clients to connect to via RMI. * @param port the RMI port. * @param name the RMI name. * @throws RemoteException RMI error. */ void makeRemotelyAvailable( int port, String name ) throws RemoteException; /** * Makes this server available at the specific {@code host} for clients to connect to via RMI. * @param host the host to make this server available at. * @param port the RMI port. * @param name the RMI name. * @throws RemoteException RMI error. */ void makeRemotelyAvailable( String host, int port, String name ) throws RemoteException; /** * @return all the available commands one can issue to this server. * @throws RemoteException RMI error. */ String[] getAllAvailableCommands() throws RemoteException; /** * Tries to complete a half-entered line and returns possible candidates, * in the form of a {@link TabCompletion}. * @param clientID identifying the client. * @param partOfLine the half-entered line to try to complete. * @return a {@link TabCompletion} containing the possible candidates for completion. * @throws ShellException if some error should occur. * @throws RemoteException RMI error. */ TabCompletion tabComplete( Serializable clientID, String partOfLine ) throws ShellException, RemoteException; /** * Sets a session property for the session identified by {@code clientID}. * @param clientID the client ID to identify the session. * @param key the property key. * @param value the property value. * @throws RemoteException RMI error. * @throws ShellException if an error occurs during initialization. */ void setSessionVariable( Serializable clientID, String key, Object value ) throws RemoteException, ShellException; }
false
community_shell_src_main_java_org_neo4j_shell_ShellServer.java
6,631
public static interface Replacer { /** * Returns a string to replace something else. * @param server the server which runs the interpretation. * @param session the environment of the interpretation. * @return the replacement. * @throws ShellException if there should be some communication error. */ String getReplacement( ShellServer server, Session session ) throws ShellException; }
false
community_shell_src_main_java_org_neo4j_shell_impl_BashVariableInterpreter.java
6,632
public interface Dependencies { Config getConfig(); GraphDatabaseAPI getGraphDatabaseAPI(); }
false
community_shell_src_main_java_org_neo4j_shell_impl_ShellServerExtensionFactory.java
6,633
public interface JSONString { /** * The <code>toJSONString</code> method allows a class to produce its own JSON * serialization. * * @return A strictly syntactically correct JSON text. */ public String toJSONString(); }
false
community_shell_src_main_java_org_neo4j_shell_util_json_JSONString.java
6,634
public interface Instance { void run( Task task ); void awaitStarted() throws InterruptedException; void restart(); // <T> T getMBean( Class<T> beanType ); }
false
community_kernel_src_test_java_org_neo4j_test_AbstractSubProcessTestBase.java
6,635
protected interface Task extends Serializable { void run( GraphDatabaseAPI graphdb ); }
false
community_kernel_src_test_java_org_neo4j_test_AbstractSubProcessTestBase.java
6,636
public interface Condition { boolean evaluate(); }
false
community_kernel_src_test_java_org_neo4j_test_AssertEventually.java
6,637
public static interface RestartAction { void run( FileSystemAbstraction fs, File storeDirectory ); }
false
community_kernel_src_test_java_org_neo4j_test_DatabaseRule.java
6,638
private static interface DiffReport { void add( String report ); }
false
community_kernel_src_test_java_org_neo4j_test_DbRepresentation.java
6,639
private interface TempDirectory { File root(); void create() throws IOException; void delete() throws IOException; }
false
community_kernel_src_test_java_org_neo4j_test_EmbeddedDatabaseRule.java
6,640
public interface GraphDefinition { Map<String, Node> create( GraphDatabaseService graphdb ); }
false
community_kernel_src_test_java_org_neo4j_test_GraphDefinition.java
6,641
@Inherited @Target( { ElementType.METHOD, ElementType.TYPE } ) @Retention( RetentionPolicy.RUNTIME ) public @interface Graph { String[] value() default {}; NODE[] nodes() default {}; REL[] relationships() default {}; boolean autoIndexNodes() default false; boolean autoIndexRelationships() default false; }
false
community_kernel_src_test_java_org_neo4j_test_GraphDescription.java
6,642
@Target( {} ) public @interface LABEL { String value(); }
false
community_kernel_src_test_java_org_neo4j_test_GraphDescription.java
6,643
@Target( {} ) public @interface NODE { String name(); PROP[] properties() default {}; LABEL[] labels() default {}; boolean setNameProperty() default false; }
false
community_kernel_src_test_java_org_neo4j_test_GraphDescription.java
6,644
@Target( {} ) public @interface PROP { String key(); String value(); PropType type() default STRING; PropType componentType() default ERROR; }
false
community_kernel_src_test_java_org_neo4j_test_GraphDescription.java
6,645
@SuppressWarnings( "boxing" ) public enum PropType { ARRAY { @Override Object convert( PropType componentType, String value ) { String[] items = value.split( " *, *" ); Object[] result = (Object[]) Array.newInstance( componentType.componentClass(), items.length ); for ( int i =0 ; i < items.length; i++ ) { result[i] = componentType.convert( items[i] ); } return result; } }, STRING { @Override String convert( String value ) { return value; } @Override Class<?> componentClass() { return String.class; } }, INTEGER { @Override Long convert( String value ) { return Long.parseLong( value ); } @Override Class<?> componentClass() { return Long.class; } }, DOUBLE { @Override Double convert( String value ) { return Double.parseDouble( value ); } @Override Class<?> componentClass() { return Double.class; } }, BOOLEAN { @Override Boolean convert( String value ) { return Boolean.parseBoolean( value ); } @Override Class<?> componentClass() { return Boolean.class; } }, ERROR{ }; Class<?> componentClass() { throw new UnsupportedOperationException( "Not implemented for property type" + name() ); } Object convert( String value ) { throw new UnsupportedOperationException( "Not implemented for property type" + name() ); } Object convert( PropType componentType, String value ) { throw new UnsupportedOperationException( "Not implemented for property type" + name() ); } }
false
community_kernel_src_test_java_org_neo4j_test_GraphDescription.java
6,646
@Target( {} ) public @interface REL { String name() default ""; String type(); String start(); String end(); PROP[] properties() default {}; boolean setNameProperty() default false; }
false
community_kernel_src_test_java_org_neo4j_test_GraphDescription.java
6,647
public interface GraphHolder { GraphDatabaseService graphdb(); }
false
community_kernel_src_test_java_org_neo4j_test_GraphHolder.java
6,648
public static interface LogHook<RECORD> extends Predicate<RECORD> { void file( File file ); void done( File file ); }
false
community_kernel_src_test_java_org_neo4j_test_LogTestUtils.java
6,649
public interface Mutable { Voice mute(); }
false
community_kernel_src_test_java_org_neo4j_test_Mute.java
6,650
public enum System implements Mutable { out { @Override PrintStream replace( PrintStream replacement ) { PrintStream old = java.lang.System.out; java.lang.System.setOut( replacement ); return old; } }, err { @Override PrintStream replace( PrintStream replacement ) { PrintStream old = java.lang.System.err; java.lang.System.setErr( replacement ); return old; } }; @Override public Voice mute() { final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); final PrintStream old = replace( new PrintStream( buffer ) ); return new Voice() { @Override void restore( boolean failure ) throws IOException { replace( old ).flush(); if ( failure ) { old.write( buffer.toByteArray() ); } } }; } abstract PrintStream replace( PrintStream replacement ); }
false
community_kernel_src_test_java_org_neo4j_test_Mute.java
6,651
private static enum ExecutionState { REQUESTED_EXECUTION, EXECUTING, EXECUTED }
false
community_kernel_src_test_java_org_neo4j_test_OtherThreadExecutor.java
6,652
public interface WorkerCommand<T, R> { R doWork( T state ) throws Exception; }
false
community_kernel_src_test_java_org_neo4j_test_OtherThreadExecutor.java
6,653
@Retention( RetentionPolicy.RUNTIME ) @Target(ElementType.METHOD) public @interface Repeat { public abstract int times(); }
false
community_kernel_src_test_java_org_neo4j_test_RepeatRule.java
6,654
public interface StreamExceptionHandler { void handle( IOException failure ); }
false
community_kernel_src_test_java_org_neo4j_test_StreamConsumer.java
6,655
public interface Producer<T> { T create( GraphDefinition graph, String title, String documentation ); void destroy( T product, boolean successful ); }
false
community_kernel_src_test_java_org_neo4j_test_TestData.java
6,656
@Target( ElementType.METHOD ) @Retention( RetentionPolicy.RUNTIME ) public @interface Title { String value(); }
false
community_kernel_src_test_java_org_neo4j_test_TestData.java
6,657
public enum TestLabels implements Label { LABEL_ONE, LABEL_TWO, LABEL_THREE; }
false
community_kernel_src_test_java_org_neo4j_test_TestLabels.java
6,658
public interface Provider { Clusters clusters() throws Throwable; }
false
enterprise_ha_src_test_java_org_neo4j_test_ha_ClusterManager.java
6,659
public interface RepairKit { HighlyAvailableGraphDatabase repair() throws Throwable; }
false
enterprise_ha_src_test_java_org_neo4j_test_ha_ClusterManager.java
6,660
public interface StoreDirInitializer { void initializeStoreDir( int serverId, File storeDir ) throws IOException; }
false
enterprise_ha_src_test_java_org_neo4j_test_ha_ClusterManager.java
6,661
interface Positionable { long pos(); void pos( long position ); }
false
community_kernel_src_test_java_org_neo4j_test_impl_EphemeralFileSystemAbstraction.java
6,662
@Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface BeforeDebuggedTest { }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_BeforeDebuggedTest.java
6,663
public enum Event { ENTRY, EXIT }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_BreakPoint.java
6,664
@Target( { ElementType.METHOD, ElementType.PARAMETER } ) @Retention( RetentionPolicy.RUNTIME ) public @interface BreakpointHandler { /** the name(s) of the breakpoint(s) to handle */ String[] value(); }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_BreakpointHandler.java
6,665
@Target( ElementType.METHOD ) @Retention( RetentionPolicy.RUNTIME ) public @interface BreakpointTrigger { /** the name of the break point */ String value() default ""; BreakPoint.Event on() default ENTRY; }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_BreakpointTrigger.java
6,666
public interface DebuggerDeadlockCallback { DebuggerDeadlockCallback RESUME_THREAD = new DebuggerDeadlockCallback() { @Override public void deadlock( DebuggedThread thread ) { thread.resume(); } }; /** Will be called with the suspended thread that causes the deadlock */ void deadlock( DebuggedThread thread ); }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_DebuggerDeadlockCallback.java
6,667
@Target( ElementType.METHOD ) @Retention( RetentionPolicy.RUNTIME ) public @interface EnabledBreakpoints { String[] value(); }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_EnabledBreakpoints.java
6,668
@Target( ElementType.TYPE ) @Retention( RetentionPolicy.RUNTIME ) public @interface ForeignBreakpoints { BreakpointDef[] value(); @interface BreakpointDef { String name() default ""; String type(); String method(); BreakPoint.Event on() default ENTRY; } }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_ForeignBreakpoints.java
6,669
@interface BreakpointDef { String name() default ""; String type(); String method(); BreakPoint.Event on() default ENTRY; }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_ForeignBreakpoints.java
6,670
private interface Dispatcher extends Remote { void stop() throws RemoteException; Object dispatch( String name, String[] types, Object[] args ) throws RemoteException, Throwable; }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_SubProcess.java
6,671
private interface DispatcherTrap extends Remote { Object trap( Dispatcher dispatcher ) throws RemoteException; SubProcess<?, Object> getSubProcess() throws RemoteException; }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_SubProcess.java
6,672
private interface NoInterface { // Used when no interface is declared }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_SubProcess.java
6,673
private interface RemoteRunNotifier extends Remote { void failure( Throwable exception ) throws RemoteException; void checkPostConditions() throws RemoteException, Throwable; }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_SubProcessTestRunner.java
6,674
interface TestRunnerDispatcher { void submit( Task<?> task ) throws Throwable; void run( String methodName ) throws Throwable; }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_SubProcessTestRunner.java
6,675
public interface Task<T> extends Serializable { void run( T parameter ); interface Executor { /** submits a task for asynchronous execution */ void submit( Task<?> task ); } }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_Task.java
6,676
interface Executor { /** submits a task for asynchronous execution */ void submit( Task<?> task ); }
false
community_kernel_src_test_java_org_neo4j_test_subprocess_Task.java
6,677
public interface BatchInserter { /** * Creates a node assigning next available id to id and also adds any * properties supplied. * * @param properties a map containing properties or <code>null</code> if no * properties should be added. * @param labels a list of labels to initially create the node with. * * @return The id of the created node. */ long createNode( Map<String,Object> properties, Label... labels ); /** * Creates a node with supplied id and properties. If a node with the given * id exist a runtime exception will be thrown. * * @param id the id of the node to create. * @param properties map containing properties or <code>null</code> if no * properties should be added. * @param labels a list of labels to initially create the node with. */ void createNode( long id, Map<String,Object> properties, Label... labels ); /** * Checks if a node with the given id exists. * * @param nodeId the id of the node. * @return <code>true</code> if the node exists. */ boolean nodeExists( long nodeId ); /** * Sets the properties of a node. This method will remove any properties * already existing and replace it with properties in the supplied map. * <p> * For best performance try supply all the nodes properties upon creation * of the node. This method will delete any existing properties so using it * together with {@link #getNodeProperties(long)} will have bad performance. * * @param node the id of the node. * @param properties map containing the properties or <code>null</code> to * clear all properties. */ void setNodeProperties( long node, Map<String,Object> properties ); /** * Returns true iff the node with id {@code node} has a property with name * {@code propertyName}. * * @param node The node id of the node to check. * @param propertyName The property name to check for * @return True if the node has the named property - false otherwise. */ boolean nodeHasProperty( long node, String propertyName ); /** * Replaces any existing labels for the given node with the supplied list of labels. * * @param node the node to set labels for. * @param labels the labels to set for the node. */ void setNodeLabels( long node, Label... labels ); /** * @param node the node to get labels for. * @return all labels for the given node. */ Iterable<Label> getNodeLabels( long node ); /** * @param node the node to check. * @param label the label to check. * @return {@code true} if a node has a given label, otherwise {@code false}. */ boolean nodeHasLabel( long node, Label label ); /** * Returns true iff the relationship with id {@code relationship} has a * property with name {@code propertyName}. * * @param relationship The relationship id of the relationship to check. * @param propertyName The property name to check for * @return True if the relationship has the named property - false * otherwise. */ boolean relationshipHasProperty( long relationship, String propertyName ); /** * Sets the property with name {@code propertyName} of node with id * {@code node} to the value {@code propertyValue}. If the property exists * it is updated, otherwise created. * * @param node The node id of the node whose property is to be set * @param propertyName The name of the property to set * @param propertyValue The value of the property to set */ void setNodeProperty( long node, String propertyName, Object propertyValue ); /** * Sets the property with name {@code propertyName} of relationship with id * {@code relationship} to the value {@code propertyValue}. If the property * exists it is updated, otherwise created. * * @param relationship The node id of the relationship whose property is to * be set * @param propertyName The name of the property to set * @param propertyValue The value of the property to set */ void setRelationshipProperty( long relationship, String propertyName, Object propertyValue ); /** * Returns a map containing all the properties of this node. * * @param nodeId the id of the node. * * @return map containing this node's properties. */ Map<String,Object> getNodeProperties( long nodeId ); /** * Returns an iterable over all the relationship ids connected to node with * supplied id. * * @param nodeId the id of the node. * @return iterable over the relationship ids connected to the node. */ Iterable<Long> getRelationshipIds( long nodeId ); /** * Returns an iterable of {@link BatchRelationship relationships} connected * to the node with supplied id. * * @param nodeId the id of the node. * @return iterable over the relationships connected to the node. */ Iterable<BatchRelationship> getRelationships( long nodeId ); /** * Creates a relationship between two nodes of a specific type. * * @param node1 the start node. * @param node2 the end node. * @param type relationship type. * @param properties map containing properties or <code>null</code> if no * properties should be added. * @return the id of the created relationship. */ long createRelationship( long node1, long node2, RelationshipType type, Map<String,Object> properties ); /** * Gets a relationship by id. * * @param relId the relationship id. * @return a simple relationship wrapper for the relationship. */ BatchRelationship getRelationshipById( long relId ); /** * Sets the properties of a relationship. This method will remove any * properties already existing and replace it with properties in the * supplied map. * <p> * For best performance try supply all the relationship properties upon * creation of the relationship. This method will delete any existing * properties so using it together with * {@link #getRelationshipProperties(long)} will have bad performance. * * @param rel the id of the relationship. * @param properties map containing the properties or <code>null</code> to * clear all properties. */ void setRelationshipProperties( long rel, Map<String,Object> properties ); /** * Returns a map containing all the properties of the relationships. * * @param relId the id of the relationship. * @return map containing the relationship's properties. */ Map<String,Object> getRelationshipProperties( long relId ); /** * Removes the property named {@code property} from the node with id * {@code id}, if present. * * @param node The id of the node from which to remove the property * @param property The name of the property */ void removeNodeProperty( long node, String property ); /** * Removes the property named {@code property} from the relationship with id * {@code id}, if present. * * @param relationship The id of the relationship from which to remove the * property * @param property The name of the property */ void removeRelationshipProperty( long relationship, String property ); /** * Returns an {@link IndexCreator} where details about the index to create can be * specified. When all details have been entered {@link IndexCreator#create() create} * must be called for it to actually be created. * * Creating an index enables indexing for nodes with the specified label. The index will * have the details supplied to the {@link IndexCreator returned index creator}. * * Indexes created with the method are deferred until the batch inserter is shut down, at * which point a background job will populate all indexes, i.e. the index * is not available during the batch insertion itself. It is therefore advisable to * create deferred indexes just before shutting down the batch inserter. * * @param label {@link Label label} on nodes to be indexed * * @return an {@link IndexCreator} capable of providing details for, as well as creating * an index for the given {@link Label label}. */ IndexCreator createDeferredSchemaIndex( Label label ); /** * Returns a {@link ConstraintCreator} where details about the constraint can be * specified. When all details have been entered {@link ConstraintCreator#create()} * must be called for it to actually be created. * * Creating a constraint will have the transaction creating it block on commit until * all existing data has been verified for compliance. If any existing data doesn't * comply with the constraint the transaction will not be able to commit, but * fail in {@link Transaction#close()}. * * @param label the label this constraint is for. * @return a {@link ConstraintCreator} capable of providing details for, as well as creating * a constraint for the given {@link Label label}. */ ConstraintCreator createDeferredConstraint( Label label ); /** * Shuts down this batch inserter syncing all changes that are still only * in memory to disk. Failing to invoke this method may leave the Neo4j * store in a inconsistent state. * * Note that this method will trigger population of all indexes, both * those created in the batch insertion session, as well as those that existed * previously. This may take a long time, depending on data size. * * <p> * After this method has been invoked any other method call to this batch * inserter is illegal. */ void shutdown(); /** * Returns the path to this Neo4j store. * * @return the path to this Neo4j store. */ String getStoreDir(); }
false
community_kernel_src_main_java_org_neo4j_unsafe_batchinsert_BatchInserter.java
6,678
public interface BatchInserterIndex { /** * Adds key/value pairs for {@code entity} to the index. If there's a * previous index for {@code entity} it will co-exist with this new one. * This behavior is because of performance reasons, to not being forced to * check if indexing for {@code entity} already exists or not. If you need * to update indexing for {@code entity} and it's ok with a slower indexing * process use {@link #updateOrAdd(long, Map)} instead. * * Entries added to the index aren't necessarily written to the index and to * disk until {@link BatchInserterIndexProvider#shutdown()} has been called. * Entries added to the index isn't necessarily seen by other methods: * {@link #updateOrAdd(long, Map)}, {@link #get(String, Object)}, * {@link #query(String, Object)} and {@link #query(Object)} until a call to * {@link #flush()} has been made. * * @param entityId the entity (i.e id of {@link Node} or * {@link Relationship}) to associate the key/value pairs with. * @param properties key/value pairs to index for {@code entity}. */ void add( long entityId, Map<String, Object> properties ); /** * Adds key/value pairs for {@code entity} to the index. If there's any * previous index for {@code entity} all such indexed key/value pairs will * be deleted first. This method can be considerably slower than * {@link #add(long, Map)} because it must check if there are properties * already indexed for {@code entity}. So if you know that there's no * previous indexing for {@code entity} use {@link #add(long, Map)} instead. * * Entries added to the index aren't necessarily written to the index and to * disk until {@link BatchInserterIndexProvider#shutdown()} has been called. * Entries added to the index isn't necessarily seen by other methods: * {@link #updateOrAdd(long, Map)}, {@link #get(String, Object)}, * {@link #query(String, Object)} and {@link #query(Object)} until a call to * {@link #flush()} has been made. So only entries added before the most * recent {@link #flush()} are guaranteed to be found by this method. * * @param entityId the entity (i.e id of {@link Node} or * {@link Relationship}) to associate the key/value pairs with. * @param properties key/value pairs to index for {@code entity}. */ void updateOrAdd( long entityId, Map<String, Object> properties ); /** * Returns exact matches from this index, given the key/value pair. Matches * will be for key/value pairs just as they were added by the * {@link #add(long, Map)} or {@link #updateOrAdd(long, Map)} method. * * Entries added to the index aren't necessarily written to the index and to * disk until {@link BatchInserterIndexProvider#shutdown()} has been called. * Entries added to the index isn't necessarily seen by other methods: * {@link #updateOrAdd(long, Map)}, {@link #get(String, Object)}, * {@link #query(String, Object)} and {@link #query(Object)} until a call to * {@link #flush()} has been made. So only entries added before the most * recent {@link #flush()} are guaranteed to be found by this method. * * @param key the key in the key/value pair to match. * @param value the value in the key/value pair to match. * @return the result wrapped in an {@link IndexHits} object. If the entire * result set isn't looped through, {@link IndexHits#close()} must * be called before disposing of the result. */ IndexHits<Long> get( String key, Object value ); /** * Returns matches from this index based on the supplied {@code key} and * query object, which can be a query string or an implementation-specific * query object. * * Entries added to the index aren't necessarily written to the index and * to disk until {@link BatchInserterIndexProvider#shutdown()} has been * called. Entries added to the index isn't necessarily seen by other * methods: {@link #updateOrAdd(long, Map)}, {@link #get(String, Object)}, * {@link #query(String, Object)} and {@link #query(Object)} until a call * to {@link #flush()} has been made. So only entries added before the most * recent {@link #flush()} are guaranteed to be found by this method. * * @param key the key in this query. * @param queryOrQueryObject the query for the {@code key} to match. * @return the result wrapped in an {@link IndexHits} object. If the entire * result set isn't looped through, {@link IndexHits#close()} must be * called before disposing of the result. */ IndexHits<Long> query( String key, Object queryOrQueryObject ); /** * Returns matches from this index based on the supplied query object, * which can be a query string or an implementation-specific query object. * * Entries added to the index aren't necessarily written to the index and * to disk until {@link BatchInserterIndexProvider#shutdown()} has been * called. Entries added to the index isn't necessarily seen by other * methods: {@link #updateOrAdd(long, Map)}, {@link #get(String, Object)}, * {@link #query(String, Object)} and {@link #query(Object)} until a call * to {@link #flush()} has been made. So only entries added before the most * recent {@link #flush()} are guaranteed to be found by this method. * * @param queryOrQueryObject the query to match. * @return the result wrapped in an {@link IndexHits} object. If the entire * result set isn't looped through, {@link IndexHits#close()} must be * called before disposing of the result. */ IndexHits<Long> query( Object queryOrQueryObject ); /** * Makes sure additions/updates can be seen by {@link #get(String, Object)}, * {@link #query(String, Object)} and {@link #query(Object)} so that they * are guaranteed to return correct results. Also * {@link #updateOrAdd(long, Map)} will find previous indexing correctly * after a flush. */ void flush(); /** * Sets the cache size for key/value pairs for the given {@code key}. * Caching values may increase {@link #get(String, Object)} lookups significantly, * but may at the same time slow down insertion of data some. * * Be sure to call this method to enable caching for keys that will be * used a lot in lookups. It's also best to call this method for your keys * right after the index has been created. * * @param key the key to set cache capacity for. * @param size the number of values to cache results for. */ void setCacheCapacity( String key, int size ); }
false
community_kernel_src_main_java_org_neo4j_unsafe_batchinsert_BatchInserterIndex.java
6,679
public interface BatchInserterIndexProvider { /** * Returns a {@link BatchInserterIndex} for {@link Node}s for the name * {@code indexName} with the given {@code config}. The {@code config} * {@link Map} can contain any provider-implementation-specific data that * can control how an index behaves. * * @param indexName the name of the index. It will be created if it doesn't * exist. * @param config a {@link Map} of configuration parameters to use with the * index if it doesn't exist. Parameters can be anything and are * implementation-specific. * @return the {@link BatchInserterIndex} corresponding to the * {@code indexName}. */ BatchInserterIndex nodeIndex( String indexName, Map<String, String> config ); /** * Returns a {@link BatchInserterIndex} for {@link Relationship}s for the * name {@code indexName} with the given {@code config}. The {@code config} * {@link Map} can contain any provider-implementation-specific data that * can control how an index behaves. * * @param indexName the name of the index. It will be created if it doesn't * exist. * @param config a {@link Map} of configuration parameters to use with the * index if it doesn't exist. Parameters can be anything and are * implementation-specific. * @return the {@link BatchInserterIndex} corresponding to the * {@code indexName}. */ BatchInserterIndex relationshipIndex( String indexName, Map<String, String> config ); /** * Shuts down this index provider and ensures that all indexes are fully * written to disk. If this method isn't called before shutting down the * {@link BatchInserter} there's no guaranteed that data added to indexes * will be persisted. */ void shutdown(); }
false
community_kernel_src_main_java_org_neo4j_unsafe_batchinsert_BatchInserterIndexProvider.java
6,680
public interface LabelScanWriter extends Closeable { /** * Store a {@link NodeLabelUpdate}. Calls to this method MUST be ordered by ascending node id. */ void write( NodeLabelUpdate update ) throws IOException; /** * Close this writer and flush pending changes to the store. */ void close() throws IOException; LabelScanWriter EMPTY = new LabelScanWriter() { @Override public void write( NodeLabelUpdate update ) throws IOException { // do nothing } @Override public void close() throws IOException { // nothing to close } }; }
false
community_kernel_src_main_java_org_neo4j_unsafe_batchinsert_LabelScanWriter.java
6,681
private static enum Labels implements Label { FIRST, SECOND, THIRD }
false
community_kernel_src_test_java_org_neo4j_unsafe_batchinsert_TestBatchInsert.java
6,682
private static enum RelTypes implements RelationshipType { BATCH_TEST, REL_TYPE1, REL_TYPE2, REL_TYPE3, REL_TYPE4, REL_TYPE5 }
false
community_kernel_src_test_java_org_neo4j_unsafe_batchinsert_TestBatchInsert.java
6,683
private enum EdgeType implements RelationshipType { KNOWS }
false
community_lucene-index_src_test_java_org_neo4j_unsafe_batchinsert_TestLuceneBatchInsert.java
6,684
public interface GraphRenderer<E extends Throwable> { /** * Renders a node. * @param node * the node to render. * @return an object capable of rendering the properties of the node, or * <code>null</code> to not render properties externally. * @throws E * if an error occurs when rendering the node. */ PropertyRenderer<E> renderNode( Node node ) throws E; /** * Renders a relationship. * @param relationship * the relationship to render. * @return an object capable of rendering the properties of the * relationship, or <code>null</code> to not render properties * externally. * @throws E * if an error occurs when rendering the relationship. */ PropertyRenderer<E> renderRelationship( Relationship relationship ) throws E; /** * Invoked when the entire graph has been rendered. * @throws E * if an error occurs. */ void done() throws E; GraphRenderer<E> renderSubgraph( String name ) throws E; }
false
community_graphviz_src_main_java_org_neo4j_visualization_GraphRenderer.java
6,685
public interface PropertyRenderer<E extends Throwable> { /** * Renders a property. * @param propertyKey * the key of the property. * @param propertyValue * the value of the property. * @throws E * if an error occurs when rendering the property. */ void renderProperty( String propertyKey, Object propertyValue ) throws E; /** * Invoked when all properties have been rendered. * @throws E * if an error occurs. */ void done() throws E; }
false
community_graphviz_src_main_java_org_neo4j_visualization_PropertyRenderer.java
6,686
public enum PropertyType { /** * Represents a String property. */ STRING( null, "String", String.class ) { @Override <T> T apply( ValueFormatter<T> formatter, Object value ) { return formatter.formatString( ( String ) value ); } }, /** * Represents an integer property. */ INT( null, "int", Integer.class, int.class ), /** * Represents a long property. */ LONG( null, "long", Long.class, long.class ), /** * Represents a boolean property. */ BOOLEAN( null, "boolean", Boolean.class, boolean.class ), /** * Represents a short property. */ SHORT( null, "short", Short.class, short.class ), /** * Represents a character property. */ CHAR( null, "char", Character.class, char.class ), /** * Represents a byte property. */ BYTE( null, "byte", Byte.class, byte.class ), /** * Represents a float property. */ FLOAT( null, "float", Float.class, float.class ), /** * Represents a double property. */ DOUBLE( null, "double", Double.class, double.class ), // Array types /** * Represents an array of Strings. */ STRING_ARRAY( String.class, "String[]", String[].class ) { @Override <T> T apply( ValueFormatter<T> formatter, Object value ) { return formatter.formatStringArray( ( String[] ) value ); } }, /** * Represents an array of integers. */ INT_ARRAY( Integer.class, "int[]", Integer[].class, int[].class ), /** * Represents an array of longs. */ LONG_ARRAY( Long.class, "long[]", Long[].class, long[].class ), /** * Represents an array of booleans. */ BOOLEAN_ARRAY( Boolean.class, "boolean[]", Boolean[].class, boolean[].class ), /** * Represents an array of shorts. */ SHORT_ARRAY( Short.class, "short[]", Short[].class, short[].class ), /** * Represents an array of characters. */ CHAR_ARRAY( Character.class, "char[]", Character[].class, char[].class ), /** * Represents an array of bytes. */ BYTE_ARRAY( Byte.class, "byte[]", Byte[].class, byte[].class ), /** * Represents an array of floats. */ FLOAT_ARRAY( Float.class, "float[]", Float[].class, float[].class ), /** * Represents an array of doubles. */ DOUBLE_ARRAY( Double.class, "double[]", Double[].class, double[].class ), /** * Represents an undefined type. */ UNDEFINED( null, "Object" ) { @Override <T> T apply( ValueFormatter<T> formatter, Object value ) { return formatter.formatUnknownObject( value ); } }; /** * Get the {@link PropertyType} representing the type of a value. * @param propertyValue * the value to get the type of. * @return the type of the given value. */ public static PropertyType getTypeOf( Object propertyValue ) { return getTypeFor( propertyValue.getClass() ); } static PropertyType getTypeFor( Class<? extends Object> type ) { PropertyType result = typeMap.get( type ); if ( result != null ) { return result; } else { return UNDEFINED; } } <T> T apply( ValueFormatter<T> formatter, Object value ) { if ( scalarType != null ) { PropertyType type = getTypeFor( scalarType ); if ( value instanceof Object[] ) { return formatter.formatBoxedPrimitiveArray( type, ( Object[] ) value ); } else { return formatter.formatPrimitiveArray( type, value ); } } else { return formatter.formatBoxedPrimitive( this, value ); } } /** * Apply a formatter to a value and return the result. * @param <T> * the type of the result. * @param formatter * the formatter to apply to the value. * @param propertyValue * the value to apply the formatter to. * @return the value as produced by the formatter. */ public static <T> T format( ValueFormatter<T> formatter, Object propertyValue ) { return getTypeOf( propertyValue ).apply( formatter, propertyValue ); } /** * Format a given value to a String by applying a string formatter. * @see #format(ValueFormatter, Object) * @param propertyValue * the value to turn into a string. * @return the given value formatted as a string. */ public static String format( Object propertyValue ) { return format( ValueFormatter.DEFAULT_STRING_FORMATTER, propertyValue ); } private final Class<?>[] types; private final Class<?> scalarType; /** * Specifies the name of the type. */ public final String typeName; private PropertyType( Class<?> scalarType, String descriptor, Class<?>... types ) { this.typeName = descriptor; this.types = types; this.scalarType = scalarType; } private static final Map<Class<?>, PropertyType> typeMap; static { Map<Class<?>, PropertyType> types = new HashMap<Class<?>, PropertyType>(); for ( PropertyType type : values() ) { for ( Class<?> cls : type.types ) { types.put( cls, type ); } } typeMap = Collections.unmodifiableMap( types ); } }
false
community_graphviz_src_main_java_org_neo4j_visualization_PropertyType.java
6,687
public interface SubgraphMapper { String getSubgraphFor( Node node ); public abstract class SubgraphMappingWalker extends Walker { private final SubgraphMapper mapper; protected SubgraphMappingWalker( SubgraphMapper mapper ) { this.mapper = mapper; } private Map<String, Collection<Node>> subgraphs; private Collection<Node> generic; private Collection<Relationship> relationships; private synchronized void initialize() { if ( subgraphs != null ) return; Map<Node, String> mappings = new HashMap<Node, String>(); subgraphs = new HashMap<String, Collection<Node>>(); generic = new ArrayList<Node>(); for ( Node node : nodes() ) { if ( mappings.containsKey( node ) ) continue; String subgraph = subgraphFor( node ); if ( !subgraphs.containsKey( subgraph ) && subgraph != null ) { subgraphs.put( subgraph, new ArrayList<Node>() ); } mappings.put( node, subgraph ); } relationships = new ArrayList<Relationship>(); for ( Relationship rel : relationships() ) { if ( mappings.containsKey( rel.getStartNode() ) && mappings.containsKey( rel.getEndNode() ) ) { relationships.add( rel ); } } for ( Map.Entry<Node, String> e : mappings.entrySet() ) { ( e.getValue() == null ? generic : subgraphs.get( e.getValue() ) ).add( e.getKey() ); } } private String subgraphFor( Node node ) { return mapper == null ? null : mapper.getSubgraphFor( node ); } @Override public final <R, E extends Throwable> R accept( Visitor<R, E> visitor ) throws E { initialize(); for ( Map.Entry<String, Collection<Node>> subgraph : subgraphs.entrySet() ) { Visitor<R, E> subVisitor = visitor.visitSubgraph( subgraph.getKey() ); for ( Node node : subgraph.getValue() ) { subVisitor.visitNode( node ); } subVisitor.done(); } for ( Node node : generic ) { visitor.visitNode( node ); } for ( Relationship relationship : relationships ) { visitor.visitRelationship( relationship ); } return visitor.done(); } protected abstract Iterable<Node> nodes(); protected abstract Iterable<Relationship> relationships(); } }
false
community_graphviz_src_main_java_org_neo4j_visualization_SubgraphMapper.java
6,688
public interface ValueFormatter<T> { /** * Format a string. * @param value * the string to format. * @return a formatted version of the given string. */ T formatString( String value ); /** * Format a string array. * @param array * the string array to format. * @return a formatted version of the given string array. */ T formatStringArray( String[] array ); /** * Format a boxed primitive. * @param type * an object representing the type of the primitive. * @param value * the boxed primitive object to format. * @return a formatted version of the given value. */ T formatBoxedPrimitive( PropertyType type, Object value ); /** * Format an array of primitives. * @param elementType * an object representing the type of the elements of the array. * @param array * the array to format. * @return a formatted version of the given array. */ T formatPrimitiveArray( PropertyType elementType, Object array ); /** * Format an array of boxed primitives. * @param elementType * an object representing the type of the elements of the array. * @param array * the array to format. * @return a formatted version of the given array. */ T formatBoxedPrimitiveArray( PropertyType elementType, Object[] array ); /** * Format an object of unsupported type. * @param value * @return a formatted version of the given value. */ T formatUnknownObject( Object value ); /** * A default implementation that formats a String. */ static final ValueFormatter<String> DEFAULT_STRING_FORMATTER = new ValueFormatter<String>() { public String formatString( String string ) { string = string.replace( "\\n", "\\\\n" ); string = string.replace( "\\", "\\\\" ); string = string.replace( "\"", "\\\"" ); string = string.replace( "'", "\\\\'" ); string = string.replace( "\n", "\\\\n" ); string = string.replace( "<", "\\<" ); string = string.replace( ">", "\\>" ); string = string.replace( "[", "\\[" ); string = string.replace( "]", "\\]" ); string = string.replace( "{", "\\{" ); string = string.replace( "}", "\\}" ); string = string.replace( "|", "\\|" ); return "'" + string + "'"; } public String formatStringArray( String[] value ) { boolean comma = false; StringBuilder result = new StringBuilder( "[" ); for ( String string : value ) { if ( comma ) { result.append( ", " ); } result.append( formatString( string ) ); comma = true; } result.append( "]" ); return result.toString(); } public String formatBoxedPrimitive( PropertyType type, Object primitive ) { return primitive.toString(); } public String formatBoxedPrimitiveArray( PropertyType elementType, Object[] array ) { return Arrays.toString( array ); } public String formatPrimitiveArray( PropertyType type, Object array ) { switch ( type ) { case INT: return Arrays.toString( ( int[] ) array ); case LONG: return Arrays.toString( ( long[] ) array ); case BOOLEAN: return Arrays.toString( ( boolean[] ) array ); case SHORT: return Arrays.toString( ( short[] ) array ); case CHAR: return Arrays.toString( ( char[] ) array ); case BYTE: return Arrays.toString( ( byte[] ) array ); case FLOAT: return Arrays.toString( ( float[] ) array ); case DOUBLE: return Arrays.toString( ( double[] ) array ); default: throw new IllegalArgumentException(); } } public String formatUnknownObject( Object value ) { return value.toString(); } }; }
false
community_graphviz_src_main_java_org_neo4j_visualization_ValueFormatter.java
6,689
interface NodeStyle extends PropertyContainerStyle { /** * Emit the start of a node. * @param stream * the stream to emit the node to. * @param node * the node to emit. * @throws IOException * if there is an error on the stream. */ void emitNodeStart( Appendable stream, Node node ) throws IOException; }
false
community_graphviz_src_main_java_org_neo4j_visualization_graphviz_NodeStyle.java
6,690
interface ParameterGetter<C extends PropertyContainer> { /** * Get the value for a parameter. * @param container * the node or relationship to get the value for. * @param key * the parameter to get. * @return the value of the parameter, or <code>null</code> to not emit * the parameter for this node/relationship. */ String getParameterValue( C container, String key ); }
false
community_graphviz_src_main_java_org_neo4j_visualization_graphviz_ParameterGetter.java
6,691
interface PropertyContainerStyle { /** * Emit the end of a node or relationship. * @param stream * the stream to emit the end on. * @throws IOException * if there is an error on the stream. */ void emitEnd( Appendable stream ) throws IOException; /** * Emit a property of a node of relationship. * @param stream * the stream to emit the property on. * @param key * the key of the property. * @param value * the value of the property. * @throws IOException * if there is an error on the stream. */ void emitProperty( Appendable stream, String key, Object value ) throws IOException; }
false
community_graphviz_src_main_java_org_neo4j_visualization_graphviz_PropertyContainerStyle.java
6,692
interface PropertyFilter { /** * Determine if a property should be emitted. * @param key * the key of the property. * @return <code>true</code> if the property should be emitted. */ boolean acceptProperty( String key ); }
false
community_graphviz_src_main_java_org_neo4j_visualization_graphviz_PropertyFilter.java
6,693
interface PropertyFormatter { /** * Format a property as a string. * @param key * the key of the property to format. * @param type * an object representing the type of the property. * @param value * the value or the property to format. * @return the property formatted as a string. */ String format( String key, PropertyType type, Object value ); }
false
community_graphviz_src_main_java_org_neo4j_visualization_graphviz_PropertyFormatter.java
6,694
interface RelationshipStyle extends PropertyContainerStyle { /** * Emit the start of a relationship. * @param stream * the stream to emit the relationship to. * @param relationship * the relationship to emit. * @throws IOException * if there is an error on the stream. */ void emitRelationshipStart( Appendable stream, Relationship relationship ) throws IOException; }
false
community_graphviz_src_main_java_org_neo4j_visualization_graphviz_RelationshipStyle.java
6,695
interface StyleConfiguration { void setGraphProperty( String property, String value ); void setDefaultNodeProperty( String property, String value ); void setDefaultRelationshipProperty( String property, String value ); void displayRelationshipLabel( boolean on ); void setNodePropertyFilter( PropertyFilter filter ); void setRelationshipPropertyFilter( PropertyFilter filter ); void setNodeParameterGetter( String key, ParameterGetter<? super Node> getter ); void setRelationshipParameterGetter( String key, ParameterGetter<? super Relationship> getter ); void setRelationshipTitleGetter( TitleGetter<? super Relationship> getter ); void setNodeTitleGetter( TitleGetter<? super Node> getter ); void setNodePropertyFomatter( PropertyFormatter format ); void setRelationshipPropertyFomatter( PropertyFormatter format ); void setRelationshipReverseOrderPredicate( Predicate<Relationship> reversed ); String escapeLabel( String label ); }
false
community_graphviz_src_main_java_org_neo4j_visualization_graphviz_StyleConfiguration.java
6,696
public interface StyleParameter { /** * Apply this configuration parameter to a configuration. * @param configuration * the configuration to apply this parameter to. */ void configure( StyleConfiguration configuration ); final class GraphLabel implements StyleParameter { private final String label; public GraphLabel( String label ) { this.label = label; } public void configure( StyleConfiguration configuration ) { configuration.setGraphProperty( "label", configuration.escapeLabel( label ) ); } } /** Configure the font of nodes. */ final class NodeFont implements StyleParameter { private final String name; private final int size; /** * Configure the font of nodes. * @param fontName * the name of the node font. * @param fontSize * the size of the node font. */ public NodeFont( String fontName, int fontSize ) { this.name = fontName; this.size = fontSize; } public final void configure( StyleConfiguration configuration ) { configuration.setDefaultNodeProperty( "fontname", name ); configuration.setDefaultNodeProperty( "fontsize", Integer .toString( size ) ); } } /** Configure the font of relationships. */ final class RelationshipFont implements StyleParameter { private final String name; private final int size; /** * Configure the font of relationships. * @param fontName * the name of the relationship font. * @param fontSize * the size of the relationship font. */ public RelationshipFont( String fontName, int fontSize ) { this.name = fontName; this.size = fontSize; } public final void configure( StyleConfiguration configuration ) { configuration.setDefaultRelationshipProperty( "fontname", name ); configuration.setDefaultRelationshipProperty( "fontsize", Integer .toString( size ) ); } } /** Add a property to the general node configuration. */ final class DefaultNodeProperty implements StyleParameter { private final String property; private final String value; /** * Add a property to the general node configuration. * @param property * the property key. * @param value * the property value. */ public DefaultNodeProperty( String property, String value ) { this.property = property; this.value = value; } public final void configure( StyleConfiguration configuration ) { configuration.setDefaultNodeProperty( property, value ); } } /** Add a property to the general relationship configuration. */ final class DefaultRelationshipProperty implements StyleParameter { private final String property; private final String value; /** * Add a property to the general relationship configuration. * @param property * the property key. * @param value * the property value. */ public DefaultRelationshipProperty( String property, String value ) { this.property = property; this.value = value; } public final void configure( StyleConfiguration configuration ) { configuration.setDefaultRelationshipProperty( property, value ); } } /** Apply a color to a relationship. */ abstract class RelationshipColor implements StyleParameter { public final void configure( StyleConfiguration configuration ) { ParameterGetter<Relationship> getter = new ParameterGetter<Relationship>() { public String getParameterValue( Relationship relationship, String key ) { if ( key.equals( "color" ) ) { return getColor( relationship ); } else { return getFontColor( relationship ); } } }; configuration.setRelationshipParameterGetter( "color", getter ); configuration.setRelationshipParameterGetter( "fontcolor", getter ); } /** * Get the font color for the given relationship. * @param relationship * the relationship to get the font color for. * @return the name of the font color for the given relationship. */ protected String getFontColor( Relationship relationship ) { return getColor( relationship ); } /** * Get the color for a given relationship. * @param relationship * the relationship to get the color for. * @return the name of the color for the given relationship. */ protected abstract String getColor( Relationship relationship ); } /** Apply a color to a relationship based on the type of the relationship. */ abstract class RelationshipTypeColor extends RelationshipColor { private final Map<String, String> colors = new HashMap<String, String>(); private final Map<String, String> fontColors = new HashMap<String, String>(); @Override protected final String getColor( Relationship relationship ) { RelationshipType type = relationship.getType(); String result = colors.get( type.name() ); if ( result == null ) { result = getColor( type ); if ( result == null ) { result = "black"; } colors.put( type.name(), result ); } return result; } @Override protected final String getFontColor( Relationship relationship ) { RelationshipType type = relationship.getType(); String result = fontColors.get( type.name() ); if ( result == null ) { result = getFontColor( type ); if ( result == null ) { result = "black"; } fontColors.put( type.name(), result ); } return result; } /** * Get the font color for a relationship type. Only invoked once for * each relationship type in the graph. * @param type * the relationship type to get the font color for. * @return the name of the font color for the relationship type. */ protected String getFontColor( RelationshipType type ) { return getColor( type ); } /** * Get the color for a relationship type. Only invoked once for each * relationship type in the graph. * @param type * the relationship type to get the color for. * @return the name of the color for the relationship type. */ protected abstract String getColor( RelationshipType type ); } /** Apply a color to a node. */ abstract class NodeColor implements StyleParameter { public final void configure( StyleConfiguration configuration ) { ParameterGetter<Node> getter = new ParameterGetter<Node>() { public String getParameterValue( Node node, String key ) { if ( key.equals( "color" ) ) { return getColor( node ); } else if ( key.equals( "fontcolor" ) ) { return getFontColor( node ); } else { return getFillColor( node ); } } }; configuration.setDefaultNodeProperty( "style", "filled" ); configuration.setNodeParameterGetter( "color", getter ); configuration.setNodeParameterGetter( "fillcolor", getter ); configuration.setNodeParameterGetter( "fontcolor", getter ); } /** * Get the font color for the given node. * @param node * the node to get the font color for. * @return the name of the font color for the given node. */ protected String getFontColor( Node node ) { return getColor( node ); } /** * Return the default color for the node. This is the color of the * borders of the node. * @param node * the node to get the color for. * @return the name of the color for the node. */ protected abstract String getColor( Node node ); /** * Return the fill color for the node. This is the color of the interior * of the node. * @param node * the node to get the color for. * @return the name of the color for the node. */ protected String getFillColor( Node node ) { return null; } } /** * Reverse the logical order of relationships. * * This affects how the layout of the nodes. */ abstract class ReverseRelationshipOrder implements StyleParameter { public void configure( StyleConfiguration configuration ) { configuration.setRelationshipReverseOrderPredicate( new Predicate<Relationship>() { public boolean accept( Relationship item ) { return reversedOrder( item ); } } ); } protected abstract boolean reversedOrder( Relationship edge ); } /** Reverse the logical order of relationships with specific types. */ final class ReverseOrderRelationshipTypes extends ReverseRelationshipOrder { private final Set<String> reversedTypes = new HashSet<String>(); public ReverseOrderRelationshipTypes( RelationshipType... types ) { for ( RelationshipType type : types ) { reversedTypes.add( type.name() ); } } @Override protected boolean reversedOrder( Relationship edge ) { return reversedTypes.contains( edge.getType().name() ); } } /** Add a custom title to nodes. */ abstract class NodeTitle implements StyleParameter, TitleGetter<Node> { public final void configure( StyleConfiguration configuration ) { configuration.setNodeTitleGetter( this ); } } /** Add a custom title to relationships. */ abstract class RelationshipTitle implements StyleParameter, TitleGetter<Relationship> { public final void configure( StyleConfiguration configuration ) { configuration.setRelationshipTitleGetter( this ); } } /** Get node title from a property. */ final class NodeTitleProperty extends NodeTitle { private final String key; /** * Get node title from a property. * @param key * the property key to use as title. */ public NodeTitleProperty( String key ) { this.key = key; } public String getTitle( Node node ) { return ( String ) node.getProperty( key ); } } /** Get relationship title from a property. */ final class RelationshipTitleProperty extends RelationshipTitle { private final String key; /** * Get relationship title from a property. * @param key * the property key to use as title. */ public RelationshipTitleProperty( String key ) { this.key = key; } public String getTitle( Relationship relationship ) { return ( String ) relationship.getProperty( key ); } } /** Add custom generic parameters to nodes. */ abstract class GenericNodeParameters implements StyleParameter, ParameterGetter<Node> { /** * Add custom generic parameters to nodes. * @param keys * the parameters to add. */ protected GenericNodeParameters( String... keys ) { this.keys = Arrays.asList( keys ); } private final Iterable<String> keys; public final void configure( StyleConfiguration configuration ) { for ( String key : keys ) { configuration.setNodeParameterGetter( key, this ); } } } /** Add custom generic parameters to relationships. */ abstract class GenericRelationshipParameters implements StyleParameter, ParameterGetter<Relationship> { /** * Add custom generic parameters to relationships. * @param keys * the parameters to add. */ protected GenericRelationshipParameters( String... keys ) { this.keys = keys; } private final String[] keys; public final void configure( StyleConfiguration configuration ) { for ( String key : keys ) { configuration.setRelationshipParameterGetter( key, this ); } } } /** Filter which properties are allowed for nodes. */ abstract class NodePropertyFilter implements StyleParameter, PropertyFilter { public final void configure( StyleConfiguration configuration ) { configuration.setNodePropertyFilter( this ); } } /** Filter which properties are alloed for relationships. */ abstract class RelationshipPropertyFilter implements StyleParameter, PropertyFilter { public final void configure( StyleConfiguration configuration ) { configuration.setRelationshipPropertyFilter( this ); } } /** Specify a custom format for node properties. */ abstract class NodePropertyFormat implements StyleParameter, PropertyFormatter { public final void configure( StyleConfiguration configuration ) { configuration.setNodePropertyFomatter( this ); } } /** Specify a custom format for relationship properties. */ abstract class RelationshipPropertyFormat implements StyleParameter, PropertyFormatter { public final void configure( StyleConfiguration configuration ) { configuration.setRelationshipPropertyFomatter( this ); } } /** Specify a label for the head of relationships. */ abstract class RelationshipHeadLabel implements StyleParameter { public void configure( StyleConfiguration configuration ) { configuration.setRelationshipParameterGetter( "headlabel", new ParameterGetter<Relationship>() { public String getParameterValue( Relationship container, String key ) { return getHeadLabel( container ); } } ); } /** * Get the head label for a relationship. * @param relationship * the relationship to get the head label for. * @return the head label for the relationship. */ protected abstract String getHeadLabel( Relationship relationship ); } /** Specify a label for the tail of relationships. */ abstract class RelationshipTailLabel implements StyleParameter { public void configure( StyleConfiguration configuration ) { configuration.setRelationshipParameterGetter( "taillabel", new ParameterGetter<Relationship>() { public String getParameterValue( Relationship container, String key ) { return getTailLabel( container ); } } ); } /** * Get the tail label for a relationship. * @param relationship * the relationship to get the tail label for. * @return the tail label for the relationship. */ protected abstract String getTailLabel( Relationship relationship ); } /** * Simple style parameter that neither requires parameters, nor custom code. */ enum Simple implements StyleParameter { /** Don't render properties for relationships. */ NO_RELATIONSHIP_PROPERTIES { @Override public final void configure( StyleConfiguration configuration ) { configuration .setRelationshipPropertyFilter( new PropertyFilter() { public boolean acceptProperty( String key ) { return false; } } ); } }, /** Don't render labels for relationships. */ NO_RELATIONSHIP_LABEL { @Override public final void configure( StyleConfiguration configuration ) { configuration.displayRelationshipLabel( false ); } }, /** Render properties for relationships as "key = value : type". */ PROPERTY_AS_KEY_EQUALS_VALUE_COLON_TYPE { @Override public final void configure( final StyleConfiguration configuration ) { PropertyFormatter format = new PropertyFormatter() { public String format( String key, PropertyType type, Object value ) { return configuration.escapeLabel( key ) + " = " + configuration.escapeLabel(PropertyType.format( value )) + " : " + type.typeName; } }; configuration.setNodePropertyFomatter( format ); configuration.setRelationshipPropertyFomatter( format ); } }, /** Render properties for relationships as "key = value". */ PROPERTY_AS_KEY_EQUALS_VALUE { @Override public final void configure( final StyleConfiguration configuration ) { PropertyFormatter format = new PropertyFormatter() { public String format( String key, PropertyType type, Object value ) { return configuration.escapeLabel( key ) + " = " + configuration.escapeLabel( PropertyType.format( value ) ); } }; configuration.setNodePropertyFomatter( format ); configuration.setRelationshipPropertyFomatter( format ); } }, /** Render properties for relationships as "key : type". */ PROPERTY_AS_KEY_COLON_TYPE { @Override public final void configure( final StyleConfiguration configuration ) { PropertyFormatter format = new PropertyFormatter() { public String format( String key, PropertyType type, Object value ) { return configuration.escapeLabel( key ) + " : " + type.typeName; } }; configuration.setNodePropertyFomatter( format ); configuration.setRelationshipPropertyFomatter( format ); } }; /** * @see StyleParameter#configure(StyleConfiguration) * @param configuration * same as in * {@link StyleParameter#configure(StyleConfiguration)}. */ public abstract void configure( StyleConfiguration configuration ); } }
false
community_graphviz_src_main_java_org_neo4j_visualization_graphviz_StyleParameter.java
6,697
enum Simple implements StyleParameter { /** Don't render properties for relationships. */ NO_RELATIONSHIP_PROPERTIES { @Override public final void configure( StyleConfiguration configuration ) { configuration .setRelationshipPropertyFilter( new PropertyFilter() { public boolean acceptProperty( String key ) { return false; } } ); } }, /** Don't render labels for relationships. */ NO_RELATIONSHIP_LABEL { @Override public final void configure( StyleConfiguration configuration ) { configuration.displayRelationshipLabel( false ); } }, /** Render properties for relationships as "key = value : type". */ PROPERTY_AS_KEY_EQUALS_VALUE_COLON_TYPE { @Override public final void configure( final StyleConfiguration configuration ) { PropertyFormatter format = new PropertyFormatter() { public String format( String key, PropertyType type, Object value ) { return configuration.escapeLabel( key ) + " = " + configuration.escapeLabel(PropertyType.format( value )) + " : " + type.typeName; } }; configuration.setNodePropertyFomatter( format ); configuration.setRelationshipPropertyFomatter( format ); } }, /** Render properties for relationships as "key = value". */ PROPERTY_AS_KEY_EQUALS_VALUE { @Override public final void configure( final StyleConfiguration configuration ) { PropertyFormatter format = new PropertyFormatter() { public String format( String key, PropertyType type, Object value ) { return configuration.escapeLabel( key ) + " = " + configuration.escapeLabel( PropertyType.format( value ) ); } }; configuration.setNodePropertyFomatter( format ); configuration.setRelationshipPropertyFomatter( format ); } }, /** Render properties for relationships as "key : type". */ PROPERTY_AS_KEY_COLON_TYPE { @Override public final void configure( final StyleConfiguration configuration ) { PropertyFormatter format = new PropertyFormatter() { public String format( String key, PropertyType type, Object value ) { return configuration.escapeLabel( key ) + " : " + type.typeName; } }; configuration.setNodePropertyFomatter( format ); configuration.setRelationshipPropertyFomatter( format ); } }; /** * @see StyleParameter#configure(StyleConfiguration) * @param configuration * same as in * {@link StyleParameter#configure(StyleConfiguration)}. */ public abstract void configure( StyleConfiguration configuration ); }
false
community_graphviz_src_main_java_org_neo4j_visualization_graphviz_StyleParameter.java
6,698
enum type implements RelationshipType { KNOWS, WORKS_FOR }
false
community_graphviz_src_test_java_org_neo4j_visualization_graphviz_TestGraphvizSubgraphOutput.java
6,699
enum type implements RelationshipType { KNOWS, WORKS_FOR }
false
community_graphviz_src_test_java_org_neo4j_visualization_graphviz_TestNewGraphvizWriter.java