idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
8,800
SchemaFuture installHandlers ( XMLReader in , SchemaReceiverImpl sr ) { Handler h = new Handler ( sr ) ; in . setContentHandler ( h ) ; return h ; }
Installs the schema handler on the reader .
41
9
8,801
private Mode getModeAttribute ( Attributes attributes , String localName ) { return lookupCreateMode ( attributes . getValue ( "" , localName ) ) ; }
Get the mode specified by an attribute from no namespace .
32
11
8,802
private Mode lookupCreateMode ( String name ) { if ( name == null ) return null ; name = name . trim ( ) ; Mode mode = ( Mode ) modeMap . get ( name ) ; if ( mode == null ) { mode = new Mode ( name , defaultBaseMode ) ; modeMap . put ( name , mode ) ; } return mode ; }
Gets a mode with the given name from the mode map . If not present then it creates a new mode extending the default base mode .
75
28
8,803
private Date _advanceToNextDayOfWeekIfNecessary ( final Date aFireTime , final boolean forceToAdvanceNextDay ) { // a. Advance or adjust to next dayOfWeek if need to first, starting next // day with startTimeOfDay. Date fireTime = aFireTime ; final TimeOfDay sTimeOfDay = getStartTimeOfDay ( ) ; final Date fireTimeStartDate = sTimeOfDay . getTimeOfDayForDate ( fireTime ) ; final Calendar fireTimeStartDateCal = _createCalendarTime ( fireTimeStartDate ) ; int nDayOfWeekOfFireTime = fireTimeStartDateCal . get ( Calendar . DAY_OF_WEEK ) ; final int nCalDay = nDayOfWeekOfFireTime ; DayOfWeek eDayOfWeekOfFireTime = PDTHelper . getAsDayOfWeek ( nCalDay ) ; // b2. We need to advance to another day if isAfterTimePassEndTimeOfDay is // true, or dayOfWeek is not set. final Set < DayOfWeek > daysOfWeekToFire = getDaysOfWeek ( ) ; if ( forceToAdvanceNextDay || ! daysOfWeekToFire . contains ( eDayOfWeekOfFireTime ) ) { // Advance one day at a time until next available date. for ( int i = 1 ; i <= 7 ; i ++ ) { fireTimeStartDateCal . add ( Calendar . DATE , 1 ) ; nDayOfWeekOfFireTime = fireTimeStartDateCal . get ( Calendar . DAY_OF_WEEK ) ; final int nCalDay1 = nDayOfWeekOfFireTime ; eDayOfWeekOfFireTime = PDTHelper . getAsDayOfWeek ( nCalDay1 ) ; if ( daysOfWeekToFire . contains ( eDayOfWeekOfFireTime ) ) { fireTime = fireTimeStartDateCal . getTime ( ) ; break ; } } } // Check fireTime not pass the endTime final Date eTime = getEndTime ( ) ; if ( eTime != null && fireTime . getTime ( ) > eTime . getTime ( ) ) { return null ; } return fireTime ; }
Given fireTime time determine if it is on a valid day of week . If so simply return it unaltered if not advance to the next valid week day and set the time of day to the start time of day
475
44
8,804
@ Nonnull public static IScheduler getScheduler ( final boolean bStartAutomatically ) { try { // Don't try to use a name - results in NPE final IScheduler aScheduler = s_aSchedulerFactory . getScheduler ( ) ; if ( bStartAutomatically && ! aScheduler . isStarted ( ) ) aScheduler . start ( ) ; return aScheduler ; } catch ( final SchedulerException ex ) { throw new IllegalStateException ( "Failed to create" + ( bStartAutomatically ? " and start" : "" ) + " scheduler!" , ex ) ; } }
Get the underlying Quartz scheduler
141
6
8,805
@ Nonnull public static SchedulerMetaData getSchedulerMetaData ( ) { try { // Get the scheduler without starting it return s_aSchedulerFactory . getScheduler ( ) . getMetaData ( ) ; } catch ( final SchedulerException ex ) { throw new IllegalStateException ( "Failed to get scheduler metadata" , ex ) ; } }
Get the metadata of the scheduler . The state of the scheduler is not changed within this method .
81
21
8,806
public void setCronExpression ( @ Nonnull final String expression ) throws ParseException { final CronExpression newExp = new CronExpression ( expression ) ; setCronExpression ( newExp ) ; }
Sets the cron expression for the calendar to a new value
46
13
8,807
public static < T extends Key < T > > GroupMatcher < T > groupEquals ( final String compareTo ) { return new GroupMatcher <> ( compareTo , StringOperatorName . EQUALS ) ; }
Create a GroupMatcher that matches groups equaling the given string .
47
14
8,808
public static < T extends Key < T > > GroupMatcher < T > groupStartsWith ( final String compareTo ) { return new GroupMatcher <> ( compareTo , StringOperatorName . STARTS_WITH ) ; }
Create a GroupMatcher that matches groups starting with the given string .
51
14
8,809
public static < T extends Key < T > > GroupMatcher < T > groupEndsWith ( final String compareTo ) { return new GroupMatcher <> ( compareTo , StringOperatorName . ENDS_WITH ) ; }
Create a GroupMatcher that matches groups ending with the given string .
51
14
8,810
public static < T extends Key < T > > GroupMatcher < T > groupContains ( final String compareTo ) { return new GroupMatcher <> ( compareTo , StringOperatorName . CONTAINS ) ; }
Create a GroupMatcher that matches groups containing the given string .
48
13
8,811
public static < U extends Key < U > > KeyMatcher < U > keyEquals ( final U compareTo ) { return new KeyMatcher <> ( compareTo ) ; }
Create a KeyMatcher that matches Keys that equal the given key .
39
14
8,812
public static < T > T instantiate ( Class < T > clazz , CRestConfig crestConfig ) throws InvocationTargetException , IllegalAccessException , InstantiationException , NoSuchMethodException { try { return accessible ( clazz . getDeclaredConstructor ( CRestConfig . class ) ) . newInstance ( crestConfig ) ; } catch ( NoSuchMethodException e ) { return accessible ( clazz . getDeclaredConstructor ( ) ) . newInstance ( ) ; } }
Instanciate the given component class passing the CRestConfig to the constructor if available otherwise uses the default empty constructor .
102
25
8,813
public Object doReverseOne ( JTransfo jTransfo , Object domainObject , SyntheticField toField , Class < ? > toType , String ... tags ) throws JTransfoException { return jTransfo . convertTo ( domainObject , jTransfo . getToSubType ( toType , domainObject ) , tags ) ; }
Do the actual reverse conversion of one object .
73
9
8,814
public void addJobChainLink ( final JobKey firstJob , final JobKey secondJob ) { ValueEnforcer . notNull ( firstJob , "FirstJob" ) ; ValueEnforcer . notNull ( firstJob . getName ( ) , "FirstJob.Name" ) ; ValueEnforcer . notNull ( secondJob , "SecondJob" ) ; ValueEnforcer . notNull ( secondJob . getName ( ) , "SecondJob.Name" ) ; m_aChainLinks . put ( firstJob , secondJob ) ; }
Add a chain mapping - when the Job identified by the first key completes the job identified by the second key will be triggered .
114
25
8,815
private void checkM ( ) throws DatatypeException , IOException { if ( context . length ( ) == 0 ) { appendToContext ( current ) ; } current = reader . read ( ) ; appendToContext ( current ) ; skipSpaces ( ) ; checkArg ( ' ' , "x coordinate" ) ; skipCommaSpaces ( ) ; checkArg ( ' ' , "y coordinate" ) ; boolean expectNumber = skipCommaSpaces2 ( ) ; _checkL ( ' ' , expectNumber ) ; }
Checks an M command .
112
6
8,816
private void checkC ( ) throws DatatypeException , IOException { if ( context . length ( ) == 0 ) { appendToContext ( current ) ; } current = reader . read ( ) ; appendToContext ( current ) ; skipSpaces ( ) ; boolean expectNumber = true ; for ( ; ; ) { switch ( current ) { default : if ( expectNumber ) reportNonNumber ( ' ' , current ) ; return ; case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : break ; } checkArg ( ' ' , "x1 coordinate" ) ; skipCommaSpaces ( ) ; checkArg ( ' ' , "y1 coordinate" ) ; skipCommaSpaces ( ) ; checkArg ( ' ' , "x2 coordinate" ) ; skipCommaSpaces ( ) ; checkArg ( ' ' , "y2 coordinate" ) ; skipCommaSpaces ( ) ; checkArg ( ' ' , "x coordinate" ) ; skipCommaSpaces ( ) ; checkArg ( ' ' , "y coordinate" ) ; expectNumber = skipCommaSpaces2 ( ) ; } }
Checks a C command .
276
6
8,817
public boolean before ( final TimeOfDay timeOfDay ) { if ( timeOfDay . m_nHour > m_nHour ) return true ; if ( timeOfDay . m_nHour < m_nHour ) return false ; if ( timeOfDay . m_nMinute > m_nMinute ) return true ; if ( timeOfDay . m_nMinute < m_nMinute ) return false ; if ( timeOfDay . m_nSecond > m_nSecond ) return true ; if ( timeOfDay . m_nSecond < m_nSecond ) return false ; return false ; // must be equal... }
Determine with this time of day is before the given time of day .
140
16
8,818
@ Nullable public Date getTimeOfDayForDate ( final Date dateTime ) { if ( dateTime == null ) return null ; final Calendar cal = PDTFactory . createCalendar ( ) ; cal . setTime ( dateTime ) ; cal . set ( Calendar . HOUR_OF_DAY , m_nHour ) ; cal . set ( Calendar . MINUTE , m_nMinute ) ; cal . set ( Calendar . SECOND , m_nSecond ) ; cal . clear ( Calendar . MILLISECOND ) ; return cal . getTime ( ) ; }
Return a date with time of day reset to this object values . The millisecond value will be zero .
122
21
8,819
public Document parse ( InputSource inputsource ) throws SAXException , IOException { return verify ( _WrappedBuilder . parse ( inputsource ) ) ; }
Parses the given InputSource and validates the resulting DOM .
33
14
8,820
public Document parse ( File file ) throws SAXException , IOException { return verify ( _WrappedBuilder . parse ( file ) ) ; }
Parses the given File and validates the resulting DOM .
30
13
8,821
public Document parse ( InputStream strm ) throws SAXException , IOException { return verify ( _WrappedBuilder . parse ( strm ) ) ; }
Parses the given InputStream and validates the resulting DOM .
33
14
8,822
public Document parse ( String url ) throws SAXException , IOException { return verify ( _WrappedBuilder . parse ( url ) ) ; }
Parses the given url and validates the resulting DOM .
30
13
8,823
private int convertNonNegativeInteger ( String str ) { str = str . trim ( ) ; DecimalDatatype decimal = new DecimalDatatype ( ) ; if ( ! decimal . lexicallyAllows ( str ) ) return - 1 ; // Canonicalize the value str = decimal . getValue ( str , null ) . toString ( ) ; // Reject negative and fractional numbers if ( str . charAt ( 0 ) == ' ' || str . indexOf ( ' ' ) >= 0 ) return - 1 ; try { return Integer . parseInt ( str ) ; } catch ( NumberFormatException e ) { // Map out of range integers to MAX_VALUE return Integer . MAX_VALUE ; } }
Return Integer . MAX_VALUE for values that are too big
150
12
8,824
private void checkItem ( Element root , Deque < Element > parents ) throws SAXException { Deque < Element > pending = new ArrayDeque < Element > ( ) ; Set < Element > memory = new HashSet < Element > ( ) ; memory . add ( root ) ; for ( Element child : root . children ) { pending . push ( child ) ; } if ( root . itemRef != null ) { for ( String id : root . itemRef ) { Element refElm = idmap . get ( id ) ; if ( refElm != null ) { pending . push ( refElm ) ; } else { err ( "The \u201Citemref\u201D attribute referenced \u201C" + id + "\u201D, but there is no element with an \u201Cid\u201D attribute with that value." , root . locator ) ; } } } boolean memoryError = false ; while ( pending . size ( ) > 0 ) { Element current = pending . pop ( ) ; if ( memory . contains ( current ) ) { memoryError = true ; continue ; } memory . add ( current ) ; if ( ! current . itemScope ) { for ( Element child : current . children ) { pending . push ( child ) ; } } if ( current . itemProp != null ) { properties . remove ( current ) ; if ( current . itemScope ) { if ( ! parents . contains ( current ) ) { parents . push ( root ) ; checkItem ( current , parents ) ; parents . pop ( ) ; } else { err ( "The \u201Citemref\u201D attribute created a circular reference with another item." , current . locator ) ; } } } } if ( memoryError ) { err ( "The \u201Citemref\u201D attribute contained redundant references." , root . locator ) ; } }
Check itemref constraints .
399
5
8,825
public static < T > ContractCondition < T > condition ( final Predicate < T > condition , final Function < T , String > describer ) { return ContractCondition . of ( condition , describer ) ; }
Construct a predicate from the given predicate function and describer .
44
12
8,826
static int compare ( final Date nextFireTime1 , final int priority1 , final TriggerKey key1 , final Date nextFireTime2 , final int priority2 , final TriggerKey key2 ) { if ( nextFireTime1 != null || nextFireTime2 != null ) { if ( nextFireTime1 == null ) return 1 ; if ( nextFireTime2 == null ) return - 1 ; if ( nextFireTime1 . before ( nextFireTime2 ) ) return - 1 ; if ( nextFireTime1 . after ( nextFireTime2 ) ) return 1 ; } int comp = priority2 - priority1 ; if ( comp == 0 ) comp = key1 . compareTo ( key2 ) ; return comp ; }
This static method exists for comparator in TC clustered quartz
152
11
8,827
@ Override public List < Connector > getSipConnectors ( ) { List < Connector > connectors = new ArrayList < Connector > ( ) ; Connector [ ] conns = service . findConnectors ( ) ; for ( Connector conn : conns ) { if ( conn . getProtocolHandler ( ) instanceof SipProtocolHandler ) { connectors . add ( conn ) ; } } return connectors ; }
Return the SipConnectors
91
6
8,828
void perform ( SectionState state ) throws SAXException { final ModeUsage modeUsage = getModeUsage ( ) ; state . reject ( ) ; state . addChildMode ( modeUsage , null ) ; state . addAttributeValidationModeUsage ( modeUsage ) ; }
Perform this action on the session state .
56
9
8,829
public Object getAttribute ( String key ) { Object result ; if ( attributes == null ) { result = null ; } else { result = attributes . get ( key ) ; } return result ; }
Gets an attribute attached to a call . Attributes are arbitrary contextual objects attached to a call .
40
19
8,830
private int reverseIndex ( int k ) { if ( reverseIndexMap == null ) { reverseIndexMap = new int [ attributes . getLength ( ) ] ; for ( int i = 0 , len = indexSet . size ( ) ; i < len ; i ++ ) reverseIndexMap [ indexSet . get ( i ) ] = i + 1 ; } return reverseIndexMap [ k ] - 1 ; }
Gets the index in the filtered set for a given real index . If the reverseIndexMap is not computed it computes it otherwise it just uses the previously computed map .
85
35
8,831
public String getURI ( int index ) { if ( index < 0 || index >= indexSet . size ( ) ) return null ; return attributes . getURI ( indexSet . get ( index ) ) ; }
Get the URI for the index - th attribute .
43
10
8,832
public String getLocalName ( int index ) { if ( index < 0 || index >= indexSet . size ( ) ) return null ; return attributes . getLocalName ( indexSet . get ( index ) ) ; }
Get the local name for the index - th attribute .
45
11
8,833
public String getQName ( int index ) { if ( index < 0 || index >= indexSet . size ( ) ) return null ; return attributes . getQName ( indexSet . get ( index ) ) ; }
Get the QName for the index - th attribute .
45
11
8,834
public String getType ( int index ) { if ( index < 0 || index >= indexSet . size ( ) ) return null ; return attributes . getType ( indexSet . get ( index ) ) ; }
Get the type for the index - th attribute .
43
10
8,835
public String getValue ( int index ) { if ( index < 0 || index >= indexSet . size ( ) ) return null ; return attributes . getValue ( indexSet . get ( index ) ) ; }
Get the value for the index - th attribute .
43
10
8,836
public String getType ( String uri , String localName ) { return attributes . getType ( getRealIndex ( uri , localName ) ) ; }
Get the type of the attribute .
33
7
8,837
public String getValue ( String uri , String localName ) { return attributes . getValue ( getRealIndex ( uri , localName ) ) ; }
Get the value of the attribute .
33
7
8,838
void perform ( SectionState state ) { state . addChildMode ( getModeUsage ( ) , null ) ; state . addAttributeValidationModeUsage ( getModeUsage ( ) ) ; }
Perform this action on the section state .
40
9
8,839
@ Nonnull public CalendarIntervalScheduleBuilder withIntervalInSeconds ( final int intervalInSeconds ) { _validateInterval ( intervalInSeconds ) ; m_nInterval = intervalInSeconds ; m_eIntervalUnit = EIntervalUnit . SECOND ; return this ; }
Specify an interval in the IntervalUnit . SECOND that the produced Trigger will repeat at .
67
20
8,840
@ Nonnull public CalendarIntervalScheduleBuilder withIntervalInMinutes ( final int intervalInMinutes ) { _validateInterval ( intervalInMinutes ) ; m_nInterval = intervalInMinutes ; m_eIntervalUnit = EIntervalUnit . MINUTE ; return this ; }
Specify an interval in the IntervalUnit . MINUTE that the produced Trigger will repeat at .
67
20
8,841
@ Nonnull public CalendarIntervalScheduleBuilder withIntervalInHours ( final int intervalInHours ) { _validateInterval ( intervalInHours ) ; m_nInterval = intervalInHours ; m_eIntervalUnit = EIntervalUnit . HOUR ; return this ; }
Specify an interval in the IntervalUnit . HOUR that the produced Trigger will repeat at .
63
20
8,842
@ Nonnull public CalendarIntervalScheduleBuilder withIntervalInDays ( final int intervalInDays ) { _validateInterval ( intervalInDays ) ; m_nInterval = intervalInDays ; m_eIntervalUnit = EIntervalUnit . DAY ; return this ; }
Specify an interval in the IntervalUnit . DAY that the produced Trigger will repeat at .
62
19
8,843
@ Nonnull public CalendarIntervalScheduleBuilder withIntervalInWeeks ( final int intervalInWeeks ) { _validateInterval ( intervalInWeeks ) ; m_nInterval = intervalInWeeks ; m_eIntervalUnit = EIntervalUnit . WEEK ; return this ; }
Specify an interval in the IntervalUnit . WEEK that the produced Trigger will repeat at .
66
19
8,844
@ Nonnull public CalendarIntervalScheduleBuilder withIntervalInMonths ( final int intervalInMonths ) { _validateInterval ( intervalInMonths ) ; m_nInterval = intervalInMonths ; m_eIntervalUnit = EIntervalUnit . MONTH ; return this ; }
Specify an interval in the IntervalUnit . MONTH that the produced Trigger will repeat at .
67
20
8,845
@ Nonnull public CalendarIntervalScheduleBuilder withIntervalInYears ( final int intervalInYears ) { _validateInterval ( intervalInYears ) ; m_nInterval = intervalInYears ; m_eIntervalUnit = EIntervalUnit . YEAR ; return this ; }
Specify an interval in the IntervalUnit . YEAR that the produced Trigger will repeat at .
62
19
8,846
static int checkResult ( int result ) { if ( exceptionsEnabled && result != cusolverStatus . CUSOLVER_STATUS_SUCCESS ) { throw new CudaException ( cusolverStatus . stringFor ( result ) ) ; } return result ; }
If the given result is not cusolverStatus . CUSOLVER_STATUS_SUCCESS and exceptions have been enabled this method will throw a CudaException with an error message that corresponds to the given result code . Otherwise the given result is simply returned .
57
55
8,847
public NonBlockingProperties getPropertyGroup ( final String sPrefix , final boolean bStripPrefix , final String [ ] excludedPrefixes ) { final NonBlockingProperties group = new NonBlockingProperties ( ) ; String prefix = sPrefix ; if ( ! prefix . endsWith ( "." ) ) prefix += "." ; for ( final String key : m_aProps . keySet ( ) ) { if ( key . startsWith ( prefix ) ) { boolean bExclude = false ; if ( excludedPrefixes != null ) { for ( int i = 0 ; i < excludedPrefixes . length && ! bExclude ; i ++ ) { bExclude = key . startsWith ( excludedPrefixes [ i ] ) ; } } if ( ! bExclude ) { final String value = getStringProperty ( key , "" ) ; if ( bStripPrefix ) group . put ( key . substring ( prefix . length ( ) ) , value ) ; else group . put ( key , value ) ; } } } return group ; }
Get all properties that start with the given prefix .
231
10
8,848
public void partialDeserialize ( TBase < ? , ? > base , DBObject dbObject , TFieldIdEnum ... fieldIds ) throws TException { try { protocol_ . setDBOject ( dbObject ) ; protocol_ . setBaseObject ( base ) ; protocol_ . setFieldIdsFilter ( base , fieldIds ) ; base . read ( protocol_ ) ; } finally { protocol_ . reset ( ) ; } }
Deserialize only a single Thrift object from a byte record .
95
14
8,849
public Verifier newVerifier ( String uri ) throws VerifierConfigurationException , SAXException , IOException { return compileSchema ( uri ) . newVerifier ( ) ; }
parses a schema at the specified location and returns a Verifier object that validates documents by using that schema .
40
24
8,850
public Verifier newVerifier ( File file ) throws VerifierConfigurationException , SAXException , IOException { return compileSchema ( file ) . newVerifier ( ) ; }
parses a schema from the specified file and returns a Verifier object that validates documents by using that schema .
38
24
8,851
public Verifier newVerifier ( InputSource source ) throws VerifierConfigurationException , SAXException , IOException { return compileSchema ( source ) . newVerifier ( ) ; }
parses a schema from the specified InputSource and returns a Verifier object that validates documents by using that schema .
39
25
8,852
public static VerifierFactory newInstance ( String language , ClassLoader classLoader ) throws VerifierConfigurationException { Iterator itr = providers ( VerifierFactoryLoader . class , classLoader ) ; while ( itr . hasNext ( ) ) { VerifierFactoryLoader loader = ( VerifierFactoryLoader ) itr . next ( ) ; try { VerifierFactory factory = loader . createFactory ( language ) ; if ( factory != null ) return factory ; } catch ( Throwable t ) { } // ignore any error } throw new VerifierConfigurationException ( "no validation engine available for: " + language ) ; }
Creates a new instance of a VerifierFactory for the specified schema language .
128
16
8,853
@ Override public void deleteUnpackedWAR ( StandardContext standardContext ) { File unpackDir = new File ( standardHost . getAppBase ( ) , standardContext . getPath ( ) . substring ( 1 ) ) ; if ( unpackDir . exists ( ) ) { ExpandWar . deleteDir ( unpackDir ) ; } }
Make sure an the unpacked WAR is not left behind you would think Tomcat would cleanup an unpacked WAR but it doesn t
72
26
8,854
public boolean sameValue ( Object value1 , Object value2 ) { return ( ( BigDecimal ) value1 ) . compareTo ( ( BigDecimal ) value2 ) == 0 ; }
BigDecimal . equals considers objects distinct if they have the different scales but the same mathematical value . Similarly for hashCode .
40
25
8,855
public void addSchema ( String uri , IslandSchema s ) { if ( schemata . containsKey ( uri ) ) throw new IllegalArgumentException ( ) ; schemata . put ( uri , s ) ; }
adds a new IslandSchema .
51
8
8,856
public String generateNonce ( ) { // Get the time of day and run MD5 over it. Date date = new Date ( ) ; long time = date . getTime ( ) ; Random rand = new Random ( ) ; long pad = rand . nextLong ( ) ; String nonceString = ( Long . valueOf ( time ) ) . toString ( ) + ( Long . valueOf ( pad ) ) . toString ( ) ; byte mdbytes [ ] = messageDigest . digest ( nonceString . getBytes ( ) ) ; // Convert the mdbytes array into a hex string. return toHexString ( mdbytes ) ; }
Generate the challenge string .
136
6
8,857
public static String formatException ( final Exception e ) { final StringBuilder sb = new StringBuilder ( ) ; Throwable t = e ; while ( t != null ) { sb . append ( t . getMessage ( ) ) . append ( "\n" ) ; t = t . getCause ( ) ; } return sb . toString ( ) ; }
Formats the given exception in a multiline error message with all causes .
76
16
8,858
public DailyTimeIntervalScheduleBuilder onDaysOfTheWeek ( final Set < DayOfWeek > onDaysOfWeek ) { ValueEnforcer . notEmpty ( onDaysOfWeek , "OnDaysOfWeek" ) ; m_aDaysOfWeek = onDaysOfWeek ; return this ; }
Set the trigger to fire on the given days of the week .
63
13
8,859
public DailyTimeIntervalScheduleBuilder endingDailyAfterCount ( final int count ) { ValueEnforcer . isGT0 ( count , "Count" ) ; if ( m_aStartTimeOfDay == null ) throw new IllegalArgumentException ( "You must set the startDailyAt() before calling this endingDailyAfterCount()!" ) ; final Date today = new Date ( ) ; final Date startTimeOfDayDate = m_aStartTimeOfDay . getTimeOfDayForDate ( today ) ; final Date maxEndTimeOfDayDate = TimeOfDay . hourMinuteAndSecondOfDay ( 23 , 59 , 59 ) . getTimeOfDayForDate ( today ) ; final long remainingMillisInDay = maxEndTimeOfDayDate . getTime ( ) - startTimeOfDayDate . getTime ( ) ; long intervalInMillis ; if ( m_eIntervalUnit == EIntervalUnit . SECOND ) intervalInMillis = m_nInterval * CGlobal . MILLISECONDS_PER_SECOND ; else if ( m_eIntervalUnit == EIntervalUnit . MINUTE ) intervalInMillis = m_nInterval * CGlobal . MILLISECONDS_PER_MINUTE ; else if ( m_eIntervalUnit == EIntervalUnit . HOUR ) intervalInMillis = m_nInterval * DateBuilder . MILLISECONDS_IN_DAY ; else throw new IllegalArgumentException ( "The IntervalUnit: " + m_eIntervalUnit + " is invalid for this trigger." ) ; if ( remainingMillisInDay - intervalInMillis <= 0 ) throw new IllegalArgumentException ( "The startTimeOfDay is too late with given Interval and IntervalUnit values." ) ; final long maxNumOfCount = ( remainingMillisInDay / intervalInMillis ) ; if ( count > maxNumOfCount ) throw new IllegalArgumentException ( "The given count " + count + " is too large! The max you can set is " + maxNumOfCount ) ; final long incrementInMillis = ( count - 1 ) * intervalInMillis ; final Date endTimeOfDayDate = new Date ( startTimeOfDayDate . getTime ( ) + incrementInMillis ) ; if ( endTimeOfDayDate . getTime ( ) > maxEndTimeOfDayDate . getTime ( ) ) throw new IllegalArgumentException ( "The given count " + count + " is too large! The max you can set is " + maxNumOfCount ) ; final Calendar cal = PDTFactory . createCalendar ( ) ; cal . setTime ( endTimeOfDayDate ) ; final int hour = cal . get ( Calendar . HOUR_OF_DAY ) ; final int minute = cal . get ( Calendar . MINUTE ) ; final int second = cal . get ( Calendar . SECOND ) ; m_aEndTimeOfDay = TimeOfDay . hourMinuteAndSecondOfDay ( hour , minute , second ) ; return this ; }
Calculate and set the endTimeOfDay using count interval and starTimeOfDay . This means that these must be set before this method is call .
655
32
8,860
protected void onValidMarkup ( AppendingStringBuffer responseBuffer , ValidationReport report ) { IRequestablePage responsePage = getResponsePage ( ) ; DocType doctype = getDocType ( responseBuffer ) ; log . info ( "Markup for {} is valid {}" , responsePage != null ? responsePage . getClass ( ) . getName ( ) : "<unable to determine page class>" , doctype . name ( ) ) ; String head = report . getHeadMarkup ( ) ; String body = report . getBodyMarkup ( ) ; int indexOfHeadClose = responseBuffer . lastIndexOf ( "</head>" ) ; responseBuffer . insert ( indexOfHeadClose , head ) ; int indexOfBodyClose = responseBuffer . lastIndexOf ( "</body>" ) ; responseBuffer . insert ( indexOfBodyClose , body ) ; }
Called when the validated markup does not contain any errors .
184
12
8,861
protected void onInvalidMarkup ( AppendingStringBuffer responseBuffer , ValidationReport report ) { String head = report . getHeadMarkup ( ) ; String body = report . getBodyMarkup ( ) ; int indexOfHeadClose = responseBuffer . lastIndexOf ( "</head>" ) ; responseBuffer . insert ( indexOfHeadClose , head ) ; int indexOfBodyClose = responseBuffer . lastIndexOf ( "</body>" ) ; responseBuffer . insert ( indexOfBodyClose , body ) ; }
Called when the validated markup contains errors .
109
9
8,862
< T > Class < T > loadClass ( String name ) throws ClassNotFoundException { ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( null == cl ) { cl = ToHelper . class . getClassLoader ( ) ; } return ( Class < T > ) cl . loadClass ( name ) ; }
Load class with given name from the correct class loader .
74
11
8,863
List < Field > getFields ( Class < ? > clazz ) { List < Field > result = new ArrayList <> ( ) ; Set < String > fieldNames = new HashSet <> ( ) ; Class < ? > searchType = clazz ; while ( ! Object . class . equals ( searchType ) && searchType != null ) { Field [ ] fields = searchType . getDeclaredFields ( ) ; for ( Field field : fields ) { if ( ! fieldNames . contains ( field . getName ( ) ) ) { fieldNames . add ( field . getName ( ) ) ; makeAccessible ( field ) ; result . add ( field ) ; } } searchType = searchType . getSuperclass ( ) ; } return result ; }
Find all declared fields of a class . Fields which are hidden by a child class are not included .
161
20
8,864
Method getMethod ( Class < ? > type , Class < ? > returnType , String name , Class < ? > ... parameters ) { Method method = null ; try { // first try for public methods method = type . getMethod ( name , parameters ) ; if ( null != returnType && ! returnType . isAssignableFrom ( method . getReturnType ( ) ) ) { method = null ; } } catch ( NoSuchMethodException nsme ) { // ignore log . trace ( nsme . getMessage ( ) , nsme ) ; } if ( null == method ) { method = getNonPublicMethod ( type , returnType , name , parameters ) ; } return method ; }
Get method with given name and parameters and given return type .
144
12
8,865
protected static void triggerCustomExceptionHandler ( @ Nonnull final Throwable t , @ Nullable final String sJobClassName , @ Nonnull final IJob aJob ) { exceptionCallbacks ( ) . forEach ( x -> x . onScheduledJobException ( t , sJobClassName , aJob ) ) ; }
Called when an exception of the specified type occurred
69
10
8,866
public static Response toResponse ( Response . Status status , String wwwAuthHeader ) { Response . ResponseBuilder rb = Response . status ( status ) ; if ( wwwAuthHeader != null ) { rb . header ( "WWW-Authenticate" , wwwAuthHeader ) ; } return rb . build ( ) ; }
Maps this exception to a response object .
68
8
8,867
public void execute ( final FifoTask < E > task ) throws InterruptedException { final int id ; synchronized ( this ) { id = idCounter ++ ; taskMap . put ( id , task ) ; while ( activeCounter >= maxThreads ) { wait ( ) ; } activeCounter ++ ; } this . threadPoolExecutor . execute ( new Runnable ( ) { public void run ( ) { try { try { final E outcome = task . runParallel ( ) ; synchronized ( resultMap ) { resultMap . put ( id , new Result ( outcome ) ) ; } } catch ( Throwable th ) { synchronized ( resultMap ) { resultMap . put ( id , new Result ( null , th ) ) ; } } finally { processResults ( ) ; synchronized ( FifoTaskExecutor . this ) { activeCounter -- ; FifoTaskExecutor . this . notifyAll ( ) ; } } } catch ( Exception ex ) { Logger . getLogger ( FifoTaskExecutor . class . getName ( ) ) . log ( Level . SEVERE , ex . getMessage ( ) , ex ) ; } } } ) ; }
Executes the submitted task . If the maximum number of pooled threads is in use this method blocks until one of a them is available .
243
27
8,868
public static String executeProcess ( Map < String , String > env , File workingFolder , String ... command ) throws ProcessException , InterruptedException { ProcessBuilder pb = new ProcessBuilder ( command ) ; if ( workingFolder != null ) { pb . directory ( workingFolder ) ; } if ( env != null ) { pb . environment ( ) . clear ( ) ; pb . environment ( ) . putAll ( env ) ; } pb . redirectErrorStream ( true ) ; int code ; try { Process process = pb . start ( ) ; String payload ; try { code = process . waitFor ( ) ; } catch ( InterruptedException ex ) { process . destroy ( ) ; throw ex ; } payload = Miscellaneous . toString ( process . getInputStream ( ) , "UTF-8" ) ; if ( code == 0 ) { return payload ; } else { StringBuilder sb = new StringBuilder ( "Process returned code: " + code + "." ) ; if ( payload != null ) { sb . append ( "\n" ) . append ( payload ) ; } throw new ProcessException ( code , sb . toString ( ) ) ; } } catch ( IOException ex ) { throw new RuntimeException ( ex ) ; } }
Executes a native process with small stdout and stderr payloads
265
15
8,869
public static int cusolverRfGetMatrixFormat ( cusolverRfHandle handle , int [ ] format , int [ ] diag ) { return checkResult ( cusolverRfGetMatrixFormatNative ( handle , format , diag ) ) ; }
CUSOLVERRF set and get input format
56
10
8,870
public static int cusolverRfSetNumericProperties ( cusolverRfHandle handle , double zero , double boost ) { return checkResult ( cusolverRfSetNumericPropertiesNative ( handle , zero , boost ) ) ; }
CUSOLVERRF set and get numeric properties
54
10
8,871
public static int cusolverRfSetAlgs ( cusolverRfHandle handle , int factAlg , int solveAlg ) { return checkResult ( cusolverRfSetAlgsNative ( handle , factAlg , solveAlg ) ) ; }
CUSOLVERRF choose the triangular solve algorithm
58
10
8,872
public static int cusolverRfSetupHost ( int n , int nnzA , Pointer h_csrRowPtrA , Pointer h_csrColIndA , Pointer h_csrValA , int nnzL , Pointer h_csrRowPtrL , Pointer h_csrColIndL , Pointer h_csrValL , int nnzU , Pointer h_csrRowPtrU , Pointer h_csrColIndU , Pointer h_csrValU , Pointer h_P , Pointer h_Q , /** Output */ cusolverRfHandle handle ) { return checkResult ( cusolverRfSetupHostNative ( n , nnzA , h_csrRowPtrA , h_csrColIndA , h_csrValA , nnzL , h_csrRowPtrL , h_csrColIndL , h_csrValL , nnzU , h_csrRowPtrU , h_csrColIndU , h_csrValU , h_P , h_Q , handle ) ) ; }
CUSOLVERRF setup of internal structures from host or device memory
249
14
8,873
public static int cusolverRfBatchSetupHost ( int batchSize , int n , int nnzA , Pointer h_csrRowPtrA , Pointer h_csrColIndA , Pointer h_csrValA_array , int nnzL , Pointer h_csrRowPtrL , Pointer h_csrColIndL , Pointer h_csrValL , int nnzU , Pointer h_csrRowPtrU , Pointer h_csrColIndU , Pointer h_csrValU , Pointer h_P , Pointer h_Q , /** Output (in the device memory) */ cusolverRfHandle handle ) { return checkResult ( cusolverRfBatchSetupHostNative ( batchSize , n , nnzA , h_csrRowPtrA , h_csrColIndA , h_csrValA_array , nnzL , h_csrRowPtrL , h_csrColIndL , h_csrValL , nnzU , h_csrRowPtrU , h_csrColIndU , h_csrValU , h_P , h_Q , handle ) ) ; }
CUSOLVERRF - batch setup of internal structures from host
270
13
8,874
public static RegexPathTemplate create ( String urlTemplate ) { StringBuffer baseUrl = new StringBuffer ( ) ; Map < String , PathTemplate > templates = new HashMap < String , PathTemplate > ( ) ; CurlyBraceTokenizer t = new CurlyBraceTokenizer ( urlTemplate ) ; while ( t . hasNext ( ) ) { String tok = t . next ( ) ; if ( CurlyBraceTokenizer . insideBraces ( tok ) ) { tok = CurlyBraceTokenizer . stripBraces ( tok ) ; int index = tok . indexOf ( ' ' ) ; // first index of : as it can't appears in the name String name ; Pattern validationPattern ; if ( index > - 1 ) { name = tok . substring ( 0 , index ) ; validationPattern = Pattern . compile ( "^" + tok . substring ( index + 1 ) + "$" ) ; } else { name = tok ; validationPattern = DEFAULT_VALIDATION_PATTERN ; } Validate . isTrue ( TEMPLATE_NAME_PATTERN . matcher ( name ) . matches ( ) , "Template name '%s' doesn't match the expected format: %s" , name , TEMPLATE_NAME_PATTERN ) ; Validate . isFalse ( templates . containsKey ( name ) , "Template name '%s' is already defined!" , name ) ; templates . put ( name , new PathTemplate ( name , validationPattern ) ) ; baseUrl . append ( "{" ) . append ( name ) . append ( "}" ) ; } else { baseUrl . append ( tok ) ; } } String url = baseUrl . toString ( ) ; isTrue ( ! Urls . hasQueryString ( url ) , "Given url contains a query string: %s" , url ) ; return new RegexPathTemplate ( url , templates ) ; }
Creates a regex path template for the given URI template
416
11
8,875
public void addValidator ( Schema schema , ModeUsage modeUsage ) { // adds the schema to this section schemas schemas . addElement ( schema ) ; // creates the validator Validator validator = createValidator ( schema ) ; // adds the validator to this section validators validators . addElement ( validator ) ; // add the validator handler to the list of active handlers activeHandlers . addElement ( validator . getContentHandler ( ) ) ; // add the mode usage to the active handlers attribute mode usage list activeHandlersAttributeModeUsage . addElement ( modeUsage ) ; // compute the attribute processing attributeProcessing = Math . max ( attributeProcessing , modeUsage . getAttributeProcessing ( ) ) ; // add a child mode with this mode usage and the validator content handler childPrograms . addElement ( new Program ( modeUsage , validator . getContentHandler ( ) ) ) ; if ( modeUsage . isContextDependent ( ) ) contextDependent = true ; }
Adds a validator .
213
5
8,876
public static void writeStringToFile ( File file , String data , String charset ) throws IOException { FileOutputStream fos = openOutputStream ( file , false ) ; fos . write ( data . getBytes ( charset ) ) ; fos . close ( ) ; }
Writes a String to a file creating the file if it does not exist .
60
16
8,877
public static Thread pipeAsynchronously ( final InputStream is , final ErrorHandler errorHandler , final boolean closeResources , final OutputStream ... os ) { Thread t = new Thread ( ) { @ Override public void run ( ) { try { pipeSynchronously ( is , closeResources , os ) ; } catch ( Throwable th ) { if ( errorHandler != null ) { errorHandler . onThrowable ( th ) ; } } } } ; t . setDaemon ( true ) ; t . start ( ) ; return t ; }
Asynchronous writing from is to os
113
7
8,878
public static File createFile ( String filePath ) throws IOException { boolean isDirectory = filePath . endsWith ( "/" ) || filePath . endsWith ( "\\" ) ; String formattedFilePath = formatFilePath ( filePath ) ; File f = new File ( formattedFilePath ) ; if ( f . exists ( ) ) { return f ; } if ( isDirectory ) { f . mkdirs ( ) ; } else { f . getParentFile ( ) . mkdirs ( ) ; f . createNewFile ( ) ; } if ( f . exists ( ) ) { f . setExecutable ( true , false ) ; f . setReadable ( true , false ) ; f . setWritable ( true , false ) ; return f ; } throw new IOException ( "Error creating file: " + f . getAbsolutePath ( ) ) ; }
Creates a file in the specified path . Creates also any necessary folder needed to achieve the file level of nesting .
185
24
8,879
public boolean compete ( NamespaceSpecification other ) { // if no wildcard for other then we check coverage if ( "" . equals ( other . wildcard ) ) { return covers ( other . ns ) ; } // split the namespaces at wildcards String [ ] otherParts = split ( other . ns , other . wildcard ) ; // if the given namepsace specification does not use its wildcard // then we just look if the current namespace specification covers it if ( otherParts . length == 1 ) { return covers ( other . ns ) ; } // if no wildcard for the current namespace specification if ( "" . equals ( wildcard ) ) { return other . covers ( ns ) ; } // also for the current namespace specification String [ ] parts = split ( ns , wildcard ) ; // now check if the current namespace specification is just an URI if ( parts . length == 1 ) { return other . covers ( ns ) ; } // now each namespace specification contains wildcards // suppose we have // ns = a1*a2*...*an // and // other.ns = b1*b2*...*bm // then we only need to check matchPrefix(a1, b1) and matchPrefix(an, bn) where // matchPrefix(a, b) means a starts with b or b starts with a. return matchPrefix ( parts [ 0 ] , otherParts [ 0 ] ) && matchPrefix ( parts [ parts . length - 1 ] , otherParts [ otherParts . length - 1 ] ) ; }
Check if this namespace specification competes with another namespace specification .
326
12
8,880
static private boolean matchPrefix ( String s1 , String s2 ) { return s1 . startsWith ( s2 ) || s2 . startsWith ( s1 ) ; }
Checks with either of the strings starts with the other .
38
12
8,881
public boolean covers ( String uri ) { // any namspace covers only the any namespace uri // no wildcard ("") requires equality between namespaces. if ( ANY_NAMESPACE . equals ( ns ) || "" . equals ( wildcard ) ) { return ns . equals ( uri ) ; } String [ ] parts = split ( ns , wildcard ) ; // no wildcard if ( parts . length == 1 ) { return ns . equals ( uri ) ; } // at least one wildcard, we need to check that the start and end are the same // then we get to match a string against a pattern like *p1*...*pn* if ( ! uri . startsWith ( parts [ 0 ] ) ) { return false ; } if ( ! uri . endsWith ( parts [ parts . length - 1 ] ) ) { return false ; } // Check that all remaining parts match the remaining URI. int start = parts [ 0 ] . length ( ) ; int end = uri . length ( ) - parts [ parts . length - 1 ] . length ( ) ; for ( int i = 1 ; i < parts . length - 1 ; i ++ ) { if ( start > end ) { return false ; } int match = uri . indexOf ( parts [ i ] , start ) ; if ( match == - 1 || match + parts [ i ] . length ( ) > end ) { return false ; } start = match + parts [ i ] . length ( ) ; } return true ; }
Checks if a namespace specification covers a specified URI . any namespace pattern covers only the any namespace uri .
321
22
8,882
@ Override public void reloadContext ( ) throws DeploymentException { Archive < ? > archive = mssContainer . getArchive ( ) ; deployableContainer . undeploy ( archive ) ; deployableContainer . deploy ( archive ) ; }
Context related methods
50
3
8,883
private Mode resolve ( Mode mode ) { if ( mode == Mode . CURRENT ) { return currentMode ; } // For an action that does not specify the useMode attribute // we create an anonymous next mode that becomes defined if we // have a nested mode element inside the action. // If we do not have a nested mode then the anonymous mode // is not defined and basically that means we should use the // current mode to perform that action. if ( mode . isAnonymous ( ) && ! mode . isDefined ( ) ) { return currentMode ; } return mode ; }
Resolves the Mode . CURRENT to the currentMode for this mode usage . If Mode . CURRENT is not passed as argument then the same mode is returned with the exception of an anonymous mode that is not defined when we get also the current mode .
118
51
8,884
int getAttributeProcessing ( ) { if ( attributeProcessing == - 1 ) { attributeProcessing = resolve ( mode ) . getAttributeProcessing ( ) ; if ( modeMap != null ) { for ( Enumeration e = modeMap . values ( ) ; e . hasMoreElements ( ) && attributeProcessing != Mode . ATTRIBUTE_PROCESSING_FULL ; ) attributeProcessing = Math . max ( resolve ( ( Mode ) e . nextElement ( ) ) . getAttributeProcessing ( ) , attributeProcessing ) ; } } return attributeProcessing ; }
Get the maximum attribute processing value from the default mode and from all the modes specified in the contexts .
126
20
8,885
public String getMergedJsonFile ( final VFS vfs , final ResourceResolver resolver , final String in ) throws IOException { final VFile file = vfs . find ( "/__temp__json__input" ) ; final List < Resource > resources = getJsonSourceFiles ( resolver . resolve ( in ) ) ; // Hack which tries to replace all non-js sources with js sources in case of // mixed json-input file boolean foundJs = false ; boolean foundNonJs = false ; for ( final Resource resource : resources ) { foundJs |= FilenameUtils . isExtension ( resource . getPath ( ) , "js" ) ; foundNonJs |= ! FilenameUtils . isExtension ( resource . getPath ( ) , "js" ) ; } if ( foundJs && foundNonJs ) { for ( int i = 0 , n = resources . size ( ) ; i < n ; i ++ ) { final Resource resource = resources . get ( i ) ; if ( ! FilenameUtils . isExtension ( resource . getPath ( ) , "js" ) ) { final Resource jsResource = resource . getResolver ( ) . resolve ( FilenameUtils . getName ( FilenameUtils . removeExtension ( resource . getPath ( ) ) + ".js" ) ) ; resources . add ( resources . indexOf ( resource ) , jsResource ) ; resources . remove ( resource ) ; } } } VFSUtils . write ( file , merge ( resources ) ) ; return file . getPath ( ) ; }
Returns a merged temporary file with all contents listed in the given json file paths .
335
16
8,886
private boolean isUniqueFileResolved ( final Set < String > alreadyHandled , final String s ) { return this . uniqueFiles && alreadyHandled . contains ( s ) ; }
Examines a source file whether it is already resolved when it should be unique .
38
16
8,887
public Class < ? > getDomainClass ( Class < ? > toClass ) { Class < ? > declaredClass = getDeclaredDomainClass ( toClass ) ; return classReplacer . replaceClass ( declaredClass ) ; }
Get domain class for transfer object .
47
7
8,888
public boolean validate ( InputSource in ) throws SAXException , IOException { if ( schema == null ) throw new IllegalStateException ( "cannot validate without schema" ) ; if ( validator == null ) validator = schema . createValidator ( instanceProperties ) ; if ( xr == null ) { xr = ResolverFactory . createResolver ( instanceProperties ) . createXMLReader ( ) ; xr . setErrorHandler ( eh ) ; } eh . reset ( ) ; xr . setContentHandler ( validator . getContentHandler ( ) ) ; DTDHandler dh = validator . getDTDHandler ( ) ; if ( dh != null ) xr . setDTDHandler ( dh ) ; try { xr . parse ( in ) ; return ! eh . getHadErrorOrFatalError ( ) ; } finally { validator . reset ( ) ; } }
Validates a document against the currently loaded schema . This can be called multiple times in order to validate multiple documents .
191
23
8,889
public TypeMirror getOperatorKind ( TypeMirror leftMirror , TypeMirror rightMirror , TokenType . BinaryOperator operator ) { if ( leftMirror == null || rightMirror == null ) return null ; TypeKind leftKind = leftMirror . getKind ( ) ; TypeKind rightKind = rightMirror . getKind ( ) ; if ( isString ( leftMirror ) ) return leftMirror ; if ( isString ( rightMirror ) ) return rightMirror ; if ( either ( leftKind , rightKind , TypeKind . BOOLEAN ) ) { if ( operator != null ) { messageUtils . error ( Option . < Element > absent ( ) , "Cannot perform perform the operation '%s' with a boolean type. (%s %s %s)" , operator . toString ( ) , leftMirror , operator . toString ( ) , rightMirror ) ; } return null ; } if ( leftKind . isPrimitive ( ) && rightKind . isPrimitive ( ) ) { if ( typeUtils . isSameType ( leftMirror , rightMirror ) ) return typeUtils . getPrimitiveType ( leftKind ) ; if ( either ( leftKind , rightKind , TypeKind . DOUBLE ) ) return typeUtils . getPrimitiveType ( TypeKind . DOUBLE ) ; if ( either ( leftKind , rightKind , TypeKind . FLOAT ) ) return typeUtils . getPrimitiveType ( TypeKind . FLOAT ) ; if ( either ( leftKind , rightKind , TypeKind . LONG ) ) return typeUtils . getPrimitiveType ( TypeKind . LONG ) ; if ( either ( leftKind , rightKind , TypeKind . INT ) || either ( leftKind , rightKind , TypeKind . CHAR ) || either ( leftKind , rightKind , TypeKind . SHORT ) || either ( leftKind , rightKind , TypeKind . BYTE ) ) { return typeUtils . getPrimitiveType ( TypeKind . INT ) ; } } TypeMirror intMirror = typeUtils . getPrimitiveType ( TypeKind . INT ) ; if ( both ( assignable ( intMirror , leftMirror ) , assignable ( intMirror , rightMirror ) ) ) return intMirror ; TypeMirror longMirror = typeUtils . getPrimitiveType ( TypeKind . LONG ) ; if ( both ( assignable ( longMirror , leftMirror ) , assignable ( longMirror , rightMirror ) ) ) return longMirror ; TypeMirror floatMirror = typeUtils . getPrimitiveType ( TypeKind . FLOAT ) ; if ( both ( assignable ( floatMirror , leftMirror ) , assignable ( floatMirror , rightMirror ) ) ) return floatMirror ; TypeMirror doubleMirror = typeUtils . getPrimitiveType ( TypeKind . DOUBLE ) ; if ( both ( assignable ( doubleMirror , leftMirror ) , assignable ( doubleMirror , rightMirror ) ) ) return doubleMirror ; return null ; }
rules for this method are found here
670
7
8,890
void perform ( ContentHandler handler , SectionState state ) { final ModeUsage modeUsage = getModeUsage ( ) ; if ( handler != null ) state . addActiveHandler ( handler , modeUsage ) ; else state . addAttributeValidationModeUsage ( modeUsage ) ; state . addChildMode ( modeUsage , handler ) ; }
Performs this action on the section state .
69
9
8,891
public Token getNextToken ( ) { Token specialToken = null ; Token matchedToken ; int curPos = 0 ; EOFLoop : for ( ; ; ) { try { curChar = input_stream . BeginToken ( ) ; } catch ( EOFException e ) { jjmatchedKind = 0 ; matchedToken = jjFillToken ( ) ; matchedToken . specialToken = specialToken ; return matchedToken ; } image = jjimage ; image . setLength ( 0 ) ; jjimageLen = 0 ; switch ( curLexState ) { case 0 : jjmatchedKind = 0x7fffffff ; jjmatchedPos = 0 ; curPos = jjMoveStringLiteralDfa0_0 ( ) ; break ; case 1 : jjmatchedKind = 0x7fffffff ; jjmatchedPos = 0 ; curPos = jjMoveStringLiteralDfa0_1 ( ) ; break ; case 2 : jjmatchedKind = 0x7fffffff ; jjmatchedPos = 0 ; curPos = jjMoveStringLiteralDfa0_2 ( ) ; break ; } if ( jjmatchedKind != 0x7fffffff ) { if ( jjmatchedPos + 1 < curPos ) input_stream . backup ( curPos - jjmatchedPos - 1 ) ; if ( ( jjtoToken [ jjmatchedKind >> 6 ] & ( 1L << ( jjmatchedKind & 077 ) ) ) != 0L ) { matchedToken = jjFillToken ( ) ; matchedToken . specialToken = specialToken ; if ( jjnewLexState [ jjmatchedKind ] != - 1 ) curLexState = jjnewLexState [ jjmatchedKind ] ; return matchedToken ; } else { if ( ( jjtoSpecial [ jjmatchedKind >> 6 ] & ( 1L << ( jjmatchedKind & 077 ) ) ) != 0L ) { matchedToken = jjFillToken ( ) ; if ( specialToken == null ) specialToken = matchedToken ; else { matchedToken . specialToken = specialToken ; specialToken = ( specialToken . next = matchedToken ) ; } SkipLexicalActions ( matchedToken ) ; } else SkipLexicalActions ( null ) ; if ( jjnewLexState [ jjmatchedKind ] != - 1 ) curLexState = jjnewLexState [ jjmatchedKind ] ; continue EOFLoop ; } } int error_line = input_stream . getEndLine ( ) ; int error_column = input_stream . getEndColumn ( ) ; String error_after = null ; boolean EOFSeen = false ; try { input_stream . readChar ( ) ; input_stream . backup ( 1 ) ; } catch ( EOFException e1 ) { EOFSeen = true ; error_after = curPos <= 1 ? "" : input_stream . GetImage ( ) ; if ( curChar == ' ' || curChar == ' ' ) { error_line ++ ; error_column = 0 ; } else error_column ++ ; } if ( ! EOFSeen ) { input_stream . backup ( 1 ) ; error_after = curPos <= 1 ? "" : input_stream . GetImage ( ) ; } throw new TokenMgrError ( EOFSeen , curLexState , error_line , error_column , error_after , curChar , TokenMgrError . LEXICAL_ERROR ) ; } }
Get the next Token .
745
5
8,892
@ Override public String filter ( String value , String previousValue ) { if ( previousValue != null && value . length ( ) > previousValue . length ( ) ) return value ; return value . equals ( "0" ) || value . equals ( "0.0" ) ? "" : value ; }
The default filter removes the display of 0 or 0 . 0 if the user has erased the text . This is to prevent a number being shown when the user tries to erase it .
64
36
8,893
public String ipToString ( long ip ) { // if ip is bigger than 255.255.255.255 or smaller than 0.0.0.0 if ( ip > 4294967295l || ip < 0 ) { throw new IllegalArgumentException ( "invalid ip" ) ; } val ipAddress = new StringBuilder ( ) ; for ( int i = 3 ; i >= 0 ; i -- ) { int shift = i * 8 ; ipAddress . append ( ( ip & ( 0xff << shift ) ) >> shift ) ; if ( i > 0 ) { ipAddress . append ( "." ) ; } } return ipAddress . toString ( ) ; }
Returns the 32bit dotted format of the provided long ip .
142
12
8,894
void outputComplementDirect ( StringBuffer buf ) { if ( ! surrogatesDirect && getContainsBmp ( ) == NONE ) buf . append ( "[\u0000-\uFFFF]" ) ; else { buf . append ( "[^" ) ; inClassOutputDirect ( buf ) ; buf . append ( ' ' ) ; } }
must not call if containsBmp == ALL && !surrogatesDirect
73
15
8,895
public Object doConvertOne ( JTransfo jTransfo , Object toObject , Class < ? > domainObjectType , String ... tags ) throws JTransfoException { return jTransfo . convertTo ( toObject , domainObjectType , tags ) ; }
Do the actual conversion of one object .
55
8
8,896
public static URIResolver createSAXURIResolver ( Resolver resolver ) { final SAXResolver saxResolver = new SAXResolver ( resolver ) ; return new URIResolver ( ) { public Source resolve ( String href , String base ) throws TransformerException { try { return saxResolver . resolve ( href , base ) ; } catch ( SAXException e ) { throw toTransformerException ( e ) ; } catch ( IOException e ) { throw new TransformerException ( e ) ; } } } ; }
Creates a URIResolver that returns a SAXSource .
117
14
8,897
public void addConverters ( Converter converter , String ... tags ) { for ( String tag : tags ) { if ( tag . startsWith ( "!" ) ) { notConverters . put ( tag . substring ( 1 ) , converter ) ; } else { converters . put ( tag , converter ) ; } } }
Add the converter which should be used for a specific tag .
70
12
8,898
public void checkValid ( CharSequence literal ) throws DatatypeException { // TODO find out what kind of thread concurrency guarantees are made ContextFactory cf = new ContextFactory ( ) ; Context cx = cf . enterContext ( ) ; RegExpImpl rei = new RegExpImpl ( ) ; String anchoredRegex = "^(?:" + literal + ")$" ; try { rei . compileRegExp ( cx , anchoredRegex , "" ) ; } catch ( EcmaError ee ) { throw newDatatypeException ( ee . getErrorMessage ( ) ) ; } finally { Context . exit ( ) ; } }
Checks that the value compiles as an anchored JavaScript regular expression .
137
14
8,899
public static < T extends Key < T > > NameMatcher < T > nameEquals ( final String compareTo ) { return new NameMatcher <> ( compareTo , StringOperatorName . EQUALS ) ; }
Create a NameMatcher that matches names equaling the given string .
47
14