id
stringlengths 7
14
| text
stringlengths 1
106k
|
---|---|
206452_7 | public boolean isBannedwordslisted(String str) {
return isBannedwordslisted(str, null, null);
} |
206452_8 | public boolean isBannedwordslisted(String str) {
return isBannedwordslisted(str, null, null);
} |
206452_9 | public boolean isBannedwordslisted(String str) {
return isBannedwordslisted(str, null, null);
} |
206459_0 | public Schema addToSchema(Schema schema) {
validate(schema);
schema.addProp(LOGICAL_TYPE_PROP, name);
schema.setLogicalType(this);
return schema;
} |
206459_1 | public Schema addToSchema(Schema schema) {
validate(schema);
schema.addProp(LOGICAL_TYPE_PROP, name);
schema.setLogicalType(this);
return schema;
} |
206459_2 | public Schema addToSchema(Schema schema) {
validate(schema);
schema.addProp(LOGICAL_TYPE_PROP, name);
schema.setLogicalType(this);
return schema;
} |
206459_3 | public Schema addToSchema(Schema schema) {
validate(schema);
schema.addProp(LOGICAL_TYPE_PROP, name);
schema.setLogicalType(this);
return schema;
} |
206459_4 | public Schema addToSchema(Schema schema) {
validate(schema);
schema.addProp(LOGICAL_TYPE_PROP, name);
schema.setLogicalType(this);
return schema;
} |
206459_5 | public Schema addToSchema(Schema schema) {
validate(schema);
schema.addProp(LOGICAL_TYPE_PROP, name);
schema.setLogicalType(this);
return schema;
} |
206459_6 | public Schema addToSchema(Schema schema) {
validate(schema);
schema.addProp(LOGICAL_TYPE_PROP, name);
schema.setLogicalType(this);
return schema;
} |
206459_7 | public Schema addToSchema(Schema schema) {
validate(schema);
schema.addProp(LOGICAL_TYPE_PROP, name);
schema.setLogicalType(this);
return schema;
} |
206459_8 | public Schema addToSchema(Schema schema) {
validate(schema);
schema.addProp(LOGICAL_TYPE_PROP, name);
schema.setLogicalType(this);
return schema;
} |
206459_9 | public Schema addToSchema(Schema schema) {
validate(schema);
schema.addProp(LOGICAL_TYPE_PROP, name);
schema.setLogicalType(this);
return schema;
} |
206478_0 | protected static boolean isDemarcator( String snippetId, String what, String line )
{
// SNIPPET and what are case insensitive
// SNIPPET and what can switch order
String snippetRegExp = "(^|\\W)(?i:SNIPPET)($|\\W)";
String snippetIdRegExp = "(^|\\W)" + snippetId + "($|\\W)";
String whatRegExp = "(^|\\W)(?i:" + what + ")($|\\W)";
return Pattern.compile( snippetRegExp ).matcher( line ).find()
&& Pattern.compile( whatRegExp ).matcher( line ).find()
&& Pattern.compile( snippetIdRegExp ).matcher( line ).find();
} |
206478_1 | public void execute( Sink sink, MacroRequest request )
throws MacroExecutionException
{
String function = (String) request.getParameter( PARAM_FUNCTION );
required( PARAM_FUNCTION, function );
StringBuilder buff = new StringBuilder();
buff.append( '#' );
buff.append( function );
for ( Map.Entry<String, Object> entry : request.getParameters().entrySet() )
{
if ( !isInternalParameter( entry.getKey() ) )
{
buff.append( ' ' );
buff.append( entry.getKey() );
buff.append( "=\"" );
buff.append( entry.getValue() );
buff.append( '"' );
}
}
buff.append( ' ' );
sink.comment( buff.toString() );
} |
206478_2 | public void execute( Sink sink, MacroRequest request )
throws MacroExecutionException
{
String source = request.getSourceContent();
Parser parser = request.getParser();
section = getInt( request, "section", 0 );
fromDepth = getInt( request, "fromDepth", 0 );
toDepth = getInt( request, "toDepth", DEFAULT_DEPTH );
if ( fromDepth > toDepth )
{
return;
}
IndexEntry index = new IndexEntry( "index" );
IndexingSink tocSink = new IndexingSink( index );
try
{
parser.parse( new StringReader( source ), tocSink );
}
catch ( ParseException e )
{
throw new MacroExecutionException( "ParseException: " + e.getMessage(), e );
}
if ( index.getChildEntries().size() > 0 )
{
sink.list( getAttributesFromMap( request.getParameters() ) );
int i = 1;
for ( IndexEntry sectionIndex : index.getChildEntries() )
{
if ( ( i == section ) || ( section == 0 ) )
{
writeSubSectionN( sink, sectionIndex, 1 );
}
i++;
}
sink.list_();
}
} |
206478_3 | public void execute( Sink sink, MacroRequest request )
throws MacroExecutionException
{
String source = request.getSourceContent();
Parser parser = request.getParser();
section = getInt( request, "section", 0 );
fromDepth = getInt( request, "fromDepth", 0 );
toDepth = getInt( request, "toDepth", DEFAULT_DEPTH );
if ( fromDepth > toDepth )
{
return;
}
IndexEntry index = new IndexEntry( "index" );
IndexingSink tocSink = new IndexingSink( index );
try
{
parser.parse( new StringReader( source ), tocSink );
}
catch ( ParseException e )
{
throw new MacroExecutionException( "ParseException: " + e.getMessage(), e );
}
if ( index.getChildEntries().size() > 0 )
{
sink.list( getAttributesFromMap( request.getParameters() ) );
int i = 1;
for ( IndexEntry sectionIndex : index.getChildEntries() )
{
if ( ( i == section ) || ( section == 0 ) )
{
writeSubSectionN( sink, sectionIndex, 1 );
}
i++;
}
sink.list_();
}
} |
206478_4 | public void execute( Sink sink, MacroRequest request )
throws MacroExecutionException
{
// parameter defaults
String src = "";
String id = "swf";
String width = "400";
String height = "400";
String quality = "high";
String menu = "false";
String loop = "0";
String play = "true";
String version = "9,0,45,0";
String allowScript = "sameDomain";
// assign parameters
for ( String key : request.getParameters().keySet() )
{
Object parameterObject = request.getParameter( key );
if ( !( parameterObject instanceof String ) )
{
continue;
}
String str = (String) parameterObject;
switch ( key )
{
case "src":
if ( StringUtils.isNotEmpty( str ) )
{
src = str;
}
break;
case "id":
if ( StringUtils.isNotEmpty( str ) )
{
id = str;
}
break;
case "width":
if ( StringUtils.isNotEmpty( str ) )
{
width = str;
}
break;
case "height":
if ( StringUtils.isNotEmpty( str ) )
{
height = str;
}
break;
case "quality":
if ( StringUtils.isNotEmpty( str ) )
{
quality = str;
}
break;
case "menu":
if ( StringUtils.isNotEmpty( str ) )
{
menu = str;
}
break;
case "loop":
if ( StringUtils.isNotEmpty( str ) )
{
loop = str;
}
break;
case "play":
if ( StringUtils.isNotEmpty( str ) )
{
play = str;
}
break;
case "version":
// enable version shorthand
// TODO: put in other shorthand versions
if ( str.equals( "6" ) )
{
version = "6,0,29,0";
}
else
{
if ( str.equals( "9" ) )
{
version = "9,0,45,0";
}
else
{
if ( StringUtils.isNotEmpty( str ) )
{
version = str;
}
}
}
break;
case "allowScript":
if ( StringUtils.isNotEmpty( str ) )
{
allowScript = str;
}
break;
default:
// ignore all other
}
}
StringBuilder content = new StringBuilder();
content.append( "<center>" ).append( EOL );
content.append( "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " )
.append( "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" )
.append( version ).append( "\" width=\"" ).append( width ).append( "\" height=\"" ).append( height )
.append( "\" id=\"" ).append( id ).append( "\">" ).append( EOL );
content.append( "<param name=\"movie\" value=\"" ).append( src ).append( "\" />" ).append( EOL );
content.append( "<param name=\"quality\" value=\"" ).append( quality ).append( "\" />" ).append( EOL );
content.append( "<param name=\"menu\" value=\"" ).append( menu ).append( "\" />" ).append( EOL );
content.append( "<param name=\"loop\" value=\"" ).append( loop ).append( "\" />" ).append( EOL );
content.append( "<param name=\"play\" value=\"" ).append( play ).append( "\" />" ).append( EOL );
content.append( "<param name=\"allowScriptAccess\" value=\"" )
.append( allowScript ).append( "\" />" ).append( EOL );
content.append( "<embed src=\"" ).append( src ).append( "\" width=\"" ).append( width ).append( "\" height=\"" )
.append( height ).append( "\" loop=\"" ).append( loop ).append( "\" play=\"" ).append( play )
.append( "\" quality=\"" ).append( quality ).append( "\" allowScriptAccess=\"" ).append( allowScript )
.append( "\" " ).append( "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" " )
.append( "type=\"application/x-shockwave-flash\" menu=\"" ).append( menu ).append( "\">" ).append( EOL );
content.append( "</embed>" ).append( EOL );
content.append( "</object>" ).append( EOL );
content.append( "</center>" ).append( EOL );
sink.rawText( content.toString() );
} |
206478_5 | public void execute( Sink sink, MacroRequest request )
throws MacroExecutionException
{
// parameter defaults
String src = "";
String id = "swf";
String width = "400";
String height = "400";
String quality = "high";
String menu = "false";
String loop = "0";
String play = "true";
String version = "9,0,45,0";
String allowScript = "sameDomain";
// assign parameters
for ( String key : request.getParameters().keySet() )
{
Object parameterObject = request.getParameter( key );
if ( !( parameterObject instanceof String ) )
{
continue;
}
String str = (String) parameterObject;
switch ( key )
{
case "src":
if ( StringUtils.isNotEmpty( str ) )
{
src = str;
}
break;
case "id":
if ( StringUtils.isNotEmpty( str ) )
{
id = str;
}
break;
case "width":
if ( StringUtils.isNotEmpty( str ) )
{
width = str;
}
break;
case "height":
if ( StringUtils.isNotEmpty( str ) )
{
height = str;
}
break;
case "quality":
if ( StringUtils.isNotEmpty( str ) )
{
quality = str;
}
break;
case "menu":
if ( StringUtils.isNotEmpty( str ) )
{
menu = str;
}
break;
case "loop":
if ( StringUtils.isNotEmpty( str ) )
{
loop = str;
}
break;
case "play":
if ( StringUtils.isNotEmpty( str ) )
{
play = str;
}
break;
case "version":
// enable version shorthand
// TODO: put in other shorthand versions
if ( str.equals( "6" ) )
{
version = "6,0,29,0";
}
else
{
if ( str.equals( "9" ) )
{
version = "9,0,45,0";
}
else
{
if ( StringUtils.isNotEmpty( str ) )
{
version = str;
}
}
}
break;
case "allowScript":
if ( StringUtils.isNotEmpty( str ) )
{
allowScript = str;
}
break;
default:
// ignore all other
}
}
StringBuilder content = new StringBuilder();
content.append( "<center>" ).append( EOL );
content.append( "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " )
.append( "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" )
.append( version ).append( "\" width=\"" ).append( width ).append( "\" height=\"" ).append( height )
.append( "\" id=\"" ).append( id ).append( "\">" ).append( EOL );
content.append( "<param name=\"movie\" value=\"" ).append( src ).append( "\" />" ).append( EOL );
content.append( "<param name=\"quality\" value=\"" ).append( quality ).append( "\" />" ).append( EOL );
content.append( "<param name=\"menu\" value=\"" ).append( menu ).append( "\" />" ).append( EOL );
content.append( "<param name=\"loop\" value=\"" ).append( loop ).append( "\" />" ).append( EOL );
content.append( "<param name=\"play\" value=\"" ).append( play ).append( "\" />" ).append( EOL );
content.append( "<param name=\"allowScriptAccess\" value=\"" )
.append( allowScript ).append( "\" />" ).append( EOL );
content.append( "<embed src=\"" ).append( src ).append( "\" width=\"" ).append( width ).append( "\" height=\"" )
.append( height ).append( "\" loop=\"" ).append( loop ).append( "\" play=\"" ).append( play )
.append( "\" quality=\"" ).append( quality ).append( "\" allowScriptAccess=\"" ).append( allowScript )
.append( "\" " ).append( "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" " )
.append( "type=\"application/x-shockwave-flash\" menu=\"" ).append( menu ).append( "\">" ).append( EOL );
content.append( "</embed>" ).append( EOL );
content.append( "</object>" ).append( EOL );
content.append( "</center>" ).append( EOL );
sink.rawText( content.toString() );
} |
206478_6 | public void execute( Sink sink, MacroRequest request )
{
sink.verbatim( SinkEventAttributeSet.BOXED );
sink.text( "echo" + EOL );
for ( String key : request.getParameters().keySet() )
{
// TODO: DOXIA-242: separate or define internal params
if ( "parser".equals( key ) || "sourceContent".equals( key ) )
{
continue;
}
sink.text( key + " ---> " + request.getParameter( key ) + EOL );
}
sink.verbatim_();
} |
206478_7 | @Override
public void section( int level, SinkEventAttributes attributes )
{
onSection( level, attributes );
} |
206478_8 | @Override
public void section1()
{
onSection( SECTION_LEVEL_1, null );
} |
206478_9 | @Override
public void section2()
{
onSection( SECTION_LEVEL_2, null );
} |
206483_0 | public void setProjectPath( Path projectPath )
{
this.projectPath = projectPath;
} |
206483_1 | @Override
public void comment( char[] ch, int start, int length )
throws SAXException
{
if ( "\n".equals( lineSeparator ) )
{
lexicalHandler.comment( ch, start, length );
}
else
{
char[] ca = new String( ch, start, length ).replaceAll( "\n", lineSeparator ).toCharArray();
lexicalHandler.comment( ca, 0, ca.length );
}
} |
206483_2 | @Override
public void comment( char[] ch, int start, int length )
throws SAXException
{
if ( "\n".equals( lineSeparator ) )
{
lexicalHandler.comment( ch, start, length );
}
else
{
char[] ca = new String( ch, start, length ).replaceAll( "\n", lineSeparator ).toCharArray();
lexicalHandler.comment( ca, 0, ca.length );
}
} |
206483_3 | public static String renameQName( String oldQName, String newLocalName )
{
return PATTERN.matcher( oldQName ).replaceFirst( newLocalName );
} |
206483_4 | public static String renameQName( String oldQName, String newLocalName )
{
return PATTERN.matcher( oldQName ).replaceFirst( newLocalName );
} |
206483_5 | @Override
public Logger getLogger( String name )
{
Logger simpleLogger = loggerMap.get( name );
if ( simpleLogger != null )
{
return simpleLogger;
}
else
{
Logger newInstance = getNewLoggingInstance( name );
Logger oldInstance = loggerMap.putIfAbsent( name, newInstance );
return oldInstance == null ? newInstance : oldInstance;
}
} |
206483_6 | @Override
public Logger getLogger( String name )
{
Logger simpleLogger = loggerMap.get( name );
if ( simpleLogger != null )
{
return simpleLogger;
}
else
{
Logger newInstance = getNewLoggingInstance( name );
Logger oldInstance = loggerMap.putIfAbsent( name, newInstance );
return oldInstance == null ? newInstance : oldInstance;
}
} |
206483_7 | @Override
public void setLogLevelRecorder( LogLevelRecorder logLevelRecorder )
{
if ( this.logLevelRecorder != null )
{
throw new IllegalStateException( "LogLevelRecorder has already been set." );
}
this.logLevelRecorder = logLevelRecorder;
} |
206483_8 | public Path createDist( WrapperConfiguration configuration )
throws IOException, URISyntaxException
{
URI distributionUrl;
String mvnwRepoUrl = System.getenv( MavenWrapperMain.MVNW_REPOURL );
if ( mvnwRepoUrl != null && !mvnwRepoUrl.isEmpty() )
{
distributionUrl = new URI( mvnwRepoUrl + "/" + MavenWrapperMain.MVN_PATH );
Logger.info( "Detected MVNW_REPOURL environment variable " + mvnwRepoUrl );
}
else
{
distributionUrl = configuration.getDistribution();
}
Logger.info( "Downloading Maven binary from " + distributionUrl );
boolean alwaysDownload = configuration.isAlwaysDownload();
boolean alwaysUnpack = configuration.isAlwaysUnpack();
PathAssembler.LocalDistribution localDistribution = pathAssembler.getDistribution( configuration );
Path localZipFile = localDistribution.getZipFile();
boolean downloaded = false;
if ( alwaysDownload || !Files.exists( localZipFile ) )
{
Path tmpZipFile = localZipFile.resolveSibling( localZipFile.getFileName() + ".part" );
Files.deleteIfExists( tmpZipFile );
Logger.info( "Downloading " + distributionUrl );
download.download( distributionUrl, tmpZipFile );
Files.move( tmpZipFile, localZipFile );
downloaded = true;
}
Path distDir = localDistribution.getDistributionDir();
List<Path> dirs = listDirs( distDir );
if ( downloaded || alwaysUnpack || dirs.isEmpty() )
{
Files.walkFileTree( distDir.toAbsolutePath(), new SimpleFileVisitor<Path>()
{
@Override
public FileVisitResult postVisitDirectory( Path dir, IOException exc )
throws IOException
{
if ( dir.getParent().equals( distDir ) )
{
Logger.info( "Deleting directory " + distDir.toAbsolutePath() );
Files.delete( dir );
}
return FileVisitResult.CONTINUE;
}
public FileVisitResult visitFile( Path file, BasicFileAttributes attrs )
throws IOException
{
if ( !file.getParent().equals( distDir ) )
{
Files.delete( file );
}
return FileVisitResult.CONTINUE;
};
} );
Logger.info( "Unzipping " + localZipFile.toAbsolutePath() + " to " + distDir.toAbsolutePath() );
unzip( localZipFile, distDir );
dirs = listDirs( distDir );
if ( dirs.isEmpty() )
{
throw new RuntimeException( String.format(
"Maven distribution '%s' does not contain any directories. Expected to find exactly 1 directory.",
distributionUrl ) );
}
setExecutablePermissions( dirs.get( 0 ) );
}
if ( dirs.size() != 1 )
{
throw new IllegalStateException( String.format(
"Maven distribution '%s' contains too many directories. Expected to find exactly 1 directory.",
distributionUrl ) );
}
return dirs.get( 0 );
} |
206483_9 | public Path createDist( WrapperConfiguration configuration )
throws IOException, URISyntaxException
{
URI distributionUrl;
String mvnwRepoUrl = System.getenv( MavenWrapperMain.MVNW_REPOURL );
if ( mvnwRepoUrl != null && !mvnwRepoUrl.isEmpty() )
{
distributionUrl = new URI( mvnwRepoUrl + "/" + MavenWrapperMain.MVN_PATH );
Logger.info( "Detected MVNW_REPOURL environment variable " + mvnwRepoUrl );
}
else
{
distributionUrl = configuration.getDistribution();
}
Logger.info( "Downloading Maven binary from " + distributionUrl );
boolean alwaysDownload = configuration.isAlwaysDownload();
boolean alwaysUnpack = configuration.isAlwaysUnpack();
PathAssembler.LocalDistribution localDistribution = pathAssembler.getDistribution( configuration );
Path localZipFile = localDistribution.getZipFile();
boolean downloaded = false;
if ( alwaysDownload || !Files.exists( localZipFile ) )
{
Path tmpZipFile = localZipFile.resolveSibling( localZipFile.getFileName() + ".part" );
Files.deleteIfExists( tmpZipFile );
Logger.info( "Downloading " + distributionUrl );
download.download( distributionUrl, tmpZipFile );
Files.move( tmpZipFile, localZipFile );
downloaded = true;
}
Path distDir = localDistribution.getDistributionDir();
List<Path> dirs = listDirs( distDir );
if ( downloaded || alwaysUnpack || dirs.isEmpty() )
{
Files.walkFileTree( distDir.toAbsolutePath(), new SimpleFileVisitor<Path>()
{
@Override
public FileVisitResult postVisitDirectory( Path dir, IOException exc )
throws IOException
{
if ( dir.getParent().equals( distDir ) )
{
Logger.info( "Deleting directory " + distDir.toAbsolutePath() );
Files.delete( dir );
}
return FileVisitResult.CONTINUE;
}
public FileVisitResult visitFile( Path file, BasicFileAttributes attrs )
throws IOException
{
if ( !file.getParent().equals( distDir ) )
{
Files.delete( file );
}
return FileVisitResult.CONTINUE;
};
} );
Logger.info( "Unzipping " + localZipFile.toAbsolutePath() + " to " + distDir.toAbsolutePath() );
unzip( localZipFile, distDir );
dirs = listDirs( distDir );
if ( dirs.isEmpty() )
{
throw new RuntimeException( String.format(
"Maven distribution '%s' does not contain any directories. Expected to find exactly 1 directory.",
distributionUrl ) );
}
setExecutablePermissions( dirs.get( 0 ) );
}
if ( dirs.size() != 1 )
{
throw new IllegalStateException( String.format(
"Maven distribution '%s' contains too many directories. Expected to find exactly 1 directory.",
distributionUrl ) );
}
return dirs.get( 0 );
} |
206633_0 | public MessageBundle getBundle(GadgetSpec spec, Locale locale, boolean ignoreCache, String container, String view)
throws GadgetException {
MessageBundle exact = getBundleFor(spec, locale, ignoreCache, container, view);
// We don't want to fetch the same bundle multiple times, so we verify that the exact match
// has not already been fetched.
MessageBundle lang, country, all;
boolean isAllLanguage = locale.getLanguage().equalsIgnoreCase("all");
boolean isAllCountry = locale.getCountry().equalsIgnoreCase("ALL");
if (isAllCountry) {
lang = MessageBundle.EMPTY;
} else {
lang = getBundleFor(spec, new Locale(locale.getLanguage(), "ALL"), ignoreCache, container, view);
}
if (isAllLanguage) {
country = MessageBundle.EMPTY;
} else {
country = getBundleFor(spec, new Locale("all", locale.getCountry()), ignoreCache, container, view);
}
if (isAllCountry || isAllLanguage) {
// If either of these is true, we already picked up both anyway.
all = MessageBundle.EMPTY;
} else {
all = getBundleFor(spec, ALL_ALL, ignoreCache, container, view);
}
return new MessageBundle(all, country, lang, exact);
} |
206633_1 | public MessageBundle getBundle(GadgetSpec spec, Locale locale, boolean ignoreCache, String container, String view)
throws GadgetException {
MessageBundle exact = getBundleFor(spec, locale, ignoreCache, container, view);
// We don't want to fetch the same bundle multiple times, so we verify that the exact match
// has not already been fetched.
MessageBundle lang, country, all;
boolean isAllLanguage = locale.getLanguage().equalsIgnoreCase("all");
boolean isAllCountry = locale.getCountry().equalsIgnoreCase("ALL");
if (isAllCountry) {
lang = MessageBundle.EMPTY;
} else {
lang = getBundleFor(spec, new Locale(locale.getLanguage(), "ALL"), ignoreCache, container, view);
}
if (isAllLanguage) {
country = MessageBundle.EMPTY;
} else {
country = getBundleFor(spec, new Locale("all", locale.getCountry()), ignoreCache, container, view);
}
if (isAllCountry || isAllLanguage) {
// If either of these is true, we already picked up both anyway.
all = MessageBundle.EMPTY;
} else {
all = getBundleFor(spec, ALL_ALL, ignoreCache, container, view);
}
return new MessageBundle(all, country, lang, exact);
} |
206633_2 | public MessageBundle getBundle(GadgetSpec spec, Locale locale, boolean ignoreCache, String container, String view)
throws GadgetException {
MessageBundle exact = getBundleFor(spec, locale, ignoreCache, container, view);
// We don't want to fetch the same bundle multiple times, so we verify that the exact match
// has not already been fetched.
MessageBundle lang, country, all;
boolean isAllLanguage = locale.getLanguage().equalsIgnoreCase("all");
boolean isAllCountry = locale.getCountry().equalsIgnoreCase("ALL");
if (isAllCountry) {
lang = MessageBundle.EMPTY;
} else {
lang = getBundleFor(spec, new Locale(locale.getLanguage(), "ALL"), ignoreCache, container, view);
}
if (isAllLanguage) {
country = MessageBundle.EMPTY;
} else {
country = getBundleFor(spec, new Locale("all", locale.getCountry()), ignoreCache, container, view);
}
if (isAllCountry || isAllLanguage) {
// If either of these is true, we already picked up both anyway.
all = MessageBundle.EMPTY;
} else {
all = getBundleFor(spec, ALL_ALL, ignoreCache, container, view);
}
return new MessageBundle(all, country, lang, exact);
} |
206633_3 | public MessageBundle getBundle(GadgetSpec spec, Locale locale, boolean ignoreCache, String container, String view)
throws GadgetException {
MessageBundle exact = getBundleFor(spec, locale, ignoreCache, container, view);
// We don't want to fetch the same bundle multiple times, so we verify that the exact match
// has not already been fetched.
MessageBundle lang, country, all;
boolean isAllLanguage = locale.getLanguage().equalsIgnoreCase("all");
boolean isAllCountry = locale.getCountry().equalsIgnoreCase("ALL");
if (isAllCountry) {
lang = MessageBundle.EMPTY;
} else {
lang = getBundleFor(spec, new Locale(locale.getLanguage(), "ALL"), ignoreCache, container, view);
}
if (isAllLanguage) {
country = MessageBundle.EMPTY;
} else {
country = getBundleFor(spec, new Locale("all", locale.getCountry()), ignoreCache, container, view);
}
if (isAllCountry || isAllLanguage) {
// If either of these is true, we already picked up both anyway.
all = MessageBundle.EMPTY;
} else {
all = getBundleFor(spec, ALL_ALL, ignoreCache, container, view);
}
return new MessageBundle(all, country, lang, exact);
} |
206633_4 | public MessageBundle getBundle(GadgetSpec spec, Locale locale, boolean ignoreCache, String container, String view)
throws GadgetException {
MessageBundle exact = getBundleFor(spec, locale, ignoreCache, container, view);
// We don't want to fetch the same bundle multiple times, so we verify that the exact match
// has not already been fetched.
MessageBundle lang, country, all;
boolean isAllLanguage = locale.getLanguage().equalsIgnoreCase("all");
boolean isAllCountry = locale.getCountry().equalsIgnoreCase("ALL");
if (isAllCountry) {
lang = MessageBundle.EMPTY;
} else {
lang = getBundleFor(spec, new Locale(locale.getLanguage(), "ALL"), ignoreCache, container, view);
}
if (isAllLanguage) {
country = MessageBundle.EMPTY;
} else {
country = getBundleFor(spec, new Locale("all", locale.getCountry()), ignoreCache, container, view);
}
if (isAllCountry || isAllLanguage) {
// If either of these is true, we already picked up both anyway.
all = MessageBundle.EMPTY;
} else {
all = getBundleFor(spec, ALL_ALL, ignoreCache, container, view);
}
return new MessageBundle(all, country, lang, exact);
} |
206633_5 | public MessageBundle getBundle(GadgetSpec spec, Locale locale, boolean ignoreCache, String container, String view)
throws GadgetException {
MessageBundle exact = getBundleFor(spec, locale, ignoreCache, container, view);
// We don't want to fetch the same bundle multiple times, so we verify that the exact match
// has not already been fetched.
MessageBundle lang, country, all;
boolean isAllLanguage = locale.getLanguage().equalsIgnoreCase("all");
boolean isAllCountry = locale.getCountry().equalsIgnoreCase("ALL");
if (isAllCountry) {
lang = MessageBundle.EMPTY;
} else {
lang = getBundleFor(spec, new Locale(locale.getLanguage(), "ALL"), ignoreCache, container, view);
}
if (isAllLanguage) {
country = MessageBundle.EMPTY;
} else {
country = getBundleFor(spec, new Locale("all", locale.getCountry()), ignoreCache, container, view);
}
if (isAllCountry || isAllLanguage) {
// If either of these is true, we already picked up both anyway.
all = MessageBundle.EMPTY;
} else {
all = getBundleFor(spec, ALL_ALL, ignoreCache, container, view);
}
return new MessageBundle(all, country, lang, exact);
} |
206633_6 | public MessageBundle getBundle(GadgetSpec spec, Locale locale, boolean ignoreCache, String container, String view)
throws GadgetException {
MessageBundle exact = getBundleFor(spec, locale, ignoreCache, container, view);
// We don't want to fetch the same bundle multiple times, so we verify that the exact match
// has not already been fetched.
MessageBundle lang, country, all;
boolean isAllLanguage = locale.getLanguage().equalsIgnoreCase("all");
boolean isAllCountry = locale.getCountry().equalsIgnoreCase("ALL");
if (isAllCountry) {
lang = MessageBundle.EMPTY;
} else {
lang = getBundleFor(spec, new Locale(locale.getLanguage(), "ALL"), ignoreCache, container, view);
}
if (isAllLanguage) {
country = MessageBundle.EMPTY;
} else {
country = getBundleFor(spec, new Locale("all", locale.getCountry()), ignoreCache, container, view);
}
if (isAllCountry || isAllLanguage) {
// If either of these is true, we already picked up both anyway.
all = MessageBundle.EMPTY;
} else {
all = getBundleFor(spec, ALL_ALL, ignoreCache, container, view);
}
return new MessageBundle(all, country, lang, exact);
} |
206633_7 | public MessageBundle getBundle(GadgetSpec spec, Locale locale, boolean ignoreCache, String container, String view)
throws GadgetException {
MessageBundle exact = getBundleFor(spec, locale, ignoreCache, container, view);
// We don't want to fetch the same bundle multiple times, so we verify that the exact match
// has not already been fetched.
MessageBundle lang, country, all;
boolean isAllLanguage = locale.getLanguage().equalsIgnoreCase("all");
boolean isAllCountry = locale.getCountry().equalsIgnoreCase("ALL");
if (isAllCountry) {
lang = MessageBundle.EMPTY;
} else {
lang = getBundleFor(spec, new Locale(locale.getLanguage(), "ALL"), ignoreCache, container, view);
}
if (isAllLanguage) {
country = MessageBundle.EMPTY;
} else {
country = getBundleFor(spec, new Locale("all", locale.getCountry()), ignoreCache, container, view);
}
if (isAllCountry || isAllLanguage) {
// If either of these is true, we already picked up both anyway.
all = MessageBundle.EMPTY;
} else {
all = getBundleFor(spec, ALL_ALL, ignoreCache, container, view);
}
return new MessageBundle(all, country, lang, exact);
} |
206633_8 | public MessageBundle getBundle(GadgetSpec spec, Locale locale, boolean ignoreCache, String container, String view)
throws GadgetException {
MessageBundle exact = getBundleFor(spec, locale, ignoreCache, container, view);
// We don't want to fetch the same bundle multiple times, so we verify that the exact match
// has not already been fetched.
MessageBundle lang, country, all;
boolean isAllLanguage = locale.getLanguage().equalsIgnoreCase("all");
boolean isAllCountry = locale.getCountry().equalsIgnoreCase("ALL");
if (isAllCountry) {
lang = MessageBundle.EMPTY;
} else {
lang = getBundleFor(spec, new Locale(locale.getLanguage(), "ALL"), ignoreCache, container, view);
}
if (isAllLanguage) {
country = MessageBundle.EMPTY;
} else {
country = getBundleFor(spec, new Locale("all", locale.getCountry()), ignoreCache, container, view);
}
if (isAllCountry || isAllLanguage) {
// If either of these is true, we already picked up both anyway.
all = MessageBundle.EMPTY;
} else {
all = getBundleFor(spec, ALL_ALL, ignoreCache, container, view);
}
return new MessageBundle(all, country, lang, exact);
} |
206633_9 | public MessageBundle getBundle(GadgetSpec spec, Locale locale, boolean ignoreCache, String container, String view)
throws GadgetException {
MessageBundle exact = getBundleFor(spec, locale, ignoreCache, container, view);
// We don't want to fetch the same bundle multiple times, so we verify that the exact match
// has not already been fetched.
MessageBundle lang, country, all;
boolean isAllLanguage = locale.getLanguage().equalsIgnoreCase("all");
boolean isAllCountry = locale.getCountry().equalsIgnoreCase("ALL");
if (isAllCountry) {
lang = MessageBundle.EMPTY;
} else {
lang = getBundleFor(spec, new Locale(locale.getLanguage(), "ALL"), ignoreCache, container, view);
}
if (isAllLanguage) {
country = MessageBundle.EMPTY;
} else {
country = getBundleFor(spec, new Locale("all", locale.getCountry()), ignoreCache, container, view);
}
if (isAllCountry || isAllLanguage) {
// If either of these is true, we already picked up both anyway.
all = MessageBundle.EMPTY;
} else {
all = getBundleFor(spec, ALL_ALL, ignoreCache, container, view);
}
return new MessageBundle(all, country, lang, exact);
} |
206635_0 | protected Map<String, MojoAnnotatedClass> scanArchive( File archiveFile, Artifact artifact, boolean excludeMojo )
throws IOException, ExtractionException
{
Map<String, MojoAnnotatedClass> mojoAnnotatedClasses = new HashMap<>();
String zipEntryName = null;
try ( ZipInputStream archiveStream = new ZipInputStream( new FileInputStream( archiveFile ) ) )
{
String archiveFilename = archiveFile.getAbsolutePath();
for ( ZipEntry zipEntry = archiveStream.getNextEntry(); zipEntry != null;
zipEntry = archiveStream.getNextEntry() )
{
zipEntryName = zipEntry.getName();
if ( !SCANNABLE_CLASS.matcher( zipEntryName ).matches() )
{
continue;
}
analyzeClassStream( mojoAnnotatedClasses, archiveStream, artifact, excludeMojo, archiveFilename,
zipEntry.getName() );
}
}
catch ( IllegalArgumentException e )
{
// In case of a class with newer specs an IllegalArgumentException can be thrown
getLogger().error( "Failed to analyze " + archiveFile.getAbsolutePath() + "!/" + zipEntryName );
throw e;
}
return mojoAnnotatedClasses;
} |
206635_1 | protected Map<String, MojoAnnotatedClass> scanArchive( File archiveFile, Artifact artifact, boolean excludeMojo )
throws IOException, ExtractionException
{
Map<String, MojoAnnotatedClass> mojoAnnotatedClasses = new HashMap<>();
String zipEntryName = null;
try ( ZipInputStream archiveStream = new ZipInputStream( new FileInputStream( archiveFile ) ) )
{
String archiveFilename = archiveFile.getAbsolutePath();
for ( ZipEntry zipEntry = archiveStream.getNextEntry(); zipEntry != null;
zipEntry = archiveStream.getNextEntry() )
{
zipEntryName = zipEntry.getName();
if ( !SCANNABLE_CLASS.matcher( zipEntryName ).matches() )
{
continue;
}
analyzeClassStream( mojoAnnotatedClasses, archiveStream, artifact, excludeMojo, archiveFilename,
zipEntry.getName() );
}
}
catch ( IllegalArgumentException e )
{
// In case of a class with newer specs an IllegalArgumentException can be thrown
getLogger().error( "Failed to analyze " + archiveFile.getAbsolutePath() + "!/" + zipEntryName );
throw e;
}
return mojoAnnotatedClasses;
} |
206635_2 | protected List<MojoDescriptor> extractMojoDescriptorsFromMetadata(
Map<String, Set<File>> metadataFilesKeyedByBasedir,
PluginToolsRequest request )
throws ExtractionException, InvalidPluginDescriptorException
{
List<MojoDescriptor> descriptors = new ArrayList<>();
PluginMetadataParser parser = new PluginMetadataParser();
for ( Map.Entry<String, Set<File>> entry : metadataFilesKeyedByBasedir.entrySet() )
{
String basedir = entry.getKey();
Set<File> metadataFiles = entry.getValue();
for ( File metadataFile : metadataFiles )
{
String basename = metadataFile.getName();
basename = basename.substring( 0, basename.length() - METADATA_FILE_EXTENSION.length() );
File scriptFile = new File( metadataFile.getParentFile(), basename + SCRIPT_FILE_EXTENSION );
if ( !scriptFile.exists() )
{
throw new InvalidPluginDescriptorException(
"Found orphaned plugin metadata file: " + metadataFile );
}
String relativePath = scriptFile.getPath().substring( basedir.length() ).replace( '\\', '/' );
if ( relativePath.startsWith( "/" ) )
{
relativePath = relativePath.substring( 1 );
}
try
{
Set<MojoDescriptor> mojoDescriptors = parser.parseMojoDescriptors( metadataFile );
for ( MojoDescriptor descriptor : mojoDescriptors )
{
@SuppressWarnings( "unchecked" )
Map<String, ?> paramMap = descriptor.getParameterMap();
if ( !paramMap.containsKey( "basedir" ) )
{
Parameter param = new Parameter();
param.setName( "basedir" );
param.setAlias( "ant.basedir" );
param.setExpression( "${antBasedir}" );
param.setDefaultValue( "${basedir}" );
param.setType( "java.io.File" );
param.setDescription( "The base directory from which to execute the Ant script." );
param.setEditable( true );
param.setRequired( true );
descriptor.addParameter( param );
}
if ( !paramMap.containsKey( "antMessageLevel" ) )
{
Parameter param = new Parameter();
param.setName( "messageLevel" );
param.setAlias( "ant.messageLevel" );
param.setExpression( "${antMessageLevel}" );
param.setDefaultValue( "info" );
param.setType( "java.lang.String" );
param.setDescription( "The message-level used to tune the verbosity of Ant logging." );
param.setEditable( true );
param.setRequired( false );
descriptor.addParameter( param );
}
if ( !paramMap.containsKey( "project" ) )
{
Parameter param = new Parameter();
param.setName( "project" );
param.setDefaultValue( "${project}" );
param.setType( MavenProject.class.getName() );
param.setDescription( "The current MavenProject instance, which contains classpath "
+ "elements." );
param.setEditable( false );
param.setRequired( true );
descriptor.addParameter( param );
}
if ( !paramMap.containsKey( "session" ) )
{
Parameter param = new Parameter();
param.setName( "session" );
param.setDefaultValue( "${session}" );
param.setType( "org.apache.maven.execution.MavenSession" );
param.setDescription( "The current MavenSession instance, which is used for "
+ "plugin-style expression resolution." );
param.setEditable( false );
param.setRequired( true );
descriptor.addParameter( param );
}
if ( !paramMap.containsKey( "mojoExecution" ) )
{
Parameter param = new Parameter();
param.setName( "mojoExecution" );
param.setDefaultValue( "${mojoExecution}" );
param.setType( "org.apache.maven.plugin.MojoExecution" );
param.setDescription( "The current Maven MojoExecution instance, which contains "
+ "information about the mojo currently executing." );
param.setEditable( false );
param.setRequired( true );
descriptor.addParameter( param );
}
@SuppressWarnings( "unchecked" )
List<ComponentRequirement> requirements = descriptor.getRequirements();
Map<String, ComponentRequirement> reqMap = new HashMap<>();
if ( requirements != null )
{
for ( ComponentRequirement req : requirements )
{
reqMap.put( req.getRole(), req );
}
}
if ( !reqMap.containsKey( PathTranslator.class.getName() ) )
{
ComponentRequirement req = new ComponentRequirement();
req.setRole( PathTranslator.class.getName() );
descriptor.addRequirement( req );
}
String implementation = relativePath;
String dImpl = descriptor.getImplementation();
if ( StringUtils.isNotEmpty( dImpl ) )
{
if ( PluginMetadataParser.IMPL_BASE_PLACEHOLDER.equals( dImpl ) )
{
implementation = relativePath;
}
else
{
implementation =
relativePath
+ dImpl.substring( PluginMetadataParser.IMPL_BASE_PLACEHOLDER.length() );
}
}
descriptor.setImplementation( implementation );
descriptor.setLanguage( "ant-mojo" );
descriptor.setComponentComposer( "map-oriented" );
descriptor.setComponentConfigurator( "map-oriented" );
descriptor.setPluginDescriptor( request.getPluginDescriptor() );
descriptors.add( descriptor );
}
}
catch ( PluginMetadataParseException e )
{
throw new ExtractionException( "Error extracting mojo descriptor from script: " + metadataFile, e );
}
}
}
return descriptors;
} |
206635_3 | public Set<MojoDescriptor> parseMojoDescriptors( File metadataFile )
throws PluginMetadataParseException
{
Set<MojoDescriptor> descriptors = new HashSet<>();
try ( Reader reader = ReaderFactory.newXmlReader( metadataFile ) )
{
PluginMetadataXpp3Reader metadataReader = new PluginMetadataXpp3Reader();
PluginMetadata pluginMetadata = metadataReader.read( reader );
List<Mojo> mojos = pluginMetadata.getMojos();
if ( mojos != null )
{
for ( Mojo mojo : mojos )
{
MojoDescriptor descriptor = asDescriptor( metadataFile, mojo );
descriptors.add( descriptor );
}
}
}
catch ( IOException | XmlPullParserException e )
{
throw new PluginMetadataParseException( metadataFile, "Cannot parse plugin metadata from file.", e );
}
return descriptors;
} |
206635_4 | public Set<MojoDescriptor> parseMojoDescriptors( File metadataFile )
throws PluginMetadataParseException
{
Set<MojoDescriptor> descriptors = new HashSet<>();
try ( Reader reader = ReaderFactory.newXmlReader( metadataFile ) )
{
PluginMetadataXpp3Reader metadataReader = new PluginMetadataXpp3Reader();
PluginMetadata pluginMetadata = metadataReader.read( reader );
List<Mojo> mojos = pluginMetadata.getMojos();
if ( mojos != null )
{
for ( Mojo mojo : mojos )
{
MojoDescriptor descriptor = asDescriptor( metadataFile, mojo );
descriptors.add( descriptor );
}
}
}
catch ( IOException | XmlPullParserException e )
{
throw new PluginMetadataParseException( metadataFile, "Cannot parse plugin metadata from file.", e );
}
return descriptors;
} |
206635_5 | public void populatePluginDescriptor( PluginToolsRequest request )
throws ExtractionException, InvalidPluginDescriptorException
{
Logger logger = getLogger();
Set<String> activeExtractorsInternal = getActiveExtractors();
logger.debug( "Using " + activeExtractorsInternal.size() + " mojo extractors." );
int numMojoDescriptors = 0;
for ( String extractorId : activeExtractorsInternal )
{
MojoDescriptorExtractor extractor = mojoDescriptorExtractors.get( extractorId );
if ( extractor == null )
{
throw new ExtractionException( "No mojo extractor with '" + extractorId + "' id." );
}
logger.debug( "Applying " + extractorId + " mojo extractor" );
List<MojoDescriptor> extractorDescriptors = extractor.execute( request );
logger.info( extractorId + " mojo extractor found " + extractorDescriptors.size()
+ " mojo descriptor" + ( extractorDescriptors.size() > 1 ? "s" : "" ) + "." );
numMojoDescriptors += extractorDescriptors.size();
for ( MojoDescriptor descriptor : extractorDescriptors )
{
logger.debug( "Adding mojo: " + descriptor + " to plugin descriptor." );
descriptor.setPluginDescriptor( request.getPluginDescriptor() );
request.getPluginDescriptor().addMojo( descriptor );
}
}
if ( numMojoDescriptors == 0 && !request.isSkipErrorNoDescriptorsFound() )
{
throw new InvalidPluginDescriptorException(
"No mojo definitions were found for plugin: " + request.getPluginDescriptor().getPluginLookupKey()
+ "." );
}
} |
209853_0 | public String getValorFormatado() {
return new BigDecimalFormatter().bigDecimalToStringInCents(this.price);
} |
209853_1 | public BigDecimal getPrice() {
return price;
} |
209853_2 | @Override
protected Validator createValidator() throws JspException {
ELContext elContext = getELContext();
StellaIEValidator validator = getBoundValidator(elContext);
if (binding != null) {
validator.setBinding(binding);
}
if (estado != null) {
String estadoValue = estado.getValue(elContext).toString();
validator.setEstado(estadoValue);
}
if (estadoComponentId != null) {
String componentId = estadoComponentId.getValue(elContext).toString();
validator.setEstadoComponentId(componentId);
}
if (formatted != null) {
Boolean formattedValue = (Boolean) formatted.getValue(elContext);
validator.setFormatted(formattedValue);
}
return validator;
} |
209853_3 | @Override
protected Validator createValidator() throws JspException {
StellaTituloEleitoralValidator validator = new StellaTituloEleitoralValidator();
return validator;
} |
209853_4 | public ResourceBundle getForCurrentLocale(FacesContext facesContext) {
Application application = facesContext.getApplication();
String bundleName = application.getMessageBundle();
if (bundleName == null) {
return defaultStellaBundle();
}
Locale locale = facesContext.getViewRoot().getLocale();
ResourceBundle bundle = ResourceBundle.getBundle(bundleName, locale);
return bundle;
} |
209853_5 | public ResourceBundle getForCurrentLocale(FacesContext facesContext) {
Application application = facesContext.getApplication();
String bundleName = application.getMessageBundle();
if (bundleName == null) {
return defaultStellaBundle();
}
Locale locale = facesContext.getViewRoot().getLocale();
ResourceBundle bundle = ResourceBundle.getBundle(bundleName, locale);
return bundle;
} |
209853_6 | public void validate(FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException {
if (value == null || "".equals(value)) return;
ResourceBundle bundle = resourceBundleFinder.getForCurrentLocale(facesContext);
ResourceBundleMessageProducer producer = new ResourceBundleMessageProducer(bundle);
CPFValidator validator = new CPFValidator(producer, formatted);
try {
validator.assertValid(value.toString());
} catch (InvalidStateException e) {
List<ValidationMessage> messages = e.getInvalidMessages();
String firstErrorMessage = messages.remove(0).getMessage();
registerAllMessages(facesContext, uiComponent, messages);
throw new ValidatorException(new FacesMessage(firstErrorMessage));
}
} |
209853_7 | public void validate(FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException {
if (value == null || "".equals(value)) return;
ResourceBundle bundle = resourceBundleFinder.getForCurrentLocale(facesContext);
ResourceBundleMessageProducer producer = new ResourceBundleMessageProducer(bundle);
CPFValidator validator = new CPFValidator(producer, formatted);
try {
validator.assertValid(value.toString());
} catch (InvalidStateException e) {
List<ValidationMessage> messages = e.getInvalidMessages();
String firstErrorMessage = messages.remove(0).getMessage();
registerAllMessages(facesContext, uiComponent, messages);
throw new ValidatorException(new FacesMessage(firstErrorMessage));
}
} |
209853_8 | public void validate(FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException {
if (value == null || "".equals(value)) return;
ResourceBundle bundle = resourceBundleFinder.getForCurrentLocale(facesContext);
ResourceBundleMessageProducer producer = new ResourceBundleMessageProducer(bundle);
CPFValidator validator = new CPFValidator(producer, formatted);
try {
validator.assertValid(value.toString());
} catch (InvalidStateException e) {
List<ValidationMessage> messages = e.getInvalidMessages();
String firstErrorMessage = messages.remove(0).getMessage();
registerAllMessages(facesContext, uiComponent, messages);
throw new ValidatorException(new FacesMessage(firstErrorMessage));
}
} |
209853_9 | public void validate(FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException {
if (value == null || "".equals(value)) return;
ResourceBundle bundle = resourceBundleFinder.getForCurrentLocale(facesContext);
ResourceBundleMessageProducer producer = new ResourceBundleMessageProducer(bundle);
CPFValidator validator = new CPFValidator(producer, formatted);
try {
validator.assertValid(value.toString());
} catch (InvalidStateException e) {
List<ValidationMessage> messages = e.getInvalidMessages();
String firstErrorMessage = messages.remove(0).getMessage();
registerAllMessages(facesContext, uiComponent, messages);
throw new ValidatorException(new FacesMessage(firstErrorMessage));
}
} |
213337_0 | public AbstractValueModel getLabelModel() {
return new DefaultLabelModel(getBean());
} |
213337_1 | public AbstractValueModel getLabelModel() {
return new DefaultLabelModel(getBean());
} |
213337_2 | public AbstractValueModel getLabelModel() {
return new DefaultLabelModel(getBean());
} |
213337_3 | public int getColumnCount() {
return d_study.getArms().size() + 2 + (d_hasOverallColumn ? 1 : 0);
} |
213337_4 | public int getColumnCount() {
return d_study.getArms().size() + 2 + (d_hasOverallColumn ? 1 : 0);
} |
213337_5 | public int getRowCount() {
int n = 0;
for (StudyOutcomeMeasure<? extends Variable> var : d_study.getStudyOutcomeMeasures(d_type)) {
n += var.getWhenTaken().size();
}
return n;
} |
213337_6 | public int getRowCount() {
int n = 0;
for (StudyOutcomeMeasure<? extends Variable> var : d_study.getStudyOutcomeMeasures(d_type)) {
n += var.getWhenTaken().size();
}
return n;
} |
213337_7 | public Object getValueAt(int rowIndex, int columnIndex) {
Key key = getKeyAt(rowIndex, columnIndex);
if (isVariableColumn(columnIndex)) {
return key.v.getValue().getName();
}
if (isMeasurementMomentColumn(columnIndex)) {
return key.wt;
}
return d_mmpMap.get(key.getMeasurementKey());
} |
213337_8 | public Object getValueAt(int rowIndex, int columnIndex) {
Key key = getKeyAt(rowIndex, columnIndex);
if (isVariableColumn(columnIndex)) {
return key.v.getValue().getName();
}
if (isMeasurementMomentColumn(columnIndex)) {
return key.wt;
}
return d_mmpMap.get(key.getMeasurementKey());
} |
213337_9 | @Override
public String getColumnName(int col) {
if (isVariableColumn(col)) {
return CategoryKnowledgeFactory.getCategoryKnowledge(d_type).getSingularCapitalized();
} else if (isMeasurementMomentColumn(col)) {
return "Measurement moment";
} else if (isOverallColumn(col)) {
return "Overall";
}
return d_pmf.getLabeledModel(d_study.getArms().get(col-2)).getLabelModel().getString();
} |
219850_0 | public static <T> void applyDiff(final List<T> a,
final List<T> b,
final List<T> l,
final Comparator<T> cmp,
final DiffEditor<T> ed) {
int acur = 0;
int bcur = 0;
int lcur = 0;
int ecur = 0;
while (lcur < l.size()) {
if (0 != cmp.compare(l.get(lcur), a.get(acur))) {
// absent in the subsequence but present in the original
ed.delete(ecur, a.get(acur));
acur++;
} else if (0 != cmp.compare(l.get(lcur), b.get(bcur))) {
// absent in the subsequence but present in the second sequence
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
} else {
lcur++;
acur++;
bcur++;
ecur++;
}
}
int aleftover = a.size() - acur;
int bleftover = b.size() - bcur;
for (int i = 0; i < aleftover; i++) {
ed.delete(ecur, a.get(acur));
acur++;
}
for (int i = 0; i < bleftover; i++) {
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
}
} |
219850_1 | public static <T> void applyDiff(final List<T> a,
final List<T> b,
final List<T> l,
final Comparator<T> cmp,
final DiffEditor<T> ed) {
int acur = 0;
int bcur = 0;
int lcur = 0;
int ecur = 0;
while (lcur < l.size()) {
if (0 != cmp.compare(l.get(lcur), a.get(acur))) {
// absent in the subsequence but present in the original
ed.delete(ecur, a.get(acur));
acur++;
} else if (0 != cmp.compare(l.get(lcur), b.get(bcur))) {
// absent in the subsequence but present in the second sequence
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
} else {
lcur++;
acur++;
bcur++;
ecur++;
}
}
int aleftover = a.size() - acur;
int bleftover = b.size() - bcur;
for (int i = 0; i < aleftover; i++) {
ed.delete(ecur, a.get(acur));
acur++;
}
for (int i = 0; i < bleftover; i++) {
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
}
} |
219850_2 | public static <T> void applyDiff(final List<T> a,
final List<T> b,
final List<T> l,
final Comparator<T> cmp,
final DiffEditor<T> ed) {
int acur = 0;
int bcur = 0;
int lcur = 0;
int ecur = 0;
while (lcur < l.size()) {
if (0 != cmp.compare(l.get(lcur), a.get(acur))) {
// absent in the subsequence but present in the original
ed.delete(ecur, a.get(acur));
acur++;
} else if (0 != cmp.compare(l.get(lcur), b.get(bcur))) {
// absent in the subsequence but present in the second sequence
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
} else {
lcur++;
acur++;
bcur++;
ecur++;
}
}
int aleftover = a.size() - acur;
int bleftover = b.size() - bcur;
for (int i = 0; i < aleftover; i++) {
ed.delete(ecur, a.get(acur));
acur++;
}
for (int i = 0; i < bleftover; i++) {
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
}
} |
219850_3 | public static <T> void applyDiff(final List<T> a,
final List<T> b,
final List<T> l,
final Comparator<T> cmp,
final DiffEditor<T> ed) {
int acur = 0;
int bcur = 0;
int lcur = 0;
int ecur = 0;
while (lcur < l.size()) {
if (0 != cmp.compare(l.get(lcur), a.get(acur))) {
// absent in the subsequence but present in the original
ed.delete(ecur, a.get(acur));
acur++;
} else if (0 != cmp.compare(l.get(lcur), b.get(bcur))) {
// absent in the subsequence but present in the second sequence
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
} else {
lcur++;
acur++;
bcur++;
ecur++;
}
}
int aleftover = a.size() - acur;
int bleftover = b.size() - bcur;
for (int i = 0; i < aleftover; i++) {
ed.delete(ecur, a.get(acur));
acur++;
}
for (int i = 0; i < bleftover; i++) {
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
}
} |
219850_4 | public static <T> void applyDiff(final List<T> a,
final List<T> b,
final List<T> l,
final Comparator<T> cmp,
final DiffEditor<T> ed) {
int acur = 0;
int bcur = 0;
int lcur = 0;
int ecur = 0;
while (lcur < l.size()) {
if (0 != cmp.compare(l.get(lcur), a.get(acur))) {
// absent in the subsequence but present in the original
ed.delete(ecur, a.get(acur));
acur++;
} else if (0 != cmp.compare(l.get(lcur), b.get(bcur))) {
// absent in the subsequence but present in the second sequence
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
} else {
lcur++;
acur++;
bcur++;
ecur++;
}
}
int aleftover = a.size() - acur;
int bleftover = b.size() - bcur;
for (int i = 0; i < aleftover; i++) {
ed.delete(ecur, a.get(acur));
acur++;
}
for (int i = 0; i < bleftover; i++) {
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
}
} |
219850_5 | public static <T> void applyDiff(final List<T> a,
final List<T> b,
final List<T> l,
final Comparator<T> cmp,
final DiffEditor<T> ed) {
int acur = 0;
int bcur = 0;
int lcur = 0;
int ecur = 0;
while (lcur < l.size()) {
if (0 != cmp.compare(l.get(lcur), a.get(acur))) {
// absent in the subsequence but present in the original
ed.delete(ecur, a.get(acur));
acur++;
} else if (0 != cmp.compare(l.get(lcur), b.get(bcur))) {
// absent in the subsequence but present in the second sequence
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
} else {
lcur++;
acur++;
bcur++;
ecur++;
}
}
int aleftover = a.size() - acur;
int bleftover = b.size() - bcur;
for (int i = 0; i < aleftover; i++) {
ed.delete(ecur, a.get(acur));
acur++;
}
for (int i = 0; i < bleftover; i++) {
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
}
} |
219850_6 | public static <T> void applyDiff(final List<T> a,
final List<T> b,
final List<T> l,
final Comparator<T> cmp,
final DiffEditor<T> ed) {
int acur = 0;
int bcur = 0;
int lcur = 0;
int ecur = 0;
while (lcur < l.size()) {
if (0 != cmp.compare(l.get(lcur), a.get(acur))) {
// absent in the subsequence but present in the original
ed.delete(ecur, a.get(acur));
acur++;
} else if (0 != cmp.compare(l.get(lcur), b.get(bcur))) {
// absent in the subsequence but present in the second sequence
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
} else {
lcur++;
acur++;
bcur++;
ecur++;
}
}
int aleftover = a.size() - acur;
int bleftover = b.size() - bcur;
for (int i = 0; i < aleftover; i++) {
ed.delete(ecur, a.get(acur));
acur++;
}
for (int i = 0; i < bleftover; i++) {
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
}
} |
219850_7 | public static <T> void applyDiff(final List<T> a,
final List<T> b,
final List<T> l,
final Comparator<T> cmp,
final DiffEditor<T> ed) {
int acur = 0;
int bcur = 0;
int lcur = 0;
int ecur = 0;
while (lcur < l.size()) {
if (0 != cmp.compare(l.get(lcur), a.get(acur))) {
// absent in the subsequence but present in the original
ed.delete(ecur, a.get(acur));
acur++;
} else if (0 != cmp.compare(l.get(lcur), b.get(bcur))) {
// absent in the subsequence but present in the second sequence
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
} else {
lcur++;
acur++;
bcur++;
ecur++;
}
}
int aleftover = a.size() - acur;
int bleftover = b.size() - bcur;
for (int i = 0; i < aleftover; i++) {
ed.delete(ecur, a.get(acur));
acur++;
}
for (int i = 0; i < bleftover; i++) {
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
}
} |
219850_8 | public static <T> void applyDiff(final List<T> a,
final List<T> b,
final List<T> l,
final Comparator<T> cmp,
final DiffEditor<T> ed) {
int acur = 0;
int bcur = 0;
int lcur = 0;
int ecur = 0;
while (lcur < l.size()) {
if (0 != cmp.compare(l.get(lcur), a.get(acur))) {
// absent in the subsequence but present in the original
ed.delete(ecur, a.get(acur));
acur++;
} else if (0 != cmp.compare(l.get(lcur), b.get(bcur))) {
// absent in the subsequence but present in the second sequence
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
} else {
lcur++;
acur++;
bcur++;
ecur++;
}
}
int aleftover = a.size() - acur;
int bleftover = b.size() - bcur;
for (int i = 0; i < aleftover; i++) {
ed.delete(ecur, a.get(acur));
acur++;
}
for (int i = 0; i < bleftover; i++) {
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
}
} |
219850_9 | public static <T> void applyDiff(final List<T> a,
final List<T> b,
final List<T> l,
final Comparator<T> cmp,
final DiffEditor<T> ed) {
int acur = 0;
int bcur = 0;
int lcur = 0;
int ecur = 0;
while (lcur < l.size()) {
if (0 != cmp.compare(l.get(lcur), a.get(acur))) {
// absent in the subsequence but present in the original
ed.delete(ecur, a.get(acur));
acur++;
} else if (0 != cmp.compare(l.get(lcur), b.get(bcur))) {
// absent in the subsequence but present in the second sequence
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
} else {
lcur++;
acur++;
bcur++;
ecur++;
}
}
int aleftover = a.size() - acur;
int bleftover = b.size() - bcur;
for (int i = 0; i < aleftover; i++) {
ed.delete(ecur, a.get(acur));
acur++;
}
for (int i = 0; i < bleftover; i++) {
ed.add(ecur, b.get(bcur));
bcur++;
ecur++;
}
} |
223355_0 | @Override
public boolean isEnabled() {
return super.isEnabled() && context.getConfig().isDebug();
} |
223355_1 | @Override
public boolean accept(final HttpServletRequest request) {
return WroUtil.matchesUrl(request, ENDPOINT_URI);
} |
223355_2 | @Override
public boolean accept(final HttpServletRequest request) {
return WroUtil.matchesUrl(request, ENDPOINT_URI);
} |
223355_3 | @Override
public void handle(final HttpServletRequest request, final HttpServletResponse response)
throws IOException {
// Set header
ResponseHeadersConfigurer.noCache().setHeaders(response);
response.setContentType(CONTENT_TYPE);
response.setStatus(HttpServletResponse.SC_OK);
// Build content
newGson(request).toJson(modelFactory.create(), response.getWriter());
response.getWriter().flush();
} |
223355_4 | @Override
public void handle(final HttpServletRequest request, final HttpServletResponse response)
throws IOException {
// Set header
ResponseHeadersConfigurer.noCache().setHeaders(response);
response.setContentType(CONTENT_TYPE);
response.setStatus(HttpServletResponse.SC_OK);
// Build content
newGson(request).toJson(modelFactory.create(), response.getWriter());
response.getWriter().flush();
} |
223355_5 | @Override
public boolean accept(final HttpServletRequest request) {
return WroUtil.matchesUrl(request, ENDPOINT_URI);
} |
223355_6 | @Override
public void handle(final HttpServletRequest request, final HttpServletResponse response)
throws IOException {
// Set header
ResponseHeadersConfigurer.noCache().setHeaders(response);
response.setContentType(CONTENT_TYPE);
response.setStatus(HttpServletResponse.SC_OK);
// Build content
newGson(request).toJson(modelFactory.create(), response.getWriter());
response.getWriter().flush();
} |
223355_7 | @Override
public Map<String, RequestHandler> provideRequestHandlers() {
final Map<String, RequestHandler> map = new HashMap<String, RequestHandler>();
map.put(ModelAsJsonRequestHandler.ALIAS, new LazyRequestHandlerDecorator(new LazyInitializer<RequestHandler>() {
@Override
protected RequestHandler initialize() {
return new ModelAsJsonRequestHandler();
}
}));
return map;
} |
223355_8 | @Override
public Map<String, RequestHandler> provideRequestHandlers() {
final Map<String, RequestHandler> map = new HashMap<String, RequestHandler>();
map.put(ModelAsJsonRequestHandler.ALIAS, new LazyRequestHandlerDecorator(new LazyInitializer<RequestHandler>() {
@Override
protected RequestHandler initialize() {
return new ModelAsJsonRequestHandler();
}
}));
return map;
} |
223355_9 | @Override
public synchronized WroModel create() {
final StopWatch stopWatch = new StopWatch("Create Wro Model from Groovy");
try {
stopWatch.start("createModel");
final Type type = new TypeToken<WroModel>() {}.getType();
final InputStream is = getModelResourceAsStream();
if (is == null) {
throw new WroRuntimeException("Invalid model stream provided!");
}
final WroModel model = new Gson().fromJson(new InputStreamReader(getModelResourceAsStream()), type);
LOG.debug("json model: {}", model);
if (model == null) {
throw new WroRuntimeException("Invalid content provided, cannot build model!");
}
return model;
} catch (final Exception e) {
throw new WroRuntimeException("Invalid model found!", e);
} finally {
stopWatch.stop();
LOG.debug(stopWatch.prettyPrint());
}
} |
225207_0 | public void doAppend(PaxLoggingEvent paxLoggingEvent) {
try {
// Send message to the destination
TextMessage message = getOrCreateSession().createTextMessage();
message.setText(format.toString(paxLoggingEvent));
getOrCreatePublisher().send(message);
} catch (JMSException e) {
LOG.warn("Exception caught while sending log event - reinitializing JMS resources to recover", e);
closeJMSResources();
}
} |
225207_1 | public String toString(PaxLoggingEvent event) {
JSONObject object = new JSONObject();
try {
object.put(MESSAGE, event.getMessage());
object.put(SOURCE, event.getLoggerName());
object.put(TIMESTAMP, TIMESTAMP_FORMAT.format(new Date(event.getTimeStamp())));
JSONObject fields = new JSONObject();
for (Object property : event.getProperties().entrySet()) {
Map.Entry<String, Object> entry = (Map.Entry<String, Object>) property;
fields.put(entry.getKey(), entry.getValue().toString());
}
object.put(FIELDS, fields);
JSONArray tags = new JSONArray();
tags.put(event.getLevel().toString());
object.put(TAGS, tags);
} catch (JSONException e) {
// let's return a minimal, String-based message representation instead
return "{ \"" + MESSAGE + "\" : " + event.getMessage() + "}";
}
return object.toString();
} |
225207_2 | public void prepare(Message message) throws IOException {
getLogger().log(Level.FINE, "JBIConduit send message");
NMRTransportFactory.removeUnusedInterceptprs(message);
message.setContent(OutputStream.class,
new NMRConduitOutputStream(message, nmr, target, this));
} |
225207_3 | public NMRDestination(EndpointInfo info, NMR nmr) {
super(getTargetReference(info, null), info);
this.nmr = nmr;
this.properties = new HashMap<String, Object>();
String address = info.getAddress();
if (address != null && address.indexOf(Endpoint.RUN_AS_SUBJECT) >= 0) {
String asSubject = address.substring(address.indexOf(Endpoint.RUN_AS_SUBJECT)
+ Endpoint.RUN_AS_SUBJECT.length() + 1);
this.properties.put(Endpoint.RUN_AS_SUBJECT, asSubject);
}
if (address != null && address.startsWith("nmr:")) {
if (address.indexOf("?") > 0) {
this.properties.put(Endpoint.NAME, address.substring(4, address.indexOf("?")));
} else {
this.properties.put(Endpoint.NAME, address.substring(4));
}
} else {
this.properties.put(Endpoint.NAME, info.getName().toString());
}
this.properties.put(Endpoint.SERVICE_NAME, info.getService().getName().toString());
this.properties.put(Endpoint.INTERFACE_NAME, info.getInterface().getName().toString());
if (address.indexOf("?") > 0) {
String[] props = address.substring(address.indexOf("?") + 1).split("&");
for (String prop : props) {
if (prop.indexOf("=") > 0) {
String key = prop.substring(0, prop.indexOf("="));
String val = prop.substring(prop.indexOf("=") + 1);
if (key.equals("synchronous")) {
key = Endpoint.CHANNEL_SYNC_DELIVERY;
}
this.properties.put(key, val);
}
}
}
} |
225207_4 | public void activate() {
nmr.getEndpointRegistry().register(this, properties);
} |
225207_5 | public Binding createBinding(BindingInfo binding) {
NMRBinding jb = new NMRBinding((NMRBindingInfo) binding);
jb.getInInterceptors().add(new StaxInInterceptor());
jb.getInInterceptors().add(new NMROperationInInterceptor());
jb.getInInterceptors().add(new NMRWrapperInInterceptor());
jb.getOutInterceptors().add(new StaxOutInterceptor());
jb.getOutInterceptors().add(new NMRWrapperOutInterceptor());
jb.getOutFaultInterceptors().add(new StaxOutInterceptor());
jb.getOutFaultInterceptors().add(new NMRFaultOutInterceptor());
jb.getInFaultInterceptors().add(new NMRFaultInInterceptor());
return jb;
} |
225207_6 | public void handleMessage(NMRMessage message) throws Fault {
Exchange ex = message.getExchange();
Endpoint ep = ex.get(Endpoint.class);
BindingOperationInfo boi = ex.get(BindingOperationInfo.class);
if (boi == null && message.getNmrExchange()!= null
&& message.getNmrExchange().getOperation() != null) {
BindingInfo service = ep.getEndpointInfo().getBinding();
boi = getBindingOperationInfo(service, message.getNmrExchange().getOperation());
if (boi == null) {
throw new Fault(new Message("UNKNOWN_OPERATION", BUNDLE,
message.getNmrExchange().getOperation().toString()));
}
ex.put(BindingOperationInfo.class, boi);
ex.put(OperationInfo.class, boi.getOperationInfo());
ex.setOneWay(boi.getOperationInfo().isOneWay());
message.put(MessageInfo.class, boi.getInput().getMessageInfo());
}
} |
225207_7 | public void handleMessage(NMRMessage message) throws Fault {
message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
NSStack nsStack = new NSStack();
nsStack.push();
try {
XMLStreamWriter writer = getWriter(message);
Fault fault = getFault(message);
NMRFault jbiFault = NMRFault.createFault(fault);
nsStack.add(NMRConstants.NS_NMR_BINDING);
String prefix = nsStack.getPrefix(NMRConstants.NS_NMR_BINDING);
StaxUtils.writeStartElement(writer, prefix, NMRFault.NMR_FAULT_ROOT,
NMRConstants.NS_NMR_BINDING);
if (!jbiFault.hasDetails()) {
writer.writeEmptyElement("fault");
} else {
Element detail = jbiFault.getDetail();
NodeList details = detail.getChildNodes();
for (int i = 0; i < details.getLength(); i++) {
if (details.item(i) instanceof Element) {
StaxUtils.writeNode(details.item(i), writer, true);
break;
}
}
}
writer.writeEndElement();
writer.flush();
} catch (XMLStreamException xe) {
throw new Fault(new Message("XML_WRITE_EXC", BUNDLE), xe);
}
} |
225207_8 | public void handleMessage(NMRMessage message) throws Fault {
message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
NSStack nsStack = new NSStack();
nsStack.push();
try {
XMLStreamWriter writer = getWriter(message);
Fault fault = getFault(message);
NMRFault jbiFault = NMRFault.createFault(fault);
nsStack.add(NMRConstants.NS_NMR_BINDING);
String prefix = nsStack.getPrefix(NMRConstants.NS_NMR_BINDING);
StaxUtils.writeStartElement(writer, prefix, NMRFault.NMR_FAULT_ROOT,
NMRConstants.NS_NMR_BINDING);
if (!jbiFault.hasDetails()) {
writer.writeEmptyElement("fault");
} else {
Element detail = jbiFault.getDetail();
NodeList details = detail.getChildNodes();
for (int i = 0; i < details.getLength(); i++) {
if (details.item(i) instanceof Element) {
StaxUtils.writeNode(details.item(i), writer, true);
break;
}
}
}
writer.writeEndElement();
writer.flush();
} catch (XMLStreamException xe) {
throw new Fault(new Message("XML_WRITE_EXC", BUNDLE), xe);
}
} |
225207_9 | public void handleMessage(NMRMessage message) throws Fault {
message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
NSStack nsStack = new NSStack();
nsStack.push();
try {
XMLStreamWriter writer = getWriter(message);
Fault fault = getFault(message);
NMRFault jbiFault = NMRFault.createFault(fault);
nsStack.add(NMRConstants.NS_NMR_BINDING);
String prefix = nsStack.getPrefix(NMRConstants.NS_NMR_BINDING);
StaxUtils.writeStartElement(writer, prefix, NMRFault.NMR_FAULT_ROOT,
NMRConstants.NS_NMR_BINDING);
if (!jbiFault.hasDetails()) {
writer.writeEmptyElement("fault");
} else {
Element detail = jbiFault.getDetail();
NodeList details = detail.getChildNodes();
for (int i = 0; i < details.getLength(); i++) {
if (details.item(i) instanceof Element) {
StaxUtils.writeNode(details.item(i), writer, true);
break;
}
}
}
writer.writeEndElement();
writer.flush();
} catch (XMLStreamException xe) {
throw new Fault(new Message("XML_WRITE_EXC", BUNDLE), xe);
}
} |
225211_0 | public static <T> Class<? extends T> locate(Class<T> factoryId) {
return locate(factoryId, factoryId.getName());
} |