idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
142,300
public static MozuUrl rejectSuggestedDiscountUrl ( String cartId , Integer discountId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/{cartId}/rejectautodiscount/{discountId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "cartId" , cartId ) ; formatter . formatUrl ( "discountId" , discountId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for RejectSuggestedDiscount
155
11
142,301
public static MozuUrl deleteCurrentCartUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteCurrentCart
69
8
142,302
public static MozuUrl getViewDocumentsUrl ( String documentListName , String filter , Boolean includeInactive , Integer pageSize , String responseFields , String sortBy , Integer startIndex , String viewName ) { UrlFormatter formatter = new UrlFormatter ( "/api/content/documentlists/{documentListName}/views/{viewName}/documents?filter={filter}&sortBy={sortBy}&pageSize={pageSize}&startIndex={startIndex}&includeInactive={includeInactive}&responseFields={responseFields}" ) ; formatter . formatUrl ( "documentListName" , documentListName ) ; formatter . formatUrl ( "filter" , filter ) ; formatter . formatUrl ( "includeInactive" , includeInactive ) ; formatter . formatUrl ( "pageSize" , pageSize ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "sortBy" , sortBy ) ; formatter . formatUrl ( "startIndex" , startIndex ) ; formatter . formatUrl ( "viewName" , viewName ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetViewDocuments
283
8
142,303
static void checkClosedOpen ( final Range < Long > range ) { checkNotNull ( range ) ; checkArgument ( BoundType . CLOSED == range . lowerBoundType ( ) , "range must be [closed, open), lower bound type was open" ) ; checkArgument ( BoundType . OPEN == range . upperBoundType ( ) , "range must be [closed, open), upper bound type was closed" ) ; }
Confirm that the specified range is [ closed open ) .
92
12
142,304
public static long length ( final Range < Long > range ) { checkClosedOpen ( range ) ; return Math . max ( 0L , range . upperEndpoint ( ) - range . lowerEndpoint ( ) ) ; }
Return the length of the specified range .
47
8
142,305
public static List < Long > lengths ( final Iterable < Range < Long > > ranges ) { checkNotNull ( ranges ) ; List < Long > lengths = new ArrayList < Long > ( ) ; for ( Range < Long > range : ranges ) { lengths . add ( length ( range ) ) ; } return lengths ; }
Return the lengths of the specified ranges .
68
8
142,306
public static long length ( final Iterable < Range < Long > > ranges ) { checkNotNull ( ranges ) ; RangeSet < Long > rangeSet = TreeRangeSet . create ( ) ; for ( Range < Long > range : ranges ) { rangeSet . add ( range ) ; } long length = 0L ; for ( Range < Long > range : rangeSet . asRanges ( ) ) { length += length ( range ) ; } return length ; }
Return the sum of lengths of the specified ranges after merging overlapping ranges .
96
14
142,307
public static int count ( final Iterable < Range < Long > > ranges ) { int count = 0 ; for ( Range < Long > range : ranges ) { checkClosedOpen ( range ) ; count ++ ; } return count ; }
Return the count of the specified ranges .
49
8
142,308
static boolean isGapSymbol ( final Symbol symbol ) { return AlphabetManager . getGapSymbol ( ) . equals ( symbol ) || DNATools . getDNA ( ) . getGapSymbol ( ) . equals ( symbol ) ; }
Return true if the specified symbol is a gap symbol .
53
11
142,309
static boolean isMatchSymbol ( final Symbol symbol ) { if ( ! ( symbol instanceof BasisSymbol ) ) { return false ; } BasisSymbol basisSymbol = ( BasisSymbol ) symbol ; Set < Symbol > uniqueSymbols = new HashSet < Symbol > ( ) ; for ( Object o : basisSymbol . getSymbols ( ) ) { Symbol s = ( Symbol ) o ; if ( isGapSymbol ( s ) ) { return false ; } uniqueSymbols . add ( ( Symbol ) o ) ; } return ( uniqueSymbols . size ( ) == 1 ) ; }
Return true if the specified symbol represents an alignment match .
134
11
142,310
public static List < Range < Long > > gaps ( final GappedSymbolList gappedSymbols ) { checkNotNull ( gappedSymbols ) ; List < Range < Long > > gaps = new ArrayList < Range < Long > > ( ) ; int gapStart = - 1 ; for ( int i = 1 , length = gappedSymbols . length ( ) + 1 ; i < length ; i ++ ) { if ( isGapSymbol ( gappedSymbols . symbolAt ( i ) ) ) { if ( gapStart < 0 ) { gapStart = i ; } } else { if ( gapStart > 0 ) { // biojava coordinates are 1-based gaps . add ( Range . closedOpen ( Long . valueOf ( gapStart - 1L ) , Long . valueOf ( i - 1L ) ) ) ; gapStart = - 1 ; } } } if ( gapStart > 0 ) { gaps . add ( Range . closedOpen ( Long . valueOf ( gapStart - 1L ) , Long . valueOf ( gappedSymbols . length ( ) ) ) ) ; } return gaps ; }
Return the gaps in the specified gapped symbol list as 0 - based [ closed open ) ranges .
242
20
142,311
public static List < Range < Long > > matches ( final AlignmentPair alignmentPair ) { checkNotNull ( alignmentPair ) ; List < Range < Long > > matches = new ArrayList < Range < Long > > ( ) ; int matchStart = - 1 ; for ( int i = 1 , length = alignmentPair . length ( ) + 1 ; i < length ; i ++ ) { if ( isMatchSymbol ( alignmentPair . symbolAt ( i ) ) ) { if ( matchStart < 0 ) { matchStart = i ; } } else { if ( matchStart > 0 ) { // biojava coordinates are 1-based matches . add ( Range . closedOpen ( Long . valueOf ( matchStart - 1L ) , Long . valueOf ( i - 1L ) ) ) ; matchStart = - 1 ; } } } if ( matchStart > 0 ) { matches . add ( Range . closedOpen ( Long . valueOf ( matchStart - 1L ) , Long . valueOf ( alignmentPair . length ( ) ) ) ) ; } return matches ; }
Return the alignment matches in the specified alignment pair as 0 - based [ closed open ) ranges .
230
19
142,312
public static List < Range < Long > > mismatches ( final AlignmentPair alignmentPair ) { checkNotNull ( alignmentPair ) ; List < Range < Long > > mismatches = new ArrayList < Range < Long > > ( ) ; int mismatchStart = - 1 ; for ( int i = 1 , length = alignmentPair . length ( ) + 1 ; i < length ; i ++ ) { if ( isMismatchSymbol ( alignmentPair . symbolAt ( i ) ) ) { if ( mismatchStart < 0 ) { mismatchStart = i ; } } else { if ( mismatchStart > 0 ) { // biojava coordinates are 1-based mismatches . add ( Range . closedOpen ( Long . valueOf ( mismatchStart - 1L ) , Long . valueOf ( i - 1L ) ) ) ; mismatchStart = - 1 ; } } } if ( mismatchStart > 0 ) { mismatches . add ( Range . closedOpen ( Long . valueOf ( mismatchStart - 1L ) , Long . valueOf ( alignmentPair . length ( ) ) ) ) ; } return mismatches ; }
Return the alignment mismatches in the specified alignment pair as 0 - based [ closed open ) ranges .
237
20
142,313
public static < C extends Comparable > C center ( final Range < C > range ) { checkNotNull ( range ) ; if ( ! range . hasLowerBound ( ) && ! range . hasUpperBound ( ) ) { throw new IllegalStateException ( "cannot find the center of a range without bounds" ) ; } if ( ! range . hasLowerBound ( ) ) { return range . upperEndpoint ( ) ; } if ( ! range . hasUpperBound ( ) ) { return range . lowerEndpoint ( ) ; } C lowerEndpoint = range . lowerEndpoint ( ) ; C upperEndpoint = range . upperEndpoint ( ) ; if ( upperEndpoint instanceof Integer ) { Integer upper = ( Integer ) upperEndpoint ; Integer lower = ( Integer ) lowerEndpoint ; return ( C ) Integer . valueOf ( ( upper . intValue ( ) + lower . intValue ( ) ) / 2 ) ; } if ( upperEndpoint instanceof Long ) { Long upper = ( Long ) upperEndpoint ; Long lower = ( Long ) lowerEndpoint ; return ( C ) Long . valueOf ( ( upper . longValue ( ) + lower . longValue ( ) ) / 2L ) ; } if ( upperEndpoint instanceof BigInteger ) { BigInteger upper = ( BigInteger ) upperEndpoint ; BigInteger lower = ( BigInteger ) lowerEndpoint ; BigInteger two = BigInteger . valueOf ( 2L ) ; return ( C ) upper . subtract ( lower ) . divide ( two ) ; } // todo: could potentially calculate the center of any range with a discrete domain throw new IllegalStateException ( "cannot find the center of a range whose endpoint type is not Integer, Long, or BigInteger" ) ; }
Return the center of the specified range .
372
8
142,314
public static < C extends Comparable > boolean intersect ( final Range < C > range0 , final Range < C > range1 ) { checkNotNull ( range0 ) ; checkNotNull ( range1 ) ; return range0 . isConnected ( range1 ) && ! range0 . intersection ( range1 ) . isEmpty ( ) ; }
Return true if the specified ranges intersect .
72
8
142,315
public static < C extends Comparable > boolean isLessThan ( final Range < C > range , final C value ) { checkNotNull ( range ) ; checkNotNull ( value ) ; if ( ! range . hasUpperBound ( ) ) { return false ; } if ( range . upperBoundType ( ) == BoundType . OPEN && range . upperEndpoint ( ) . equals ( value ) ) { return true ; } return range . upperEndpoint ( ) . compareTo ( value ) < 0 ; }
Return true if the specified range is strictly less than the specified value .
108
14
142,316
public static < C extends Comparable > boolean isGreaterThan ( final Range < C > range , final C value ) { checkNotNull ( range ) ; checkNotNull ( value ) ; if ( ! range . hasLowerBound ( ) ) { return false ; } if ( range . lowerBoundType ( ) == BoundType . OPEN && range . lowerEndpoint ( ) . equals ( value ) ) { return true ; } return range . lowerEndpoint ( ) . compareTo ( value ) > 0 ; }
Return true if the specified range is strictly greater than the specified value .
108
14
142,317
public static < C extends Comparable > Ordering < Range < C > > orderingByLowerEndpoint ( ) { return new Ordering < Range < C > > ( ) { @ Override public int compare ( final Range < C > left , final Range < C > right ) { return ComparisonChain . start ( ) . compare ( left . hasLowerBound ( ) , right . hasLowerBound ( ) ) . compare ( left . lowerEndpoint ( ) , right . lowerEndpoint ( ) ) . result ( ) ; } } ; }
Return an ordering by lower endpoint over ranges .
113
9
142,318
public static < C extends Comparable > Ordering < Range < C > > reverseOrderingByLowerEndpoint ( ) { Ordering < Range < C >> orderingByLowerEndpoint = orderingByLowerEndpoint ( ) ; return orderingByLowerEndpoint . reverse ( ) ; }
Return a reverse ordering by lower endpoint over ranges .
59
10
142,319
public static < C extends Comparable > Ordering < Range < C > > orderingByUpperEndpoint ( ) { return new Ordering < Range < C > > ( ) { @ Override public int compare ( final Range < C > left , final Range < C > right ) { return ComparisonChain . start ( ) . compare ( left . hasUpperBound ( ) , right . hasUpperBound ( ) ) . compare ( left . upperEndpoint ( ) , right . upperEndpoint ( ) ) . result ( ) ; } } ; }
Return an ordering by upper endpoint over ranges .
116
9
142,320
public static < C extends Comparable > Ordering < Range < C > > reverseOrderingByUpperEndpoint ( ) { Ordering < Range < C >> orderingByUpperEndpoint = orderingByUpperEndpoint ( ) ; return orderingByUpperEndpoint . reverse ( ) ; }
Return a reverse ordering by upper endpoint over ranges .
63
10
142,321
public static MozuUrl getCurrencyExchangeRatesUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/storefront/currencies/exchangerates" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetCurrencyExchangeRates
82
12
142,322
public void extractFromArchive ( final File targetFile , final boolean forceOverwrite ) throws IOException { if ( zipArchive != null ) { ZipEntry entry = zipArchive . getEntry ( targetFile . getName ( ) ) ; if ( entry != null ) { if ( ! targetFile . exists ( ) ) { try { targetFile . createNewFile ( ) ; } catch ( IOException ex ) { throw new JFunkException ( "Error creating file: " + targetFile , ex ) ; } } else if ( ! forceOverwrite ) { return ; } logger . info ( "Loading file '{}' from zip archive..." , targetFile ) ; OutputStream out = null ; InputStream in = null ; try { out = new FileOutputStream ( targetFile ) ; in = zipArchive . getInputStream ( entry ) ; IOUtils . copy ( in , out ) ; } finally { IOUtils . closeQuietly ( in ) ; IOUtils . closeQuietly ( out ) ; } } else { logger . error ( "Could not find file '{}' in zip archive" , targetFile ) ; } } }
Extracts the specified file from this configuration s zip file if applicable .
250
15
142,323
public static MozuUrl getDestinationUrl ( String checkoutId , String destinationId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/destinations/{destinationId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "destinationId" , destinationId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetDestination
151
8
142,324
public static MozuUrl addDestinationUrl ( String checkoutId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/destinations?responseFields={responseFields}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for AddDestination
125
8
142,325
public static MozuUrl removeDestinationUrl ( String checkoutId , String destinationId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/destinations/{destinationId}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "destinationId" , destinationId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for RemoveDestination
120
8
142,326
public static Iterable < VcfSample > samples ( final Readable readable ) throws IOException { checkNotNull ( readable ) ; ParseListener parseListener = new ParseListener ( ) ; VcfParser . parse ( readable , parseListener ) ; return parseListener . getSamples ( ) . values ( ) ; }
Read zero or more VCF samples from the specified readable .
67
12
142,327
private String chooseAlternations ( final String expression ) { StrBuilder sb = new StrBuilder ( expression ) ; int i = 0 ; // Loop until an unescaped pipe symbol appears. while ( UNESCAPED_PIPE_PATTERN . matcher ( sb . toString ( ) ) . find ( ) ) { for ( ; i < sb . length ( ) ; ++ i ) { if ( sb . charAt ( i ) == ' ' ) { if ( sb . charAt ( i - 1 ) == ' ' ) { // escapet continue ; } int start = i ; // Backtrack until an opening bracket is found // to limit the context of alternatives. for ( int closingCount = 0 ; start >= 0 ; -- start ) { char c = sb . charAt ( start ) ; if ( c == ' ' ) { if ( closingCount == 0 ) { break ; } -- closingCount ; } else if ( c == ' ' ) { ++ closingCount ; } } if ( start >= 0 ) { // If an opening brace was found // search for a closing bracket. int end = i ; for ( int openingCount = 0 ; end < sb . length ( ) ; ++ end ) { char c = sb . charAt ( end ) ; if ( c == ' ' ) { ++ openingCount ; } else if ( c == ' ' ) { if ( openingCount == 0 ) { break ; } -- openingCount ; } } String alternative = random . getBoolean ( ) ? sb . substring ( start + 1 , i ) : sb . substring ( i + 1 , end ) ; sb . replace ( start , end + 1 , alternative ) ; i = start + alternative . length ( ) ; break ; } String alternative = random . getBoolean ( ) ? sb . substring ( 0 , i ) : sb . substring ( i + 1 ) ; sb . replace ( 0 , sb . length ( ) + 1 , alternative ) ; break ; } } } return sb . toString ( ) ; }
Resolves alternations by randomly choosing one at a time and adapting the pattern accordingly
444
16
142,328
public String negateString ( final String input , int bad ) { int length = input . length ( ) ; Range [ ] ranges = getRanges ( ) ; int [ ] lengths = new int [ ranges . length ] ; // arrange lengths for ( int i = 0 ; i < lengths . length ; i ++ ) { Range r = ranges [ i ] ; lengths [ i ] = r . getMin ( ) ; length -= r . getMin ( ) ; } /** * distribute remaining lengths */ int i = 0 ; // only 1000 tries otherwise break as it just does not work while ( length > 0 && i < 1000 ) { int index = i % lengths . length ; Range r = ranges [ index ] ; if ( lengths [ index ] < r . getMax ( ) ) { lengths [ index ] += 1 ; length -- ; } i ++ ; } // generate completely negative string String replaceString = generate ( lengths , - 2 ) ; if ( replaceString . length ( ) == 0 ) { log . warn ( "No negative characters possible in this expression. All characters are allowed." ) ; return input ; } // now replace the #bad character in the input string List < Integer > l = new ArrayList < Integer > ( input . length ( ) ) ; for ( i = 0 ; i < input . length ( ) ; i ++ ) { l . add ( i ) ; } if ( bad == - 2 ) { // all false bad = input . length ( ) ; } else if ( bad == - 1 ) { bad = 1 + random . getInt ( input . length ( ) - 1 ) ; } Collections . shuffle ( l ) ; StringBuffer base = new StringBuffer ( input ) ; int j = 0 ; for ( i = 0 ; i < bad ; i ++ ) { int index = l . remove ( 0 ) ; char replaceChar = ' ' ; if ( index < replaceString . length ( ) ) { replaceChar = replaceString . charAt ( index ) ; } while ( ( index == 0 || index >= replaceString . length ( ) || index == input . length ( ) - 1 ) && Character . isSpaceChar ( replaceChar ) ) { replaceChar = replaceString . charAt ( j ) ; j = ( j + 1 ) % replaceString . length ( ) ; } base . setCharAt ( index , replaceChar ) ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "False characters in string; " + input + " became " + base ) ; } return base . toString ( ) ; }
Replaces randomly selected characters in the given string with forbidden characters according to the given expression .
535
18
142,329
public Range [ ] getRanges ( ) { Range [ ] ranges = new Range [ nodes . size ( ) ] ; for ( int i = 0 ; i < ranges . length ; i ++ ) { ranges [ i ] = nodes . get ( i ) . getRange ( ) ; } return ranges ; }
As the regular expression was distributed in separate node every node has its own range . This method returns an array containing all range objects .
64
26
142,330
public String generate ( final int [ ] nodeSizes , final int bad ) { buf . setLength ( 0 ) ; for ( int i = 0 ; i < nodes . size ( ) && i < nodeSizes . length ; i ++ ) { buf . append ( nodes . get ( i ) . getCharacters ( nodeSizes [ i ] , bad ) ) ; } String value = buf . toString ( ) ; buf . setLength ( 0 ) ; return value ; }
Generates a string containing subject to the parameter value only allowed or one half of forbidden characters .
100
19
142,331
public String generate ( final int bad ) { int [ ] sizes = new int [ nodes . size ( ) ] ; for ( int i = 0 ; i < sizes . length ; i ++ ) { Range r = nodes . get ( i ) . getRange ( ) ; sizes [ i ] = r . getMin ( ) + r . getRange ( ) / 2 ; } return generate ( sizes , bad ) ; }
Returns a string whose length is always exactly in the middle of the allowed range
87
15
142,332
public String generate ( int total , final int bad ) { if ( total < 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Character string cannot have a negative length!" ) ; } total = 0 ; } Range [ ] ranges = getRanges ( ) ; int [ ] lengths = new int [ ranges . length ] ; int length = 0 ; // first make sure every single node has at least its minimum length for ( int i = 0 ; i < ranges . length ; i ++ ) { lengths [ i ] = ranges [ i ] . getMin ( ) ; length += lengths [ i ] ; } // now increase each node chosen randomly by one until the extra is consumed int index = 0 ; boolean increase = length < total ; if ( increase ) { boolean maxedOut = total > getRange ( ) . getMax ( ) ; while ( length < total ) { // if maxed out is true, we have more than normal max characters, so // we ignore the local max; if not maxed out, the nodes are not bigger than max if ( ( maxedOut || ranges [ index ] . getMax ( ) > lengths [ index ] ) && choice . get ( ) ) { lengths [ index ] ++ ; length ++ ; } index = ( index + 1 ) % lengths . length ; } } else { boolean minOut = total < getRange ( ) . getMin ( ) ; while ( length > total ) { // if min out is true, we have less than normal min characters, so // we ignore the local min; if not min out, the nodes are not smaller than min if ( ( minOut || ranges [ index ] . getMin ( ) > lengths [ index ] ) && lengths [ index ] > 0 && choice . get ( ) ) { lengths [ index ] -- ; length -- ; } index = ( index + 1 ) % lengths . length ; } } // now we have distributed the character number to all subnodes of this expression // build buffer return generate ( lengths , bad ) ; }
Generates a string with the given length . Thereby the mandatory length will be reached first and then the separate areas are filled with the remaining characters randlomly .
427
34
142,333
private static int intFromSubArray ( final byte [ ] bytes , final int from , final int to ) { final byte [ ] subBytes = Arrays . copyOfRange ( bytes , from , to ) ; final ByteBuffer wrap = ByteBuffer . wrap ( subBytes ) ; return wrap . getInt ( ) ; }
Take a slice of an array of bytes and interpret it as an int .
67
15
142,334
void startArchiving ( ) { if ( isArchivingDisabled ( ) ) { return ; } String archiveName = configuration . get ( JFunkConstants . ARCHIVE_FILE ) ; if ( StringUtils . isBlank ( archiveName ) ) { archiveName = String . format ( DIR_PATTERN , moduleMetaData . getModuleName ( ) , Thread . currentThread ( ) . getName ( ) , FORMAT . format ( moduleMetaData . getStartDate ( ) ) ) ; } moduleArchiveDir = new File ( archiveDir , archiveName ) ; if ( moduleArchiveDir . exists ( ) ) { log . warn ( "Archive directory already exists: {}" , moduleArchiveDir ) ; } else { moduleArchiveDir . mkdirs ( ) ; } addModuleAppender ( ) ; log . info ( "Started archiving: (module={}, moduleArchiveDir={})" , moduleMetaData . getModuleName ( ) , moduleArchiveDir ) ; }
Starts archiving of the specified module if archiving is enabled .
219
14
142,335
@ Override public String initValuesImpl ( final FieldCase ca ) { if ( ca == FieldCase . NULL || ca == FieldCase . BLANK ) { return null ; } // If there still is an mandatory case, a value will be generated anyway if ( ca != null || last && constraint . hasNextCase ( ) || generator . isIgnoreOptionalConstraints ( ) ) { return constraint . initValues ( ca ) ; } if ( choice . isNext ( ) ) { last = true ; return constraint . initValues ( null ) ; } // Initialize the field below with 0 as optional equals false last = false ; constraint . initValues ( FieldCase . NULL ) ; return null ; }
Returns either null or a value . If null is returned the embedded constraint is initialized with FieldCase . NULL . If a value is returned the embedded constraint is initialized with the FieldCase whose value is returned . If the latest value was not not null the next value will be generated if in the case that the embedded constraint still has an mandatory case . This also applies if all optional constraints have been turned of globally using the property IGNORE_CONSTRAINT_OPTIONAL . Otherwise no value will be generated in 50% of the cases or the values of the embedded constraints are returned .
146
118
142,336
public static String spacesOptional ( final String input ) { String output ; output = input . replaceAll ( "\\s" , "\\\\s?" ) ; return output ; }
Replaces a space with the regular expression \\ s?
36
11
142,337
public static MozuUrl getDiscountSettingsUrl ( Integer catalogId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/discountsettings/{catalogId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "catalogId" , catalogId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetDiscountSettings
129
9
142,338
public static Hml read ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return read ( reader ) ; } }
Read HML from the specified file .
50
8
142,339
byte [ ] readSignResponse ( ) throws IOException { // Read the first 9 bytes from the InputStream which are the SSH2_AGENT_SIGN_RESPONSE headers. final byte [ ] headerBytes = readBytes ( 9 , "SSH2_AGENT_SIGN_RESPONSE" ) ; log . debug ( "Received SSH2_AGENT_SIGN_RESPONSE message from ssh-agent." ) ; final SignResponseHeaders headers = SignResponseHeaders . from ( headerBytes ) ; // Read the rest of the SSH2_AGENT_SIGN_RESPONSE message from ssh-agent. // 5 is the sum of the number of bytes of response code and response length final byte [ ] bytes = readBytes ( headers . getLength ( ) - 5 ) ; final ByteIterator iterator = new ByteIterator ( bytes ) ; final byte [ ] responseType = iterator . next ( ) ; final String signatureFormatId = new String ( responseType ) ; if ( ! signatureFormatId . equals ( Rsa . RSA_LABEL ) ) { throw new RuntimeException ( "I unexpectedly got a non-Rsa signature format ID in the " + "SSH2_AGENT_SIGN_RESPONSE's signature blob." ) ; } return iterator . next ( ) ; }
Return an array of bytes from the ssh - agent representing data signed by a private SSH key .
279
19
142,340
public static MozuUrl getTaxableTerritoriesUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/settings/general/taxableterritories" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetTaxableTerritories
77
11
142,341
public static MozuUrl updateTaxableTerritoriesUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/settings/general/taxableterritories" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateTaxableTerritories
77
11
142,342
public static Iterable < VcfRecord > records ( final Readable readable ) throws IOException { checkNotNull ( readable ) ; ParseListener parseListener = new ParseListener ( ) ; VcfParser . parse ( readable , parseListener ) ; return parseListener . getRecords ( ) ; }
Read zero or more VCF records from the specified readable .
63
12
142,343
public Constraint createModel ( final MathRandom random , final Element element ) { if ( element == null ) { return null ; } Class < ? extends Constraint > classObject = null ; Constraint object = null ; try { classObject = getClassObject ( element ) ; Constructor < ? extends Constraint > constructor = getConstructor ( classObject ) ; object = getObject ( random , element , constructor ) ; } catch ( InvocationTargetException ex ) { throw new JFunkException ( "Could not initialise object of class " + classObject , ex . getCause ( ) ) ; } catch ( Exception ex ) { throw new JFunkException ( "Could not initialise object of class " + classObject , ex ) ; } putToCache ( element , object ) ; return object ; }
Generates an instance based on the data in the given object . The object s class will be determined by the class attribute of the element . IF the element contains an id attribute the generated instance is stored in a map using this id as key .
173
49
142,344
public Constraint getModel ( final Element element ) throws IdNotFoundException { Attribute attr = element . getAttribute ( XMLTags . ID ) ; if ( attr == null ) { throw new IdNotFoundException ( null ) ; } Constraint c = null ; final String id = attr . getValue ( ) ; try { c = getModel ( id ) ; } catch ( IdNotFoundException e ) { LOG . debug ( "DummyConstraint fuer id " + id ) ; } if ( c == null ) { c = new DummyConstraint ( ) ; putToCache ( id , c ) ; } return c ; }
Returns the constraint to the associated id attribute value of the passed element . To achieve this the id attribute of the passed element is searched first . If there is none an IdNotFoundException will be thrown . Then the constraint stored under the respective key is returned from the internal table . If this constraint is not found a wrapper is written to the table at the requested key . This way the sequence of the constraints in the XML file does not determine the cross - references by id . The wrapper will be replaced if a constraint already represented by the wrapper in the table is generated later on .
142
116
142,345
public Constraint getModel ( final String id ) throws IdNotFoundException { Constraint e = map . get ( id ) ; if ( e == null ) { throw new IdNotFoundException ( id ) ; } return e ; }
Returns the object in the map with the key id
51
10
142,346
private Class < ? extends Constraint > getClassObject ( final Element element ) throws ClassNotFoundException { String className = element . getAttributeValue ( XMLTags . CLASS ) ; className = className . indexOf ( ' ' ) > 0 ? className : getClass ( ) . getPackage ( ) . getName ( ) + ' ' + className ; return Class . forName ( className ) . asSubclass ( Constraint . class ) ; }
This method returns the class object of which a new instance shall be generated . To achieve this the class attribute of the passed element will be used to determine the class name
100
33
142,347
private Constructor < ? extends Constraint > getConstructor ( final Class < ? extends Constraint > classObject ) throws NoSuchMethodException { return classObject . getConstructor ( new Class [ ] { MathRandom . class , Element . class , Generator . class } ) ; }
Searches for the matching constraint constructor with the parameter types MathRandom Element and Generator .
61
18
142,348
private Constraint getObject ( final MathRandom random , final Element element , final Constructor < ? extends Constraint > constructor ) throws IllegalArgumentException , InstantiationException , IllegalAccessException , InvocationTargetException { LOG . debug ( "Creating constraint: " + element . getAttributes ( ) ) ; Constraint instance = constructor . newInstance ( new Object [ ] { random , element , generator } ) ; injector . injectMembers ( instance ) ; return instance ; }
Generates a new constraint instance using the given constructor the element and the generateor callback as parameters .
101
20
142,349
private void putToCache ( final Element element , final Constraint object ) { String id = element . getAttributeValue ( XMLTags . ID ) ; if ( id != null && id . length ( ) > 0 ) { Constraint old = putToCache ( id , object ) ; if ( old != null ) { LOG . warn ( "The id=" + id + " for object of type=" + old . getClass ( ) . getName ( ) + " was already found. Please make sure this is ok and no mistake." ) ; } } }
If the element has an attribute with name id this attribute s value will be used as key to store the just generated object in a map . The object can in this case also be retrieved using this id .
118
41
142,350
private Constraint putToCache ( final String id , final Constraint object ) { Constraint c = this . map . put ( id , object ) ; if ( c instanceof DummyConstraint ) { ( ( DummyConstraint ) c ) . constraint = object ; return null ; } return c ; }
Puts the given constraint object into the cache using the key id . If an existing DummyConstraint object is found in the table the reference will be set to the constraint and the constraint will not be put into the table .
70
47
142,351
public static Analysis readAnalysis ( final Reader reader ) throws IOException { checkNotNull ( reader ) ; try { JAXBContext context = JAXBContext . newInstance ( Analysis . class ) ; Unmarshaller unmarshaller = context . createUnmarshaller ( ) ; SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; URL commonSchemaURL = SraReader . class . getResource ( "/org/nmdp/ngs/sra/xsd/SRA.common.xsd" ) ; URL analysisSchemaURL = SraReader . class . getResource ( "/org/nmdp/ngs/sra/xsd/SRA.analysis.xsd" ) ; Schema schema = schemaFactory . newSchema ( new StreamSource [ ] { new StreamSource ( commonSchemaURL . toString ( ) ) , new StreamSource ( analysisSchemaURL . toString ( ) ) } ) ; unmarshaller . setSchema ( schema ) ; return ( Analysis ) unmarshaller . unmarshal ( reader ) ; } catch ( JAXBException | SAXException e ) { throw new IOException ( "could not unmarshal Analysis" , e ) ; } }
Read an analysis from the specified reader .
290
8
142,352
public static Analysis readAnalysis ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readAnalysis ( reader ) ; } }
Read an analysis from the specified file .
51
8
142,353
public static Analysis readAnalysis ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readAnalysis ( reader ) ; } }
Read an analysis from the specified URL .
62
8
142,354
public static Analysis readAnalysis ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readAnalysis ( reader ) ; } }
Read an analysis from the specified input stream .
56
9
142,355
public static Experiment readExperiment ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readExperiment ( reader ) ; } }
Read an experiment from the specified file .
53
8
142,356
public static Experiment readExperiment ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readExperiment ( reader ) ; } }
Read an experiment from the specified URL .
64
8
142,357
public static Experiment readExperiment ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readExperiment ( reader ) ; } }
Read an experiment from the specified input stream .
58
9
142,358
public static RunSet readRunSet ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readRunSet ( reader ) ; } }
Read a run set from the specified file .
54
9
142,359
public static RunSet readRunSet ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readRunSet ( reader ) ; } }
Read a run set from the specified URL .
65
9
142,360
public static RunSet readRunSet ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readRunSet ( reader ) ; } }
Read a run set from the specified input stream .
59
10
142,361
public static Sample readSample ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readSample ( reader ) ; } }
Read a sample from the specified file .
51
8
142,362
public static Sample readSample ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readSample ( reader ) ; } }
Read a sample from the specified URL .
62
8
142,363
public static Sample readSample ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readSample ( reader ) ; } }
Read a sample from the specified input stream .
56
9
142,364
public static Study readStudy ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readStudy ( reader ) ; } }
Read a study from the specified file .
51
8
142,365
public static Study readStudy ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readStudy ( reader ) ; } }
Read a study from the specified URL .
62
8
142,366
public static Study readStudy ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readStudy ( reader ) ; } }
Read a study from the specified input stream .
56
9
142,367
public static Submission readSubmission ( final File file ) throws IOException { checkNotNull ( file ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { return readSubmission ( reader ) ; } }
Read a submission from the specified file .
53
8
142,368
public static Submission readSubmission ( final URL url ) throws IOException { checkNotNull ( url ) ; try ( BufferedReader reader = Resources . asCharSource ( url , Charsets . UTF_8 ) . openBufferedStream ( ) ) { return readSubmission ( reader ) ; } }
Read a submission from the specified URL .
64
8
142,369
public static Submission readSubmission ( final InputStream inputStream ) throws IOException { checkNotNull ( inputStream ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( inputStream ) ) ) { return readSubmission ( reader ) ; } }
Read a submission from the specified input stream .
58
9
142,370
protected < T > T getScopedObject ( final Key < T > key , final Provider < T > unscoped , final Map < Key < ? > , Object > scopeMap ) { // ok, because we know what we'd put in before @ SuppressWarnings ( "unchecked" ) T value = ( T ) scopeMap . get ( key ) ; if ( value == null ) { /* * no cache instance present, so we use the one we get from the unscoped provider and * add it to the cache */ value = unscoped . get ( ) ; scopeMap . put ( key , value ) ; } return value ; }
If already present gets the object for the specified key from the scope map . Otherwise it is retrieved from the unscoped provider and stored in the scope map .
135
31
142,371
public static MozuUrl refreshUserAuthTicketUrl ( String refreshToken , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/authtickets/refresh?refreshToken={refreshToken}&responseFields={responseFields}" ) ; formatter . formatUrl ( "refreshToken" , refreshToken ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for RefreshUserAuthTicket
134
10
142,372
public static MozuUrl createUserAuthTicketUrl ( String responseFields , Integer tenantId ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/adminuser/authtickets/tenants?tenantId={tenantId}&responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "tenantId" , tenantId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; }
Get Resource Url for CreateUserAuthTicket
132
10
142,373
public static MozuUrl deleteUserAuthTicketUrl ( String refreshToken ) { UrlFormatter formatter = new UrlFormatter ( "/api/platform/adminuser/authtickets/?refreshToken={refreshToken}" ) ; formatter . formatUrl ( "refreshToken" , refreshToken ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; }
Get Resource Url for DeleteUserAuthTicket
98
10
142,374
public static Iterable < BedRecord > read ( final Readable readable ) throws IOException { checkNotNull ( readable ) ; Collect collect = new Collect ( ) ; stream ( readable , collect ) ; return collect . records ( ) ; }
Read zero or more BED records from the specified readable .
49
12
142,375
public static void stream ( final Readable readable , final BedListener listener ) throws IOException { checkNotNull ( readable ) ; checkNotNull ( listener ) ; BedLineProcessor lineProcessor = new BedLineProcessor ( listener ) ; CharStreams . readLines ( readable , lineProcessor ) ; }
Stream zero or more BED records from the specified readable .
66
12
142,376
public void copy ( final File source ) throws IOException { if ( ! source . exists ( ) ) { LOG . warn ( "File " + source + " cannot be copied as it does not exist" ) ; return ; } if ( equals ( source ) ) { LOG . info ( "Skipping copying of " + source + " as it matches the target" ) ; return ; } File target = isDirectory ( ) ? new File ( this , source . getName ( ) ) : this ; FileUtils . copyFile ( source , target ) ; }
Copies the specified file . If this object is a directory the file will be copied to this directory . If this object represents a file it will be overwritten with the specified file .
117
37
142,377
public void zip ( final File zipFile ) throws IOException { File [ ] files = listFiles ( ) ; if ( files . length == 0 ) { return ; } LOG . info ( "Creating zip file " + zipFile + " from directory " + this ) ; ZipOutputStream zipOut = null ; try { zipOut = new ZipOutputStream ( new FileOutputStream ( zipFile ) ) ; for ( File file : files ) { zip ( "" , file , zipOut ) ; } } finally { IOUtils . closeQuietly ( zipOut ) ; } }
Zips all included objects into the specified file .
122
10
142,378
public static Module loadModulesFromProperties ( final Module jFunkModule , final String propertiesFile ) throws ClassNotFoundException , InstantiationException , IllegalAccessException , IOException { final List < Module > modules = Lists . newArrayList ( ) ; LOG . debug ( "Using jfunk.props.file=" + propertiesFile ) ; Properties props = loadProperties ( propertiesFile ) ; for ( final Enumeration < ? > en = props . propertyNames ( ) ; en . hasMoreElements ( ) ; ) { String name = ( String ) en . nextElement ( ) ; if ( name . startsWith ( "module." ) ) { String className = props . getProperty ( name ) ; LOG . info ( "Loading " + name + "=" + className ) ; Class < ? extends Module > moduleClass = Class . forName ( className ) . asSubclass ( Module . class ) ; Module module = moduleClass . newInstance ( ) ; modules . add ( module ) ; } } return Modules . override ( jFunkModule ) . with ( modules ) ; }
Loads Guice modules whose class names are specified as properties . All properties starting with module . are considered to have a fully qualified class name representing a Guice module . The modules are combined and override thespecified jFunkModule .
234
47
142,379
public Range merge ( final Range otherRange ) { int newMin = Math . min ( otherRange . min , min ) ; int newMax = Math . max ( otherRange . max , max ) ; return new Range ( newMin , newMax ) ; }
Merges this range with the passed range . Returns a range object whose min and max values match the minimum or maximum of the two values respectively . So the range returned contains this and the passed range in any case .
54
43
142,380
public Range sumBoundaries ( final Range plus ) { int newMin = min + plus . min ; int newMax = max == RANGE_MAX || plus . max == RANGE_MAX ? RANGE_MAX : max + plus . max ; return new Range ( newMin , newMax ) ; }
Sums the boundaries of this range with the ones of the passed . So the returned range has this . min + plus . min as minimum and this . max + plus . max as maximum respectively .
64
40
142,381
public Range intersect ( final Range outerRange ) throws RangeException { if ( min > outerRange . max ) { throw new IllegalArgumentException ( "range maximum must be greater or equal than " + min ) ; } if ( max < outerRange . min ) { throw new IllegalArgumentException ( "range minimum must be less or equal than " + max ) ; } int newMin = Math . max ( min , outerRange . min ) ; int newMax = Math . min ( max , outerRange . max ) ; return new Range ( newMin , newMax ) ; }
Intersects this range with the one passed . This means that the returned rand contains the maximum of both minima as minimum and the minimum of the two maxima as maximum .
121
36
142,382
public List < Integer > listValues ( ) { ArrayList < Integer > list = new ArrayList < Integer > ( getRange ( ) ) ; for ( int i = getMin ( ) ; i <= getMax ( ) ; i ++ ) { list . add ( i ) ; } return list ; }
Returns a list of all allowed values within the range
63
10
142,383
public static MozuUrl getCartItemUrl ( String cartItemId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/items/{cartItemId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "cartItemId" , cartItemId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for GetCartItem
128
8
142,384
public static MozuUrl addItemsToCartUrl ( Boolean throwErrorOnInvalidItems ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/bulkitems?throwErrorOnInvalidItems={throwErrorOnInvalidItems}" ) ; formatter . formatUrl ( "throwErrorOnInvalidItems" , throwErrorOnInvalidItems ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for AddItemsToCart
113
9
142,385
public static MozuUrl updateCartItemQuantityUrl ( String cartItemId , Integer quantity , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/items/{cartItemId}/{quantity}?responseFields={responseFields}" ) ; formatter . formatUrl ( "cartItemId" , cartItemId ) ; formatter . formatUrl ( "quantity" , quantity ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for UpdateCartItemQuantity
151
9
142,386
public static MozuUrl removeAllCartItemsUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/items" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for RemoveAllCartItems
72
9
142,387
public static MozuUrl deleteCartItemUrl ( String cartItemId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/carts/current/items/{cartItemId}" ) ; formatter . formatUrl ( "cartItemId" , cartItemId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for DeleteCartItem
97
8
142,388
public static MozuUrl processDigitalWalletUrl ( String checkoutId , String digitalWalletType , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/digitalWallet/{digitalWalletType}?responseFields={responseFields}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "digitalWalletType" , digitalWalletType ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for ProcessDigitalWallet
153
8
142,389
public static VcfHeader header ( final Readable readable ) throws IOException { checkNotNull ( readable ) ; ParseListener parseListener = new ParseListener ( ) ; VcfParser . parse ( readable , parseListener ) ; return parseListener . getHeader ( ) ; }
Read the VCF header from the specified readable .
58
10
142,390
@ Override protected String initValuesImpl ( final FieldCase ca ) { if ( ca == FieldCase . NULL || ca == FieldCase . BLANK ) { return null ; } return field . getString ( control . getNext ( ca ) ) ; }
Returns a string whose length and character type reflect the passed FieldCase using the embedded field object . If FieldCase . NULL or FieldCase . BLANK is passed the method returns null .
53
37
142,391
public static MozuUrl validateTargetRuleUrl ( ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/targetrules/validate" ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; }
Get Resource Url for ValidateTargetRule
70
9
142,392
public static String formatLatitude ( final Latitude latitude , final PointLocationFormatType formatType ) throws FormatterException { if ( latitude == null ) { throw new FormatterException ( "No point location provided" ) ; } if ( formatType == null ) { throw new FormatterException ( "No format type provided" ) ; } final String formatted ; switch ( formatType ) { case HUMAN_LONG : formatted = latitude . toString ( ) ; break ; case HUMAN_MEDIUM : formatted = formatLatitudeHumanMedium ( latitude ) ; break ; case LONG : formatted = formatLatitudeLong ( latitude ) ; break ; case MEDIUM : formatted = formatLatitudeMedium ( latitude ) ; break ; case SHORT : formatted = formatLatitudeShort ( latitude ) ; break ; case DECIMAL : formatted = formatLatitudeWithDecimals ( latitude ) ; break ; default : throw new FormatterException ( "Unsupported format type" ) ; } return formatted ; }
Formats a latitude as an ISO 6709 string .
206
11
142,393
public static String formatLongitude ( final Longitude longitude , final PointLocationFormatType formatType ) throws FormatterException { if ( longitude == null ) { throw new FormatterException ( "No point location provided" ) ; } if ( formatType == null ) { throw new FormatterException ( "No format type provided" ) ; } final String formatted ; switch ( formatType ) { case HUMAN_LONG : formatted = longitude . toString ( ) ; break ; case HUMAN_MEDIUM : formatted = formatLongitudeHumanMedium ( longitude ) ; break ; case LONG : formatted = formatLongitudeLong ( longitude ) ; break ; case MEDIUM : formatted = formatLongitudeMedium ( longitude ) ; break ; case SHORT : formatted = formatLongitudeShort ( longitude ) ; break ; case DECIMAL : formatted = formatLongitudeWithDecimals ( longitude ) ; break ; default : throw new FormatterException ( "Unsupported format type" ) ; } return formatted ; }
Formats a longitude as an ISO 6709 string .
214
12
142,394
public static String formatPointLocation ( final PointLocation pointLocation , final PointLocationFormatType formatType ) throws FormatterException { if ( pointLocation == null ) { throw new FormatterException ( "No point location provided" ) ; } if ( formatType == null ) { throw new FormatterException ( "No format type provided" ) ; } final String formatted ; switch ( formatType ) { case HUMAN_LONG : formatted = pointLocation . toString ( ) ; break ; case HUMAN_MEDIUM : formatted = formatHumanMedium ( pointLocation ) ; break ; case HUMAN_SHORT : formatted = formatHumanShort ( pointLocation ) ; break ; case LONG : formatted = formatISO6709Long ( pointLocation ) ; break ; case MEDIUM : formatted = formatISO6709Medium ( pointLocation ) ; break ; case SHORT : formatted = formatISO6709Short ( pointLocation ) ; break ; case DECIMAL : formatted = formatISO6709WithDecimals ( pointLocation ) ; break ; default : throw new FormatterException ( "Unsupported format type" ) ; } return formatted ; }
Formats a point location as an ISO 6709 or human readable string .
235
15
142,395
private static String formatISO6709WithDecimals ( final PointLocation pointLocation ) { final Latitude latitude = pointLocation . getLatitude ( ) ; final Longitude longitude = pointLocation . getLongitude ( ) ; String string = formatLatitudeWithDecimals ( latitude ) + formatLongitudeWithDecimals ( longitude ) ; final double altitude = pointLocation . getAltitude ( ) ; string = string + formatAltitudeWithSign ( altitude ) ; final String crs = pointLocation . getCoordinateReferenceSystemIdentifier ( ) ; string = string + formatCoordinateReferenceSystemIdentifier ( crs ) ; return string + "/" ; }
Formats a point location as an ISO 6709 string using decimals .
141
16
142,396
private int [ ] sexagesimalSplit ( final double value ) { final double absValue = Math . abs ( value ) ; int units ; int minutes ; int seconds ; final int sign = value < 0 ? - 1 : 1 ; // Calculate absolute integer units units = ( int ) Math . floor ( absValue ) ; seconds = ( int ) Math . round ( ( absValue - units ) * 3600D ) ; // Calculate absolute integer minutes minutes = seconds / 60 ; // Integer arithmetic if ( minutes == 60 ) { minutes = 0 ; units ++ ; } // Calculate absolute integer seconds seconds = seconds % 60 ; // Correct for sign units = units * sign ; minutes = minutes * sign ; seconds = seconds * sign ; return new int [ ] { units , minutes , seconds } ; }
Splits a double value into it s sexagesimal parts . Each part has the same sign as the provided value .
166
24
142,397
public static < N extends Number & Comparable < ? super N > > Point singleton ( final N value ) { checkNotNull ( value ) ; return Geometries . point ( value . doubleValue ( ) , 0.5d ) ; }
Create and return a new point geometry from the specified singleton value .
52
14
142,398
public static < N extends Number & Comparable < ? super N > > Rectangle range ( final Range < N > range ) { checkNotNull ( range ) ; if ( range . isEmpty ( ) ) { throw new IllegalArgumentException ( "range must not be empty" ) ; } if ( ! range . hasLowerBound ( ) || ! range . hasUpperBound ( ) ) { throw new IllegalArgumentException ( "range must have lower and upper bounds" ) ; } Number lowerEndpoint = range . lowerEndpoint ( ) ; BoundType lowerBoundType = range . lowerBoundType ( ) ; Number upperEndpoint = range . upperEndpoint ( ) ; BoundType upperBoundType = range . upperBoundType ( ) ; /* Since we are representing genomic coordinate systems, the expectation is that endpoints are instance of Integer, Long, or BigInteger; thus for open lower and upper bounds we can safely add or substract 1.0 respectively. Then by convention a rectangle with y1 0.0 and height of 1.0 is used. closed(10, 20) --> (10.0, 0.0, 20.0, 1.0) closedOpen(10, 20) --> (10.0, 0.0, 19.0, 1.0) openClosed(10, 20) --> (11.0, 0.0, 20.0, 1.0) open(10, 20) --> (11.0, 0.0, 19.0, 1.0); closed(10, 11) --> (10.0, 0.0, 11.0, 1.0) closedOpen(10, 11) --> (10.0, 0.0, 10.0, 1.0) openClosed(10, 11) --> (11.0, 0.0, 11.0, 1.0) open(10, 11) --> empty, throw exception closed(10, 10) --> (10.0, 0.0, 10.0, 1.0) closedOpen(10, 10) --> empty, throw exception openClosed(10, 10) --> empty, throw exception open(10, 10) --> empty, throw exception */ double x1 = lowerBoundType == BoundType . OPEN ? lowerEndpoint . doubleValue ( ) + 1.0d : lowerEndpoint . doubleValue ( ) ; double y1 = 0.0d ; double x2 = upperBoundType == BoundType . OPEN ? upperEndpoint . doubleValue ( ) - 1.0d : upperEndpoint . doubleValue ( ) ; double y2 = 1.0d ; return Geometries . rectangle ( x1 , y1 , x2 , y2 ) ; }
Create and return a new rectangle geometry from the specified range .
578
12
142,399
static boolean isLeft ( final Fastq fastq ) { checkNotNull ( fastq ) ; return LEFT . matcher ( fastq . getDescription ( ) ) . matches ( ) ; }
Return true if the specified fastq is the left or first read of a paired end read .
41
19