@Test public void testNextNonVersion() { FilenameParser parser = new FilenameParser( "maven-test-plugin-1.8.3.jar" ); assertEquals( "maven-test-plugin", parser.nextNonVersion() ); assertEquals( "1.8.3", parser.remaining() ); }
public String nextNonVersion() { boolean done = false; StringBuilder ver = new StringBuilder(); Matcher specialMat = mavenPluginPattern.matcher( name ); if ( specialMat.find() ) { ver.append( name.substring( offset, specialMat.end() ) ); offset = specialMat.end() + 1; } while ( !done ) { int initialOffset = offset; String section = next(); if ( section == null ) { done = true; } else if ( !VersionUtil.isVersion( section ) ) { if ( ver.length() > 0 ) { ver.append( '-' ); } ver.append( section ); } else { offset = initialOffset; done = true; } } return ver.toString(); }
FilenameParser { public String nextNonVersion() { boolean done = false; StringBuilder ver = new StringBuilder(); Matcher specialMat = mavenPluginPattern.matcher( name ); if ( specialMat.find() ) { ver.append( name.substring( offset, specialMat.end() ) ); offset = specialMat.end() + 1; } while ( !done ) { int initialOffset = offset; String section = next(); if ( section == null ) { done = true; } else if ( !VersionUtil.isVersion( section ) ) { if ( ver.length() > 0 ) { ver.append( '-' ); } ver.append( section ); } else { offset = initialOffset; done = true; } } return ver.toString(); } }
FilenameParser { public String nextNonVersion() { boolean done = false; StringBuilder ver = new StringBuilder(); Matcher specialMat = mavenPluginPattern.matcher( name ); if ( specialMat.find() ) { ver.append( name.substring( offset, specialMat.end() ) ); offset = specialMat.end() + 1; } while ( !done ) { int initialOffset = offset; String section = next(); if ( section == null ) { done = true; } else if ( !VersionUtil.isVersion( section ) ) { if ( ver.length() > 0 ) { ver.append( '-' ); } ver.append( section ); } else { offset = initialOffset; done = true; } } return ver.toString(); } FilenameParser( String filename ); }
FilenameParser { public String nextNonVersion() { boolean done = false; StringBuilder ver = new StringBuilder(); Matcher specialMat = mavenPluginPattern.matcher( name ); if ( specialMat.find() ) { ver.append( name.substring( offset, specialMat.end() ) ); offset = specialMat.end() + 1; } while ( !done ) { int initialOffset = offset; String section = next(); if ( section == null ) { done = true; } else if ( !VersionUtil.isVersion( section ) ) { if ( ver.length() > 0 ) { ver.append( '-' ); } ver.append( section ); } else { offset = initialOffset; done = true; } } return ver.toString(); } FilenameParser( String filename ); void reset(); String next(); String getExtension(); String remaining(); String nextNonVersion(); }
FilenameParser { public String nextNonVersion() { boolean done = false; StringBuilder ver = new StringBuilder(); Matcher specialMat = mavenPluginPattern.matcher( name ); if ( specialMat.find() ) { ver.append( name.substring( offset, specialMat.end() ) ); offset = specialMat.end() + 1; } while ( !done ) { int initialOffset = offset; String section = next(); if ( section == null ) { done = true; } else if ( !VersionUtil.isVersion( section ) ) { if ( ver.length() > 0 ) { ver.append( '-' ); } ver.append( section ); } else { offset = initialOffset; done = true; } } return ver.toString(); } FilenameParser( String filename ); void reset(); String next(); String getExtension(); String remaining(); String nextNonVersion();  }