• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

class instantiation question

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi

Looking at some professionally written code, Pipe is a class, it looks to me like importPipe is re-instantiated 3 times.
Don't the first essentially have no effect?

Thanks
Brian


public ImportCrawlDataAssembly( String name )
{
// split the text line into "url" and "raw" with the default delimiter of tab
RegexSplitter regexSplitter = new RegexSplitter( new Fields( "url", "raw" ) );

1--> Pipe importPipe = new Each( name, new Fields( "line" ), regexSplitter );

// remove all pdf documents from the stream

2--> importPipe = new Each( importPipe, new Fields( "url" ), new RegexFilter( ".*\\.pdf$", true ) );

// replace ":nl" with a new line, return the fields "url" and "page" to the stream.
// discared the other fields in the stream

RegexReplace regexReplace = new RegexReplace( new Fields( "page" ), ":nl:", "\n" );

3--> importPipe = new Each( importPipe, new Fields( "raw" ), regexReplace, new Fields( "url", "page" ) );

setTails( importPipe );
}
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't read that. Can't you just post the actual code? And please UseCodeTags.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like each previous pipe is being fed into the new one: I'd assume that is meaningful.
 
Brian R Wolf
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, yes, I didn't see it being feed back in
thanks!
 
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic