idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
121,000
protected boolean hasChildrenValuesLoaded ( ) { for ( int i = 0 ; i < variables . length ; ++ i ) { if ( variables [ i ] != null ) { return true ; } } return false ; }
Tests that some of the children are already created .
121,001
public Value check ( ILexNameToken name ) { Value v = get ( name ) ; if ( v != null ) { return v ; } if ( freeVariables != null ) { v = freeVariables . get ( name ) ; if ( v != null ) { return v ; } } v = assistantFactory . createSClassDefinitionAssistant ( ) . getStatic ( classdef , name ) ; if ( v != null ) { return ...
Check for the name in the current context and classdef and if not present search the global context . Note that the context chain is not followed .
121,002
public synchronized boolean compatible ( PType to , PType from ) { done . clear ( ) ; return searchCompatible ( to , from , false ) == Result . Yes ; }
Test whether the two types are compatible . This means that at runtime it is possible that the two types are the same or sufficiently similar that the from value can be assigned to the to value .
121,003
private Result allCompatible ( List < PType > to , List < PType > from , boolean paramOnly ) { if ( to . size ( ) != from . size ( ) ) { return Result . No ; } else { for ( int i = 0 ; i < to . size ( ) ; i ++ ) { if ( searchCompatible ( to . get ( i ) , from . get ( i ) , paramOnly ) == Result . No ) { return Result ....
Compare two type lists for placewise compatibility . This is used to check ordered lists of types such as those in a ProductType or parameters to a function or operation .
121,004
private Result allSubTypes ( List < PType > sub , List < PType > sup , boolean invignore ) { if ( sub . size ( ) != sup . size ( ) ) { return Result . No ; } else { for ( int i = 0 ; i < sub . size ( ) ; i ++ ) { if ( searchSubType ( sub . get ( i ) , sup . get ( i ) , invignore ) == Result . No ) { return Result . No ...
Compare two type lists for placewise subtype compatibility . This is used to check ordered lists of types such as those in a ProductType or parameters to a function or operation .
121,005
public PTypeList checkComposeTypes ( PType type , Environment env , boolean newTypes ) { PTypeList undefined = new PTypeList ( ) ; for ( PType compose : env . af . createPTypeAssistant ( ) . getComposeTypes ( type ) ) { ARecordInvariantType composeType = ( ARecordInvariantType ) compose ; PDefinition existing = env . f...
Check that the compose types that are referred to in a type have a matching definition in the environment . The method returns a list of types that do not exist if the newTypes parameter is passed .
121,006
public PType intersect ( PType a , PType b ) { Set < PType > tsa = new HashSet < PType > ( ) ; Set < PType > tsb = new HashSet < PType > ( ) ; boolean resolved = false ; while ( ! resolved ) { if ( a instanceof ABracketType ) { a = ( ( ABracketType ) a ) . getType ( ) ; continue ; } if ( b instanceof ABracketType ) { b...
Calculate the intersection of two types .
121,007
public PStm findStatement ( PStm stm , int lineno ) { try { return stm . apply ( af . getStatementFinder ( ) , lineno ) ; } catch ( AnalysisException e ) { return null ; } }
Find a statement starting on the given line . Single statements just compare their location to lineno but block statements and statements with sub - statements iterate over their branches .
121,008
public Boolean writeThyFiles ( String path ) throws IOException { File modelThyFile = new File ( path + modelThyName ) ; FileUtils . writeStringToFile ( modelThyFile , modelThy . getContent ( ) ) ; File posThyFile = new File ( path + posThyName ) ; FileUtils . writeStringToFile ( posThyFile , posThy ) ; return true ; }
Write Isabelle theory files to disk for the model and proof obligations
121,009
public boolean hasSupertype ( AClassType sclass , PType other ) { return af . createSClassDefinitionAssistant ( ) . hasSupertype ( sclass . getClassdef ( ) , other ) ; }
Used in the SClassDefinitionAssistantTC .
121,010
public boolean isConstructor ( PDefinition def ) { if ( def instanceof AExplicitOperationDefinition ) { AExplicitOperationDefinition op = ( AExplicitOperationDefinition ) def ; return op . getIsConstructor ( ) ; } else if ( def instanceof AImplicitOperationDefinition ) { AImplicitOperationDefinition op = ( AImplicitOpe...
Test whether a definition is a class constructor .
121,011
public boolean inConstructor ( Environment env ) { PDefinition encl = env . getEnclosingDefinition ( ) ; if ( encl != null ) { return isConstructor ( encl ) ; } return false ; }
Test whether the calling environment indicates that we are within a constructor .
121,012
public ImageDescriptor getCUResourceImageDescriptor ( IFile file , int flags ) { Point size = useSmallSize ( flags ) ? SMALL_SIZE : BIG_SIZE ; return new VdmElementImageDescriptor ( VdmPluginImages . DESC_OBJS_CUNIT_RESOURCE , 0 , size ) ; }
Returns an image descriptor for a compilation unit not on the class path . The descriptor includes overlays if specified .
121,013
public static Display getStandardDisplay ( ) { Display display ; display = Display . getCurrent ( ) ; if ( display == null ) display = Display . getDefault ( ) ; return display ; }
Returns the standard display to be used . The method first checks if the thread calling this method has an associated display . If so this display is returned . Otherwise the method returns the default display .
121,014
public static int getButtonWidthHint ( Button button ) { button . setFont ( JFaceResources . getDialogFont ( ) ) ; PixelConverter converter = new PixelConverter ( button ) ; int widthHint = converter . convertHorizontalDLUsToPixels ( IDialogConstants . BUTTON_WIDTH ) ; return Math . max ( widthHint , button . computeSi...
Returns a width hint for a button control .
121,015
public static void setAccessibilityText ( Control control , final String text ) { control . getAccessible ( ) . addAccessibleListener ( new AccessibleAdapter ( ) { public void getName ( AccessibleEvent e ) { e . result = text ; } } ) ; }
Adds an accessibility listener returning the given fixed name .
121,016
protected void valueChanged ( ) { String newValue = fViewer . getDocument ( ) . get ( ) ; if ( ! newValue . equals ( fOldValue ) ) { fOldValue = newValue ; } refreshValidState ( ) ; }
Handle that the value changed
121,017
private List < PMultipleBind > getSetBindList ( ILexNameToken finmap , ILexNameToken findex ) { AMapDomainUnaryExp domExp = new AMapDomainUnaryExp ( ) ; domExp . setType ( new ABooleanBasicType ( ) ) ; domExp . setExp ( getVarExp ( finmap ) ) ; return getMultipleSetBindList ( domExp , findex ) ; }
idx in set dom m
121,018
public PExp defaultSBinaryExp ( SBinaryExp node , Substitution question ) throws AnalysisException { PExp subl = node . getLeft ( ) . clone ( ) . apply ( main , question ) ; PExp subr = node . getRight ( ) . clone ( ) . apply ( main , question ) ; node . setLeft ( subl . clone ( ) ) ; node . setRight ( subr . clone ( )...
Let s try to do most stuff with S family
121,019
public PExp caseAExistsExp ( AExistsExp node , Substitution question ) throws AnalysisException { PExp sub = node . getPredicate ( ) . clone ( ) . apply ( main , question ) ; node . setPredicate ( sub . clone ( ) ) ; return node ; }
cases here for what we need
121,020
public void typeCheck ( AFromModuleImports ifm , ModuleEnvironment env ) throws AnalysisException { TypeCheckVisitor tc = new TypeCheckVisitor ( ) ; TypeCheckInfo question = new TypeCheckInfo ( af , env , null , null ) ; for ( List < PImport > ofType : ifm . getSignatures ( ) ) { for ( PImport imp : ofType ) { imp . ap...
Overloads the typeCheck method of this class .
121,021
public static Value abort ( LocatedException e , Context ctxt ) { throw new ContextException ( e . number , e . getMessage ( ) , e . location , ctxt ) ; }
Abort the runtime interpretation of the definition throwing a ContextException to indicate the call stack . The information is based on that in the Exception passed .
121,022
public static void patternFail ( int number , String msg , ILexLocation location ) throws PatternMatchException { throw new PatternMatchException ( number , msg , location ) ; }
Throw a PatternMatchException with the given message .
121,023
public static Value patternFail ( ValueException ve , ILexLocation location ) throws PatternMatchException { throw new PatternMatchException ( ve . number , ve . getMessage ( ) , location ) ; }
Throw a PatternMatchException with a message from the ValueException .
121,024
private static boolean isBrowserDead ( ) { try { if ( ( ( FramesTransparentWebDriver ) getDriver ( ) ) . getWrappedDriver ( ) instanceof AppiumDriver ) { getDriver ( ) . getPageSource ( ) ; } else { getDriver ( ) . getCurrentUrl ( ) ; } return false ; } catch ( Throwable t ) { Report . jenkins ( "*****BROWSER IS DEAD E...
Checks whether browser is dead . Used to catch situations like Error communicating with the remote browser . It may have died . exceptions
121,025
public static ExpectedCondition < List < WebElement > > visibilityOfFirstElements ( final By locator ) { return new ExpectedCondition < List < WebElement > > ( ) { public List < WebElement > apply ( final WebDriver driver ) { return getFirstVisibleWebElements ( driver , null , locator ) ; } public String toString ( ) {...
Expected condition to look for elements in frames that will return as soon as elements are found in any frame
121,026
private static boolean isAvailable ( WebElement element ) { return element . isDisplayed ( ) || isElementHiddenUnderScroll ( element ) && ! element . getCssValue ( "visibility" ) . equals ( "hidden" ) ; }
Defines whether it s possible to work with element i . e . is displayed or located under scroll .
121,027
private static boolean isElementHiddenUnderScroll ( WebElement element ) { return ExecutionUtils . isFF ( ) && element . getLocation ( ) . getX ( ) > 0 && element . getLocation ( ) . getY ( ) > 0 ; }
Trick with zero coordinates for not - displayed element works only in FF
121,028
public void append ( byte [ ] toWrite ) throws BitsyException { ByteBuffer buf = ByteBuffer . wrap ( toWrite ) ; append ( buf ) ; }
This method appends a line to the file channel
121,029
private IEdge removeEdgeOnVertexDelete ( UUID edgeId ) throws BitsyException { BitsyEdge edge = changedEdges . remove ( edgeId ) ; assert ( edge != null ) ; return edge ; }
This method is called to remove an edge through the IEdgeRemover
121,030
public boolean sizeBiggerThan24 ( ) { int currentSize = 0 ; for ( int i = 0 ; i < elements . length ; i ++ ) { Object elem = elements [ i ] ; if ( elem == null ) { continue ; } else if ( elem instanceof ArraySet ) { return true ; } else if ( elem instanceof SetMax ) { return true ; } else { currentSize += CompactSet . ...
This method goes over the elements to see if this compact set can be fit inside a Set24
121,031
public boolean isMatch ( Endpoint other ) { assert isMarker ( ) : "isMatch can only be used on marker end-points" ; int ans = 0 ; if ( edgeLabel == null ) { return true ; } if ( other . getEdgeLabel ( ) == null ) { return false ; } ans = edgeLabel . compareTo ( other . getEdgeLabel ( ) ) ; if ( ans != 0 ) { return fals...
This method must only be called on marker endpoints i . e . end - points used for matching existing Endpoints in the B - Tree . It returns true if the given Endpoint matches this marker
121,032
public boolean checkObsolete ( IGraphStore store , boolean isReorg , int lineNo , String fileName ) { if ( type == RecordType . T ) { return isReorg ; } else if ( type == RecordType . L ) { return false ; } else if ( ( type != RecordType . V ) && ( type != RecordType . E ) ) { throw new BitsyException ( BitsyErrorCodes...
This method checks to see if a record is obsolete i . e . its version is not present in the store
121,033
public static int getQueueSize ( ) { if ( instance != null && instance . executor != null ) { return instance . executor . getQueue ( ) . size ( ) ; } else { return 0 ; } }
Returns the current queue size .
121,034
public static synchronized void initialize ( GerritWorkersConfig config ) { if ( instance == null ) { instance = new GerritSendCommandQueue ( ) ; } getInstance ( ) . startQueue ( config ) ; }
Initializes the singleton instance and configures it .
121,035
public String asUrlPart ( ) { try { return encode ( projectName ) + "~" + encode ( branchName ) + "~" + id ; } catch ( UnsupportedEncodingException e ) { String parameter = projectName + "~" + branchName + "~" + id ; logger . error ( "Failed to encode ChangeId {}, falling back to unencoded {}" , this , parameter ) ; re...
As the part of the URL .
121,036
public boolean sendCommand ( String command ) { try { sendCommand2 ( command ) ; } catch ( Exception ex ) { logger . error ( "Could not run command " + command , ex ) ; return false ; } return true ; }
Sends a command to the Gerrit server .
121,037
public String sendCommandStr ( String command ) { String str = null ; try { str = sendCommand2 ( command ) ; } catch ( Exception ex ) { logger . error ( "Could not run command " + command , ex ) ; } return str ; }
Sends a command to the Gerrit server returning the output from the command .
121,038
public String sendCommand2 ( String command ) throws IOException { String str = null ; SshConnection ssh = null ; try { ssh = SshConnectionFactory . getConnection ( config . getGerritHostName ( ) , config . getGerritSshPort ( ) , config . getGerritProxy ( ) , config . getGerritAuthentication ( ) ) ; str = ssh . execute...
Runs a command on the gerrit server and returns the output from the command .
121,039
private static KeyPair parsePrivateKeyFile ( File keyFile ) { if ( keyFile == null ) { return null ; } try { JSch jsch = new JSch ( ) ; KeyPair key = KeyPair . load ( jsch , keyFile . getAbsolutePath ( ) ) ; return key ; } catch ( JSchException ex ) { return null ; } }
Parses the keyFile hiding any Exceptions that might occur .
121,040
public static boolean checkPassPhrase ( File keyFilePath , String passPhrase ) { KeyPair key = parsePrivateKeyFile ( keyFilePath ) ; boolean isValidPhrase = passPhrase != null && ! passPhrase . trim ( ) . isEmpty ( ) ; if ( key == null ) { return false ; } else if ( key . isEncrypted ( ) != isValidPhrase ) { return fal...
Checks to see if the passPhrase is valid for the private key file .
121,041
private HttpPost createHttpPostEntity ( ReviewInput reviewInput , String reviewEndpoint ) { HttpPost httpPost = new HttpPost ( reviewEndpoint ) ; String asJson = GSON . toJson ( reviewInput ) ; StringEntity entity = null ; try { entity = new StringEntity ( asJson ) ; } catch ( UnsupportedEncodingException e ) { logger ...
Construct the post .
121,042
public synchronized void connect ( ) throws IOException { logger . debug ( "connecting..." ) ; Authentication auth = authentication ; if ( updater != null ) { Authentication updatedAuth = updater . updateAuthentication ( authentication ) ; if ( updatedAuth != null && auth != updatedAuth ) { auth = updatedAuth ; } } try...
Connects the connection .
121,043
public synchronized String executeCommand ( String command ) throws SshException { if ( ! isConnected ( ) ) { throw new IllegalStateException ( "Not connected!" ) ; } Channel channel = null ; try { logger . debug ( "Opening channel" ) ; channel = connectSession . openChannel ( CMD_EXEC ) ; ( ( ChannelExec ) channel ) ....
Execute an ssh command on the server . After the command is sent the used channel is disconnected .
121,044
private static void waitForChannelClosure ( Channel channel , long timoutInMs ) { final long start = System . currentTimeMillis ( ) ; final long until = start + timoutInMs ; try { while ( ! channel . isClosed ( ) && System . currentTimeMillis ( ) < until ) { Thread . sleep ( CLOSURE_WAIT_INTERVAL ) ; } logger . trace (...
Blocks until the given channel is close or the timout is reached
121,045
public synchronized Reader executeCommandReader ( String command ) throws SshException , IOException { if ( ! isConnected ( ) ) { throw new IllegalStateException ( "Not connected!" ) ; } try { Channel channel = connectSession . openChannel ( "exec" ) ; ( ( ChannelExec ) channel ) . setCommand ( command ) ; InputStreamR...
Execute an ssh command on the server without closing the session so that a Reader can be returned with streaming data from the server .
121,046
public synchronized void disconnect ( ) { if ( connectSession != null ) { logger . debug ( "Disconnecting client connection." ) ; connectSession . disconnect ( ) ; connectSession = null ; } }
Disconnects the connection .
121,047
public static GerritJsonEvent getEventIfInteresting ( String jsonString ) { logger . trace ( "finding event for jsonString: {}" , jsonString ) ; try { JSONObject jsonObject = getJsonObjectIfInterestingAndUsable ( jsonString ) ; if ( jsonObject != null ) { return getEvent ( jsonObject ) ; } } catch ( Exception ex ) { lo...
Tries to parse the provided string into a GerritJsonEvent DTO if it is interesting and usable .
121,048
public static String getString ( JSONObject json , String key , String defaultValue ) { if ( json . containsKey ( key ) ) { return json . getString ( key ) ; } else { return defaultValue ; } }
Returns the value of a JSON property as a String if it exists otherwise returns the defaultValue .
121,049
public static boolean getBoolean ( JSONObject json , String key , boolean defaultValue ) { if ( json . containsKey ( key ) ) { boolean result ; try { result = json . getBoolean ( key ) ; } catch ( JSONException ex ) { result = defaultValue ; } return result ; } else { return defaultValue ; } }
Returns the value of a JSON property as a boolean if it exists and boolean value otherwise returns the defaultValue .
121,050
public static Date getDate ( JSONObject json , String key ) { return getDate ( json , key , null ) ; }
Returns the value of a JSON property as a Date if it exists otherwise returns null .
121,051
public static Date getDate ( JSONObject json , String key , Date defaultValue ) { Date result = defaultValue ; if ( json . containsKey ( key ) ) { try { String secondsString = json . getString ( key ) ; Long milliseconds = TimeUnit . SECONDS . toMillis ( Long . parseLong ( secondsString ) ) ; result = new Date ( millis...
Returns the value of a JSON property as a Date if it exists otherwise returns the defaultValue .
121,052
public void setEventCreatedOn ( String eventCreatedOn ) { Long milliseconds = TimeUnit . SECONDS . toMillis ( Long . parseLong ( eventCreatedOn ) ) ; this . eventCreatedOn = new Date ( milliseconds ) ; }
Gerrit server - based time stamp when the event was created by Gerrit Server . ONLY USE FOR UNIT TESTS!
121,053
public boolean isExceptionAtThisTime ( ) { Time now = new Time ( ) ; for ( TimeSpan span : timesOfDay ) { if ( span . isWithin ( now ) ) { return true ; } } return false ; }
If the current time is configured as an exception .
121,054
public boolean isExceptionToday ( ) { if ( daysOfWeek != null && daysOfWeek . length > 0 ) { int dayOfWeekNow = Calendar . getInstance ( ) . get ( Calendar . DAY_OF_WEEK ) ; for ( int exceptionDay : daysOfWeek ) { if ( exceptionDay == dayOfWeekNow ) { return true ; } } } return false ; }
If today is a day configured as an exception .
121,055
public boolean isEnabled ( ) { if ( daysOfWeek != null && daysOfWeek . length > 0 ) { return true ; } if ( timesOfDay != null && timesOfDay . size ( ) > 0 ) { return true ; } return false ; }
Returns true if any exception data has been added either days or time .
121,056
private List < String > hashtagsFromArray ( JSONObject json , String array ) { if ( json . containsKey ( array ) ) { JSONArray hashtagsArray = json . getJSONArray ( array ) ; List < String > result = new ArrayList < String > ( hashtagsArray . size ( ) ) ; for ( Object tag : hashtagsArray ) { result . add ( tag . toStri...
Converts an array key from JSON into a list of the strings it contains .
121,057
public void fromJson ( JSONObject json ) { super . fromJson ( json ) ; if ( json . containsKey ( CHANGE ) ) { change = new Change ( json . getJSONObject ( CHANGE ) ) ; } if ( json . containsKey ( PATCH_SET ) ) { patchSet = new PatchSet ( json . getJSONObject ( PATCH_SET ) ) ; } else if ( json . containsKey ( PATCHSET )...
Takes a JSON object and fills its internal data - structure .
121,058
private String getLine ( CharBuffer cb ) { String line = null ; int pos = cb . position ( ) ; int limit = cb . limit ( ) ; cb . flip ( ) ; for ( int i = 0 ; i < cb . length ( ) ; i ++ ) { if ( cb . charAt ( i ) == '\n' ) { line = getSubSequence ( cb , 0 , i ) . toString ( ) ; cb . position ( i + 1 ) ; break ; } } if ( ...
Offers lines in buffer to queue .
121,059
private CharSequence getSubSequence ( CharBuffer cb , int start , int end ) { return cb . subSequence ( start , end ) ; }
Get sub sequence of buffer .
121,060
private SshConnection connect ( ) { if ( sshConnection != null && sshConnection . isConnected ( ) ) { return sshConnection ; } while ( ! shutdownInProgress ) { SshConnection ssh = null ; try { logger . debug ( "Connecting..." ) ; ssh = SshConnectionFactory . getConnection ( gerritHostName , gerritSshPort , gerritProxy ...
Connects to the Gerrit server and authenticates as the specified user .
121,061
private String formatVersion ( String version ) { if ( version == null ) { return version ; } String [ ] split = version . split ( GERRIT_VERSION_PREFIX ) ; if ( split . length < 2 ) { return version . trim ( ) ; } return split [ 1 ] . trim ( ) ; }
Removes the gerrit version from the start of the response from gerrit .
121,062
public void notifyListeners ( GerritConnectionEvent event ) { for ( ConnectionListener listener : listeners ) { try { switch ( event ) { case GERRIT_CONNECTION_ESTABLISHED : listener . connectionEstablished ( ) ; break ; case GERRIT_CONNECTION_DOWN : listener . connectionDown ( ) ; break ; default : break ; } } catch (...
Notifies all listeners of a Gerrit connection event .
121,063
protected SshConnection getConnection ( ) throws IOException { if ( ! isPersistedConnectionValid ( ) ) { activeConnection = super . getConnection ( ) ; logger . trace ( "SSH connection is not valid anymore, a new one was created." ) ; } return activeConnection ; }
Returns a fresh SSH connection if the persisted one is not valid . Otherwise returns the existing connection .
121,064
public Map < Change , PatchSet > getChanges ( GerritQueryHandler gerritQueryHandler ) { if ( StringUtils . isEmpty ( name ) ) { logger . error ( "Topic name can not be empty" ) ; return Collections . emptyMap ( ) ; } if ( changes == null ) { Map < Change , PatchSet > temp = new HashMap < Change , PatchSet > ( ) ; try {...
Gets all change - patchset pairs related to this topic . After first call data is cached .
121,065
private String resolveEndpointURL ( ) { String gerritFrontEndUrl = config . getGerritFrontEndUrl ( ) ; if ( ! gerritFrontEndUrl . endsWith ( "/" ) ) { gerritFrontEndUrl = gerritFrontEndUrl + "/" ; } ChangeId changeId = new ChangeId ( event . getChange ( ) . getProject ( ) , event . getChange ( ) . getBranch ( ) , event...
What it says resolve Endpoint URL .
121,066
public String getChangeInfo ( String preText ) { StringBuilder s = new StringBuilder ( ) ; s . append ( preText + "\n" ) ; s . append ( "Subject: " + getSubject ( ) + "\n" ) ; s . append ( "Project: " + getProject ( ) + " " + getBranch ( ) + " " + getId ( ) + "\n" ) ; s . append ( "Link: " + getUrl ( ) + "\n" ) ; ...
Returns change s info in string format .
121,067
public static List < String > getFilesByChange ( GerritQueryHandler gerritQueryHandler , String changeId ) { try { List < JSONObject > jsonList = gerritQueryHandler . queryFiles ( "change:" + changeId ) ; for ( JSONObject json : jsonList ) { if ( json . has ( "type" ) && "stats" . equalsIgnoreCase ( json . getString ( ...
Provides list of files related to the change .
121,068
public String getRefName ( ) { if ( refName . startsWith ( REFS_HEADS ) ) { return refName . substring ( REFS_HEADS . length ( ) ) ; } return refName ; }
Ref name within project .
121,069
public String getUrl ( ) { String frontUrl = this . url ; if ( frontUrl != null && ! frontUrl . isEmpty ( ) && ! frontUrl . endsWith ( "/" ) ) { frontUrl += '/' ; } return frontUrl ; }
Get url .
121,070
protected Object readResolve ( ) { if ( proto != null && scheme == null ) { scheme = proto ; proto = null ; } else if ( scheme == null && proto == null ) { scheme = GerritConnection . GERRIT_PROTOCOL_SCHEME_NAME ; } return this ; }
Deserialization handling .
121,071
public List < JSONObject > queryCurrentPatchSets ( String queryString ) throws SshException , IOException , GerritQueryException { return queryJava ( queryString , false , true , false , false ) ; }
Runs the query and returns the result as a list of Java JSONObjects .
121,072
private void runQuery ( String queryString , boolean getPatchSets , boolean getCurrentPatchSet , boolean getFiles , boolean getCommitMessage , boolean getComments , LineVisitor visitor ) throws GerritQueryException , SshException , IOException { StringBuilder str = new StringBuilder ( QUERY_COMMAND ) ; str . append ( "...
Runs the query on the Gerrit server and lets the provided visitor handle each line in the result .
121,073
protected SshConnection getConnection ( ) throws IOException { return SshConnectionFactory . getConnection ( gerritHostName , gerritSshPort , gerritProxy , authentication , connectionTimeout ) ; }
Creates a new SSH connection used to execute the queries .
121,074
public String getIgnoreEMail ( String serverName ) { if ( serverName != null ) { return ignoreEMails . get ( serverName ) ; } else { return null ; } }
Standard getter for the ignoreEMail .
121,075
public void setIgnoreEMail ( String serverName , String ignoreEMail ) { if ( serverName != null ) { if ( ignoreEMail != null ) { ignoreEMails . put ( serverName , ignoreEMail ) ; } else { ignoreEMails . remove ( serverName ) ; } } }
Standard setter for the ignoreEMail .
121,076
private void queueWork ( Work work ) { try { logger . debug ( "Queueing work {}" , work ) ; executor . submit ( new EventWorker ( work , this ) ) ; } catch ( RejectedExecutionException e ) { logger . error ( "Unable to queue a received event! " , e ) ; } checkQueueSize ( ) ; }
puts work in the queue
121,077
public Collection < GerritEventListener > removeAllEventListeners ( ) { synchronized ( this ) { HashSet < GerritEventListener > listeners = new HashSet < GerritEventListener > ( gerritEventListeners ) ; gerritEventListeners . clear ( ) ; return listeners ; } }
Removes all event listeners and returns those that where removed .
121,078
public void setThreadKeepAliveTime ( int threadKeepAliveTime ) { this . threadKeepAliveTime = Math . max ( MIN_RECEIVE_THREAD_KEEP_ALIVE_TIME , threadKeepAliveTime ) ; executor . setKeepAliveTime ( threadKeepAliveTime , TimeUnit . SECONDS ) ; }
Sets the number of seconds threads well be kept alive .
121,079
public BlockingQueue < Work > getWorkQueue ( ) { BlockingQueue < Work > queue = new LinkedBlockingQueue < Work > ( ) ; BlockingQueue < Runnable > workQueue = executor . getQueue ( ) ; for ( Runnable r : workQueue ) { if ( r instanceof EventWorker ) { queue . add ( ( ( EventWorker ) r ) . work ) ; } } return queue ; }
Returns a snapshot of the current state of the queue in the executor and not the Queue itself .
121,080
private boolean ignoreEvent ( CommentAdded event ) { Account account = event . getAccount ( ) ; if ( account == null ) { return false ; } String accountEmail = account . getEmail ( ) ; if ( StringUtils . isEmpty ( accountEmail ) ) { return false ; } Provider provider = event . getProvider ( ) ; if ( provider != null ) ...
Checks if the event should be ignored .
121,081
public Token recoverInline ( Parser recognizer ) throws RecognitionException { throw new RecognitionException ( recognizer , recognizer . getInputStream ( ) , recognizer . getContext ( ) ) ; }
throws RecognitionException to handle in parser s catch block
121,082
protected void consumeUntilGreedy ( Parser recognizer , IntervalSet follow ) { logger . trace ( "CONSUME UNTIL GREEDY {}" , follow . toString ( ) ) ; for ( int ttype = recognizer . getInputStream ( ) . LA ( 1 ) ; ttype != - 1 && ! follow . contains ( ttype ) ; ttype = recognizer . getInputStream ( ) . LA ( 1 ) ) { Toke...
Consumes token until lexer state is balanced and token from follow is matched . Matched token is also consumed
121,083
protected void consumeUntilGreedy ( Parser recognizer , IntervalSet set , CSSLexerState . RecoveryMode mode ) { CSSToken t ; do { Token next = recognizer . getInputStream ( ) . LT ( 1 ) ; if ( next instanceof CSSToken ) { t = ( CSSToken ) recognizer . getInputStream ( ) . LT ( 1 ) ; if ( t . getType ( ) == Token . EOF ...
Consumes token until lexer state is function - balanced and token from follow is matched . Matched token is also consumed
121,084
public void consumeUntilGreedy ( Parser recognizer , IntervalSet follow , CSSLexerState . RecoveryMode mode , CSSLexerState ls ) { consumeUntil ( recognizer , follow , mode , ls ) ; recognizer . getInputStream ( ) . consume ( ) ; }
Consumes token until lexer state is function - balanced and token from follow is matched . Matched token is also consumed .
121,085
public void consumeUntil ( Parser recognizer , IntervalSet follow , CSSLexerState . RecoveryMode mode , CSSLexerState ls ) { CSSToken t ; boolean finish ; TokenStream input = recognizer . getInputStream ( ) ; do { Token next = input . LT ( 1 ) ; if ( next instanceof CSSToken ) { t = ( CSSToken ) input . LT ( 1 ) ; if (...
Consumes token until lexer state is function - balanced and token from follow is matched .
121,086
public static StringBuilder appendTimes ( StringBuilder sb , String append , int times ) { for ( ; times > 0 ; times -- ) sb . append ( append ) ; return sb ; }
Appends string multiple times to buffer
121,087
public static StringBuilder appendFunctionArgs ( StringBuilder sb , List < Term < ? > > list ) { Term < ? > prev = null , pprev = null ; for ( Term < ? > elem : list ) { boolean sep = true ; if ( elem instanceof TermOperator && ( ( TermOperator ) elem ) . getValue ( ) == ',' ) sep = false ; if ( ( prev != null && prev ...
Appends the formatted list of function arguments to a string builder . The individual arguments are separated by spaces with the exception of commas .
121,088
public String getText ( ) { text = super . getText ( ) ; int t ; try { t = typeMapper . inverse ( ) . get ( type ) ; } catch ( NullPointerException e ) { return text ; } switch ( t ) { case FUNCTION : return text . substring ( 0 , text . length ( ) - 1 ) ; case URI : return extractURI ( text ) ; case UNCLOSED_URI : ret...
Returns common text stored in token . Content is not modified .
121,089
public static String extractCHARSET ( String charset ) { final String arg = charset . replace ( "@charset" , "" ) . replace ( ";" , "" ) . trim ( ) ; if ( arg . length ( ) > 2 ) return extractSTRING ( arg ) ; else return "" ; }
extract charset value from CHARSET token
121,090
public Node parentNode ( ) { if ( currentNode == null ) return null ; Node node = getParentNode ( currentNode ) ; if ( node != null ) currentNode = node ; return node ; }
Return the parent Node from the current node after applying filter whatToshow . If result is not null set the current Node .
121,091
public Node firstChild ( ) { if ( currentNode == null ) return null ; Node node = getFirstChild ( currentNode ) ; if ( node != null ) currentNode = node ; return node ; }
Return the first child Node from the current node after applying filter whatToshow . If result is not null set the current Node .
121,092
public Node lastChild ( ) { if ( currentNode == null ) return null ; Node node = getLastChild ( currentNode ) ; if ( node != null ) currentNode = node ; return node ; }
Return the last child Node from the current node after applying filter whatToshow . If result is not null set the current Node .
121,093
public Node previousSibling ( ) { if ( currentNode == null ) return null ; Node node = getPreviousSibling ( currentNode ) ; if ( node != null ) currentNode = node ; return node ; }
Return the previous sibling Node from the current node after applying filter whatToshow . If result is not null set the current Node .
121,094
public Node nextSibling ( ) { if ( currentNode == null ) return null ; Node node = getNextSibling ( currentNode ) ; if ( node != null ) currentNode = node ; return node ; }
Return the next sibling Node from the current node after applying filter whatToshow . If result is not null set the current Node .
121,095
public Node previousNode ( ) { if ( currentNode == null ) return null ; Node result = getPreviousSibling ( currentNode ) ; if ( result == null ) { result = getParentNode ( currentNode ) ; if ( result != null ) { currentNode = result ; return result ; } return null ; } Node lastChild = getLastChild ( result ) ; Node pre...
Return the previous Node from the current node after applying filter whatToshow . If result is not null set the current Node .
121,096
public Node nextNode ( ) { if ( currentNode == null ) return null ; Node result = getFirstChild ( currentNode ) ; if ( result != null ) { currentNode = result ; return result ; } result = getNextSibling ( currentNode ) ; if ( result != null ) { currentNode = result ; return result ; } Node parent = getParentNode ( curr...
Return the next Node from the current node after applying filter whatToshow . If result is not null set the current Node .
121,097
private Node getParentNode ( Node node ) { if ( node == null || node == root ) return null ; Node newNode = node . getParentNode ( ) ; if ( newNode == null ) return null ; int accept = acceptNode ( newNode ) ; if ( accept == NodeFilter . FILTER_ACCEPT ) return newNode ; else return getParentNode ( newNode ) ; }
Internal function . Return the parent Node from the input node after applying filter whatToshow . The current node is not consulted or set .
121,098
private Node getNextSibling ( Node node ) { if ( node == null || node == root ) return null ; Node newNode = node . getNextSibling ( ) ; if ( newNode == null ) { newNode = node . getParentNode ( ) ; if ( newNode == null || node == root ) return null ; int parentAccept = acceptNode ( newNode ) ; if ( parentAccept == Nod...
Internal function . Return the nextSibling Node from the input node after applying filter whatToshow . The current node is not consulted or set .
121,099
private Node getPreviousSibling ( Node node ) { if ( node == null || node == root ) return null ; Node newNode = node . getPreviousSibling ( ) ; if ( newNode == null ) { newNode = node . getParentNode ( ) ; if ( newNode == null || node == root ) return null ; int parentAccept = acceptNode ( newNode ) ; if ( parentAccep...
Internal function . Return the previous sibling Node from the input node after applying filter whatToshow . The current node is not consulted or set .