idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
120,800
protected INode computeHighlightRangeSourceReference ( ) { ISourceViewer sourceViewer = getSourceViewer ( ) ; if ( sourceViewer == null ) return null ; StyledText styledText = sourceViewer . getTextWidget ( ) ; if ( styledText == null ) return null ; int caret = 0 ; if ( sourceViewer instanceof ITextViewerExtension5 ) ...
Computes and returns the source reference that includes the caret and serves as provider for the outline page selection and the editor range indication .
120,801
private void writeObject ( java . io . ObjectOutputStream out ) throws IOException { if ( delegateMethods != null ) { delegateMethods . clear ( ) ; } out . defaultWriteObject ( ) ; }
The Method objects in the delegateMethods map cannot be serialized which means that deep copies fail . So here we clear the map when serialization occurs . The map is re - build later on demand .
120,802
public void saveState ( IMemento memento ) { memento . putString ( TAG_HIDEFIELDS , String . valueOf ( hasMemberFilter ( FILTER_FIELDS ) ) ) ; memento . putString ( TAG_HIDESTATIC , String . valueOf ( hasMemberFilter ( FILTER_STATIC ) ) ) ; memento . putString ( TAG_HIDENONPUBLIC , String . valueOf ( hasMemberFilter ( ...
Saves the state of the filter actions in a memento .
120,803
public void contributeToToolBar ( IToolBarManager tbm ) { if ( fInViewMenu ) return ; for ( int i = 0 ; i < fFilterActions . length ; i ++ ) { tbm . add ( fFilterActions [ i ] ) ; } }
Adds the filter actions to the given tool bar
120,804
public void contributeToViewMenu ( IMenuManager menu ) { if ( ! fInViewMenu ) return ; final String filters = "filters" ; if ( menu . find ( filters ) != null ) { for ( int i = 0 ; i < fFilterActions . length ; i ++ ) { menu . prependToGroup ( filters , fFilterActions [ i ] ) ; } } else { for ( int i = 0 ; i < fFilterA...
Adds the filter actions to the given menu manager .
120,805
protected int computeAdornmentFlags ( Object obj ) { if ( obj instanceof IVdmElement ) { IVdmElement element = ( IVdmElement ) obj ; int type = element . getElementType ( ) ; switch ( type ) { case IVdmElement . VDM_MODEL : case IVdmElement . VDM_PROJECT : case IVdmElement . COMPILATION_UNIT : case IVdmElement . TYPE :...
Computes the adornment flags for the given element .
120,806
public Image get ( ImageDescriptor descriptor ) { if ( descriptor == null ) descriptor = ImageDescriptor . getMissingImageDescriptor ( ) ; Image result = ( Image ) fRegistry . get ( descriptor ) ; if ( result != null ) return result ; Assert . isTrue ( fDisplay == SWTUtil . getStandardDisplay ( ) , "Allocating image fo...
Returns the image associated with the given image descriptor .
120,807
public void dispose ( ) { for ( Iterator < Image > iter = fRegistry . values ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Image image = ( Image ) iter . next ( ) ; image . dispose ( ) ; } fRegistry . clear ( ) ; }
Disposes all images managed by this registry .
120,808
public static void addAstNode ( LexLocation location , INode node ) { synchronized ( locationToAstNode ) { locationToAstNode . put ( location , node ) ; } }
FIXME we know this is never called a new solutions is needed
120,809
private static List < ILexLocation > removeDuplicates ( List < ILexLocation > locations ) { BinaryOperator < Vector < ILexLocation > > merge = ( old , latest ) -> { for ( ILexLocation location : latest ) { if ( location . getHits ( ) > 0 ) { for ( ILexLocation loc : old ) if ( loc . getHits ( ) == 0 ) old . remove ( lo...
This method handles the case where a location exist both with hits > 0 and hits == 0 . It will remove the location with hits == 0 when another location hits > 0 exists .
120,810
protected void dupHideCheck ( List < PDefinition > list , NameScope scope ) { LexNameList allnames = af . createPDefinitionListAssistant ( ) . getVariableNames ( list ) ; for ( ILexNameToken n1 : allnames ) { LexNameList done = new LexNameList ( ) ; for ( ILexNameToken n2 : allnames ) { if ( n1 != n2 && n1 . equals ( n...
Check whether the list of definitions passed contains any duplicates or whether any names in the list hide the same name further down the environment chain .
120,811
public void unusedCheck ( Environment downTo ) { Environment p = this ; while ( p != null && p != downTo ) { p . unusedCheck ( ) ; p = p . outer ; } }
Unravelling unused check .
120,812
public void setDefaultName ( String mname ) throws Exception { if ( mname == null ) { defaultModule = AstFactory . newAModuleModules ( ) ; } else { for ( AModuleModules m : modules ) { if ( m . getName ( ) . getName ( ) . equals ( mname ) ) { defaultModule = m ; return ; } } throw new Exception ( "Module " + mname + " ...
Set the default module to the name given .
120,813
private synchronized void setCreator ( ObjectValue newCreator ) { if ( newCreator != null && newCreator . type . getClassdef ( ) instanceof ASystemClassDefinition ) { return ; } newCreator . addChild ( this ) ; }
Sets the creator of this object value and adds this to the newCreator parsed as argument
120,814
public void formatTo ( Formatter formatter , int flags , int width , int precision ) { formatTo ( this . toString ( ) , formatter , flags , width , precision ) ; }
This is overridden in the few classes that need to change formatting
120,815
public static synchronized void enable ( boolean on ) { for ( IRTLogger logger : loggers ) { logger . enable ( on ) ; } enabled = on ; }
Turns the logging on or off
120,816
public static void setLogfile ( Class < ? extends IRTLogger > loggerClass , File outputFile ) throws FileNotFoundException { for ( IRTLogger logger : loggers ) { if ( logger . getClass ( ) == loggerClass ) { logger . setLogfile ( outputFile ) ; logger . dump ( true ) ; } } enable ( true ) ; }
Configure the logger output types
120,817
public ISourceParser getSourceParser ( IVdmProject project ) throws CoreException { IConfigurationElement [ ] config = Platform . getExtensionRegistry ( ) . getConfigurationElementsFor ( ICoreConstants . EXTENSION_PARSER_ID ) ; IConfigurationElement selectedParser = getParserWithHeighestPriority ( project . getVdmNatur...
Loads a source parser for the given project
120,818
private IConfigurationElement getParserWithHeighestPriority ( String natureId , IConfigurationElement [ ] config ) { IConfigurationElement selectedParser = null ; int selectedParserPriority = 0 ; for ( IConfigurationElement e : config ) { if ( e . getAttribute ( "nature" ) . equals ( natureId ) ) { if ( selectedParser ...
Gets the parser available for the given nature having the highest priority
120,819
public static void parseFile ( final IVdmSourceUnit source ) throws CoreException , IOException { try { ISourceParser parser = SourceParserManager . getInstance ( ) . getSourceParser ( source . getProject ( ) ) ; Assert . isNotNull ( parser , "No parser for file : " + source . toString ( ) + " in project " + source . g...
Parse a single file from a project
120,820
public synchronized IDbgpService getDbgpService ( int freePort ) { dbgpService = new DbgpService ( freePort ) ; getPluginPreferences ( ) . addPropertyChangeListener ( new DbgpServicePreferenceUpdater ( ) ) ; return dbgpService ; }
Inefficient use getDbgpService
120,821
private static int b64decode ( char c ) { int i = c ; if ( i >= 'A' && i <= 'Z' ) { return i - 'A' ; } if ( i >= 'a' && i <= 'z' ) { return i - 'a' + 26 ; } if ( i >= '0' && i <= '9' ) { return i - '0' + 52 ; } if ( i == '+' ) { return 62 ; } if ( i == '/' ) { return 63 ; } return - 1 ; }
Return the 6 - bit value corresponding to a base64 encoded char . If the character is the base64 padding character = - 1 is returned .
120,822
private static char b64encode ( int b ) { if ( b >= 0 && b <= 25 ) { return ( char ) ( 'A' + b ) ; } if ( b >= 26 && b <= 51 ) { return ( char ) ( 'a' + b - 26 ) ; } if ( b >= 52 && b <= 61 ) { return ( char ) ( '0' + b - 52 ) ; } if ( b == 62 ) { return '+' ; } if ( b == 63 ) { return '/' ; } return '?' ; }
Encode a 6 - bit quantity as a base64 character .
120,823
public static byte [ ] decode ( String text ) throws Exception { if ( text . length ( ) % 4 != 0 ) { throw new Exception ( "Base64 not a multiple of 4 bytes" ) ; } byte [ ] result = new byte [ text . length ( ) / 4 * 3 ] ; int p = 0 ; for ( int i = 0 ; i < text . length ( ) ; ) { if ( text . charAt ( i ) == '\n' ) { co...
Base64 decode a string into a byte array .
120,824
public static StringBuffer encode ( byte [ ] data ) { int rem = data . length % 3 ; int num = data . length / 3 ; StringBuffer result = new StringBuffer ( ) ; int p = 0 ; for ( int i = 0 ; i < num ; i ++ ) { int b1 = ( data [ p ] & 0xfc ) >> 2 ; int b2 = ( data [ p ] & 0x03 ) << 4 | ( data [ p + 1 ] & 0xf0 ) >> 4 ; int...
Base64 encode a byte array .
120,825
public boolean reschedule ( ) { if ( swappedIn != null && swappedIn . getRunState ( ) == RunState . TIMESTEP ) { return false ; } if ( policy . reschedule ( ) ) { ISchedulableThread best = policy . getThread ( ) ; if ( swappedIn != best ) { if ( swappedIn != null ) { RTLogger . log ( new RTThreadSwapMessage ( SwapType ...
may be due to a time step including a swap delay ) .
120,826
public Value eval ( ACaseAlternative node , Value val , Context ctxt ) throws AnalysisException { Context evalContext = new Context ( ctxt . assistantFactory , node . getLocation ( ) , "case alternative" , ctxt ) ; try { evalContext . putList ( ctxt . assistantFactory . createPPatternAssistant ( ) . getNamedValues ( no...
Utility method for ACaseAlternative
120,827
protected Value evalIf ( INode node , ILexLocation ifLocation , PExp testExp , INode thenNode , List < ? extends INode > elseIfNodeList , INode elseNode , Context ctxt ) throws AnalysisException { BreakpointManager . getBreakpoint ( node ) . check ( ifLocation , ctxt ) ; try { if ( testExp . apply ( VdmRuntime . getSta...
Utility method to evaluate both if expressions and statements
120,828
protected Value evalElseIf ( INode node , ILexLocation location , PExp test , INode then , Context ctxt ) throws AnalysisException { BreakpointManager . getBreakpoint ( node ) . check ( location , ctxt ) ; try { return test . apply ( VdmRuntime . getExpressionEvaluator ( ) , ctxt ) . boolValue ( ctxt ) ? then . apply (...
Utility method to evaluate elseif nodes
120,829
public void init ( EvaluatePP inst , long nrf ) { instance = inst ; act = new long [ ( int ) nrf ] ; fin = new long [ ( int ) nrf ] ; req = new long [ ( int ) nrf ] ; active = new long [ ( int ) nrf ] ; waiting = new long [ ( int ) nrf ] ; }
and the number of methods to define the size of the arrays .
120,830
public synchronized void entering ( long fnr2 ) { int fnr = ( int ) fnr2 ; requesting ( fnr ) ; try { if ( ! instance . evaluatePP ( fnr ) . booleanValue ( ) ) { waiting ( fnr , + 1 ) ; while ( ! instance . evaluatePP ( fnr ) . booleanValue ( ) ) { this . wait ( ) ; } waiting ( fnr , - 1 ) ; } } catch ( InterruptedExce...
This methods is used to enable the activation of a method .
120,831
public void createPageControlsPostconfig ( ) { try { getMainPageButton ( "projectFromArchiveRadio" ) . setSelection ( true ) ; getMainPageButton ( "projectFromArchiveRadio" ) . setEnabled ( false ) ; getMainPageButton ( "projectFromDirectoryRadio" ) . setSelection ( false ) ; getMainPageButton ( "projectFromDirectoryRa...
This initializes the page with the graphical selection and sets the input path . The input path must be set prior to the call to this method
120,832
public static void init ( ) { try { init ( "vdmj.properties" , Properties . class ) ; } catch ( Exception e ) { System . err . println ( e . getMessage ( ) ) ; } InputStream fis = ConfigBase . class . getResourceAsStream ( "/" + "overture.properties" ) ; if ( fis != null ) { try { java . util . Properties overturePrope...
When the class is initialized we call the ConfigBase init method which uses the properties file passed to update the static fields above .
120,833
protected List < AVarDeclIR > replaceArgsWithVars ( SStmIR callStm ) { List < AVarDeclIR > decls = new LinkedList < AVarDeclIR > ( ) ; if ( Settings . dialect != Dialect . VDM_SL ) { return decls ; } List < SExpIR > args = null ; if ( callStm instanceof SCallStmIR ) { args = ( ( SCallStmIR ) callStm ) . getArgs ( ) ; }...
Assumes dialect is VDM - SL . This method does not work with store lookups for local variables and since code generated VDM - SL traces do not rely on this then it is safe to use this method for this dialect .
120,834
protected void collectOpCtxt ( AExplicitOperationDefinition node , IPOContextStack question , Boolean precond ) throws AnalysisException { question . push ( new POOperationDefinitionContext ( node , precond , node . getState ( ) ) ) ; }
Operation processing is identical in extension except for context generation . So a quick trick here .
120,835
public ValueList getValues ( PDefinition def , ObjectContext ctxt ) { try { return def . apply ( af . getValuesDefinitionLocator ( ) , ctxt ) ; } catch ( AnalysisException e ) { return null ; } }
Return a list of external values that are read by the definition .
120,836
public Value execute ( String line , DBGPReader dbgp ) throws Exception { PExp expr = parseExpression ( line , getDefaultName ( ) ) ; Environment env = getGlobalEnvironment ( ) ; Environment created = new FlatCheckedEnvironment ( assistantFactory , createdDefinitions . asList ( ) , env , NameScope . NAMESANDSTATE ) ; t...
Parse the line passed type check it and evaluate it as an expression in the initial context .
120,837
static int decodeDigit ( byte data ) { char charData = ( char ) data ; if ( charData <= 'Z' && charData >= 'A' ) { return charData - 'A' ; } if ( charData <= 'z' && charData >= 'a' ) { return charData - 'a' + 26 ; } if ( charData <= '9' && charData >= '0' ) { return charData - '0' + 52 ; } switch ( charData ) { case '+...
This method converts a Base 64 digit to its numeric value .
120,838
public ExitStatus run ( ) { synchronized ( DebuggerReader . class ) { println ( "Stopped " + breakpoint ) ; println ( interpreter . getSourceLine ( breakpoint . location ) ) ; try { interpreter . setDefaultName ( breakpoint . location . getModule ( ) ) ; } catch ( Exception e ) { throw new InternalException ( 52 , "Can...
This first prints out the current breakpoint source location before calling the superclass run method . The synchronization prevents more than one debugging session on the console .
120,839
protected boolean doEvaluate ( String line ) { line = line . substring ( line . indexOf ( ' ' ) + 1 ) ; try { println ( line + " = " + interpreter . evaluate ( line , getFrame ( ) ) ) ; } catch ( ParserException e ) { println ( "Syntax: " + e ) ; } catch ( ContextException e ) { println ( "Runtime: " + e . getMessage (...
Evaluate an expression in the breakpoint s context . This is similar to the superclass method except that the context is the one taken from the breakpoint and the execution is not timed .
120,840
private void updateCPUandChildCPUs ( ObjectValue obj , CPUValue cpu ) { if ( cpu != obj . getCPU ( ) ) { for ( ObjectValue superObj : obj . superobjects ) { updateCPUandChildCPUs ( superObj , cpu ) ; } obj . setCPU ( cpu ) ; } for ( ObjectValue objVal : obj . children ) { updateCPUandChildCPUs ( objVal , cpu ) ; } }
Recursively updates all transitive references with the new CPU but without removing the parent - child relation unlike the deploy method .
120,841
public static ImageDescriptor getDescriptor ( String key ) { if ( fgImageRegistry == null ) { return fgAvoidSWTErrorMap . get ( key ) ; } return getImageRegistry ( ) . getDescriptor ( key ) ; }
Returns the image descriptor for the given key in this registry . Might be called in a non - UI thread .
120,842
private IContainer getActualTarget ( IResource mouseTarget ) { if ( mouseTarget . getType ( ) == IResource . FILE ) { return mouseTarget . getParent ( ) ; } return ( IContainer ) mouseTarget ; }
Returns the actual target of the drop given the resource under the mouse . If the mouse target is a file then the drop actually occurs in its parent . If the drop location is before or after the mouse target and feedback is enabled the target is also the parent .
120,843
private IStatus performResourceCopy ( CommonDropAdapter dropAdapter , Shell shell , IResource [ ] sources ) { MultiStatus problems = new MultiStatus ( PlatformUI . PLUGIN_ID , 1 , WorkbenchNavigatorMessages . DropAdapter_problemsMoving , null ) ; mergeStatus ( problems , validateTarget ( dropAdapter . getCurrentTarget ...
Performs a resource copy
120,844
private IStatus performResourceMove ( CommonDropAdapter dropAdapter , IResource [ ] sources ) { MultiStatus problems = new MultiStatus ( PlatformUI . PLUGIN_ID , 1 , WorkbenchNavigatorMessages . DropAdapter_problemsMoving , null ) ; mergeStatus ( problems , validateTarget ( dropAdapter . getCurrentTarget ( ) , dropAdap...
Performs a resource move
120,845
private IStatus performFileDrop ( CommonDropAdapter anAdapter , Object data ) { MultiStatus problems = new MultiStatus ( PlatformUI . PLUGIN_ID , 0 , WorkbenchNavigatorMessages . DropAdapter_problemImporting , null ) ; mergeStatus ( problems , validateTarget ( anAdapter . getCurrentTarget ( ) , anAdapter . getCurrentTr...
Performs a drop using the FileTransfer transfer type .
120,846
private IStatus validateTarget ( Object target , TransferData transferType , int dropOperation ) { if ( target instanceof IVdmContainer ) { target = ( ( IVdmContainer ) target ) . getContainer ( ) ; } if ( ! ( target instanceof IResource ) ) { return WorkbenchNavigatorPlugin . createInfoStatus ( WorkbenchNavigatorMessa...
Ensures that the drop target meets certain criteria
120,847
private void mergeStatus ( MultiStatus status , IStatus toMerge ) { if ( ! toMerge . isOK ( ) ) { status . merge ( toMerge ) ; } }
Adds the given status to the list of problems . Discards OK statuses . If the status is a multi - status only its children are added .
120,848
private void openError ( IStatus status ) { if ( status == null ) { return ; } String genericTitle = WorkbenchNavigatorMessages . DropAdapter_title ; int codes = IStatus . ERROR | IStatus . WARNING ; if ( ! status . isMultiStatus ( ) ) { ErrorDialog . openError ( getShell ( ) , genericTitle , null , status , codes ) ; ...
Opens an error dialog if necessary . Takes care of complex rules necessary for making the error dialog look nice .
120,849
private AFromModuleImports importAll ( ILexIdentifierToken from ) { List < List < PImport > > types = new Vector < List < PImport > > ( ) ; ILexNameToken all = new LexNameToken ( from . getName ( ) , "all" , from . getLocation ( ) ) ; List < PImport > impAll = new Vector < PImport > ( ) ; AAllImport iport = AstFactory ...
This function is copied from the module reader
120,850
public static String toCpEnvString ( Collection < ? extends String > entries ) { if ( entries . size ( ) > 0 ) { StringBuffer classPath = new StringBuffer ( "" ) ; for ( String cp : new HashSet < String > ( entries ) ) { if ( cp == null ) { continue ; } classPath . append ( cp ) ; classPath . append ( System . getPrope...
Creates a class path string from the entries using the path . seperator
120,851
private void searchAndLaunch ( Object [ ] scope , String mode , String selectTitle , String emptyMessage ) { INode [ ] types = null ; try { project = findProject ( scope , PlatformUI . getWorkbench ( ) . getProgressService ( ) ) ; ILaunchConfiguration config = findLaunchConfiguration ( project . getName ( ) , getConfig...
Resolves a type that can be launched from the given scope and launches in the specified mode .
120,852
protected INode chooseType ( INode [ ] types , String title ) { try { DebugTypeSelectionDialog mmsd = new DebugTypeSelectionDialog ( VdmDebugPlugin . getActiveWorkbenchShell ( ) , types , title , project ) ; if ( mmsd . open ( ) == Window . OK ) { return ( INode ) mmsd . getResult ( ) [ 0 ] ; } } catch ( Exception e ) ...
Prompts the user to select a type from the given types .
120,853
public static InputStreamReader readerFactory ( File file , String charset ) throws IOException { String name = file . getName ( ) ; if ( name . toLowerCase ( ) . endsWith ( ".doc" ) ) { return new DocStreamReader ( new FileInputStream ( file ) , charset ) ; } else if ( name . toLowerCase ( ) . endsWith ( ".docx" ) ) {...
Create an InputStreamReader from a File depending on the filename .
120,854
public int read ( char [ ] cbuf , int off , int len ) { int n = 0 ; while ( pos != max && n < len ) { cbuf [ off + n ++ ] = data [ pos ++ ] ; } return n == 0 ? - 1 : n ; }
Read characters into the array passed .
120,855
public void toFile ( ) throws IOException { if ( logFile != null ) { FileWriter fstream = new FileWriter ( logFile + ".rttxt" ) ; BufferedWriter out = new BufferedWriter ( fstream ) ; writeCPUdecls ( out ) ; writeBUSdecls ( out ) ; writeDeployObjs ( out ) ; writeEvents ( out ) ; out . flush ( ) ; out . close ( ) ; } }
Writing to log
120,856
public Context getGlobal ( ) { Context op = this ; while ( op . outer != null ) { op = op . outer ; } return op ; }
Find the outermost context from this one .
120,857
public Context deepCopy ( ) { Context below = null ; if ( outer != null ) { below = outer . deepCopy ( ) ; } Context result = new Context ( assistantFactory , location , title , below ) ; result . threadState = threadState ; for ( ILexNameToken var : keySet ( ) ) { Value v = get ( var ) ; result . put ( var , v . deepC...
Make a deep copy of the context using Value . deepCopy . Every concrete subclass must implements its own version of this method .
120,858
public Context getVisibleVariables ( ) { Context visible = new Context ( assistantFactory , location , title , null ) ; if ( outer != null ) { visible . putAll ( outer . getVisibleVariables ( ) ) ; } visible . putAll ( this ) ; return visible ; }
Get all visible names from this Context with more visible values overriding those below .
120,859
public Value check ( ILexNameToken name ) { Value v = get ( name ) ; if ( v == null ) { if ( outer != null ) { return outer . check ( name ) ; } } return v ; }
Get the value for a given name . This searches outer contexts if any are present .
120,860
public Context locate ( ILexNameToken name ) { Value v = get ( name ) ; if ( v == null ) { if ( outer != null ) { return outer . locate ( name ) ; } else { return null ; } } else { return this ; } }
Locate the Context in a chain that contains a name if any .
120,861
private synchronized void writeObject ( java . io . ObjectOutputStream stream ) throws java . io . IOException { ThreadState tmp = this . threadState ; this . threadStateSerilizationHashedId = serilizationCache . store ( this . threadState ) ; this . threadState = null ; stream . defaultWriteObject ( ) ; this . threadS...
Custom serialization method handling the transient values
120,862
private synchronized void readObject ( java . io . ObjectInputStream stream ) throws java . io . IOException , ClassNotFoundException { stream . defaultReadObject ( ) ; this . threadState = ( ThreadState ) serilizationCache . load ( this . threadStateSerilizationHashedId ) ; this . threadStateSerilizationHashedId = nul...
Custom de - serialization method handling the transient values
120,863
public String getMeasureApply ( AApplyExp node , ILexNameToken measure , boolean close ) { String start = null ; PExp root = node . getRoot ( ) ; if ( root instanceof AApplyExp ) { AApplyExp aexp = ( AApplyExp ) root ; start = getMeasureApply ( aexp , measure , false ) ; } else if ( root instanceof AVariableExp ) { sta...
Create a measure application string from this apply turning the root function name into the measure name passed and collapsing curried argument sets into one .
120,864
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 ; } } if ( v == null ) { if ( stateCtxt != null ) { v = stateCtxt . check ( name ) ; if ( v != null ) { return v ; } } Contex...
Check for the name in the current context and state and if not present search the global context . Note that the context chain is not followed .
120,865
public ValueList getValues ( PExp exp , ObjectContext ctxt ) { try { return exp . apply ( af . getExpressionValueCollector ( ) , ctxt ) ; } catch ( AnalysisException e ) { return null ; } }
Return a list of all the updatable values read by the expression . This is used to add listeners to values that affect permission guards so that the guard may be efficiently re - evaluated when the values change .
120,866
public PExp findExpression ( PExp exp , int lineno ) { try { return exp . apply ( af . getExpExpressionFinder ( ) , lineno ) ; } catch ( AnalysisException e ) { return null ; } }
Find an expression starting on the given line . Single expressions just compare their location to lineno but expressions with sub - expressions iterate over their branches .
120,867
public List < INextGenEvent > getEvents ( Long startTime ) { ArrayList < INextGenEvent > eventList = null ; Long eventKey = events . ceilingKey ( startTime ) ; if ( eventKey != null ) { eventList = events . get ( eventKey ) ; currentEventTime = eventKey ; } return eventList ; }
Get events from a specified start time . If no events at specified time the next series of events is returned
120,868
private static int discardWhitespace ( byte [ ] data ) { final int length = data . length ; int i = 0 ; while ( i < length ) { byte c = data [ i ++ ] ; if ( c == ( byte ) ' ' || c == ( byte ) '\n' || c == ( byte ) '\r' || c == ( byte ) '\t' ) { int count = i - 1 ; while ( i < length ) { c = data [ i ++ ] ; if ( c != ( ...
Discards any whitespace from a base - 64 encoded block . The base64 data in responses could be chunked in the multiple lines so we need to remove extra whitespaces . The bytes are copied in - place and the length of the actual data bytes is returned .
120,869
private void setBreakpoint ( File file , int line , String condition ) throws Exception { if ( file == null ) { file = interpreter . getDefaultFile ( ) ; } if ( file == null || file . getPath ( ) . equals ( "?" ) ) { Set < File > files = interpreter . getSourceFiles ( ) ; if ( files . size ( ) > 1 ) { println ( "Assumi...
Set a breakpoint at the given file and line with a condition .
120,870
private void setBreakpoint ( String name , String condition ) throws Exception { LexTokenReader ltr = new LexTokenReader ( name , Dialect . VDM_SL ) ; LexToken token = ltr . nextToken ( ) ; ltr . close ( ) ; Value v = null ; if ( token . is ( VDMToken . IDENTIFIER ) ) { LexIdentifierToken id = ( LexIdentifierToken ) to...
Set a breakpoint at the given function or operation name with a condition .
120,871
private char rdCh ( ) { char c = super . readCh ( ) ; if ( c == '\n' ) { linecount ++ ; charpos = 0 ; } else if ( c == '\t' ) { charpos += Properties . parser_tabstop - charpos % Properties . parser_tabstop ; } else if ( c != ( char ) - 1 ) { charpos ++ ; } ch = c ; charsread ++ ; offset = getCurrentRawReadOffset ( ) ;...
Read the next character from the stream . The position details are updated accounting for newlines and tab stops . The next character is set in the ch field as well as being returned for convenience .
120,872
private char rdQuotedCh ( ) throws LexException { quotedQuote = false ; char c = rdCh ( ) ; if ( c == '\\' ) { rdCh ( ) ; switch ( ch ) { case 'r' : ch = '\r' ; break ; case 'n' : ch = '\n' ; break ; case 't' : ch = '\t' ; break ; case 'f' : ch = '\f' ; break ; case 'e' : ch = '\033' ; break ; case 'a' : ch = '\007' ; ...
Read a backslash quoted character from the stream . This method is used when parsing strings and individual quoted characters which may include things like \ n .
120,873
private String rdNumber ( int base ) throws LexException { StringBuilder v = new StringBuilder ( ) ; int n = value ( ch ) ; v . append ( ch ) ; if ( n < 0 || n >= base ) { throwMessage ( 1001 , "Invalid char [" + ch + "] in base " + base + " number" ) ; } while ( true ) { rdCh ( ) ; n = value ( ch ) ; if ( n < 0 || n >...
Read a number of the given base . Parsing terminates when a character not within the number base is read .
120,874
private LexToken rdReal ( int tokline , int tokpos , int tokOffset ) throws LexException { String floatSyntax = "Expecting <digits>[.<digits>][e<+-><digits>]" ; String value = rdNumber ( 10 ) ; String fraction = null ; String exponent = null ; boolean negative = false ; push ( ) ; if ( ch == '.' ) { rdCh ( ) ; if ( ch ...
Read a decimal floating point number .
120,875
private List < String > rdName ( ) { List < String > names = new Vector < String > ( ) ; names . add ( rdIdentifier ( ) ) ; if ( ch == '`' ) { if ( startOfName ( rdCh ( ) ) ) { names . add ( rdIdentifier ( ) ) ; } } if ( names . size ( ) == 2 ) { String first = names . get ( 0 ) ; if ( first . startsWith ( "mk_" ) || f...
Read a fully qualified module name .
120,876
private String rdIdentifier ( ) { StringBuilder id = new StringBuilder ( ) ; id . append ( ch ) ; while ( restOfName ( rdCh ( ) ) ) { id . append ( ch ) ; } return id . toString ( ) ; }
Read a simple identifier without a module name prefix .
120,877
public List < PDefinition > getDefinitions ( PPattern rp , PType ptype , NameScope scope ) { PDefinitionSet set = af . createPDefinitionSet ( ) ; set . addAll ( af . createPPatternAssistant ( ) . getAllDefinitions ( rp , ptype , scope ) ) ; List < PDefinition > result = new Vector < PDefinition > ( set ) ; return resul...
Get a set of definitions for the pattern s variables . Note that if the pattern includes duplicate variable names these are collapse into one .
120,878
private List < PDefinition > getAllDefinitions ( PPattern pattern , PType ptype , NameScope scope ) { try { return pattern . apply ( af . getAllDefinitionLocator ( ) , new AllDefinitionLocator . NewQuestion ( ptype , scope ) ) ; } catch ( AnalysisException e ) { return null ; } }
Get a complete list of all definitions including duplicates . This method should only be used only by PP
120,879
protected void waitDebuggerConnected ( ILaunch launch , DebugSessionAcceptor acceptor ) throws CoreException { int timeout = VdmDebugPlugin . getDefault ( ) . getConnectionTimeout ( ) ; if ( ! acceptor . waitConnection ( timeout ) ) { launch . terminate ( ) ; return ; } if ( ! acceptor . waitInitialized ( 60 * 60 * 100...
Waiting debugging process to connect to current launch
120,880
public static File prepareCustomOvertureProperties ( IVdmProject project , ILaunchConfiguration configuration ) throws CoreException { List < String > properties = new Vector < String > ( ) ; if ( VdmDebugPlugin . getDefault ( ) . getPreferenceStore ( ) . getBoolean ( IDebugPreferenceConstants . PREF_DBGP_ENABLE_EXPERI...
Create the custom overture . properties file loaded by the debugger
120,881
public static String getProbHomeProperty ( ) { final Bundle bundle = Platform . getBundle ( ORG_OVERTURE_IDE_PLUGINS_PROBRUNTIME ) ; if ( bundle != null ) { URL buildInfoUrl = FileLocator . find ( bundle , new Path ( "prob/build_info.txt" ) , null ) ; try { if ( buildInfoUrl != null ) { URL buildInfofileUrl = FileLocat...
Obtains the prob bundled executable and returns the prob . home property set to that location
120,882
protected Collection < ? extends String > getExtendedCommands ( IVdmProject project , ILaunchConfiguration configuration ) throws CoreException { return new Vector < String > ( ) ; }
Intended to be used when sub classing the delegate to add additional parameters to the launch of VDMJ
120,883
private static void abort ( String message , Throwable e ) throws CoreException { throw new CoreException ( ( IStatus ) new Status ( IStatus . ERROR , IDebugConstants . PLUGIN_ID , 0 , message , e ) ) ; }
Throws an exception with a new status containing the given message and optional exception .
120,884
public void register ( boolean register ) throws CoreException { DebugPlugin plugin = DebugPlugin . getDefault ( ) ; if ( plugin != null && register ) { plugin . getBreakpointManager ( ) . addBreakpoint ( this ) ; } else { setRegistered ( false ) ; } }
Add this breakpoint to the breakpoint manager or sets it as unregistered .
120,885
public static File getBundleFile ( Bundle bundle ) throws IOException { URL rootEntry = bundle . getEntry ( "/" ) ; rootEntry = FileLocator . resolve ( rootEntry ) ; if ( "file" . equals ( rootEntry . getProtocol ( ) ) ) return new File ( rootEntry . getPath ( ) ) ; if ( "jar" . equals ( rootEntry . getProtocol ( ) ) )...
Returns a file for the contents of the specified bundle . Depending on how the bundle is installed the returned file may be a directory or a jar file containing the bundle content .
120,886
public IDbgpFeature getFeature ( String name ) throws DbgpException { IDbgpCoreCommands core = session . getCoreCommands ( ) ; return core . getFeature ( name ) ; }
Feature helper methods
120,887
public TemplateCallable [ ] addDefaults ( TemplateCallable [ ] userCallables ) { TemplateCallable strFunctionality = new TemplateCallable ( String . class . getSimpleName ( ) , String . class ) ; for ( TemplateCallable u : userCallables ) { if ( u . equals ( strFunctionality ) ) { return userCallables ; } } return Gene...
Enables the static methods of the java . lang . String class to be called from the templates . If the key String is already reserved by the user this method simply returns the input parameter .
120,888
public boolean performOk ( ) { IWorkspaceRunnable wr = new IWorkspaceRunnable ( ) { public void run ( IProgressMonitor monitor ) throws CoreException { IVdmBreakpoint breakpoint = getBreakpoint ( ) ; boolean delOnCancel = breakpoint . getMarker ( ) . getAttribute ( ATTR_DELETE_ON_CANCEL ) != null ; if ( delOnCancel ) {...
Store the breakpoint properties .
120,889
private void storeHitCount ( IVdmBreakpoint breakpoint ) throws CoreException { int hitCount = - 1 ; try { hitCount = Integer . parseInt ( fHitValueText . getText ( ) ) ; } catch ( NumberFormatException e ) { } breakpoint . setHitValue ( hitCount ) ; breakpoint . setHitCondition ( fHitValueButton . getSelection ( ) ? I...
Stores the value of the hit count in the breakpoint .
120,890
protected Control createContents ( Composite parent ) { setTitle ( "TODO: property title (VdmBreakpointPropertyPage)" ) ; noDefaultAndApplyButton ( ) ; Composite mainComposite = createComposite ( parent , 1 ) ; createLabels ( mainComposite ) ; try { createEnabledButton ( mainComposite ) ; createHitValueEditor ( mainCom...
Creates the labels and editors displayed for the breakpoint .
120,891
protected void createLabels ( Composite parent ) { Composite labelComposite = createComposite ( parent , 2 ) ; try { String typeName = ( ( IVdmBreakpoint ) getElement ( ) ) . getMessage ( ) ; if ( typeName != null ) { String s = getTypeName ( typeName ) ; createLabel ( labelComposite , "Filename:" ) ; Text text = SWTFa...
Creates the labels displayed for the breakpoint .
120,892
private void hitCountChanged ( ) { if ( ! fHitValueButton . getSelection ( ) ) { removeErrorMessage ( fgHitCountErrorMessage ) ; return ; } String hitCountText = fHitValueText . getText ( ) ; int hitCount = - 1 ; try { hitCount = Integer . parseInt ( hitCountText ) ; } catch ( NumberFormatException e1 ) { addErrorMessa...
Validates the current state of the hit count editor . Hit count value must be a positive integer .
120,893
protected void createEnabledButton ( Composite parent ) throws CoreException { fEnabledButton = createCheckButton ( parent , "Enable" ) ; fEnabledButton . setSelection ( getBreakpoint ( ) . isEnabled ( ) ) ; }
Creates the button to toggle enablement of the breakpoint
120,894
protected Text createText ( Composite parent , String initialValue ) { Text t = SWTFactory . createText ( parent , SWT . SINGLE | SWT . BORDER , 1 ) ; t . setText ( initialValue ) ; return t ; }
Creates a fully configured text editor with the given initial value
120,895
protected Composite createComposite ( Composite parent , int numColumns ) { return SWTFactory . createComposite ( parent , parent . getFont ( ) , numColumns , 1 , GridData . FILL_HORIZONTAL , 0 , 0 ) ; }
Creates a fully configured composite with the given number of columns
120,896
protected Button createCheckButton ( Composite parent , String text ) { return SWTFactory . createCheckButton ( parent , text , null , false , 1 ) ; }
Creates a fully configured check button with the given text .
120,897
protected Label createLabel ( Composite parent , String text ) { return SWTFactory . createLabel ( parent , text , 1 ) ; }
Creates a fully configured label with the given text .
120,898
protected Button createRadioButton ( Composite parent , String text ) { return SWTFactory . createRadioButton ( parent , text ) ; }
Creates a fully configured radio button with the given text .
120,899
public boolean performCancel ( ) { try { if ( getBreakpoint ( ) . getMarker ( ) . getAttribute ( ATTR_DELETE_ON_CANCEL ) != null ) { getBreakpoint ( ) . delete ( ) ; } } catch ( CoreException e ) { } return super . performCancel ( ) ; }
Check to see if the breakpoint should be deleted .