idx
int64 0
165k
| question
stringlengths 73
5.81k
| target
stringlengths 5
918
|
|---|---|---|
5,400
|
public static String getNonce ( long issueTime ) { long currentTime = new Date ( ) . getTime ( ) ; return TimeUnit . MILLISECONDS . toSeconds ( currentTime - issueTime ) + ":" + Long . toString ( System . nanoTime ( ) ) ; }
|
Returns a nonce value . The nonce value MUST be unique across all requests with the same MAC key identifier .
|
5,401
|
public static Object invoke ( final Object obj , final String methodName , final Object param ) throws UtilException { return invokeOneArgMethod ( obj , methodName , param , param . getClass ( ) ) ; }
|
Invoke an arbitrary one argument method on an arbitrary object and let the method work out the parameter s type . The user of this method had better be sure that the param isn t null . If there s a chance it is null then the invoke method with a paramType argument must be used .
|
5,402
|
public static Object invoke ( final Object obj , final String methodName , final Object param , final Class < ? > parameterType ) throws UtilException { return invokeOneArgMethod ( obj , methodName , param , parameterType ) ; }
|
Invoke an arbitrary one argument method on an arbitrary object but also include the parameter s type .
|
5,403
|
public static Object invokeStaticMethod ( final Class < ? > objClass , final String methodName , final Object param ) throws UtilException { return invokeOneArgStaticMethod ( objClass , methodName , param , param . getClass ( ) ) ; }
|
Invoke an arbitrary one argument method on an arbitrary class and let the method work out the parameter s type . The user of this method had better be sure that the param isn t null . If there s a chance it is null then the invoke method with a paramType argument must be used .
|
5,404
|
public int runCommandLine ( ) throws IOException , InterruptedException { logRunnerConfiguration ( ) ; ProcessBuilder processBuilder = new ProcessBuilder ( getCommandLineArguments ( ) ) ; processBuilder . directory ( workingDirectory ) ; processBuilder . environment ( ) . putAll ( environmentVars ) ; Process commandLineProc = processBuilder . start ( ) ; final StreamPumper stdoutPumper = new StreamPumper ( commandLineProc . getInputStream ( ) , outputConsumer ) ; final StreamPumper stderrPumper = new StreamPumper ( commandLineProc . getErrorStream ( ) , errorConsumer ) ; stdoutPumper . start ( ) ; stderrPumper . start ( ) ; if ( standardInputString != null ) { OutputStream outputStream = commandLineProc . getOutputStream ( ) ; outputStream . write ( standardInputString . getBytes ( ) ) ; outputStream . close ( ) ; } int exitCode = commandLineProc . waitFor ( ) ; stdoutPumper . waitUntilDone ( ) ; stderrPumper . waitUntilDone ( ) ; if ( exitCode == 0 ) { LOGGER . fine ( processName + " returned zero exit code" ) ; } else { LOGGER . severe ( processName + " returned non-zero exit code (" + exitCode + ")" ) ; } return exitCode ; }
|
Execute the configured program
|
5,405
|
private File getDefaultOutputDirectory ( ) { String childOutputDirectory = getConfiguration ( ) ; if ( ! getPlatform ( ) . equals ( "Win32" ) ) { childOutputDirectory = new File ( getPlatform ( ) , childOutputDirectory ) . getPath ( ) ; } return new File ( getBaseDirectory ( ) , childOutputDirectory ) ; }
|
Retrieve the default output directory for the Visual C ++ project .
|
5,406
|
private File getBaseDirectory ( ) { File referenceFile = ( solutionFile != null ? solutionFile : getInputFile ( ) ) ; return referenceFile . getParentFile ( ) . getAbsoluteFile ( ) ; }
|
Retrieve the base directory for the Visual C ++ project . If this project is part of a Visual Studio solution the base directory is the solution directory ; for standalone projects the base directory is the project directory .
|
5,407
|
public String toSqlString ( Criteria criteria , CriteriaQuery criteriaQuery ) throws HibernateException { String [ ] columns ; try { columns = criteriaQuery . getColumnsUsingProjection ( criteria , propertyName ) ; } catch ( QueryException e ) { columns = new String [ 0 ] ; } return columns . length > 0 ? "FALSE" : "TRUE" ; }
|
Render the SQL fragment that corresponds to this criterion .
|
5,408
|
public String getIdProperty ( TableRef tableRef ) { TableMapping tableMapping = mappedClasses . get ( tableRef ) ; if ( tableMapping == null ) { return null ; } ColumnMetaData identifierColumn = tableMapping . getIdentifierColumn ( ) ; return tableMapping . getColumnMapping ( identifierColumn ) . getPropertyName ( ) ; }
|
Returns the name of the Identifier property
|
5,409
|
public String getGeometryProperty ( TableRef tableRef ) { TableMapping tableMapping = mappedClasses . get ( tableRef ) ; if ( tableMapping == null ) { return null ; } for ( ColumnMetaData columnMetaData : tableMapping . getMappedColumns ( ) ) { if ( columnMetaData . isGeometry ( ) ) { ColumnMapping cm = tableMapping . getColumnMapping ( columnMetaData ) ; return cm . getPropertyName ( ) ; } } return null ; }
|
Returns the name of the primary geometry property .
|
5,410
|
public void run ( String cmd , CommandFilter f ) { CommandWords commandWord = null ; if ( cmd . contains ( " " ) ) { try { commandWord = CommandWords . valueOf ( cmd . substring ( 1 , cmd . indexOf ( " " ) ) ) ; } catch ( IllegalArgumentException e ) { commandWord = CommandWords . INVALID_COMMAND_WORD ; } } else { commandWord = CommandWords . INVALID_COMMAND_WORD ; } switch ( commandWord ) { case change_player_type : f . changePlayerTypeCommand ( cmd . substring ( 20 , cmd . length ( ) - 1 ) ) ; break ; case error : f . errorCommand ( cmd . substring ( 7 , cmd . length ( ) - 1 ) ) ; break ; case hear : f . hearCommand ( cmd . substring ( 6 , cmd . length ( ) - 1 ) ) ; break ; case init : f . initCommand ( cmd . substring ( 6 , cmd . length ( ) - 1 ) ) ; break ; case ok : f . okCommand ( cmd . substring ( 4 , cmd . length ( ) - 1 ) ) ; break ; case player_param : f . playerParamCommand ( cmd . substring ( 14 , cmd . length ( ) - 1 ) ) ; break ; case player_type : f . playerTypeCommand ( cmd . substring ( 13 , cmd . length ( ) - 1 ) ) ; break ; case see : f . seeCommand ( cmd . substring ( 5 , cmd . length ( ) - 1 ) ) ; break ; case see_global : f . seeCommand ( cmd . substring ( 12 , cmd . length ( ) - 1 ) ) ; break ; case sense_body : f . senseBodyCommand ( cmd . substring ( 12 , cmd . length ( ) - 1 ) ) ; break ; case server_param : f . serverParamCommand ( cmd . substring ( 14 , cmd . length ( ) - 1 ) ) ; break ; case warning : f . warningCommand ( cmd . substring ( 9 , cmd . length ( ) - 1 ) ) ; break ; case INVALID_COMMAND_WORD : default : throw new Error ( "Invalid command received: \"" + cmd + "\"" ) ; } }
|
Works out what type of command has been put into the method .
|
5,411
|
private void addProjectProperties ( ) throws MojoExecutionException { Properties projectProps = mavenProject . getProperties ( ) ; projectProps . setProperty ( PROPERTY_NAME_COMPANY , versionInfo . getCompanyName ( ) ) ; projectProps . setProperty ( PROPERTY_NAME_COPYRIGHT , versionInfo . getCopyright ( ) ) ; projectProps . setProperty ( PROPERTY_NAME_VERSION_MAJOR , "0" ) ; projectProps . setProperty ( PROPERTY_NAME_VERSION_MINOR , "0" ) ; projectProps . setProperty ( PROPERTY_NAME_VERSION_INCREMENTAL , "0" ) ; projectProps . setProperty ( PROPERTY_NAME_VERSION_BUILD , "0" ) ; String version = mavenProject . getVersion ( ) ; if ( version != null && version . length ( ) > 0 ) { ArtifactVersion artifactVersion = new DefaultArtifactVersion ( version ) ; if ( version . equals ( artifactVersion . getQualifier ( ) ) ) { String msg = "Unable to parse the version string, please use standard maven version format." ; getLog ( ) . error ( msg ) ; throw new MojoExecutionException ( msg ) ; } projectProps . setProperty ( PROPERTY_NAME_VERSION_MAJOR , String . valueOf ( artifactVersion . getMajorVersion ( ) ) ) ; projectProps . setProperty ( PROPERTY_NAME_VERSION_MINOR , String . valueOf ( artifactVersion . getMinorVersion ( ) ) ) ; projectProps . setProperty ( PROPERTY_NAME_VERSION_INCREMENTAL , String . valueOf ( artifactVersion . getIncrementalVersion ( ) ) ) ; projectProps . setProperty ( PROPERTY_NAME_VERSION_BUILD , String . valueOf ( artifactVersion . getBuildNumber ( ) ) ) ; } else { getLog ( ) . warn ( "Missing version for project. Version parts will be set to 0" ) ; } }
|
Add properties to the project that are replaced .
|
5,412
|
private File writeVersionInfoTemplateToTempFile ( ) throws MojoExecutionException { try { final File versionInfoSrc = File . createTempFile ( "msbuild-maven-plugin_" + MOJO_NAME , null ) ; InputStream is = getClass ( ) . getResourceAsStream ( DEFAULT_VERSION_INFO_TEMPLATE ) ; FileOutputStream dest = new FileOutputStream ( versionInfoSrc ) ; byte [ ] buffer = new byte [ 1024 ] ; int read = - 1 ; while ( ( read = is . read ( buffer ) ) != - 1 ) { dest . write ( buffer , 0 , read ) ; } dest . close ( ) ; return versionInfoSrc ; } catch ( IOException ioe ) { String msg = "Failed to create temporary version file" ; getLog ( ) . error ( msg , ioe ) ; throw new MojoExecutionException ( msg , ioe ) ; } }
|
Write the default . rc template file to a temporary file and return it
|
5,413
|
private void applyParser ( ) { this . snapshot . clear ( ) ; Map < String , String > originals = new HashMap < String , String > ( this . resolvers . size ( ) ) ; for ( Entry < String , VariableValue > resolver : this . resolvers . entrySet ( ) ) { originals . put ( resolver . getKey ( ) , resolver . getValue ( ) . getOriginal ( ) ) ; } putAll ( originals ) ; }
|
Re apply parser on all entries in map
|
5,414
|
protected PropertyValueBindingBuilder bindProperty ( final String name ) { checkNotNull ( name , "Property name cannot be null." ) ; return new PropertyValueBindingBuilder ( ) { public void toValue ( final String value ) { checkNotNull ( value , "Null value not admitted for property '%s's" , name ) ; bindConstant ( ) . annotatedWith ( named ( name ) ) . to ( value ) ; } } ; }
|
Binds to a property with the given name .
|
5,415
|
public Tree < T > addLeaf ( T child ) { Tree < T > leaf = new Tree < T > ( child ) ; leaf . parent = this ; children . add ( leaf ) ; return leaf ; }
|
Add a new leaf to this tree
|
5,416
|
public void removeSubtree ( Tree < T > subtree ) { if ( children . remove ( subtree ) ) { subtree . parent = null ; } }
|
Remove given subtree
|
5,417
|
public Tree < T > addSubtree ( Tree < T > subtree ) { Tree < T > copy = addLeaf ( subtree . data ) ; copy . children = new ArrayList < Tree < T > > ( subtree . children ) ; return copy ; }
|
Add a subtree provided tree is not modified .
|
5,418
|
public static void checkIsSetLocal ( final DelegateExecution execution , final String variableName ) { Preconditions . checkArgument ( variableName != null , VARIABLE_NAME_MUST_BE_NOT_NULL ) ; final Object variableLocal = execution . getVariableLocal ( variableName ) ; Preconditions . checkState ( variableLocal != null , String . format ( "Condition of task '%s' is violated: Local variable '%s' is not set." , new Object [ ] { execution . getCurrentActivityId ( ) , variableName } ) ) ; }
|
Checks if a local variable with specified name is set .
|
5,419
|
public static void checkIsSetGlobal ( final DelegateExecution execution , final String variableName ) { Preconditions . checkArgument ( variableName != null , VARIABLE_SKIP_GUARDS ) ; final Object variable = execution . getVariable ( variableName ) ; Preconditions . checkState ( variable != null , String . format ( "Condition of task '%s' is violated: Global variable '%s' is not set." , new Object [ ] { execution . getCurrentActivityId ( ) , variableName } ) ) ; }
|
Checks if a global variable with specified name is set .
|
5,420
|
private List < File > getRelativeIncludeDirectories ( VCProject vcProject ) throws MojoExecutionException { final List < File > relativeIncludeDirectories = new ArrayList < File > ( ) ; for ( File includeDir : vcProject . getIncludeDirectories ( ) ) { if ( includeDir . isAbsolute ( ) ) { relativeIncludeDirectories . add ( includeDir ) ; } else { try { File absoluteIncludeDir = new File ( vcProject . getFile ( ) . getParentFile ( ) , includeDir . getPath ( ) ) ; relativeIncludeDirectories . add ( getRelativeFile ( vcProject . getBaseDirectory ( ) , absoluteIncludeDir . getCanonicalFile ( ) ) ) ; } catch ( IOException ioe ) { throw new MojoExecutionException ( "Failed to compute relative path for directroy " + includeDir , ioe ) ; } } } return relativeIncludeDirectories ; }
|
Adjust the list of include paths to be relative to the projectFile directory
|
5,421
|
@ AfterStory ( uponGivenStory = false ) public void cleanUp ( ) { LOG . debug ( "Cleaning up after story run." ) ; Mocks . reset ( ) ; support . undeploy ( ) ; support . resetClock ( ) ; ProcessEngineAssertions . reset ( ) ; }
|
Clean up all resources .
|
5,422
|
@ Then ( "the step $activityId is reached" ) @ When ( "the step $activityId is reached" ) public void stepIsReached ( final String activityId ) { assertThat ( support . getProcessInstance ( ) ) . isWaitingAt ( activityId ) ; LOG . debug ( "Step {} reached." , activityId ) ; }
|
Process step reached .
|
5,423
|
public static boolean isValid ( String packaging ) { return MSBUILD_SOLUTION . equals ( packaging ) || EXE . equals ( packaging ) || DLL . equals ( packaging ) || LIB . equals ( packaging ) ; }
|
Test whether a packaging is a valid MSBuild packaging
|
5,424
|
public static final String validPackaging ( ) { return new StringBuilder ( ) . append ( MSBUILD_SOLUTION ) . append ( ", " ) . append ( EXE ) . append ( ", " ) . append ( DLL ) . append ( ", " ) . append ( LIB ) . toString ( ) ; }
|
Return a string listing the valid packaging types
|
5,425
|
public void setString ( String str ) throws IOException { Reader r = new StringReader ( str ) ; int c ; reset ( ) ; while ( ( ( c = r . read ( ) ) != 0 ) && ( c != - 1 ) ) { write ( c ) ; } }
|
Sets the buffer contents .
|
5,426
|
public String getString ( ) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream ( buf ) ; int c ; StringWriter w = new StringWriter ( ) ; while ( ( ( c = in . read ( ) ) != 0 ) && ( c != - 1 ) ) { w . write ( ( char ) c ) ; } return w . getBuffer ( ) . toString ( ) ; }
|
Gets the buffer contents .
|
5,427
|
public void identifyPrimaryConfiguration ( ) throws MojoExecutionException { Set < String > configurationNames = new HashSet < String > ( ) ; for ( BuildConfiguration configuration : configurations ) { if ( configurationNames . contains ( configuration . getName ( ) ) ) { throw new MojoExecutionException ( "Duplicate configuration '" + configuration . getName ( ) + "' for '" + getName ( ) + "', configuration names must be unique" ) ; } configurationNames . add ( configuration . getName ( ) ) ; configuration . setPrimary ( false ) ; } if ( configurations . contains ( RELEASE_CONFIGURATION ) ) { configurations . get ( configurations . indexOf ( RELEASE_CONFIGURATION ) ) . setPrimary ( true ) ; } else if ( configurations . contains ( DEBUG_CONFIGURATION ) ) { configurations . get ( configurations . indexOf ( DEBUG_CONFIGURATION ) ) . setPrimary ( true ) ; } else { configurations . get ( 0 ) . setPrimary ( true ) ; } }
|
Check the configurations and mark one as primary .
|
5,428
|
public final String getCopyright ( ) { if ( copyright == null ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( COPYRIGHT_PREAMBLE ) . append ( " " ) . append ( Calendar . getInstance ( ) . get ( Calendar . YEAR ) ) . append ( " " ) . append ( companyName ) ; copyright = sb . toString ( ) ; } return copyright ; }
|
Get the configured copyright string
|
5,429
|
public void createNewPlayers ( ) { for ( int i = 0 ; i < size ( ) ; i ++ ) { players [ i ] = new SServerPlayer ( teamName , getNewControllerPlayer ( i ) , playerPort , hostname ) ; } }
|
Create 11 SServerPlayer s .
|
5,430
|
public void connectAll ( ) { for ( int i = 0 ; i < size ( ) ; i ++ ) { if ( i == 0 ) { players [ i ] . connect ( true ) ; } else if ( i >= 1 ) { try { players [ i ] . connect ( false ) ; } catch ( Exception ex ) { players [ i ] . handleError ( ex . getMessage ( ) ) ; } } pause ( 500 ) ; } if ( hasCoach ) { try { coach . connect ( ) ; } catch ( Exception ex ) { coach . handleError ( ex . getMessage ( ) ) ; } pause ( 500 ) ; } }
|
Connect all the players to the server . ActionsPlayer with index 0 is always the goalie . Connects a coach if there is one .
|
5,431
|
public void connect ( int index ) { try { if ( index == 0 ) { players [ index ] . connect ( true ) ; } else { players [ index ] . connect ( false ) ; } } catch ( Exception ex ) { players [ index ] . handleError ( ex . getMessage ( ) ) ; } pause ( 500 ) ; }
|
Connect the selected player to the server . The player with index 0 is always the goalie .
|
5,432
|
private String findProperty ( String prop ) { String result = System . getProperty ( prop ) ; if ( result == null ) { result = mavenProject . getProperties ( ) . getProperty ( prop ) ; } return result ; }
|
Look for a value for the specified property in System properties then project properties .
|
5,433
|
protected void validateProjectFile ( ) throws MojoExecutionException { if ( projectFile != null && projectFile . exists ( ) && projectFile . isFile ( ) ) { getLog ( ) . debug ( "Project file validated at " + projectFile ) ; boolean solutionFile = projectFile . getName ( ) . toLowerCase ( ) . endsWith ( "." + SOLUTION_EXTENSION ) ; if ( ( MSBuildPackaging . isSolution ( mavenProject . getPackaging ( ) ) && ! solutionFile ) || ( ! MSBuildPackaging . isSolution ( mavenProject . getPackaging ( ) ) && solutionFile ) ) { String msg = "Packaging doesn't match project file type. " + "If you specify a solution file then packaging must be " + MSBuildPackaging . MSBUILD_SOLUTION ; getLog ( ) . error ( msg ) ; throw new MojoExecutionException ( msg ) ; } return ; } String prefix = "Missing projectFile" ; if ( projectFile != null ) { prefix = ". The specified projectFile '" + projectFile + "' is not valid" ; } throw new MojoExecutionException ( prefix + ", please check your configuration" ) ; }
|
Check that we have a valid project or solution file .
|
5,434
|
protected List < File > getProjectSources ( VCProject vcProject , boolean includeHeaders , List < String > excludes ) throws MojoExecutionException { final DirectoryScanner directoryScanner = new DirectoryScanner ( ) ; List < String > sourceFilePatterns = new ArrayList < String > ( ) ; String relProjectDir = calculateProjectRelativeDirectory ( vcProject ) ; sourceFilePatterns . add ( relProjectDir + "**\\*.c" ) ; sourceFilePatterns . add ( relProjectDir + "**\\*.cpp" ) ; if ( includeHeaders ) { sourceFilePatterns . add ( relProjectDir + "**\\*.h" ) ; sourceFilePatterns . add ( relProjectDir + "**\\*.hpp" ) ; } directoryScanner . setCaseSensitive ( false ) ; directoryScanner . setIncludes ( sourceFilePatterns . toArray ( new String [ 0 ] ) ) ; directoryScanner . setExcludes ( excludes . toArray ( new String [ excludes . size ( ) ] ) ) ; directoryScanner . setBasedir ( vcProject . getBaseDirectory ( ) ) ; directoryScanner . scan ( ) ; List < File > sourceFiles = new ArrayList < File > ( ) ; for ( String fileName : directoryScanner . getIncludedFiles ( ) ) { sourceFiles . add ( new File ( vcProject . getBaseDirectory ( ) , fileName ) ) ; } return sourceFiles ; }
|
Generate a list of source files in the project directory and sub - directories
|
5,435
|
protected List < VCProject > getParsedProjects ( BuildPlatform platform , BuildConfiguration configuration ) throws MojoExecutionException { Map < String , String > envVariables = new HashMap < String , String > ( ) ; if ( isCxxTestEnabled ( null , true ) ) { envVariables . put ( CxxTestConfiguration . HOME_ENVVAR , cxxTest . getCxxTestHome ( ) . getPath ( ) ) ; } VCProjectHolder vcProjectHolder = VCProjectHolder . getVCProjectHolder ( projectFile , MSBuildPackaging . isSolution ( mavenProject . getPackaging ( ) ) , envVariables ) ; try { return vcProjectHolder . getParsedProjects ( platform . getName ( ) , configuration . getName ( ) ) ; } catch ( FileNotFoundException fnfe ) { throw new MojoExecutionException ( "Could not find file " + projectFile , fnfe ) ; } catch ( IOException ioe ) { throw new MojoExecutionException ( "I/O error while parsing file " + projectFile , ioe ) ; } catch ( SAXException se ) { throw new MojoExecutionException ( "Syntax error while parsing file " + projectFile , se ) ; } catch ( ParserConfigurationException pce ) { throw new MojoExecutionException ( "XML parser configuration exception " , pce ) ; } catch ( ParseException pe ) { throw new MojoExecutionException ( "Syntax error while parsing solution file " + projectFile , pe ) ; } }
|
Return project configurations for the specified platform and configuration .
|
5,436
|
protected List < VCProject > getParsedProjects ( BuildPlatform platform , BuildConfiguration configuration , String filterRegex ) throws MojoExecutionException { Pattern filterPattern = null ; List < VCProject > filteredList = new ArrayList < VCProject > ( ) ; if ( filterRegex != null ) { filterPattern = Pattern . compile ( filterRegex ) ; } for ( VCProject vcProject : getParsedProjects ( platform , configuration ) ) { if ( filterPattern == null ) { filteredList . add ( vcProject ) ; } else { Matcher prjExcludeMatcher = filterPattern . matcher ( vcProject . getName ( ) ) ; if ( ! prjExcludeMatcher . matches ( ) ) { filteredList . add ( vcProject ) ; } } } return filteredList ; }
|
Return project configurations for the specified platform and configuration filtered by name using the specified Pattern .
|
5,437
|
protected List < File > getOutputDirectories ( BuildPlatform p , BuildConfiguration c ) throws MojoExecutionException { List < File > result = new ArrayList < File > ( ) ; File configured = c . getOutputDirectory ( ) ; if ( configured != null ) { result . add ( configured ) ; } else { List < VCProject > projects = getParsedProjects ( p , c ) ; if ( projects . size ( ) == 1 ) { result . add ( projects . get ( 0 ) . getOutputDirectory ( ) ) ; } else { for ( VCProject project : projects ) { boolean addResult = false ; if ( targets == null ) { addResult = true ; } else { if ( targets . contains ( project . getTargetName ( ) ) ) { addResult = true ; } } if ( addResult && ! result . contains ( project . getOutputDirectory ( ) ) ) { result . add ( project . getOutputDirectory ( ) ) ; } } } } if ( result . size ( ) < 1 ) { String exceptionMessage = "Could not identify any output directories, configuration error?" ; getLog ( ) . error ( exceptionMessage ) ; throw new MojoExecutionException ( exceptionMessage ) ; } for ( File toTest : result ) { if ( ! toTest . exists ( ) && ! toTest . isDirectory ( ) ) { String exceptionMessage = "Expected output directory was not created, configuration error?" ; getLog ( ) . error ( exceptionMessage ) ; getLog ( ) . error ( "Looking for build output at " + toTest . getAbsolutePath ( ) ) ; throw new MojoExecutionException ( exceptionMessage ) ; } } return result ; }
|
Determine the directories that msbuild will write output files to for a given platform and configuration . If an outputDirectory is configured in the POM this will take precedence and be the only result .
|
5,438
|
protected boolean isCppCheckEnabled ( boolean quiet ) { if ( cppCheck . getSkip ( ) ) { if ( ! quiet ) { getLog ( ) . info ( CppCheckConfiguration . SKIP_MESSAGE + ", 'skip' set to true in the " + CppCheckConfiguration . TOOL_NAME + " configuration" ) ; } return false ; } if ( cppCheck . getCppCheckPath ( ) == null ) { if ( ! quiet ) { getLog ( ) . info ( CppCheckConfiguration . SKIP_MESSAGE + ", path to " + CppCheckConfiguration . TOOL_NAME + " not set" ) ; } return false ; } return true ; }
|
Determine whether CppCheck is enabled by the configuration
|
5,439
|
protected boolean isVeraEnabled ( boolean quiet ) { if ( vera . getSkip ( ) ) { if ( ! quiet ) { getLog ( ) . info ( VeraConfiguration . SKIP_MESSAGE + ", 'skip' set to true in the " + VeraConfiguration . TOOL_NAME + " configuration" ) ; } return false ; } if ( vera . getVeraHome ( ) == null ) { if ( ! quiet ) { getLog ( ) . info ( VeraConfiguration . SKIP_MESSAGE + ", path to " + VeraConfiguration . TOOL_NAME + " home directory not set" ) ; } return false ; } return true ; }
|
Determine whether Vera ++ is enabled by the configuration
|
5,440
|
public void send ( String message ) throws IOException { buf . setString ( message ) ; DatagramPacket packet = new DatagramPacket ( buf . getByteArray ( ) , buf . length ( ) , host , port ) ; socket . send ( packet ) ; }
|
Sends a message to SServer .
|
5,441
|
public String toStateString ( ) { StringBuffer buff = new StringBuffer ( ) ; buff . append ( "Host: " ) ; buff . append ( this . hostname ) ; buff . append ( ':' ) ; buff . append ( this . port ) ; buff . append ( "\n" ) ; return buff . toString ( ) ; }
|
Returns a string containing the connection details .
|
5,442
|
public static void register ( final String scheme , Class < ? extends URLStreamHandler > handlerType ) { if ( ! registeredSchemes . add ( scheme ) ) { throw new IllegalStateException ( "a scheme has already been registered for " + scheme ) ; } registerPackage ( "org.skife.url.generated" ) ; Enhancer e = new Enhancer ( ) ; e . setNamingPolicy ( new NamingPolicy ( ) { public String getClassName ( String prefix , String source , Object key , Predicate names ) { return "org.skife.url.generated." + scheme + ".Handler" ; } } ) ; e . setSuperclass ( handlerType ) ; e . setCallbackType ( NoOp . class ) ; e . createClass ( ) ; }
|
Used to register a handler for a scheme . The actual handler used will in fact be a runtime generated subclass of handlerType in order to abide by the naming rules for URL scheme handlers .
|
5,443
|
public void addPlayerInitCommand ( String teamName , boolean isGoalie ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(init " ) ; buf . append ( teamName ) ; buf . append ( " (version " ) ; if ( isGoalie ) { buf . append ( serverVersion ) ; buf . append ( ") (goalie))" ) ; } else { buf . append ( serverVersion ) ; buf . append ( "))" ) ; } fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
This is used to initialise a player .
|
5,444
|
public void addTrainerInitCommand ( ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(init (version " ) ; buf . append ( serverVersion ) ; buf . append ( "))" ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
This is used to initialise a trainer .
|
5,445
|
public void addCoachInitCommand ( String teamName ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(init " ) ; buf . append ( teamName ) ; buf . append ( " (version " ) ; buf . append ( serverVersion ) ; buf . append ( "))" ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
This is used to initialise the online coach .
|
5,446
|
public void addReconnectCommand ( String teamName , int num ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(reconnect " ) ; buf . append ( teamName ) ; buf . append ( ' ' ) ; buf . append ( num ) ; buf . append ( ')' ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
This is used to reconnect the player to the server .
|
5,447
|
public void addCatchCommand ( int direction ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(catch " ) ; buf . append ( direction ) ; buf . append ( ')' ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
Goalie special command . Tries to catch the ball in a given direction relative to its body direction . If the catch is successful the ball will be in the goalies hand untill kicked away .
|
5,448
|
public void addDashCommand ( int power ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(dash " ) ; buf . append ( power ) ; buf . append ( ')' ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
This command accelerates the player in the direction of its body .
|
5,449
|
public void addKickCommand ( int power , int direction ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(kick " ) ; buf . append ( power ) ; buf . append ( ' ' ) ; buf . append ( direction ) ; buf . append ( ')' ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
This command accelerates the ball with the given power in the given direction .
|
5,450
|
public void addTurnCommand ( int angle ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(turn " ) ; buf . append ( angle ) ; buf . append ( ')' ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
This command will turn the players body in degrees relative to their current direction .
|
5,451
|
public void addChangePlayModeCommand ( PlayMode playMode ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(change_mode " ) ; buf . append ( playMode ) ; buf . append ( ')' ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
Trainer only command . Changes the play mode of the server .
|
5,452
|
public void addMoveBallCommand ( double x , double y ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(move " ) ; buf . append ( "ball" ) ; buf . append ( ' ' ) ; buf . append ( x ) ; buf . append ( ' ' ) ; buf . append ( y ) ; buf . append ( ')' ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
Trainer only command . Moves the ball to the given coordinates .
|
5,453
|
public void addCheckBallCommand ( ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(check_ball)" ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
Trainer only command . Checks the current status of the ball .
|
5,454
|
public void addStartCommand ( ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(start)" ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
Trainer only command . Starts the server .
|
5,455
|
public void addRecoverCommand ( ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(recover)" ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
Trainer only command . Recovers the players stamina recovery effort and hear capacity to the values at the beginning of the game .
|
5,456
|
public void addEarCommand ( boolean earOn ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(ear " ) ; if ( earOn ) { buf . append ( "on" ) ; } else { buf . append ( "off" ) ; } buf . append ( ')' ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
Trainer only command . It turns on or off the sending of auditory information to the trainer .
|
5,457
|
public void addChangePlayerTypeCommand ( String teamName , int unum , int playerType ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(change_player_type " ) ; buf . append ( teamName ) ; buf . append ( ' ' ) ; buf . append ( unum ) ; buf . append ( ' ' ) ; buf . append ( playerType ) ; buf . append ( ')' ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
Trainer only command . This command changes the specified players heterogeneous type .
|
5,458
|
public void addTeamNamesCommand ( ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "(team_names)" ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; }
|
Trainer command that can be used by online coach . This command provides information about the names of both teams and which side they are playing on .
|
5,459
|
public void addTeamGraphicCommand ( XPMImage xpm ) { for ( int x = 0 ; x < xpm . getArrayWidth ( ) ; x ++ ) { for ( int y = 0 ; y < xpm . getArrayHeight ( ) ; y ++ ) { StringBuilder buf = new StringBuilder ( ) ; String tile = xpm . getTile ( x , y ) ; buf . append ( "(team_graphic (" ) ; buf . append ( x ) ; buf . append ( ' ' ) ; buf . append ( y ) ; buf . append ( ' ' ) ; buf . append ( tile ) ; buf . append ( ' ' ) ; buf . append ( "))" ) ; fifo . add ( fifo . size ( ) , buf . toString ( ) ) ; } } }
|
Coach only command . The online coach can send teams - graphics as 256 x 64 XPM to the server . Each team graphic - command sends a 8x8 tile . X and Y are the coordinates of this tile so they range from 0 to 31 and 0 to 7 respectively . Each XPM line is a line from the 8x8 XPM tile .
|
5,460
|
public String next ( ) { if ( fifo . isEmpty ( ) ) { throw new RuntimeException ( "Fifo is empty" ) ; } String cmd = ( String ) fifo . get ( 0 ) ; fifo . remove ( 0 ) ; return cmd ; }
|
Gets the next command from the stack .
|
5,461
|
protected boolean isSonarEnabled ( boolean quiet ) throws MojoExecutionException { if ( sonar . skip ( ) ) { if ( ! quiet ) { getLog ( ) . info ( SonarConfiguration . SONAR_SKIP_MESSAGE + ", 'skip' set to true in the " + SonarConfiguration . SONAR_NAME + " configuration." ) ; } return false ; } validateProjectFile ( ) ; platforms = MojoHelper . validatePlatforms ( platforms ) ; return true ; }
|
Determine whether Sonar configuration generation is enabled by the configuration
|
5,462
|
public List < T > parse ( ) throws IllegalAccessException , InstantiationException , InvocationTargetException , NoSuchMethodException { List < T > list = new ArrayList < > ( ) ; Map < Method , TableCellMapping > cellMappingByMethod = ImporterUtils . getMappedMethods ( clazz , group ) ; final Constructor < T > constructor = clazz . getDeclaredConstructor ( ) ; constructor . setAccessible ( true ) ; for ( int i = 0 ; i < csvLines . size ( ) ; i ++ ) { final String line = csvLines . get ( i ) ; if ( ( i + 1 ) <= headersRows ) { continue ; } List < String > fields = split ( line ) ; T instance = constructor . newInstance ( ) ; for ( Entry < Method , TableCellMapping > methodTcm : cellMappingByMethod . entrySet ( ) ) { Method method = methodTcm . getKey ( ) ; method . setAccessible ( true ) ; TableCellMapping tcm = methodTcm . getValue ( ) ; String value = getValueOrEmpty ( fields , tcm . columnIndex ( ) ) ; Converter < ? , ? > converter = tcm . converter ( ) . newInstance ( ) ; Object obj = converter . apply ( value ) ; method . invoke ( instance , obj ) ; } list . add ( instance ) ; } return list ; }
|
Parser file to list of T objects
|
5,463
|
private String toJavaName ( String name ) { StringBuilder stb = new StringBuilder ( ) ; char [ ] namechars = name . toCharArray ( ) ; if ( ! Character . isJavaIdentifierStart ( namechars [ 0 ] ) ) { stb . append ( "__" ) ; } else { stb . append ( namechars [ 0 ] ) ; } for ( int i = 1 ; i < namechars . length ; i ++ ) { if ( ! Character . isJavaIdentifierPart ( namechars [ i ] ) ) { stb . append ( "__" ) ; } else { stb . append ( namechars [ i ] ) ; } } return stb . toString ( ) ; }
|
Turns the name into a valid simplified Java Identifier .
|
5,464
|
protected final void validateForMSBuild ( ) throws MojoExecutionException { if ( ! MSBuildPackaging . isValid ( mavenProject . getPackaging ( ) ) ) { throw new MojoExecutionException ( "Please set packaging to one of " + MSBuildPackaging . validPackaging ( ) ) ; } findMSBuild ( ) ; validateProjectFile ( ) ; platforms = MojoHelper . validatePlatforms ( platforms ) ; }
|
Check the Mojo configuration provides sufficient data to construct an MSBuild command line .
|
5,465
|
protected final void findMSBuild ( ) throws MojoExecutionException { if ( msbuildPath == null ) { String msbuildEnv = System . getenv ( ENV_MSBUILD_PATH ) ; if ( msbuildEnv != null ) { msbuildPath = new File ( msbuildEnv ) ; } } if ( msbuildPath != null && msbuildPath . exists ( ) && msbuildPath . isFile ( ) ) { getLog ( ) . debug ( "Using MSBuild at " + msbuildPath ) ; return ; } throw new MojoExecutionException ( "MSBuild could not be found. You need to configure it in the " + "plugin configuration section in the pom file using " + "<msbuild.path>...</msbuild.path> or " + "<properties><msbuild.path>...</msbuild.path></properties> " + "or on command-line using -Dmsbuild.path=... or by setting " + "the environment variable " + ENV_MSBUILD_PATH ) ; }
|
Attempts to locate MSBuild . First looks at the mojo configuration property if not found there try the system environment .
|
5,466
|
protected void runMSBuild ( List < String > targets , Map < String , String > environment ) throws MojoExecutionException , MojoFailureException { try { MSBuildExecutor msbuild = new MSBuildExecutor ( getLog ( ) , msbuildPath , msbuildMaxCpuCount , projectFile ) ; msbuild . setPlatforms ( platforms ) ; msbuild . setTargets ( targets ) ; msbuild . setEnvironment ( environment ) ; if ( msbuild . execute ( ) != 0 ) { throw new MojoFailureException ( "MSBuild execution failed, see log for details." ) ; } } catch ( IOException ioe ) { throw new MojoExecutionException ( "MSBUild execution failed" , ioe ) ; } catch ( InterruptedException ie ) { throw new MojoExecutionException ( "Interrupted waiting for " + "MSBUild execution to complete" , ie ) ; } }
|
Run MSBuild for each platform and configuration pair .
|
5,467
|
public String getTile ( int x , int y ) { if ( ( x > getArrayWidth ( ) ) || ( y > getArrayHeight ( ) ) || ( x < 0 ) || ( y < 0 ) ) { throw new IllegalArgumentException ( ) ; } return image [ x ] [ y ] ; }
|
Gets a tile of the XPM Image .
|
5,468
|
public String toListString ( ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( controller . getClass ( ) . getName ( ) ) ; return buf . toString ( ) ; }
|
Create a list string .
|
5,469
|
private void throwMultiEventException ( Event < ? > eventThatThrewException ) { while ( throwable instanceof MultiEventException && throwable . getCause ( ) != null ) { eventThatThrewException = ( ( MultiEventException ) throwable ) . getEvent ( ) ; throwable = throwable . getCause ( ) ; } throw new MultiEventException ( eventThatThrewException , throwable ) ; }
|
Unwraps cause of throwable if the throwable is itself a MultiEventException . This eliminates much excessive noise that is purely implementation detail of MultiEvents from the stack trace .
|
5,470
|
List < Node > get ( final Pattern ... patterns ) { return AbsoluteGetQuery . INSTANCE . execute ( this , includeRootPatternFirst ( patterns ) ) ; }
|
Get all children matching the specified query .
|
5,471
|
public String resolve ( Map < String , String > configuration ) { StringBuilder buffer = new StringBuilder ( ) ; append ( buffer , configuration , null ) ; return buffer . toString ( ) ; }
|
Begin resolving process with this appender against the provided configuration .
|
5,472
|
public static void validateToolPath ( File toolPath , String toolName , Log logger ) throws FileNotFoundException { logger . debug ( "Validating path for " + toolName ) ; if ( toolPath == null ) { logger . error ( "Missing " + toolName + " path" ) ; throw new FileNotFoundException ( ) ; } if ( ! toolPath . exists ( ) || ! toolPath . isFile ( ) ) { logger . error ( "Could not find " + toolName + " at " + toolPath ) ; throw new FileNotFoundException ( toolPath . getAbsolutePath ( ) ) ; } logger . debug ( "Found " + toolName + " at " + toolPath ) ; }
|
Validates the path to a command - line tool .
|
5,473
|
public static List < BuildPlatform > validatePlatforms ( List < BuildPlatform > platforms ) throws MojoExecutionException { if ( platforms == null ) { platforms = new ArrayList < BuildPlatform > ( ) ; platforms . add ( new BuildPlatform ( ) ) ; } else { Set < String > platformNames = new HashSet < String > ( ) ; for ( BuildPlatform platform : platforms ) { if ( platformNames . contains ( platform . getName ( ) ) ) { throw new MojoExecutionException ( "Duplicate platform '" + platform . getName ( ) + "' in configuration, platform names must be unique" ) ; } platformNames . add ( platform . getName ( ) ) ; platform . identifyPrimaryConfiguration ( ) ; } } return platforms ; }
|
Check that we have a valid set of platforms . If no platforms are configured we create 1 default platform .
|
5,474
|
public static < D > RuleContext < D > collect ( ResultCollector < ? , D > resultCollector ) { return new ResultCollectorContext ( ) . collect ( resultCollector ) ; }
|
Adds the first result collector to the validator .
|
5,475
|
public static < D > RuleContext < D > collect ( ResultCollector < ? , D > ... resultCollectors ) { return new ResultCollectorContext ( ) . collect ( resultCollectors ) ; }
|
Adds the first result collectors to the validator .
|
5,476
|
private void initComponents ( ) { getRootPane ( ) . putClientProperty ( "apple.awt.draggableWindowBackground" , Boolean . FALSE ) ; toolTip = new JToolTip ( ) ; toolTip . addMouseListener ( new TransparencyAdapter ( ) ) ; owner . addComponentListener ( locationAdapter ) ; owner . addAncestorListener ( locationAdapter ) ; getRootPane ( ) . setWindowDecorationStyle ( JRootPane . NONE ) ; setFocusable ( false ) ; setFocusableWindowState ( false ) ; setContentPane ( toolTip ) ; pack ( ) ; }
|
Initializes the components of the tooltip window .
|
5,477
|
public void setText ( String text ) { if ( ! ValueUtils . areEqual ( text , toolTip . getTipText ( ) ) ) { boolean wasVisible = isVisible ( ) ; if ( wasVisible ) { setVisible ( false ) ; } toolTip . setTipText ( text ) ; if ( wasVisible ) { setVisible ( true ) ; } } }
|
Sets the text to be displayed as a tooltip .
|
5,478
|
private void followOwner ( ) { if ( owner . isVisible ( ) && owner . isShowing ( ) ) { try { Point screenLocation = owner . getLocationOnScreen ( ) ; Point relativeSlaveLocation = anchorLink . getRelativeSlaveLocation ( owner . getSize ( ) , TransparentToolTipDialog . this . getSize ( ) ) ; setLocation ( screenLocation . x + relativeSlaveLocation . x , screenLocation . y + relativeSlaveLocation . y ) ; } catch ( IllegalComponentStateException e ) { LOGGER . error ( "Failed getting location of component: " + owner , e ) ; } } }
|
Updates the location of the window based on the location of the owner component .
|
5,479
|
public void addDataProvider ( K key , DataProvider < DPO > dataProvider ) { dataProviders . put ( key , dataProvider ) ; }
|
Adds the specified data provider with the specified key .
|
5,480
|
private void updateDecoration ( ) { if ( lastResult != null ) { if ( lastResult ) { setIcon ( validIcon ) ; setToolTipText ( validText ) ; } else { setIcon ( invalidIcon ) ; setToolTipText ( invalidText ) ; } } }
|
Updates the icon and tooltip text according to the last result processed by this result handler .
|
5,481
|
private static KeyStroke [ ] toKeyStrokes ( int ... keyCodes ) { KeyStroke [ ] keyStrokes = null ; if ( keyCodes != null ) { keyStrokes = new KeyStroke [ keyCodes . length ] ; for ( int i = 0 ; i < keyCodes . length ; i ++ ) { keyStrokes [ i ] = KeyStroke . getKeyStroke ( keyCodes [ i ] , 0 ) ; } } return keyStrokes ; }
|
Converts the specified array of key codes in an array of key strokes .
|
5,482
|
private void initValidation ( ) { SimpleProperty < Result > resultCollector1 = new SimpleProperty < Result > ( ) ; createValidator ( textField1 , new StickerFeedback ( textField1 ) , resultCollector1 ) ; SimpleProperty < Result > resultCollector2 = new SimpleProperty < Result > ( ) ; createValidator ( textField2 , new ColorFeedback ( textField2 , false ) , resultCollector2 ) ; SimpleProperty < Result > resultCollector3 = new SimpleProperty < Result > ( ) ; createValidator ( textField3 , new ColorFeedback ( textField3 , true ) , resultCollector3 ) ; SimpleProperty < Result > resultCollector4 = new SimpleProperty < Result > ( ) ; createValidator ( textField4 , new IconFeedback ( textField4 , false ) , resultCollector4 ) ; SimpleProperty < Result > resultCollector5 = new SimpleProperty < Result > ( ) ; createValidator ( textField5 , new IconFeedback ( textField5 , true ) , resultCollector5 ) ; read ( resultCollector1 , resultCollector2 , resultCollector3 , resultCollector4 , resultCollector5 ) . transform ( new CollectionElementTransformer < Result , Boolean > ( new ResultToBooleanTransformer ( ) ) ) . transform ( new AndBooleanAggregator ( ) ) . write ( new ComponentEnabledProperty ( applyButton ) ) ; }
|
Initializes the input validation and conditional logic .
|
5,483
|
public Object add ( String key , Object value ) { if ( ! this . containsKey ( key ) ) { this . put ( key , value ) ; return null ; } return this . get ( key ) ; }
|
This method safely add new options . If the key already exists it does not overwrite the current value . You can use put for overwritten the value .
|
5,484
|
protected void appendElements ( RendersnakeHtmlCanvas html , List < SubtitleItem . Inner > elements ) throws IOException { for ( SubtitleItem . Inner element : elements ) { String kanji = element . getKanji ( ) ; if ( kanji != null ) { html . spanKanji ( kanji ) ; } else { html . write ( element . getText ( ) ) ; } } }
|
Appends furigana over the whole word
|
5,485
|
private void updateValue ( ) { if ( list != null ) { int oldCount = this . count ; this . count = list . getSelectedIndices ( ) . length ; maybeNotifyListeners ( oldCount , count ) ; } }
|
Updates the value of this property based on the list s selection model and notify the listeners .
|
5,486
|
public String parse ( String query ) throws Exception { if ( StringUtils . isEmpty ( query ) ) { return "" ; } Map < String , Object > jsonFacetMap = new LinkedHashMap < > ( ) ; String [ ] split = query . split ( FACET_SEPARATOR ) ; for ( String facet : split ) { if ( facet . contains ( NESTED_FACET_SEPARATOR ) ) { parseNestedFacet ( facet , jsonFacetMap ) ; } else { List < String > simpleFacets = getSubFacets ( facet ) ; for ( String simpleFacet : simpleFacets ) { parseSimpleFacet ( simpleFacet , jsonFacetMap ) ; } } } return parseJson ( new ObjectMapper ( ) . writeValueAsString ( jsonFacetMap ) ) ; }
|
This method accepts a simple facet declaration format and converts it into a rich JSON query .
|
5,487
|
protected void doNotifyListenersOfAddedValues ( Set < R > newItems ) { List < SetValueChangeListener < R > > listenersCopy = new ArrayList < SetValueChangeListener < R > > ( listeners ) ; Set < R > unmodifiable = Collections . unmodifiableSet ( newItems ) ; for ( SetValueChangeListener < R > listener : listenersCopy ) { listener . valuesAdded ( this , unmodifiable ) ; } }
|
Notifies the change listeners that items have been added .
|
5,488
|
protected void doNotifyListenersOfRemovedValues ( Set < R > oldItems ) { List < SetValueChangeListener < R > > listenersCopy = new ArrayList < SetValueChangeListener < R > > ( listeners ) ; Set < R > unmodifiable = Collections . unmodifiableSet ( oldItems ) ; for ( SetValueChangeListener < R > listener : listenersCopy ) { listener . valuesRemoved ( this , unmodifiable ) ; } }
|
Notifies the change listeners that items have been removed .
|
5,489
|
public static < MO > SingleMasterBinding < MO , MO > read ( ReadableProperty < MO > master ) { return new SingleMasterBinding < MO , MO > ( master , null ) ; }
|
Specifies the master property that is part of the binding .
|
5,490
|
public static < T > boolean areEqual ( T value1 , T value2 , Comparator < T > comparator ) { return ( ( value1 == null ) && ( value2 == null ) ) || ( ( value1 != null ) && ( value2 != null ) && ( comparator . compare ( value1 , value2 ) == 0 ) ) ; }
|
Compares the two given values by taking null values into account and the specified comparator .
|
5,491
|
public void setIllegalCharacters ( final String illegalCharacters ) { this . illegalCharacters = illegalCharacters ; delegatePattern = new NegateBooleanRule < String > ( new StringRegexRule ( "[" + Pattern . quote ( illegalCharacters ) + "]" ) ) ; final int illegalCharacterCount = illegalCharacters . length ( ) ; final StringBuilder illegalCharactersSeparatedBySpacesStringBuilder = new StringBuilder ( illegalCharacterCount * 2 ) ; for ( int i = 0 ; i < illegalCharacterCount ; i ++ ) { illegalCharactersSeparatedBySpacesStringBuilder . append ( illegalCharacters . toCharArray ( ) [ i ] ) ; if ( i < ( illegalCharacterCount - 1 ) ) { illegalCharactersSeparatedBySpacesStringBuilder . append ( ' ' ) ; } } illegalCharactersSeparatedBySpaces = illegalCharactersSeparatedBySpacesStringBuilder . toString ( ) ; }
|
Sets the list of illegal characters in a string .
|
5,492
|
private Component createTabContent ( CompositeReadableProperty < Boolean > tabResultsProperty ) { JPanel panel = new JPanel ( ) ; panel . setLayout ( new MigLayout ( "fill, wrap 2" , "[][grow, fill]" ) ) ; for ( int i = 0 ; i < 2 ; i ++ ) { panel . add ( new JLabel ( "Field " + ( i + 1 ) + ":" ) ) ; JTextField field = new JTextField ( ) ; panel . add ( field ) ; field . setColumns ( 10 ) ; field . setText ( "Value" ) ; tabResultsProperty . addProperty ( installFieldValidation ( field ) ) ; } return panel ; }
|
Creates some content to put in a tab in the tabbed pane .
|
5,493
|
private ReadableProperty < Boolean > installFieldValidation ( JTextField field ) { SimpleBooleanProperty fieldResult = new SimpleBooleanProperty ( ) ; on ( new JTextFieldDocumentChangedTrigger ( field ) ) . read ( new JTextFieldTextProvider ( field ) ) . check ( new StringNotEmptyRule ( ) ) . handleWith ( new IconBooleanFeedback ( field ) ) . handleWith ( fieldResult ) . getValidator ( ) . trigger ( ) ; return fieldResult ; }
|
Sets up a validator for the specified field .
|
5,494
|
public String getTokenName ( final int pTokenId ) { final List < String > searchClasses = Arrays . asList ( "com.puppycrawl.tools.checkstyle.utils.TokenUtil" , "com.puppycrawl.tools.checkstyle.utils.TokenUtils" , TokenTypes . class . getName ( ) , "com.puppycrawl.tools.checkstyle.Utils" ) ; Method getTokenName = null ; for ( final String className : searchClasses ) { try { final Class < ? > utilsClass = Class . forName ( className ) ; getTokenName = utilsClass . getMethod ( "getTokenName" , int . class ) ; break ; } catch ( ClassNotFoundException | NoSuchMethodException e ) { } } if ( getTokenName == null ) { throw new UnsupportedOperationException ( "getTokenName() - method not found" ) ; } String result = null ; try { result = ( String ) getTokenName . invoke ( null , pTokenId ) ; } catch ( IllegalAccessException | InvocationTargetException e ) { throw new UnsupportedOperationException ( getTokenName . getDeclaringClass ( ) . getName ( ) + ".getTokenName()" , e ) ; } return result ; }
|
Returns the name of a token for a given ID .
|
5,495
|
private static int checkResult ( int result ) { if ( exceptionsEnabled && result != nvgraphStatus . NVGRAPH_STATUS_SUCCESS ) { throw new CudaException ( nvgraphStatus . stringFor ( result ) ) ; } return result ; }
|
If the given result is not nvgraphStatus . NVGRAPH_STATUS_SUCCESS and exceptions have been enabled this method will throw a CudaException with an error message that corresponds to the given result code . Otherwise the given result is simply returned .
|
5,496
|
public static int nvgraphSetGraphStructure ( nvgraphHandle handle , nvgraphGraphDescr descrG , Object topologyData , int TType ) { return checkResult ( nvgraphSetGraphStructureNative ( handle , descrG , topologyData , TType ) ) ; }
|
Set size topology data in the graph descriptor
|
5,497
|
public static int nvgraphGetGraphStructure ( nvgraphHandle handle , nvgraphGraphDescr descrG , Object topologyData , int [ ] TType ) { return checkResult ( nvgraphGetGraphStructureNative ( handle , descrG , topologyData , TType ) ) ; }
|
Query size and topology information from the graph descriptor
|
5,498
|
public static int nvgraphConvertTopology ( nvgraphHandle handle , int srcTType , Object srcTopology , Pointer srcEdgeData , Pointer dataType , int dstTType , Object dstTopology , Pointer dstEdgeData ) { return checkResult ( nvgraphConvertTopologyNative ( handle , srcTType , srcTopology , srcEdgeData , dataType , dstTType , dstTopology , dstEdgeData ) ) ; }
|
Convert the edge data to another topology
|
5,499
|
public static int nvgraphConvertGraph ( nvgraphHandle handle , nvgraphGraphDescr srcDescrG , nvgraphGraphDescr dstDescrG , int dstTType ) { return checkResult ( nvgraphConvertGraphNative ( handle , srcDescrG , dstDescrG , dstTType ) ) ; }
|
Convert graph to another structure
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.