repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
nightcode/yaranga
core/src/org/nightcode/common/net/http/MacAuthUtils.java
MacAuthUtils.getNonce
public static String getNonce(long issueTime) { long currentTime = new Date().getTime(); return TimeUnit.MILLISECONDS.toSeconds(currentTime - issueTime) + ":" + Long.toString(System.nanoTime()); }
java
public static String getNonce(long issueTime) { long currentTime = new Date().getTime(); return TimeUnit.MILLISECONDS.toSeconds(currentTime - issueTime) + ":" + Long.toString(System.nanoTime()); }
[ "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. @see <a href="https://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05#section-3.1">3.1. The "Authorization" Request Header</a> @param issueTime the number of seconds since the credentials were issued to the client @return nonce value
[ "Returns", "a", "nonce", "value", ".", "The", "nonce", "value", "MUST", "be", "unique", "across", "all", "requests", "with", "the", "same", "MAC", "key", "identifier", "." ]
f02cf8d8bcd365b6b1d55638938631a00e9ee808
https://github.com/nightcode/yaranga/blob/f02cf8d8bcd365b6b1d55638938631a00e9ee808/core/src/org/nightcode/common/net/http/MacAuthUtils.java#L40-L43
train
crowmagnumb/s6-util
src/main/java/net/crowmagnumb/util/reflect/SimpleMethodInvoker.java
SimpleMethodInvoker.invoke
public static Object invoke( final Object obj, final String methodName, final Object param ) throws UtilException { // // This time we have a parameter passed in. // // We can therefore work out it's class (type) and pass // that through to our invokeOneArgMethod 'wrapper' method. // return invokeOneArgMethod( obj, methodName, param, param.getClass() ); }
java
public static Object invoke( final Object obj, final String methodName, final Object param ) throws UtilException { // // This time we have a parameter passed in. // // We can therefore work out it's class (type) and pass // that through to our invokeOneArgMethod 'wrapper' method. // return invokeOneArgMethod( obj, methodName, param, param.getClass() ); }
[ "public", "static", "Object", "invoke", "(", "final", "Object", "obj", ",", "final", "String", "methodName", ",", "final", "Object", "param", ")", "throws", "UtilException", "{", "//", "// This time we have a parameter passed in.", "//", "// We can therefore work out it's class (type) and pass", "// that through to our invokeOneArgMethod 'wrapper' method.", "//", "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. @param obj to invoke method on @param methodName to invoke @param param to use @return method result @throws net.crowmagnumb.util.UtilException if problem
[ "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", "." ]
0f9969bc0809e8a617501fa57c135e9b3984fae0
https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/reflect/SimpleMethodInvoker.java#L200-L216
train
crowmagnumb/s6-util
src/main/java/net/crowmagnumb/util/reflect/SimpleMethodInvoker.java
SimpleMethodInvoker.invoke
public static Object invoke( final Object obj, final String methodName, final Object param, final Class<?> parameterType ) throws UtilException { // // For this call, we have all the information passed in to // this method for us to use. // // It may turn out to have the wrong contents etc. but the // final method to actually invoke the 'methodName' stated // here on the 'obj'(ect) stated here, will deal with that. // return invokeOneArgMethod( obj, methodName, param, parameterType ); }
java
public static Object invoke( final Object obj, final String methodName, final Object param, final Class<?> parameterType ) throws UtilException { // // For this call, we have all the information passed in to // this method for us to use. // // It may turn out to have the wrong contents etc. but the // final method to actually invoke the 'methodName' stated // here on the 'obj'(ect) stated here, will deal with that. // return invokeOneArgMethod( obj, methodName, param, parameterType ); }
[ "public", "static", "Object", "invoke", "(", "final", "Object", "obj", ",", "final", "String", "methodName", ",", "final", "Object", "param", ",", "final", "Class", "<", "?", ">", "parameterType", ")", "throws", "UtilException", "{", "//", "// For this call, we have all the information passed in to", "// this method for us to use.", "//", "// It may turn out to have the wrong contents etc. but the", "// final method to actually invoke the 'methodName' stated", "// here on the 'obj'(ect) stated here, will deal with that.", "//", "return", "invokeOneArgMethod", "(", "obj", ",", "methodName", ",", "param", ",", "parameterType", ")", ";", "}" ]
Invoke an arbitrary one argument method on an arbitrary object, but also include the parameter's type. @param obj to invoke method on @param methodName to invoke @param param to use @param parameterType type of parameter @return method result @throws net.crowmagnumb.util.UtilException if problem
[ "Invoke", "an", "arbitrary", "one", "argument", "method", "on", "an", "arbitrary", "object", "but", "also", "include", "the", "parameter", "s", "type", "." ]
0f9969bc0809e8a617501fa57c135e9b3984fae0
https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/reflect/SimpleMethodInvoker.java#L230-L249
train
crowmagnumb/s6-util
src/main/java/net/crowmagnumb/util/reflect/SimpleMethodInvoker.java
SimpleMethodInvoker.invokeStaticMethod
public static Object invokeStaticMethod( final Class<?> objClass, final String methodName, final Object param ) throws UtilException { // // This time we have a parameter passed in. // // We can therefore work out it's class (type) and pass // that through to our invokeOneArgStaticMethod 'wrapper' method. // return invokeOneArgStaticMethod( objClass, methodName, param, param.getClass() ); }
java
public static Object invokeStaticMethod( final Class<?> objClass, final String methodName, final Object param ) throws UtilException { // // This time we have a parameter passed in. // // We can therefore work out it's class (type) and pass // that through to our invokeOneArgStaticMethod 'wrapper' method. // return invokeOneArgStaticMethod( objClass, methodName, param, param.getClass() ); }
[ "public", "static", "Object", "invokeStaticMethod", "(", "final", "Class", "<", "?", ">", "objClass", ",", "final", "String", "methodName", ",", "final", "Object", "param", ")", "throws", "UtilException", "{", "//", "// This time we have a parameter passed in.", "//", "// We can therefore work out it's class (type) and pass", "// that through to our invokeOneArgStaticMethod 'wrapper' method.", "//", "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. @param objClass to invoke method on @param methodName to invoke @param param to use @return method result @throws net.crowmagnumb.util.UtilException if problem
[ "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", "." ]
0f9969bc0809e8a617501fa57c135e9b3984fae0
https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/reflect/SimpleMethodInvoker.java#L325-L341
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/CommandLineRunner.java
CommandLineRunner.runCommandLine
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; }
java
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; }
[ "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 @return the exit code from the program @throws IOException if there is a problem with program execution @throws InterruptedException if we are interrupted waiting for the process to exit or streams to complete
[ "Execute", "the", "configured", "program" ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/CommandLineRunner.java#L64-L99
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/parser/VCProjectParser.java
VCProjectParser.getDefaultOutputDirectory
private File getDefaultOutputDirectory() { //The default output directory is the configuration name String childOutputDirectory = getConfiguration(); //However, for platforms others than Win32, the default output directory becomes platform/configuration if ( ! getPlatform().equals( "Win32" ) ) { childOutputDirectory = new File( getPlatform(), childOutputDirectory ).getPath(); } //Place the default output directory within the appropriate base directory return new File( getBaseDirectory(), childOutputDirectory ); }
java
private File getDefaultOutputDirectory() { //The default output directory is the configuration name String childOutputDirectory = getConfiguration(); //However, for platforms others than Win32, the default output directory becomes platform/configuration if ( ! getPlatform().equals( "Win32" ) ) { childOutputDirectory = new File( getPlatform(), childOutputDirectory ).getPath(); } //Place the default output directory within the appropriate base directory return new File( getBaseDirectory(), childOutputDirectory ); }
[ "private", "File", "getDefaultOutputDirectory", "(", ")", "{", "//The default output directory is the configuration name", "String", "childOutputDirectory", "=", "getConfiguration", "(", ")", ";", "//However, for platforms others than Win32, the default output directory becomes platform/configuration", "if", "(", "!", "getPlatform", "(", ")", ".", "equals", "(", "\"Win32\"", ")", ")", "{", "childOutputDirectory", "=", "new", "File", "(", "getPlatform", "(", ")", ",", "childOutputDirectory", ")", ".", "getPath", "(", ")", ";", "}", "//Place the default output directory within the appropriate base directory", "return", "new", "File", "(", "getBaseDirectory", "(", ")", ",", "childOutputDirectory", ")", ";", "}" ]
Retrieve the default output directory for the Visual C++ project. @return the default output directory for the Visual C++ project
[ "Retrieve", "the", "default", "output", "directory", "for", "the", "Visual", "C", "++", "project", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/parser/VCProjectParser.java#L391-L404
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/parser/VCProjectParser.java
VCProjectParser.getBaseDirectory
private File getBaseDirectory() { File referenceFile = ( solutionFile != null ? solutionFile : getInputFile() ); return referenceFile.getParentFile().getAbsoluteFile(); }
java
private File getBaseDirectory() { File referenceFile = ( solutionFile != null ? solutionFile : getInputFile() ); return referenceFile.getParentFile().getAbsoluteFile(); }
[ "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. @return the base directory for the Visual C++ project
[ "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", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/parser/VCProjectParser.java#L411-L415
train
GeoLatte/geolatte-common-hibernate
src/main/java/org/geolatte/common/cql/hibernate/PropertyDoesNotExistCriterion.java
PropertyDoesNotExistCriterion.toSqlString
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { String[] columns; try { columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); } catch (QueryException e) { columns = new String[0]; } // if there are columns that map the given property.. the property exists, so we don't need to add anything to the sql return columns.length > 0 ? "FALSE" : "TRUE"; }
java
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { String[] columns; try { columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); } catch (QueryException e) { columns = new String[0]; } // if there are columns that map the given property.. the property exists, so we don't need to add anything to the sql return columns.length > 0 ? "FALSE" : "TRUE"; }
[ "public", "String", "toSqlString", "(", "Criteria", "criteria", ",", "CriteriaQuery", "criteriaQuery", ")", "throws", "HibernateException", "{", "String", "[", "]", "columns", ";", "try", "{", "columns", "=", "criteriaQuery", ".", "getColumnsUsingProjection", "(", "criteria", ",", "propertyName", ")", ";", "}", "catch", "(", "QueryException", "e", ")", "{", "columns", "=", "new", "String", "[", "0", "]", ";", "}", "// if there are columns that map the given property.. the property exists, so we don't need to add anything to the sql", "return", "columns", ".", "length", ">", "0", "?", "\"FALSE\"", ":", "\"TRUE\"", ";", "}" ]
Render the SQL fragment that corresponds to this criterion. @param criteria The local criteria @param criteriaQuery The overal criteria query @return The generated SQL fragment @throws org.hibernate.HibernateException Problem during rendering.
[ "Render", "the", "SQL", "fragment", "that", "corresponds", "to", "this", "criterion", "." ]
2e871c70e506df2485d91152fbd0955c94de1d39
https://github.com/GeoLatte/geolatte-common-hibernate/blob/2e871c70e506df2485d91152fbd0955c94de1d39/src/main/java/org/geolatte/common/cql/hibernate/PropertyDoesNotExistCriterion.java#L61-L75
train
GeoLatte/geolatte-common-hibernate
src/main/java/org/geolatte/common/automapper/DatabaseMapping.java
DatabaseMapping.getIdProperty
public String getIdProperty(TableRef tableRef) { TableMapping tableMapping = mappedClasses.get(tableRef); if (tableMapping == null) { return null; } ColumnMetaData identifierColumn = tableMapping.getIdentifierColumn(); return tableMapping.getColumnMapping(identifierColumn).getPropertyName(); }
java
public String getIdProperty(TableRef tableRef) { TableMapping tableMapping = mappedClasses.get(tableRef); if (tableMapping == null) { return null; } ColumnMetaData identifierColumn = tableMapping.getIdentifierColumn(); return tableMapping.getColumnMapping(identifierColumn).getPropertyName(); }
[ "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 @param tableRef the <code>TableRef</code> for the table @return the name of the identifier property, or null if the table specified by the <code>tableRef</code> parameter is not mapped @throws IllegalStateException if the map() method has not been invoked first.
[ "Returns", "the", "name", "of", "the", "Identifier", "property" ]
2e871c70e506df2485d91152fbd0955c94de1d39
https://github.com/GeoLatte/geolatte-common-hibernate/blob/2e871c70e506df2485d91152fbd0955c94de1d39/src/main/java/org/geolatte/common/automapper/DatabaseMapping.java#L134-L141
train
GeoLatte/geolatte-common-hibernate
src/main/java/org/geolatte/common/automapper/DatabaseMapping.java
DatabaseMapping.getGeometryProperty
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; }
java
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; }
[ "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. <p>A geometry property is primary when it represents the location and shape of the object.</p> @param tableRef the <code>TableRef</code> for the table @return the name of the primary geometry property, or null if the table specified by the <code>tableRef</code> parameter is not mapped or has no primary geometry. @throws IllegalStateException if the map() method has not been invoked first.
[ "Returns", "the", "name", "of", "the", "primary", "geometry", "property", "." ]
2e871c70e506df2485d91152fbd0955c94de1d39
https://github.com/GeoLatte/geolatte-common-hibernate/blob/2e871c70e506df2485d91152fbd0955c94de1d39/src/main/java/org/geolatte/common/automapper/DatabaseMapping.java#L153-L165
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/parser/Filter.java
Filter.run
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 + "\""); } }
java
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 + "\""); } }
[ "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. @param cmd The string of text from SServer. @param f An instance of CommandFilter.
[ "Works", "out", "what", "type", "of", "command", "has", "been", "put", "into", "the", "method", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/parser/Filter.java#L61-L116
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/VersionInfoMojo.java
VersionInfoMojo.addProjectProperties
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" ); } }
java
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" ); } }
[ "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.
[ "Add", "properties", "to", "the", "project", "that", "are", "replaced", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/VersionInfoMojo.java#L126-L160
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/VersionInfoMojo.java
VersionInfoMojo.writeVersionInfoTemplateToTempFile
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 ); } }
java
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 ); } }
[ "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 @return a File pointing to the temporary file @throws MojoExecutionException if there is an IOException
[ "Write", "the", "default", ".", "rc", "template", "file", "to", "a", "temporary", "file", "and", "return", "it" ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/VersionInfoMojo.java#L167-L191
train
99soft/rocoto
src/main/java/org/nnsoft/guice/rocoto/variables/VariablesMap.java
VariablesMap.applyParser
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); }
java
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); }
[ "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
[ "Re", "apply", "parser", "on", "all", "entries", "in", "map" ]
9f54ed913cae54d613b3bc7a352f579d0c6b816f
https://github.com/99soft/rocoto/blob/9f54ed913cae54d613b3bc7a352f579d0c6b816f/src/main/java/org/nnsoft/guice/rocoto/variables/VariablesMap.java#L211-L220
train
99soft/rocoto
src/main/java/org/nnsoft/guice/rocoto/configuration/ConfigurationModule.java
ConfigurationModule.bindProperty
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 ); } }; }
java
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 ); } }; }
[ "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. @param name The property name @return The property value binder
[ "Binds", "to", "a", "property", "with", "the", "given", "name", "." ]
9f54ed913cae54d613b3bc7a352f579d0c6b816f
https://github.com/99soft/rocoto/blob/9f54ed913cae54d613b3bc7a352f579d0c6b816f/src/main/java/org/nnsoft/guice/rocoto/configuration/ConfigurationModule.java#L102-L117
train
99soft/rocoto
src/main/java/org/nnsoft/guice/rocoto/variables/Tree.java
Tree.addLeaf
public Tree<T> addLeaf( T child ) { Tree<T> leaf = new Tree<T>( child ); leaf.parent = this; children.add( leaf ); return leaf; }
java
public Tree<T> addLeaf( T child ) { Tree<T> leaf = new Tree<T>( child ); leaf.parent = this; children.add( leaf ); return leaf; }
[ "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 @param child @return Tree node of the newly added leaf
[ "Add", "a", "new", "leaf", "to", "this", "tree" ]
9f54ed913cae54d613b3bc7a352f579d0c6b816f
https://github.com/99soft/rocoto/blob/9f54ed913cae54d613b3bc7a352f579d0c6b816f/src/main/java/org/nnsoft/guice/rocoto/variables/Tree.java#L71-L77
train
99soft/rocoto
src/main/java/org/nnsoft/guice/rocoto/variables/Tree.java
Tree.removeSubtree
public void removeSubtree( Tree<T> subtree ) { if ( children.remove( subtree ) ) { subtree.parent = null; } }
java
public void removeSubtree( Tree<T> subtree ) { if ( children.remove( subtree ) ) { subtree.parent = null; } }
[ "public", "void", "removeSubtree", "(", "Tree", "<", "T", ">", "subtree", ")", "{", "if", "(", "children", ".", "remove", "(", "subtree", ")", ")", "{", "subtree", ".", "parent", "=", "null", ";", "}", "}" ]
Remove given subtree @param subtree
[ "Remove", "given", "subtree" ]
9f54ed913cae54d613b3bc7a352f579d0c6b816f
https://github.com/99soft/rocoto/blob/9f54ed913cae54d613b3bc7a352f579d0c6b816f/src/main/java/org/nnsoft/guice/rocoto/variables/Tree.java#L103-L109
train
99soft/rocoto
src/main/java/org/nnsoft/guice/rocoto/variables/Tree.java
Tree.addSubtree
public Tree<T> addSubtree( Tree<T> subtree ) { Tree<T> copy = addLeaf( subtree.data ); copy.children = new ArrayList<Tree<T>>( subtree.children ); return copy; }
java
public Tree<T> addSubtree( Tree<T> subtree ) { Tree<T> copy = addLeaf( subtree.data ); copy.children = new ArrayList<Tree<T>>( subtree.children ); return copy; }
[ "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. @param subtree @return subtree copy added
[ "Add", "a", "subtree", "provided", "tree", "is", "not", "modified", "." ]
9f54ed913cae54d613b3bc7a352f579d0c6b816f
https://github.com/99soft/rocoto/blob/9f54ed913cae54d613b3bc7a352f579d0c6b816f/src/main/java/org/nnsoft/guice/rocoto/variables/Tree.java#L149-L154
train
camunda/camunda-bpm-jbehave
camunda-bpm-jbehave/src/main/java/org/camunda/bpm/data/Guards.java
Guards.checkIsSetLocal
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 })); }
java
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 })); }
[ "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. @param execution process execution. @param variableName name of the variable to check.
[ "Checks", "if", "a", "local", "variable", "with", "specified", "name", "is", "set", "." ]
ffad22471418e2c7f161f8976ca8a042114138ab
https://github.com/camunda/camunda-bpm-jbehave/blob/ffad22471418e2c7f161f8976ca8a042114138ab/camunda-bpm-jbehave/src/main/java/org/camunda/bpm/data/Guards.java#L62-L68
train
camunda/camunda-bpm-jbehave
camunda-bpm-jbehave/src/main/java/org/camunda/bpm/data/Guards.java
Guards.checkIsSetGlobal
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 })); }
java
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 })); }
[ "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. @param execution process execution. @param variableName name of the variable to check.
[ "Checks", "if", "a", "global", "variable", "with", "specified", "name", "is", "set", "." ]
ffad22471418e2c7f161f8976ca8a042114138ab
https://github.com/camunda/camunda-bpm-jbehave/blob/ffad22471418e2c7f161f8976ca8a042114138ab/camunda-bpm-jbehave/src/main/java/org/camunda/bpm/data/Guards.java#L96-L102
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/CppCheckMojo.java
CppCheckMojo.getRelativeIncludeDirectories
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; }
java
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; }
[ "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
[ "Adjust", "the", "list", "of", "include", "paths", "to", "be", "relative", "to", "the", "projectFile", "directory" ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/CppCheckMojo.java#L180-L207
train
camunda/camunda-bpm-jbehave
camunda-bpm-jbehave/src/main/java/org/camunda/bpm/bdd/steps/CamundaSteps.java
CamundaSteps.cleanUp
@AfterStory(uponGivenStory = false) public void cleanUp() { LOG.debug("Cleaning up after story run."); Mocks.reset(); support.undeploy(); support.resetClock(); ProcessEngineAssertions.reset(); }
java
@AfterStory(uponGivenStory = false) public void cleanUp() { LOG.debug("Cleaning up after story run."); Mocks.reset(); support.undeploy(); support.resetClock(); ProcessEngineAssertions.reset(); }
[ "@", "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.
[ "Clean", "up", "all", "resources", "." ]
ffad22471418e2c7f161f8976ca8a042114138ab
https://github.com/camunda/camunda-bpm-jbehave/blob/ffad22471418e2c7f161f8976ca8a042114138ab/camunda-bpm-jbehave/src/main/java/org/camunda/bpm/bdd/steps/CamundaSteps.java#L39-L46
train
camunda/camunda-bpm-jbehave
camunda-bpm-jbehave/src/main/java/org/camunda/bpm/bdd/steps/CamundaSteps.java
CamundaSteps.stepIsReached
@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); }
java
@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); }
[ "@", "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. @param activityId name of the step to reach.
[ "Process", "step", "reached", "." ]
ffad22471418e2c7f161f8976ca8a042114138ab
https://github.com/camunda/camunda-bpm-jbehave/blob/ffad22471418e2c7f161f8976ca8a042114138ab/camunda-bpm-jbehave/src/main/java/org/camunda/bpm/bdd/steps/CamundaSteps.java#L79-L84
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/MSBuildPackaging.java
MSBuildPackaging.isValid
public static boolean isValid( String packaging ) { return MSBUILD_SOLUTION.equals( packaging ) || EXE.equals( packaging ) || DLL.equals( packaging ) || LIB.equals( packaging ); }
java
public static boolean isValid( String packaging ) { return MSBUILD_SOLUTION.equals( packaging ) || EXE.equals( packaging ) || DLL.equals( packaging ) || LIB.equals( packaging ); }
[ "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 @param packaging string to test @return true if the packaging is valid for MSBuild
[ "Test", "whether", "a", "packaging", "is", "a", "valid", "MSBuild", "packaging" ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/MSBuildPackaging.java#L52-L58
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/MSBuildPackaging.java
MSBuildPackaging.validPackaging
public static final String validPackaging() { return new StringBuilder() .append( MSBUILD_SOLUTION ).append( ", " ) .append( EXE ).append( ", " ) .append( DLL ).append( ", " ) .append( LIB ).toString(); }
java
public static final String validPackaging() { return new StringBuilder() .append( MSBUILD_SOLUTION ).append( ", " ) .append( EXE ).append( ", " ) .append( DLL ).append( ", " ) .append( LIB ).toString(); }
[ "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 @return a common separated list of packaging types
[ "Return", "a", "string", "listing", "the", "valid", "packaging", "types" ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/MSBuildPackaging.java#L74-L81
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/ByteBuffer.java
ByteBuffer.setString
public void setString(String str) throws IOException { Reader r = new StringReader(str); int c; reset(); while (((c = r.read()) != 0) && (c != -1)) { write(c); } }
java
public void setString(String str) throws IOException { Reader r = new StringReader(str); int c; reset(); while (((c = r.read()) != 0) && (c != -1)) { write(c); } }
[ "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. @param str The string to set. @throws java.io.IOException if any.
[ "Sets", "the", "buffer", "contents", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/ByteBuffer.java#L70-L77
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/ByteBuffer.java
ByteBuffer.getString
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(); }
java
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(); }
[ "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. @return The string in the buffer. @throws java.io.IOException if any.
[ "Gets", "the", "buffer", "contents", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/ByteBuffer.java#L85-L93
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/configuration/BuildPlatform.java
BuildPlatform.identifyPrimaryConfiguration
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 ); } }
java
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 ); } }
[ "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. @throws MojoExecutionException if duplicate configuration names are found
[ "Check", "the", "configurations", "and", "mark", "one", "as", "primary", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/configuration/BuildPlatform.java#L117-L142
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/configuration/VersionInfoConfiguration.java
VersionInfoConfiguration.getCopyright
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; }
java
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; }
[ "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 @return copyright string or default if not configured
[ "Get", "the", "configured", "copyright", "string" ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/configuration/VersionInfoConfiguration.java#L50-L63
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/AbstractTeam.java
AbstractTeam.createNewPlayers
public void createNewPlayers() { for (int i = 0; i < size(); i++) { players[i] = new SServerPlayer(teamName, getNewControllerPlayer(i), playerPort, hostname); } }
java
public void createNewPlayers() { for (int i = 0; i < size(); i++) { players[i] = new SServerPlayer(teamName, getNewControllerPlayer(i), playerPort, hostname); } }
[ "public", "void", "createNewPlayers", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", "(", ")", ";", "i", "++", ")", "{", "players", "[", "i", "]", "=", "new", "SServerPlayer", "(", "teamName", ",", "getNewControllerPlayer", "(", "i", ")", ",", "playerPort", ",", "hostname", ")", ";", "}", "}" ]
Create 11 SServerPlayer's.
[ "Create", "11", "SServerPlayer", "s", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/AbstractTeam.java#L140-L144
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/AbstractTeam.java
AbstractTeam.connectAll
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); } }
java
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); } }
[ "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.
[ "Connect", "all", "the", "players", "to", "the", "server", ".", "ActionsPlayer", "with", "index", "0", "is", "always", "the", "goalie", ".", "Connects", "a", "coach", "if", "there", "is", "one", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/AbstractTeam.java#L187-L208
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/AbstractTeam.java
AbstractTeam.connect
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); }
java
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); }
[ "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. @param index The number of the player to connect.
[ "Connect", "the", "selected", "player", "to", "the", "server", ".", "The", "player", "with", "index", "0", "is", "always", "the", "goalie", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/AbstractTeam.java#L216-L227
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java
AbstractMSBuildPluginMojo.findProperty
private String findProperty( String prop ) { String result = System.getProperty( prop ); if ( result == null ) { result = mavenProject.getProperties().getProperty( prop ); } return result; }
java
private String findProperty( String prop ) { String result = System.getProperty( prop ); if ( result == null ) { result = mavenProject.getProperties().getProperty( prop ); } return result; }
[ "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. @param prop the property name @return the value or null if not found
[ "Look", "for", "a", "value", "for", "the", "specified", "property", "in", "System", "properties", "then", "project", "properties", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java#L153-L161
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java
AbstractMSBuildPluginMojo.validateProjectFile
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 ) ) { // Solution packaging defined but the projectFile is not a .sln 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" ); }
java
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 ) ) { // Solution packaging defined but the projectFile is not a .sln 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" ); }
[ "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", ")", ")", "{", "// Solution packaging defined but the projectFile is not a .sln", "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. @throws MojoExecutionException if the specified projectFile is invalid.
[ "Check", "that", "we", "have", "a", "valid", "project", "or", "solution", "file", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java#L175-L204
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java
AbstractMSBuildPluginMojo.getProjectSources
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" ); } //Make sure we use case-insensitive matches as this plugin runs on a Windows platform 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; }
java
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" ); } //Make sure we use case-insensitive matches as this plugin runs on a Windows platform 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; }
[ "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\"", ")", ";", "}", "//Make sure we use case-insensitive matches as this plugin runs on a Windows platform ", "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 @param vcProject the parsed project @param includeHeaders set to true to include header files (*.h and *.hpp) @param excludes a List of pathname patterns to exclude from results @return a list of abstract paths representing each source file
[ "Generate", "a", "list", "of", "source", "files", "in", "the", "project", "directory", "and", "sub", "-", "directories" ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java#L239-L269
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java
AbstractMSBuildPluginMojo.getParsedProjects
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 ); } }
java
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 ); } }
[ "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. @param platform the platform to parse for @param configuration the configuration to parse for @return a list of VCProject objects containing configuration for the specified platform and configuration @throws MojoExecutionException if parsing fails
[ "Return", "project", "configurations", "for", "the", "specified", "platform", "and", "configuration", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java#L309-L346
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java
AbstractMSBuildPluginMojo.getParsedProjects
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; }
java
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; }
[ "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. @param platform the platform to parse for @param configuration the configuration to parse for @param filterRegex a Pattern to use to filter the projects @return a list of VCProject objects containing configuration for the specified platform and configuration @throws MojoExecutionException if parsing fails
[ "Return", "project", "configurations", "for", "the", "specified", "platform", "and", "configuration", "filtered", "by", "name", "using", "the", "specified", "Pattern", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java#L357-L386
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java
AbstractMSBuildPluginMojo.getOutputDirectories
protected List<File> getOutputDirectories( BuildPlatform p, BuildConfiguration c ) throws MojoExecutionException { List<File> result = new ArrayList<File>(); // If there is a configured value use it File configured = c.getOutputDirectory(); if ( configured != null ) { result.add( configured ); } else { List<VCProject> projects = getParsedProjects( p, c ); if ( projects.size() == 1 ) { // probably a standalone project result.add( projects.get( 0 ).getOutputDirectory() ); } else { // a solution for ( VCProject project : projects ) { boolean addResult = false; if ( targets == null ) { // building all targets, add all outputs addResult = true; } else { // building select targets, only add ones we were asked for 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 ) { // result will be populated, now check if it was created 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; }
java
protected List<File> getOutputDirectories( BuildPlatform p, BuildConfiguration c ) throws MojoExecutionException { List<File> result = new ArrayList<File>(); // If there is a configured value use it File configured = c.getOutputDirectory(); if ( configured != null ) { result.add( configured ); } else { List<VCProject> projects = getParsedProjects( p, c ); if ( projects.size() == 1 ) { // probably a standalone project result.add( projects.get( 0 ).getOutputDirectory() ); } else { // a solution for ( VCProject project : projects ) { boolean addResult = false; if ( targets == null ) { // building all targets, add all outputs addResult = true; } else { // building select targets, only add ones we were asked for 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 ) { // result will be populated, now check if it was created 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; }
[ "protected", "List", "<", "File", ">", "getOutputDirectories", "(", "BuildPlatform", "p", ",", "BuildConfiguration", "c", ")", "throws", "MojoExecutionException", "{", "List", "<", "File", ">", "result", "=", "new", "ArrayList", "<", "File", ">", "(", ")", ";", "// If there is a configured value use it", "File", "configured", "=", "c", ".", "getOutputDirectory", "(", ")", ";", "if", "(", "configured", "!=", "null", ")", "{", "result", ".", "add", "(", "configured", ")", ";", "}", "else", "{", "List", "<", "VCProject", ">", "projects", "=", "getParsedProjects", "(", "p", ",", "c", ")", ";", "if", "(", "projects", ".", "size", "(", ")", "==", "1", ")", "{", "// probably a standalone project", "result", ".", "add", "(", "projects", ".", "get", "(", "0", ")", ".", "getOutputDirectory", "(", ")", ")", ";", "}", "else", "{", "// a solution", "for", "(", "VCProject", "project", ":", "projects", ")", "{", "boolean", "addResult", "=", "false", ";", "if", "(", "targets", "==", "null", ")", "{", "// building all targets, add all outputs", "addResult", "=", "true", ";", "}", "else", "{", "// building select targets, only add ones we were asked for", "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", ")", "{", "// result will be populated, now check if it was created", "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. @param p the BuildPlatform @param c the BuildConfiguration @return a List of File objects @throws MojoExecutionException if an output directory cannot be determined or does not exist
[ "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", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java#L419-L484
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java
AbstractMSBuildPluginMojo.isCppCheckEnabled
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; }
java
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; }
[ "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 @param quiet set to true to suppress logging @return true if CppCheck is enabled, false otherwise
[ "Determine", "whether", "CppCheck", "is", "enabled", "by", "the", "configuration" ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java#L491-L516
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java
AbstractMSBuildPluginMojo.isVeraEnabled
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; }
java
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; }
[ "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 @param quiet set to true to suppress logging @return true if Vera++ is enabled, false otherwise
[ "Determine", "whether", "Vera", "++", "is", "enabled", "by", "the", "configuration" ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildPluginMojo.java#L523-L548
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/AbstractUDPClient.java
AbstractUDPClient.send
public void send(String message) throws IOException { buf.setString(message); DatagramPacket packet = new DatagramPacket(buf.getByteArray(), buf.length(), host, port); socket.send(packet); }
java
public void send(String message) throws IOException { buf.setString(message); DatagramPacket packet = new DatagramPacket(buf.getByteArray(), buf.length(), host, port); socket.send(packet); }
[ "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. @param message A valid SServer message. @throws java.io.IOException if any.
[ "Sends", "a", "message", "to", "SServer", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/AbstractUDPClient.java#L163-L167
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/AbstractUDPClient.java
AbstractUDPClient.toStateString
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(); }
java
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(); }
[ "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. @return Connection details (eg. "Host: 192.168.1.67:6000").
[ "Returns", "a", "string", "containing", "the", "connection", "details", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/AbstractUDPClient.java#L203-L211
train
brianm/url-scheme-registry
src/main/java/org/skife/url/UrlSchemeRegistry.java
UrlSchemeRegistry.register
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() { @Override 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(); }
java
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() { @Override 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(); }
[ "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", "(", ")", "{", "@", "Override", "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. @param scheme scheme name to associate handlerType with @param handlerType non-final class with a no-arg public constructor which will create handlers for scheme
[ "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", "." ]
db577eea4d246bcf96d7fcb06dda02f9c23db059
https://github.com/brianm/url-scheme-registry/blob/db577eea4d246bcf96d7fcb06dda02f9c23db059/src/main/java/org/skife/url/UrlSchemeRegistry.java#L50-L69
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addPlayerInitCommand
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()); }
java
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()); }
[ "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. @param teamName The team the player belongs to. @param isGoalie If the player is a goalie. Note: Only one goalie per team.
[ "This", "is", "used", "to", "initialise", "a", "player", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L61-L74
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addTrainerInitCommand
public void addTrainerInitCommand() { StringBuilder buf = new StringBuilder(); buf.append("(init (version "); buf.append(serverVersion); buf.append("))"); fifo.add(fifo.size(), buf.toString()); }
java
public void addTrainerInitCommand() { StringBuilder buf = new StringBuilder(); buf.append("(init (version "); buf.append(serverVersion); buf.append("))"); fifo.add(fifo.size(), buf.toString()); }
[ "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.
[ "This", "is", "used", "to", "initialise", "a", "trainer", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L79-L85
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addCoachInitCommand
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()); }
java
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()); }
[ "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. @param teamName The team the coach belongs to.
[ "This", "is", "used", "to", "initialise", "the", "online", "coach", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L92-L100
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addReconnectCommand
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()); }
java
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()); }
[ "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. @param teamName a {@link java.lang.String} object. @param num a int.
[ "This", "is", "used", "to", "reconnect", "the", "player", "to", "the", "server", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L108-L116
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addCatchCommand
public void addCatchCommand(int direction) { StringBuilder buf = new StringBuilder(); buf.append("(catch "); buf.append(direction); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
java
public void addCatchCommand(int direction) { StringBuilder buf = new StringBuilder(); buf.append("(catch "); buf.append(direction); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
[ "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. @param direction The direction in which to catch, relative to its body.
[ "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", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L125-L131
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addDashCommand
public void addDashCommand(int power) { StringBuilder buf = new StringBuilder(); buf.append("(dash "); buf.append(power); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
java
public void addDashCommand(int power) { StringBuilder buf = new StringBuilder(); buf.append("(dash "); buf.append(power); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
[ "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. @param power Power is between minpower (-100) and maxpower (+100).
[ "This", "command", "accelerates", "the", "player", "in", "the", "direction", "of", "its", "body", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L187-L193
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addKickCommand
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()); }
java
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()); }
[ "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. @param power Power is between minpower (-100) and maxpower (+100). @param direction Direction is relative to the body of the player.
[ "This", "command", "accelerates", "the", "ball", "with", "the", "given", "power", "in", "the", "given", "direction", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L201-L209
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addTurnCommand
public void addTurnCommand(int angle) { StringBuilder buf = new StringBuilder(); buf.append("(turn "); buf.append(angle); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
java
public void addTurnCommand(int angle) { StringBuilder buf = new StringBuilder(); buf.append("(turn "); buf.append(angle); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
[ "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. @param angle Angle to turn (between -180 and +180).
[ "This", "command", "will", "turn", "the", "players", "body", "in", "degrees", "relative", "to", "their", "current", "direction", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L233-L239
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addChangePlayModeCommand
public void addChangePlayModeCommand(PlayMode playMode) { StringBuilder buf = new StringBuilder(); buf.append("(change_mode "); buf.append(playMode); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
java
public void addChangePlayModeCommand(PlayMode playMode) { StringBuilder buf = new StringBuilder(); buf.append("(change_mode "); buf.append(playMode); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
[ "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. @param playMode a {@link com.github.robocup_atan.atan.model.enums.PlayMode} object.
[ "Trainer", "only", "command", ".", "Changes", "the", "play", "mode", "of", "the", "server", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L277-L283
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addMoveBallCommand
public void addMoveBallCommand(double x, double y) { StringBuilder buf = new StringBuilder(); buf.append("(move "); buf.append("ball"); // TODO Manual says the format...will implement this later. buf.append(' '); buf.append(x); buf.append(' '); buf.append(y); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
java
public void addMoveBallCommand(double x, double y) { StringBuilder buf = new StringBuilder(); buf.append("(move "); buf.append("ball"); // TODO Manual says the format...will implement this later. buf.append(' '); buf.append(x); buf.append(' '); buf.append(y); buf.append(')'); fifo.add(fifo.size(), buf.toString()); }
[ "public", "void", "addMoveBallCommand", "(", "double", "x", ",", "double", "y", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "\"(move \"", ")", ";", "buf", ".", "append", "(", "\"ball\"", ")", ";", "// TODO Manual says the format...will implement this later.", "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. @param x The x coordinate to move to. @param y The y coordinate to move to.
[ "Trainer", "only", "command", ".", "Moves", "the", "ball", "to", "the", "given", "coordinates", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L316-L326
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addCheckBallCommand
public void addCheckBallCommand() { StringBuilder buf = new StringBuilder(); buf.append("(check_ball)"); fifo.add(fifo.size(), buf.toString()); }
java
public void addCheckBallCommand() { StringBuilder buf = new StringBuilder(); buf.append("(check_ball)"); fifo.add(fifo.size(), buf.toString()); }
[ "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.
[ "Trainer", "only", "command", ".", "Checks", "the", "current", "status", "of", "the", "ball", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L332-L336
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addStartCommand
public void addStartCommand() { StringBuilder buf = new StringBuilder(); buf.append("(start)"); fifo.add(fifo.size(), buf.toString()); }
java
public void addStartCommand() { StringBuilder buf = new StringBuilder(); buf.append("(start)"); fifo.add(fifo.size(), buf.toString()); }
[ "public", "void", "addStartCommand", "(", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "\"(start)\"", ")", ";", "fifo", ".", "add", "(", "fifo", ".", "size", "(", ")", ",", "buf", ".", "toString", "(", ")", ")", ";", "}" ]
Trainer only command. Starts the server.
[ "Trainer", "only", "command", ".", "Starts", "the", "server", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L342-L346
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addRecoverCommand
public void addRecoverCommand() { StringBuilder buf = new StringBuilder(); buf.append("(recover)"); fifo.add(fifo.size(), buf.toString()); }
java
public void addRecoverCommand() { StringBuilder buf = new StringBuilder(); buf.append("(recover)"); fifo.add(fifo.size(), buf.toString()); }
[ "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.
[ "Trainer", "only", "command", ".", "Recovers", "the", "players", "stamina", "recovery", "effort", "and", "hear", "capacity", "to", "the", "values", "at", "the", "beginning", "of", "the", "game", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L352-L356
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addEarCommand
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()); }
java
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()); }
[ "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. @param earOn True to turn auditory information on, false to turn it off.
[ "Trainer", "only", "command", ".", "It", "turns", "on", "or", "off", "the", "sending", "of", "auditory", "information", "to", "the", "trainer", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L364-L374
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addChangePlayerTypeCommand
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()); }
java
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()); }
[ "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. @param teamName The name of the team the player belongs to. @param unum The players uniform number (1~11 on pitch usually, subs <= 14). @param playerType A player type between 0 (the standard player) and 18. However, player.conf can change this.
[ "Trainer", "only", "command", ".", "This", "command", "changes", "the", "specified", "players", "heterogeneous", "type", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L384-L394
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addTeamNamesCommand
public void addTeamNamesCommand() { StringBuilder buf = new StringBuilder(); buf.append("(team_names)"); fifo.add(fifo.size(), buf.toString()); }
java
public void addTeamNamesCommand() { StringBuilder buf = new StringBuilder(); buf.append("(team_names)"); fifo.add(fifo.size(), buf.toString()); }
[ "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.
[ "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", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L431-L435
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.addTeamGraphicCommand
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()); } } }
java
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()); } } }
[ "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. @param xpm An XPMImage object.
[ "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", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L468-L484
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java
CommandFactory.next
public String next() { if (fifo.isEmpty()) { throw new RuntimeException("Fifo is empty"); } String cmd = (String) fifo.get(0); fifo.remove(0); return cmd; }
java
public String next() { if (fifo.isEmpty()) { throw new RuntimeException("Fifo is empty"); } String cmd = (String) fifo.get(0); fifo.remove(0); return cmd; }
[ "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. @return The next command.
[ "Gets", "the", "next", "command", "from", "the", "stack", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L501-L508
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/SonarConfigGeneratorMojo.java
SonarConfigGeneratorMojo.isSonarEnabled
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; }
java
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; }
[ "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 @param quiet set to true to suppress logging @return true if sonar configuration generation is enabled, false otherwise @throws MojoExecutionException if the configured project or solution file is invalid or cannot be parsed
[ "Determine", "whether", "Sonar", "configuration", "generation", "is", "enabled", "by", "the", "configuration" ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/SonarConfigGeneratorMojo.java#L74-L91
train
tecsinapse/tecsinapse-data-io
src/main/java/br/com/tecsinapse/dataio/importer/parser/CsvParser.java
CsvParser.parse
@Override 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; }
java
@Override 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; }
[ "@", "Override", "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 Obs.: No read de first line. @return List of T object @throws IllegalAccessException IllegalAccessException @throws InstantiationException InstantiationException @throws InvocationTargetException InvocationTargetException @throws NoSuchMethodException NoSuchMethodException
[ "Parser", "file", "to", "list", "of", "T", "objects" ]
73029c887bc970598bb6127e2d7ed8055bd7f701
https://github.com/tecsinapse/tecsinapse-data-io/blob/73029c887bc970598bb6127e2d7ed8055bd7f701/src/main/java/br/com/tecsinapse/dataio/importer/parser/CsvParser.java#L164-L195
train
GeoLatte/geolatte-common-hibernate
src/main/java/org/geolatte/common/automapper/SimpleNamingStrategy.java
SimpleNamingStrategy.toJavaName
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(); }
java
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(); }
[ "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. @param name input String @return java identifier, based on input String.
[ "Turns", "the", "name", "into", "a", "valid", "simplified", "Java", "Identifier", "." ]
2e871c70e506df2485d91152fbd0955c94de1d39
https://github.com/GeoLatte/geolatte-common-hibernate/blob/2e871c70e506df2485d91152fbd0955c94de1d39/src/main/java/org/geolatte/common/automapper/SimpleNamingStrategy.java#L61-L78
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildMojo.java
AbstractMSBuildMojo.validateForMSBuild
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 ); }
java
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 ); }
[ "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. @throws MojoExecutionException is a validation step encounters an error.
[ "Check", "the", "Mojo", "configuration", "provides", "sufficient", "data", "to", "construct", "an", "MSBuild", "command", "line", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildMojo.java#L44-L53
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildMojo.java
AbstractMSBuildMojo.findMSBuild
protected final void findMSBuild() throws MojoExecutionException { if ( msbuildPath == null ) { // not set in configuration try system environment 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 ); // TODO: Could check that this is really MSBuild 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 ); }
java
protected final void findMSBuild() throws MojoExecutionException { if ( msbuildPath == null ) { // not set in configuration try system environment 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 ); // TODO: Could check that this is really MSBuild 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 ); }
[ "protected", "final", "void", "findMSBuild", "(", ")", "throws", "MojoExecutionException", "{", "if", "(", "msbuildPath", "==", "null", ")", "{", "// not set in configuration try system environment", "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", ")", ";", "// TODO: Could check that this is really MSBuild", "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. @throws MojoExecutionException if MSBuild cannot be located
[ "Attempts", "to", "locate", "MSBuild", ".", "First", "looks", "at", "the", "mojo", "configuration", "property", "if", "not", "found", "there", "try", "the", "system", "environment", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildMojo.java#L61-L87
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildMojo.java
AbstractMSBuildMojo.runMSBuild
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 ); } }
java
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 ); } }
[ "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. @param targets the build targets to pass to MSBuild @param environment optional environment variable Map (my be null) @throws MojoExecutionException if there is a problem running MSBuild @throws MojoFailureException if MSBuild returns a non-zero exit code
[ "Run", "MSBuild", "for", "each", "platform", "and", "configuration", "pair", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/AbstractMSBuildMojo.java#L96-L121
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/XPMImage.java
XPMImage.getTile
public String getTile(int x, int y) { if ((x > getArrayWidth()) || (y > getArrayHeight()) || (x < 0) || (y < 0)) { throw new IllegalArgumentException(); } return image[x][y]; }
java
public String getTile(int x, int y) { if ((x > getArrayWidth()) || (y > getArrayHeight()) || (x < 0) || (y < 0)) { throw new IllegalArgumentException(); } return image[x][y]; }
[ "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. @param x Between 0 and 31. @param y Between 0 and 7. @return An XPM image string defining an 8*8 image.
[ "Gets", "a", "tile", "of", "the", "XPM", "Image", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/XPMImage.java#L86-L91
train
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/SServerPlayer.java
SServerPlayer.toListString
public String toListString() { StringBuffer buf = new StringBuffer(); buf.append(controller.getClass().getName()); return buf.toString(); }
java
public String toListString() { StringBuffer buf = new StringBuffer(); buf.append(controller.getClass().getName()); return buf.toString(); }
[ "public", "String", "toListString", "(", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "buf", ".", "append", "(", "controller", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Create a list string. @return A list string.
[ "Create", "a", "list", "string", "." ]
52237b468b09ba5b7c52d290984dbe0326c96df7
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/SServerPlayer.java#L222-L226
train
darcy-framework/synq
src/main/java/com/redhat/synq/MultiEvent.java
MultiEvent.throwMultiEventException
private void throwMultiEventException(Event<?> eventThatThrewException) { while(throwable instanceof MultiEventException && throwable.getCause() != null) { eventThatThrewException = ((MultiEventException) throwable).getEvent(); throwable = throwable.getCause(); } throw new MultiEventException(eventThatThrewException, throwable); }
java
private void throwMultiEventException(Event<?> eventThatThrewException) { while(throwable instanceof MultiEventException && throwable.getCause() != null) { eventThatThrewException = ((MultiEventException) throwable).getEvent(); throwable = throwable.getCause(); } throw new MultiEventException(eventThatThrewException, throwable); }
[ "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.
[ "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", "." ]
37f2e6966496520efd1ec506770a717823671e9b
https://github.com/darcy-framework/synq/blob/37f2e6966496520efd1ec506770a717823671e9b/src/main/java/com/redhat/synq/MultiEvent.java#L97-L104
train
forge/xml-parser
src/main/java/org/jboss/forge/parser/xml/Node.java
Node.get
List<Node> get(final Pattern... patterns) { return AbsoluteGetQuery.INSTANCE.execute(this, includeRootPatternFirst(patterns)); }
java
List<Node> get(final Pattern... patterns) { return AbsoluteGetQuery.INSTANCE.execute(this, includeRootPatternFirst(patterns)); }
[ "List", "<", "Node", ">", "get", "(", "final", "Pattern", "...", "patterns", ")", "{", "return", "AbsoluteGetQuery", ".", "INSTANCE", ".", "execute", "(", "this", ",", "includeRootPatternFirst", "(", "patterns", ")", ")", ";", "}" ]
Get all children matching the specified query. @param query The query to use for finding relevant child nodes @return All found children, or empty list if none found.
[ "Get", "all", "children", "matching", "the", "specified", "query", "." ]
2804337a6028878a3f97fb12f8bbe45501fa0024
https://github.com/forge/xml-parser/blob/2804337a6028878a3f97fb12f8bbe45501fa0024/src/main/java/org/jboss/forge/parser/xml/Node.java#L334-L337
train
99soft/rocoto
src/main/java/org/nnsoft/guice/rocoto/variables/AbstractAppender.java
AbstractAppender.resolve
public String resolve( Map<String, String> configuration ) { StringBuilder buffer = new StringBuilder(); append( buffer, configuration, null ); return buffer.toString(); }
java
public String resolve( Map<String, String> configuration ) { StringBuilder buffer = new StringBuilder(); append( buffer, configuration, null ); return buffer.toString(); }
[ "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.
[ "Begin", "resolving", "process", "with", "this", "appender", "against", "the", "provided", "configuration", "." ]
9f54ed913cae54d613b3bc7a352f579d0c6b816f
https://github.com/99soft/rocoto/blob/9f54ed913cae54d613b3bc7a352f579d0c6b816f/src/main/java/org/nnsoft/guice/rocoto/variables/AbstractAppender.java#L86-L91
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/MojoHelper.java
MojoHelper.validateToolPath
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 ); }
java
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 ); }
[ "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. @param toolPath the configured tool path from the POM @param toolName the name of the tool, used for logging messages @param logger a Log to write messages to @throws FileNotFoundException if the tool cannot be found
[ "Validates", "the", "path", "to", "a", "command", "-", "line", "tool", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/MojoHelper.java#L48-L66
train
andi12/msbuild-maven-plugin
msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/MojoHelper.java
MojoHelper.validatePlatforms
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; }
java
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; }
[ "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. @param platforms the list of BuildPlatform's to validate @return the passed in list or a new list with a default platform added @throws MojoExecutionException if the configuration is invalid.
[ "Check", "that", "we", "have", "a", "valid", "set", "of", "platforms", ".", "If", "no", "platforms", "are", "configured", "we", "create", "1", "default", "platform", "." ]
224159c15efba20d482f8c630f7947339b1a1b86
https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/MojoHelper.java#L75-L97
train
padrig64/ValidationFramework
validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/ResultCollectorValidatorBuilder.java
ResultCollectorValidatorBuilder.collect
@Deprecated public static <D> RuleContext<D> collect(ResultCollector<?, D> resultCollector) { return new ResultCollectorContext().collect(resultCollector); }
java
@Deprecated public static <D> RuleContext<D> collect(ResultCollector<?, D> resultCollector) { return new ResultCollectorContext().collect(resultCollector); }
[ "@", "Deprecated", "public", "static", "<", "D", ">", "RuleContext", "<", "D", ">", "collect", "(", "ResultCollector", "<", "?", ",", "D", ">", "resultCollector", ")", "{", "return", "new", "ResultCollectorContext", "(", ")", ".", "collect", "(", "resultCollector", ")", ";", "}" ]
Adds the first result collector to the validator. @param resultCollector First result collector to be added. @param <D> Type of data provided. @return Next component to continue building the validator. @deprecated Use {@link com.google.code.validationframework.base.validator.generalvalidator.dsl.GeneralValidatorBuilder} instead.
[ "Adds", "the", "first", "result", "collector", "to", "the", "validator", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/ResultCollectorValidatorBuilder.java#L59-L62
train
padrig64/ValidationFramework
validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/ResultCollectorValidatorBuilder.java
ResultCollectorValidatorBuilder.collect
@Deprecated public static <D> RuleContext<D> collect(ResultCollector<?, D>... resultCollectors) { return new ResultCollectorContext().collect(resultCollectors); }
java
@Deprecated public static <D> RuleContext<D> collect(ResultCollector<?, D>... resultCollectors) { return new ResultCollectorContext().collect(resultCollectors); }
[ "@", "Deprecated", "public", "static", "<", "D", ">", "RuleContext", "<", "D", ">", "collect", "(", "ResultCollector", "<", "?", ",", "D", ">", "...", "resultCollectors", ")", "{", "return", "new", "ResultCollectorContext", "(", ")", ".", "collect", "(", "resultCollectors", ")", ";", "}" ]
Adds the first result collectors to the validator. @param resultCollectors First result collectors to be added. @param <D> Type of data provided. @return Next component to continue building the validator. @deprecated Use {@link com.google.code.validationframework.base.validator.generalvalidator.dsl.GeneralValidatorBuilder} instead.
[ "Adds", "the", "first", "result", "collectors", "to", "the", "validator", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/ResultCollectorValidatorBuilder.java#L74-L77
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/support/TransparentToolTipDialog.java
TransparentToolTipDialog.initComponents
private void initComponents() { // Avoid warning on Mac OS X when changing the alpha getRootPane().putClientProperty("apple.awt.draggableWindowBackground", Boolean.FALSE); toolTip = new JToolTip(); toolTip.addMouseListener(new TransparencyAdapter()); owner.addComponentListener(locationAdapter); owner.addAncestorListener(locationAdapter); getRootPane().setWindowDecorationStyle(JRootPane.NONE); // Just in case... setFocusable(false); // Just in case... setFocusableWindowState(false); setContentPane(toolTip); pack(); // Seems to help for the very first setVisible(true) when window transparency is on }
java
private void initComponents() { // Avoid warning on Mac OS X when changing the alpha getRootPane().putClientProperty("apple.awt.draggableWindowBackground", Boolean.FALSE); toolTip = new JToolTip(); toolTip.addMouseListener(new TransparencyAdapter()); owner.addComponentListener(locationAdapter); owner.addAncestorListener(locationAdapter); getRootPane().setWindowDecorationStyle(JRootPane.NONE); // Just in case... setFocusable(false); // Just in case... setFocusableWindowState(false); setContentPane(toolTip); pack(); // Seems to help for the very first setVisible(true) when window transparency is on }
[ "private", "void", "initComponents", "(", ")", "{", "// Avoid warning on Mac OS X when changing the alpha", "getRootPane", "(", ")", ".", "putClientProperty", "(", "\"apple.awt.draggableWindowBackground\"", ",", "Boolean", ".", "FALSE", ")", ";", "toolTip", "=", "new", "JToolTip", "(", ")", ";", "toolTip", ".", "addMouseListener", "(", "new", "TransparencyAdapter", "(", ")", ")", ";", "owner", ".", "addComponentListener", "(", "locationAdapter", ")", ";", "owner", ".", "addAncestorListener", "(", "locationAdapter", ")", ";", "getRootPane", "(", ")", ".", "setWindowDecorationStyle", "(", "JRootPane", ".", "NONE", ")", ";", "// Just in case...", "setFocusable", "(", "false", ")", ";", "// Just in case...", "setFocusableWindowState", "(", "false", ")", ";", "setContentPane", "(", "toolTip", ")", ";", "pack", "(", ")", ";", "// Seems to help for the very first setVisible(true) when window transparency is on", "}" ]
Initializes the components of the tooltip window.
[ "Initializes", "the", "components", "of", "the", "tooltip", "window", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/support/TransparentToolTipDialog.java#L287-L302
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/support/TransparentToolTipDialog.java
TransparentToolTipDialog.setText
public void setText(String text) { // Only change if different if (!ValueUtils.areEqual(text, toolTip.getTipText())) { boolean wasVisible = isVisible(); if (wasVisible) { setVisible(false); } toolTip.setTipText(text); if (wasVisible) { setVisible(true); } } }
java
public void setText(String text) { // Only change if different if (!ValueUtils.areEqual(text, toolTip.getTipText())) { boolean wasVisible = isVisible(); if (wasVisible) { setVisible(false); } toolTip.setTipText(text); if (wasVisible) { setVisible(true); } } }
[ "public", "void", "setText", "(", "String", "text", ")", "{", "// Only change if different", "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. @param text Text to be displayed
[ "Sets", "the", "text", "to", "be", "displayed", "as", "a", "tooltip", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/support/TransparentToolTipDialog.java#L359-L374
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/support/TransparentToolTipDialog.java
TransparentToolTipDialog.followOwner
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); } } }
java
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); } } }
[ "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.
[ "Updates", "the", "location", "of", "the", "window", "based", "on", "the", "location", "of", "the", "owner", "component", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/support/TransparentToolTipDialog.java#L379-L390
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/dataprovider/MapCompositeDataProvider.java
MapCompositeDataProvider.addDataProvider
public void addDataProvider(K key, DataProvider<DPO> dataProvider) { dataProviders.put(key, dataProvider); }
java
public void addDataProvider(K key, DataProvider<DPO> dataProvider) { dataProviders.put(key, dataProvider); }
[ "public", "void", "addDataProvider", "(", "K", "key", ",", "DataProvider", "<", "DPO", ">", "dataProvider", ")", "{", "dataProviders", ".", "put", "(", "key", ",", "dataProvider", ")", ";", "}" ]
Adds the specified data provider with the specified key. @param key Key associated to the data provider. @param dataProvider Data provider associated to the key.
[ "Adds", "the", "specified", "data", "provider", "with", "the", "specified", "key", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/dataprovider/MapCompositeDataProvider.java#L56-L58
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/resulthandler/bool/IconBooleanFeedback.java
IconBooleanFeedback.updateDecoration
private void updateDecoration() { if (lastResult != null) { if (lastResult) { setIcon(validIcon); setToolTipText(validText); } else { setIcon(invalidIcon); setToolTipText(invalidText); } } }
java
private void updateDecoration() { if (lastResult != null) { if (lastResult) { setIcon(validIcon); setToolTipText(validText); } else { setIcon(invalidIcon); setToolTipText(invalidText); } } }
[ "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.
[ "Updates", "the", "icon", "and", "tooltip", "text", "according", "to", "the", "last", "result", "processed", "by", "this", "result", "handler", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/resulthandler/bool/IconBooleanFeedback.java#L248-L258
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/trigger/BaseComponentKeyStrokeTrigger.java
BaseComponentKeyStrokeTrigger.toKeyStrokes
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; }
java
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; }
[ "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. @param keyCodes Array of key codes to be converted. @return Array of keystrokes resulting form the conversion.
[ "Converts", "the", "specified", "array", "of", "key", "codes", "in", "an", "array", "of", "key", "strokes", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/trigger/BaseComponentKeyStrokeTrigger.java#L137-L148
train
padrig64/ValidationFramework
validationframework-demo/src/main/java/com/google/code/validationframework/demo/swing/FeedbackDemo.java
FeedbackDemo.initValidation
private void initValidation() { // Create validators and collect the results 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); // Enable Apply button only when all fields are valid read(resultCollector1, resultCollector2, resultCollector3, resultCollector4, resultCollector5) // .transform(new CollectionElementTransformer<Result, Boolean>(new ResultToBooleanTransformer())) // .transform(new AndBooleanAggregator()) // .write(new ComponentEnabledProperty(applyButton)); }
java
private void initValidation() { // Create validators and collect the results 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); // Enable Apply button only when all fields are valid read(resultCollector1, resultCollector2, resultCollector3, resultCollector4, resultCollector5) // .transform(new CollectionElementTransformer<Result, Boolean>(new ResultToBooleanTransformer())) // .transform(new AndBooleanAggregator()) // .write(new ComponentEnabledProperty(applyButton)); }
[ "private", "void", "initValidation", "(", ")", "{", "// Create validators and collect the results", "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", ")", ";", "// Enable Apply button only when all fields are valid", "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.
[ "Initializes", "the", "input", "validation", "and", "conditional", "logic", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-demo/src/main/java/com/google/code/validationframework/demo/swing/FeedbackDemo.java#L294-L312
train
opencb/java-common-libs
commons-datastore/commons-datastore-core/src/main/java/org/opencb/commons/datastore/core/QueryOptions.java
QueryOptions.add
public Object add(String key, Object value) { if (!this.containsKey(key)) { this.put(key, value); return null; } return this.get(key); }
java
public Object add(String key, Object value) { if (!this.containsKey(key)) { this.put(key, value); return null; } return this.get(key); }
[ "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. @param key The new option name @param value The new value @return null if the key was not present, or the existing object if the key exists.
[ "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", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-core/src/main/java/org/opencb/commons/datastore/core/QueryOptions.java#L85-L91
train
riccardove/easyjasub
easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/SubtitleLineContentToHtmlBase.java
SubtitleLineContentToHtmlBase.appendElements
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()); } } }
java
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()); } } }
[ "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
[ "Appends", "furigana", "over", "the", "whole", "word" ]
58d6af66b1b1c738326c74d9ad5e4ad514120e27
https://github.com/riccardove/easyjasub/blob/58d6af66b1b1c738326c74d9ad5e4ad514120e27/easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/SubtitleLineContentToHtmlBase.java#L38-L48
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/property/JListSelectedItemCountProperty.java
JListSelectedItemCountProperty.updateValue
private void updateValue() { if (list != null) { int oldCount = this.count; this.count = list.getSelectedIndices().length; maybeNotifyListeners(oldCount, count); } }
java
private void updateValue() { if (list != null) { int oldCount = this.count; this.count = list.getSelectedIndices().length; maybeNotifyListeners(oldCount, count); } }
[ "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.
[ "Updates", "the", "value", "of", "this", "property", "based", "on", "the", "list", "s", "selection", "model", "and", "notify", "the", "listeners", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/property/JListSelectedItemCountProperty.java#L93-L99
train
opencb/java-common-libs
commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/FacetQueryParser.java
FacetQueryParser.parse
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)); }
java
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)); }
[ "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. @param query A string with the format: chrom>>type,biotype,avg>>gerp,avg;type;biotype>>sadasd @return A JSON string facet query @throws Exception Any exception related with JSON conversion
[ "This", "method", "accepts", "a", "simple", "facet", "declaration", "format", "and", "converts", "it", "into", "a", "rich", "JSON", "query", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/FacetQueryParser.java#L55-L74
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableSetProperty.java
AbstractReadableSetProperty.doNotifyListenersOfAddedValues
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); } }
java
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); } }
[ "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. @param newItems Newly added items.
[ "Notifies", "the", "change", "listeners", "that", "items", "have", "been", "added", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableSetProperty.java#L88-L94
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableSetProperty.java
AbstractReadableSetProperty.doNotifyListenersOfRemovedValues
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); } }
java
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); } }
[ "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. @param oldItems Removed items.
[ "Notifies", "the", "change", "listeners", "that", "items", "have", "been", "removed", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableSetProperty.java#L101-L107
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/binding/Binder.java
Binder.read
public static <MO> SingleMasterBinding<MO, MO> read(ReadableProperty<MO> master) { return new SingleMasterBinding<MO, MO>(master, null); }
java
public static <MO> SingleMasterBinding<MO, MO> read(ReadableProperty<MO> master) { return new SingleMasterBinding<MO, MO>(master, null); }
[ "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. @param master Master property. @param <MO> Type of value to be read from the master property. @return DSL object.
[ "Specifies", "the", "master", "property", "that", "is", "part", "of", "the", "binding", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/binding/Binder.java#L224-L226
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/utils/ValueUtils.java
ValueUtils.areEqual
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)); }
java
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)); }
[ "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. @param value1 First value. @param value2 Second value. @param comparator Comparator to be used to compare the two values in case they are both non null. @param <T> Type of values to be compared. @return True if both values are null, or equal according to the comparator.
[ "Compares", "the", "two", "given", "values", "by", "taking", "null", "values", "into", "account", "and", "the", "specified", "comparator", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/utils/ValueUtils.java#L68-L71
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/rule/string/IllegalCharacterBooleanRule.java
IllegalCharacterBooleanRule.setIllegalCharacters
public void setIllegalCharacters(final String illegalCharacters) { // Create a simple sub-rule taking care of the check this.illegalCharacters = illegalCharacters; delegatePattern = new NegateBooleanRule<String>(new StringRegexRule("[" + Pattern.quote(illegalCharacters) + "]")); // Create a nicely space-separated list of illegal characters 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(); }
java
public void setIllegalCharacters(final String illegalCharacters) { // Create a simple sub-rule taking care of the check this.illegalCharacters = illegalCharacters; delegatePattern = new NegateBooleanRule<String>(new StringRegexRule("[" + Pattern.quote(illegalCharacters) + "]")); // Create a nicely space-separated list of illegal characters 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(); }
[ "public", "void", "setIllegalCharacters", "(", "final", "String", "illegalCharacters", ")", "{", "// Create a simple sub-rule taking care of the check", "this", ".", "illegalCharacters", "=", "illegalCharacters", ";", "delegatePattern", "=", "new", "NegateBooleanRule", "<", "String", ">", "(", "new", "StringRegexRule", "(", "\"[\"", "+", "Pattern", ".", "quote", "(", "illegalCharacters", ")", "+", "\"]\"", ")", ")", ";", "// Create a nicely space-separated list of illegal characters", "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. @param illegalCharacters String containing all illegal characters.
[ "Sets", "the", "list", "of", "illegal", "characters", "in", "a", "string", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/rule/string/IllegalCharacterBooleanRule.java#L79-L96
train
padrig64/ValidationFramework
validationframework-demo/src/main/java/com/google/code/validationframework/demo/swing/TabbedPaneDemo.java
TabbedPaneDemo.createTabContent
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) + ":")); // Create formatted textfield JTextField field = new JTextField(); panel.add(field); field.setColumns(10); field.setText("Value"); // Create field validator tabResultsProperty.addProperty(installFieldValidation(field)); } return panel; }
java
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) + ":")); // Create formatted textfield JTextField field = new JTextField(); panel.add(field); field.setColumns(10); field.setText("Value"); // Create field validator tabResultsProperty.addProperty(installFieldValidation(field)); } return panel; }
[ "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", ")", "+", "\":\"", ")", ")", ";", "// Create formatted textfield", "JTextField", "field", "=", "new", "JTextField", "(", ")", ";", "panel", ".", "add", "(", "field", ")", ";", "field", ".", "setColumns", "(", "10", ")", ";", "field", ".", "setText", "(", "\"Value\"", ")", ";", "// Create field validator", "tabResultsProperty", ".", "addProperty", "(", "installFieldValidation", "(", "field", ")", ")", ";", "}", "return", "panel", ";", "}" ]
Creates some content to put in a tab in the tabbed pane. @param tabResultsProperty Composite property to put the tab-wise result into. @return Component representing the tab content and to be added to the tabbed pane.
[ "Creates", "some", "content", "to", "put", "in", "a", "tab", "in", "the", "tabbed", "pane", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-demo/src/main/java/com/google/code/validationframework/demo/swing/TabbedPaneDemo.java#L157-L175
train
padrig64/ValidationFramework
validationframework-demo/src/main/java/com/google/code/validationframework/demo/swing/TabbedPaneDemo.java
TabbedPaneDemo.installFieldValidation
private ReadableProperty<Boolean> installFieldValidation(JTextField field) { // FieLd is valid if not empty SimpleBooleanProperty fieldResult = new SimpleBooleanProperty(); on(new JTextFieldDocumentChangedTrigger(field)) // .read(new JTextFieldTextProvider(field)) // .check(new StringNotEmptyRule()) // .handleWith(new IconBooleanFeedback(field)) // .handleWith(fieldResult) // .getValidator().trigger(); // Tab will be valid only if all fields are valid return fieldResult; }
java
private ReadableProperty<Boolean> installFieldValidation(JTextField field) { // FieLd is valid if not empty SimpleBooleanProperty fieldResult = new SimpleBooleanProperty(); on(new JTextFieldDocumentChangedTrigger(field)) // .read(new JTextFieldTextProvider(field)) // .check(new StringNotEmptyRule()) // .handleWith(new IconBooleanFeedback(field)) // .handleWith(fieldResult) // .getValidator().trigger(); // Tab will be valid only if all fields are valid return fieldResult; }
[ "private", "ReadableProperty", "<", "Boolean", ">", "installFieldValidation", "(", "JTextField", "field", ")", "{", "// FieLd is valid if not empty", "SimpleBooleanProperty", "fieldResult", "=", "new", "SimpleBooleanProperty", "(", ")", ";", "on", "(", "new", "JTextFieldDocumentChangedTrigger", "(", "field", ")", ")", "//", ".", "read", "(", "new", "JTextFieldTextProvider", "(", "field", ")", ")", "//", ".", "check", "(", "new", "StringNotEmptyRule", "(", ")", ")", "//", ".", "handleWith", "(", "new", "IconBooleanFeedback", "(", "field", ")", ")", "//", ".", "handleWith", "(", "fieldResult", ")", "//", ".", "getValidator", "(", ")", ".", "trigger", "(", ")", ";", "// Tab will be valid only if all fields are valid", "return", "fieldResult", ";", "}" ]
Sets up a validator for the specified field. @param field Field on which a validator should be installed. @return Property representing the result of the field validation and that can be used for tab-wise validation.
[ "Sets", "up", "a", "validator", "for", "the", "specified", "field", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-demo/src/main/java/com/google/code/validationframework/demo/swing/TabbedPaneDemo.java#L184-L196
train
checkstyle-addons/checkstyle-addons
src/main/java/com/thomasjensen/checkstyle/addons/util/CheckstyleApiFixer.java
CheckstyleApiFixer.getTokenName
@Nonnull 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) { // ignore } } 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; }
java
@Nonnull 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) { // ignore } } 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; }
[ "@", "Nonnull", "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", ")", "{", "// ignore", "}", "}", "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. @param pTokenId the ID of the token name to get @return a token name as returned by Checkstyle @throws UnsupportedOperationException no known variant of <code>getTokenName()</code> could be found
[ "Returns", "the", "name", "of", "a", "token", "for", "a", "given", "ID", "." ]
fae1b4d341639c8e32c3e59ec5abdc0ffc11b865
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/src/main/java/com/thomasjensen/checkstyle/addons/util/CheckstyleApiFixer.java#L126-L156
train
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.checkResult
private static int checkResult(int result) { if (exceptionsEnabled && result != nvgraphStatus.NVGRAPH_STATUS_SUCCESS) { throw new CudaException(nvgraphStatus.stringFor(result)); } return result; }
java
private static int checkResult(int result) { if (exceptionsEnabled && result != nvgraphStatus.NVGRAPH_STATUS_SUCCESS) { throw new CudaException(nvgraphStatus.stringFor(result)); } return result; }
[ "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. @param result The result to check @return The result that was given as the parameter @throws CudaException If exceptions have been enabled and the given result code is not nvgraphStatus.NVGRAPH_STATUS_SUCCESS
[ "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", "." ]
2c6bd7c58edac181753bacf30af2cceeb1989a78
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L109-L117
train
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphSetGraphStructure
public static int nvgraphSetGraphStructure( nvgraphHandle handle, nvgraphGraphDescr descrG, Object topologyData, int TType) { return checkResult(nvgraphSetGraphStructureNative(handle, descrG, topologyData, TType)); }
java
public static int nvgraphSetGraphStructure( nvgraphHandle handle, nvgraphGraphDescr descrG, Object topologyData, int TType) { return checkResult(nvgraphSetGraphStructureNative(handle, descrG, topologyData, TType)); }
[ "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
[ "Set", "size", "topology", "data", "in", "the", "graph", "descriptor" ]
2c6bd7c58edac181753bacf30af2cceeb1989a78
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L206-L213
train
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphGetGraphStructure
public static int nvgraphGetGraphStructure( nvgraphHandle handle, nvgraphGraphDescr descrG, Object topologyData, int[] TType) { return checkResult(nvgraphGetGraphStructureNative(handle, descrG, topologyData, TType)); }
java
public static int nvgraphGetGraphStructure( nvgraphHandle handle, nvgraphGraphDescr descrG, Object topologyData, int[] TType) { return checkResult(nvgraphGetGraphStructureNative(handle, descrG, topologyData, TType)); }
[ "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
[ "Query", "size", "and", "topology", "information", "from", "the", "graph", "descriptor" ]
2c6bd7c58edac181753bacf30af2cceeb1989a78
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L222-L229
train
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphConvertTopology
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)); }
java
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)); }
[ "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
[ "Convert", "the", "edge", "data", "to", "another", "topology" ]
2c6bd7c58edac181753bacf30af2cceeb1989a78
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L307-L318
train
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphConvertGraph
public static int nvgraphConvertGraph( nvgraphHandle handle, nvgraphGraphDescr srcDescrG, nvgraphGraphDescr dstDescrG, int dstTType) { return checkResult(nvgraphConvertGraphNative(handle, srcDescrG, dstDescrG, dstTType)); }
java
public static int nvgraphConvertGraph( nvgraphHandle handle, nvgraphGraphDescr srcDescrG, nvgraphGraphDescr dstDescrG, int dstTType) { return checkResult(nvgraphConvertGraphNative(handle, srcDescrG, dstDescrG, dstTType)); }
[ "public", "static", "int", "nvgraphConvertGraph", "(", "nvgraphHandle", "handle", ",", "nvgraphGraphDescr", "srcDescrG", ",", "nvgraphGraphDescr", "dstDescrG", ",", "int", "dstTType", ")", "{", "return", "checkResult", "(", "nvgraphConvertGraphNative", "(", "handle", ",", "srcDescrG", ",", "dstDescrG", ",", "dstTType", ")", ")", ";", "}" ]
Convert graph to another structure
[ "Convert", "graph", "to", "another", "structure" ]
2c6bd7c58edac181753bacf30af2cceeb1989a78
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L332-L339
train