idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
120,700
public long getLong ( int index ) { synchronized ( lock ) { return CBLConverter . asLong ( getMValue ( internalArray , index ) , internalArray ) ; } }
Gets value at the given index as an long . Floating point values will be rounded . The value true is returned as 1 false as 0 . Returns 0 if the value doesn t exist or does not have a numeric value .
120,701
public float getFloat ( int index ) { synchronized ( lock ) { return CBLConverter . asFloat ( getMValue ( internalArray , index ) , internalArray ) ; } }
Gets value at the given index as an float . Integers will be converted to float . The value true is returned as 1 . 0 false as 0 . 0 . Returns 0 . 0 if the value doesn t exist or does not have a numeric value .
120,702
public double getDouble ( int index ) { synchronized ( lock ) { return CBLConverter . asDouble ( getMValue ( internalArray , index ) , internalArray ) ; } }
Gets value at the given index as an double . Integers will be converted to double . The value true is returned as 1 . 0 false as 0 . 0 . Returns 0 . 0 if the property doesn t exist or does not have a numeric value .
120,703
public boolean getBoolean ( int index ) { synchronized ( lock ) { return CBLConverter . asBoolean ( getMValue ( internalArray , index ) . asNative ( internalArray ) ) ; } }
Gets value at the given index as a boolean .
120,704
public Blob getBlob ( int index ) { synchronized ( lock ) { return ( Blob ) getMValue ( internalArray , index ) . asNative ( internalArray ) ; } }
Gets value at the given index as a Blob . Returns null if the value doesn t exist or its value is not a Blob .
120,705
public Array getArray ( int index ) { synchronized ( lock ) { final Object obj = getMValue ( internalArray , index ) . asNative ( internalArray ) ; return obj instanceof Array ? ( Array ) obj : null ; } }
Gets a Array at the given index . Return null if the value is not an array .
120,706
public Dictionary getDictionary ( int index ) { synchronized ( lock ) { final Object obj = getMValue ( internalArray , index ) . asNative ( internalArray ) ; return obj instanceof Dictionary ? ( Dictionary ) obj : null ; } }
Gets a Dictionary at the given index . Return null if the value is not an dictionary .
120,707
public List < Object > toList ( ) { synchronized ( lock ) { final int count = ( int ) internalArray . count ( ) ; final List < Object > result = new ArrayList < > ( count ) ; for ( int index = 0 ; index < count ; index ++ ) { result . add ( Fleece . toObject ( getMValue ( internalArray , index ) . asNative ( internalAr...
Gets content of the current object as an List . The values contained in the returned List object are all JSON based values .
120,708
public C4Document update ( byte [ ] body , int flags ) throws LiteCoreException { return new C4Document ( update ( handle , body , flags ) ) ; }
- Purging and Expiration
120,709
public C4QueryEnumerator run ( C4QueryOptions options , AllocSlice parameters ) throws LiteCoreException { if ( parameters == null ) { parameters = new AllocSlice ( null ) ; } return new C4QueryEnumerator ( run ( handle , options . isRankFullText ( ) , parameters . getHandle ( ) ) ) ; }
- Creates a database index to speed up subsequent queries .
120,710
@ SuppressWarnings ( { "MethodName" , "PMD.MethodNamingConventions" } ) public static void socket_open ( long socket , Object socketFactoryContext , String scheme , String hostname , int port , String path , byte [ ] optionsFleece ) { Log . e ( TAG , "CBLWebSocket.socket_open()" ) ; Map < String , Object > options = nu...
!! Called by reflection! Don t change the name .
120,711
public void start ( ) { synchronized ( lock ) { Log . i ( DOMAIN , "Replicator is starting ....." ) ; if ( c4repl != null ) { Log . i ( DOMAIN , "%s has already started" , this ) ; return ; } Log . i ( DOMAIN , "%s: Starting" , this ) ; retryCount = 0 ; internalStart ( ) ; } }
Starts the replicator . This method returns immediately ; the replicator runs asynchronously and will report its progress throuh the replicator change notification .
120,712
public void stop ( ) { synchronized ( lock ) { Log . i ( DOMAIN , "%s: Replicator is stopping ..." , this ) ; if ( c4repl != null ) { c4repl . stop ( ) ; } else { Log . i ( DOMAIN , "%s: Replicator has been stopped or offlined ..." , this ) ; } if ( c4ReplStatus . getActivityLevel ( ) == C4ReplicatorStatus . ActivityLe...
Stops a running replicator . This method returns immediately ; when the replicator actually stops the replicator will change its status s activity level to kCBLStopped and the replicator change notification will be notified accordingly .
120,713
public void resetCheckpoint ( ) { synchronized ( lock ) { if ( c4ReplStatus != null && c4ReplStatus . getActivityLevel ( ) != C4ReplicatorStatus . ActivityLevel . STOPPED ) { throw new IllegalStateException ( "Replicator is not stopped. Resetting checkpoint is only allowed when the replicator is in the " + "stopped sta...
Resets the local checkpoint of the replicator meaning that it will read all changes since the beginning of time from the remote database . This can only be called when the replicator is in a stopped state .
120,714
public void setParameters ( Parameters parameters ) { final LiveQuery liveQuery ; synchronized ( lock ) { this . parameters = parameters != null ? parameters . readonlyCopy ( ) : null ; liveQuery = this . query ; } if ( liveQuery != null ) { liveQuery . start ( ) ; } }
Set parameters should copy the given parameters . Set a new parameter will also re - execute the query if there is at least one listener listening for changes .
120,715
private static Endpoint initServiceEndpoint ( EndpointRegistry epRegistry , String contextPath , String servletName ) { if ( contextPath . startsWith ( "/" ) ) contextPath = contextPath . substring ( 1 ) ; final ObjectName oname = ObjectNameFactory . create ( Endpoint . SEPID_DOMAIN + ":" + Endpoint . SEPID_PROPERTY_CO...
Initialize the service endpoint
120,716
public Configurer createServerConfigurer ( BindingCustomization customization , WSDLFilePublisher wsdlPublisher , ArchiveDeployment dep ) { ServerBeanCustomizer customizer = new ServerBeanCustomizer ( ) ; customizer . setBindingCustomization ( customization ) ; customizer . setWsdlPublisher ( wsdlPublisher ) ; customiz...
A convenient method for getting a jbossws cxf server configurer
120,717
private static String rewriteSoapAddress ( SOAPAddressRewriteMetadata sarm , String origAddress , String newAddress , String uriScheme ) { try { URL url = new URL ( newAddress ) ; String path = url . getPath ( ) ; String host = sarm . getWebServiceHost ( ) ; String port = getDotPortNumber ( uriScheme , sarm ) ; StringB...
Rewrite the provided address according to the current server configuration and always using the specified uriScheme .
120,718
protected Map < String , String > attributesByBeanRef ( String beanRef ) { Map < String , String > result = null ; for ( Entry < String , String > e : map . entrySet ( ) ) { final String k = e . getKey ( ) ; if ( k . startsWith ( beanRef ) && k . startsWith ( DOT , beanRef . length ( ) ) ) { if ( result == null ) { res...
Return an attribute name to attribute value map
120,719
static String getSystemProperty ( final String name , final String defaultValue ) { PrivilegedAction < String > action = new PrivilegedAction < String > ( ) { public String run ( ) { return System . getProperty ( name , defaultValue ) ; } } ; return AccessController . doPrivileged ( action ) ; }
Return the current value of the specified system property
120,720
static Class < ? > loadClass ( final ClassLoader cl , final String name ) throws PrivilegedActionException , ClassNotFoundException { SecurityManager sm = System . getSecurityManager ( ) ; if ( sm == null ) { return cl . loadClass ( name ) ; } else { return AccessController . doPrivileged ( new PrivilegedExceptionActio...
Load a class using the provided classloader
120,721
public Object invoke ( Exchange exchange , Object o ) { BindingOperationInfo bop = exchange . getBindingOperationInfo ( ) ; MethodDispatcher md = ( MethodDispatcher ) exchange . getService ( ) . get ( MethodDispatcher . class . getName ( ) ) ; List < Object > params = null ; if ( o instanceof List ) { params = CastUtil...
This overrides org . apache . cxf . jaxws . AbstractInvoker in order for using the JBoss AS target bean and simplifying the business method matching
120,722
protected Object performInvocation ( Exchange exchange , final Object serviceObject , Method m , Object [ ] paramArray ) throws Exception { Endpoint ep = exchange . get ( Endpoint . class ) ; final InvocationHandler invHandler = ep . getInvocationHandler ( ) ; final Invocation inv = createInvocation ( invHandler , serv...
This overrides org . apache . cxf . jaxws . AbstractInvoker in order for using the JBossWS integration logic to invoke the JBoss AS target bean .
120,723
private static String getTypeNamespace ( String packageName ) { StringBuilder sb = new StringBuilder ( "http://" ) ; StringTokenizer st = new StringTokenizer ( packageName , "." ) ; Stack < String > stk = new Stack < String > ( ) ; while ( st != null && st . hasMoreTokens ( ) ) { stk . push ( st . nextToken ( ) ) ; } S...
Extracts the typeNS given the package name Algorithm is based on the one specified in JAXWS v2 . 0 spec
120,724
protected void publishContractToFilesystem ( ) { if ( wsdlPublisher != null ) { Endpoint endpoint = getServer ( ) . getEndpoint ( ) ; Service service = endpoint . getService ( ) ; try { String wsdlLocation = getWsdlLocation ( ) ; if ( wsdlLocation == null ) { JaxWsImplementorInfo info = new JaxWsImplementorInfo ( getIm...
Publish the contract to a file using the configured wsdl publisher
120,725
private void updateSoapAddress ( ) { final SOAPAddressRewriteMetadata metadata = getSOAPAddressRewriteMetadata ( ) ; if ( metadata . isModifySOAPAddress ( ) ) { List < ServiceInfo > sevInfos = getServer ( ) . getEndpoint ( ) . getService ( ) . getServiceInfos ( ) ; for ( ServiceInfo si : sevInfos ) { Collection < Endpo...
For both code - first and wsdl - first scenarios reset the endpoint address so that it is written to the generated wsdl file .
120,726
private AbstractHTTPDestination findDestination ( HttpServletRequest req , Bus bus ) throws ServletException { String requestURI = req . getRequestURI ( ) ; DestinationRegistry destRegistry = getDestinationRegistryFromBus ( bus ) ; if ( destRegistry == null ) { throw Messages . MESSAGES . cannotObtainRegistry ( Destina...
Finds destination based on request URI
120,727
private static String getRegexp ( SedArguments args ) { if ( args . isRegexpSet ( ) ) { return args . getRegexp ( ) ; } if ( args . isString1Set ( ) ) { return args . getString1 ( ) ; } return "" ; }
Returns the regexp operand from args either called regexp or string1 . If none of the two is set an empty string is returned .
120,728
private static String getReplacement ( SedArguments args ) { if ( args . isReplacementSet ( ) ) { return args . getReplacement ( ) ; } if ( args . isString2Set ( ) ) { return args . getString2 ( ) ; } return "" ; }
Returns the replacement operand from args either called replacement or string2 . If none of the two is set an empty string is returned .
120,729
private static int findStartTrimWhitespace ( CharSequence s ) { final int len = s . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( ! Character . isWhitespace ( s . charAt ( i ) ) ) { return i ; } } return len ; }
Finds and returns the start of the given sequence after trimming whitespace characters from the left .
120,730
private static int findWhitespace ( CharSequence s , int start ) { final int len = s . length ( ) ; for ( int i = start ; i < len ; i ++ ) { if ( Character . isWhitespace ( s . charAt ( i ) ) ) { return i ; } } return len ; }
Finds and returns the first whitespace character in the given sequence at or after start . Returns the length of the string if no whitespace is found .
120,731
public static Bus getClassLoaderDefaultBus ( final ClassLoader classloader , final ClientBusSelector clientBusSelector ) { Bus classLoaderBus ; synchronized ( classLoaderBusses ) { classLoaderBus = classLoaderBusses . get ( classloader ) ; if ( classLoaderBus == null ) { classLoaderBus = clientBusSelector . createNewBu...
Gets the default bus for the given classloader ; if a new Bus is needed the creation is delegated to the specified ClientBusSelector instance .
120,732
public static Bus getClassLoaderDefaultBus ( final ClassLoader classloader ) { Bus classLoaderBus ; synchronized ( classLoaderBusses ) { classLoaderBus = classLoaderBusses . get ( classloader ) ; if ( classLoaderBus == null ) { classLoaderBus = new JBossWSBusFactory ( ) . createBus ( ) ; BusLifeCycleListener listener =...
Gets the default bus for the given classloader
120,733
public static void clearDefaultBusForAnyClassLoader ( final Bus bus ) { synchronized ( classLoaderBusses ) { for ( final Iterator < Bus > iterator = classLoaderBusses . values ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { Bus itBus = iterator . next ( ) ; if ( bus == null || itBus == null || bus . equals ( itBus ) ...
Removes a bus from being the default bus for any classloader
120,734
static boolean checkAndFixContextClassLoader ( ClassLoader origClassLoader ) { try { origClassLoader . loadClass ( ProviderImpl . class . getName ( ) ) ; } catch ( Exception e ) { ClassLoader clientClassLoader = ProviderImpl . class . getClassLoader ( ) ; if ( BusFactory . getDefaultBus ( false ) == null ) { JBossWSBus...
Ensure the current context classloader can load this ProviderImpl class .
120,735
public boolean compileFiles ( String [ ] files ) { JavaCompiler compiler = ToolProvider . getSystemJavaCompiler ( ) ; if ( compiler == null ) { throw new IllegalStateException ( "No compiler detected, make sure you are running on top of a JDK instead of a JRE." ) ; } StandardJavaFileManager fileManager = compiler . get...
unix file separator
120,736
public String getTrimmedPath ( String path ) { if ( path == null ) { return "/" ; } if ( ! path . startsWith ( "/" ) ) { try { path = new URL ( path ) . getPath ( ) ; } catch ( MalformedURLException ex ) { Logger . getLogger ( JBossWSDestinationRegistryImpl . class ) . trace ( ex ) ; } if ( ! path . startsWith ( "/" ) ...
Return a real path value removing the protocol host and port if specified .
120,737
@ Resource ( name = "cxf" ) public final void setBus ( Bus bus ) { assert this . bus == null || this . bus == bus ; this . bus = bus ; if ( bus != null ) { bus . setExtension ( this , UndertowServerEngineFactory . class ) ; lifeCycleManager = bus . getExtension ( BusLifeCycleManager . class ) ; if ( null != lifeCycleMa...
This call is used to set the bus . It should only be called once .
120,738
public synchronized UndertowServerEngine retrieveHttpServerEngine ( int port ) { UndertowServerEngine engine = null ; synchronized ( portMap ) { engine = portMap . get ( port ) ; } return engine ; }
Retrieve a previously configured HttpServerEngine for the given port . If none exists this call returns null .
120,739
public synchronized void destroyForPort ( int port ) { synchronized ( portMap ) { UndertowServerEngine ref = portMap . remove ( port ) ; if ( ref != null ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Stopping HttpServer Engine on port " + port + "." ) ; } try { ref . stop ( ) ; } catch ( Exception e ) { LOG . wa...
This method removes the Server Engine from the port map and stops it .
120,740
public synchronized void shutdown ( ) { if ( factory != null && handlerCount == 0 ) { factory . destroyForPort ( port ) ; } else { LOG . warnv ( "Failed to shutdown Undertow server on port {0,number,####0} because it is still in use" , port ) ; } }
This method will shut down the server engine and remove it from the factory s cache .
120,741
protected void configureEndpointFactory ( AbstractWSDLBasedEndpointFactory factory ) { if ( customization != null ) { ReflectionServiceFactoryBean serviceFactory = factory . getServiceFactory ( ) ; serviceFactory . reset ( ) ; DataBinding serviceFactoryDataBinding = serviceFactory . getDataBinding ( true ) ; configureB...
Configure the endpoint factory
120,742
public MAP inboundMap ( Map < String , Object > ctx ) { AddressingProperties implementation = ( AddressingProperties ) ctx . get ( CXFMAPConstants . SERVER_ADDRESSING_PROPERTIES_INBOUND ) ; return newMap ( implementation ) ; }
retrieve the inbound server message address properties attached to a message context
120,743
public MAP outboundMap ( Map < String , Object > ctx ) { AddressingProperties implementation = ( AddressingProperties ) ctx . get ( CXFMAPConstants . CLIENT_ADDRESSING_PROPERTIES_OUTBOUND ) ; if ( implementation == null ) { implementation = new AddressingProperties ( ) ; ctx . put ( CXFMAPConstants . CLIENT_ADDRESSING_...
retrieve the outbound client message address properties attached to a message request map
120,744
public void publishWsdlFiles ( QName serviceName , String wsdlLocation , Bus bus , List < ServiceInfo > serviceInfos ) throws IOException { String deploymentName = dep . getCanonicalName ( ) ; File wsdlFile = getPublishLocation ( serviceName . getLocalPart ( ) , deploymentName , wsdlLocation ) ; if ( wsdlFile == null )...
Publish the deployed wsdl file to the data directory
120,745
private File getPublishLocation ( String serviceName , String archiveName , String wsdlLocation ) throws IOException { if ( wsdlLocation == null && serviceName == null ) { Loggers . DEPLOYMENT_LOGGER . cannotGetWsdlPublishLocation ( ) ; return null ; } if ( archiveName . startsWith ( "http://" ) ) { archiveName = archi...
Get the file publish location
120,746
public MessageBroker processAfterStartup ( MessageBroker broker ) { Service service = broker . getServiceByType ( getServiceClassName ( ) ) ; Assert . notNull ( service , "The MessageBroker with id '" + broker . getId ( ) + "' does not have a service of type " + getServiceClassName ( ) + " configured." ) ; Assert . isT...
Error checking is done on the started MessageBroker to ensure configuration was successful .
120,747
public MessageBroker processBeforeStartup ( MessageBroker broker ) { Service service = broker . getServiceByType ( getServiceClassName ( ) ) ; if ( service == null ) { service = broker . createService ( getServiceId ( ) , getServiceClassName ( ) ) ; if ( getServiceAdapterId ( ) . equals ( this . defaultAdapterId ) ) { ...
The MessageBroker is checked to see if the Service has already been configured via the BlazeDS XML config . If no existing Service is found one will be installed using the defined configuration properties of this class .
120,748
@ SuppressWarnings ( "rawtypes" ) protected String extractPassword ( Object credentials ) { String password = null ; if ( credentials instanceof String ) { password = ( String ) credentials ; } else if ( credentials instanceof Map ) { password = ( String ) ( ( Map ) credentials ) . get ( MessageIOConstants . SECURITY_C...
Extracts the password from the Flex client credentials
120,749
void handleMessage ( Message flexMessage ) { flexMessage . setDestination ( this . getDestination ( ) . getId ( ) ) ; MessageService messageService = ( MessageService ) getDestination ( ) . getService ( ) ; messageService . pushMessageToClients ( flexMessage , true ) ; messageService . sendPushMessageFromPeer ( flexMes...
Invoked when a Message is received from a JMS client .
120,750
public void findDefaultChannel ( MessageBroker broker , Service service ) { if ( ! CollectionUtils . isEmpty ( broker . getDefaultChannels ( ) ) ) { return ; } Iterator < String > channels = broker . getChannelIds ( ) . iterator ( ) ; while ( channels . hasNext ( ) ) { Endpoint endpoint = broker . getEndpoint ( channel...
Tries to find a sensible default AMF channel for the default MessageService
120,751
protected void configureAdapter ( Destination destination ) { String adapterId = StringUtils . hasText ( this . serviceAdapter ) ? this . serviceAdapter : getTargetService ( this . broker ) . getDefaultAdapter ( ) ; if ( this . beanFactory . containsBean ( adapterId ) ) { ServiceAdapter adapter = ( ServiceAdapter ) thi...
Configure the service adapter for the destination .
120,752
@ SuppressWarnings ( "unchecked" ) public MessagingConfiguration getMessagingConfiguration ( ServletConfig servletConfig ) { Assert . isTrue ( JdkVersion . getMajorJavaVersion ( ) >= JdkVersion . JAVA_15 , "Spring BlazeDS Integration requires a minimum of Java 1.5" ) ; Assert . notNull ( servletConfig , "FlexConfigurat...
Parses the BlazeDS config files and returns a populated MessagingConfiguration
120,753
public static SpringPropertyProxy proxyFor ( Class < ? > beanType , boolean useDirectFieldAccess , ConversionService conversionService ) { if ( PropertyProxyUtils . hasAmfCreator ( beanType ) ) { SpringPropertyProxy proxy = new DelayedWriteSpringPropertyProxy ( beanType , useDirectFieldAccess , conversionService ) ; re...
Factory method for creating correctly configured Spring property proxy instances .
120,754
public void handleMessage ( Message < ? > message ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "received Integration Message: " + message ) ; } AsyncMessage flexMessage = new AsyncMessage ( ) ; flexMessage . setBody ( message . getPayload ( ) ) ; MessageHeaders headers = message . getHeaders ( ) ; flexMess...
Invoked when a Message is received from the Spring Integration channel .
120,755
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public Object invoke ( flex . messaging . messages . Message flexMessage ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "received Flex Message: " + flexMessage ) ; } Message < ? > message = null ; if ( this . extractPayload ) { Map headers = flexMessage . g...
Invoked when a Message is received from a Flex client .
120,756
public void send ( String destination , Object body ) { AsyncMessage message = this . defaultMessageCreator . createMessage ( ) ; message . setDestination ( destination ) ; message . setBody ( body ) ; getMessageBroker ( ) . routeMessageToService ( message , null ) ; }
Sends a message with the specified body to the specified destination
120,757
public void afterThrowing ( Throwable original ) throws Throwable { Class < ? > candidateType = original . getClass ( ) ; Throwable candidate = original ; if ( ClassUtils . isAssignable ( MessageException . class , candidateType ) ) { MessageException me = ( MessageException ) candidate ; if ( SERVER_PROCESSING_CODE . ...
Apply translation to the thrown exception .
120,758
public String getQualifiedName ( ) { if ( this . module == null || this . module . getName ( ) == null ) { return name ; } if ( this . module . getName ( ) . equals ( "core" ) || this . module . getName ( ) . equals ( "filters" ) || this . module . getName ( ) . equals ( "elements" ) ) { return "kurento." + name ; } el...
Get qualified name mixing In the format module . name
120,759
public boolean satisfies ( String expr ) { Parser < Expression > parser = ExpressionParser . newInstance ( ) ; return parser . parse ( expr ) . interpret ( this ) ; }
Checks if this version satisfies the specified SemVer Expression .
120,760
public String translate ( String text , List < String [ ] > patterns ) { String res = text ; for ( String [ ] each : patterns ) { res = res . replaceAll ( "(?ms)" + each [ 0 ] , each [ 1 ] ) ; } return res ; }
Clone the python unicode translate method in legacy languages younger than python . python docutils is public domain .
120,761
public Result generateCode ( ) throws JsonIOException , IOException { if ( moduleManager == null ) { loadModulesFromKmdFiles ( ) ; } if ( internalTemplates != null ) { templatesDir = getInternalTemplatesDir ( internalTemplates ) ; } if ( templatesDir != null ) { Path configFile = templatesDir . resolve ( CONFIG_FILE_NA...
Genarates the code .
120,762
private CharType nearestCharType ( CharType ... types ) { for ( Character chr : chars ) { for ( CharType type : types ) { if ( type . isMatchedBy ( chr ) ) { return type ; } } } return CharType . EOL ; }
Finds the nearest character type .
120,763
private void checkForLeadingZeroes ( ) { Character la1 = chars . lookahead ( 1 ) ; Character la2 = chars . lookahead ( 2 ) ; if ( la1 != null && la1 == '0' && CharType . DIGIT . isMatchedBy ( la2 ) ) { throw new ParseException ( "Numeric identifier MUST NOT contain leading zeroes" ) ; } }
Checks for leading zeroes in the numeric identifiers .
120,764
private void checkForEmptyIdentifier ( ) { Character la = chars . lookahead ( 1 ) ; if ( CharType . DOT . isMatchedBy ( la ) || CharType . PLUS . isMatchedBy ( la ) || CharType . EOL . isMatchedBy ( la ) ) { throw new ParseException ( "Identifiers MUST NOT be empty" , new UnexpectedCharacterException ( la , chars . cur...
Checks for empty identifiers in the pre - release version or build metadata .
120,765
private void consConstructorCallContext ( ) { proposalPrefix = rawScan . subSequence ( rawScan . indexOf ( "new" ) , rawScan . length ( ) ) . toString ( ) ; processedScan = rawScan ; type = SearchType . New ; }
Constructs the completion context for a constructor call
120,766
private void consMkContext ( ) { final int MK_LENGTH = "mk_" . length ( ) ; CharSequence subSeq = rawScan . subSequence ( MK_LENGTH , rawScan . length ( ) ) ; processedScan = new StringBuffer ( subSeq ) ; proposalPrefix = processedScan . toString ( ) . trim ( ) ; type = SearchType . Mk ; }
Constructs the completion context for a mk_ call
120,767
private void consQuoteContext ( int index ) { processedScan = new StringBuffer ( proposalPrefix . subSequence ( index , proposalPrefix . length ( ) ) ) ; proposalPrefix = processedScan . substring ( processedScan . lastIndexOf ( "<" ) ) ; type = SearchType . Quote ; }
Constructs the completion context for quotes
120,768
private void setMeasureExp ( TypeCheckInfo question , SFunctionDefinitionBase node , Environment base , Environment local , NameScope scope ) throws AnalysisException { PType actual = node . getMeasure ( ) . apply ( THIS , question . newInfo ( local ) ) ; node . setMeasureName ( node . getName ( ) . getMeasureName ( no...
Set measureDef to a newly created function based on the measure expression .
120,769
private void checkMeasure ( TypeCheckInfo question , SFunctionDefinitionBase node , ILexNameToken iLexNameToken , PType result ) { PTypeAssistantTC assistant = question . assistantFactory . createPTypeAssistant ( ) ; if ( ! assistant . isNumeric ( result ) ) { if ( assistant . isProduct ( result ) ) { AProductType pt =...
A measure must return a nat or nat - tuple .
120,770
private int getFirstCompleteLineOfRegion ( IRegion region , IDocument document ) { try { int startLine = document . getLineOfOffset ( region . getOffset ( ) ) ; int offset = document . getLineOffset ( startLine ) ; if ( offset >= region . getOffset ( ) ) return startLine ; offset = document . getLineOffset ( startLine ...
Returns the index of the first line whose start offset is in the given text range .
120,771
private boolean isBlockCommented ( int startLine , int endLine , String [ ] prefixes , IDocument document ) { try { for ( int i = startLine ; i <= endLine ; i ++ ) { IRegion line = document . getLineInformation ( i ) ; String text = document . get ( line . getOffset ( ) , line . getLength ( ) ) ; int [ ] found = TextUt...
Determines whether each line is prefixed by one of the prefixes .
120,772
PType typeCheckAElseIf ( INode elseIfNode , ILexLocation elseIfLocation , INode test , INode thenNode , TypeCheckInfo question ) throws AnalysisException { if ( ! question . assistantFactory . createPTypeAssistant ( ) . isType ( test . apply ( THIS , question . newConstraint ( null ) ) , ABooleanBasicType . class ) ) {...
Type checks a AElseIf node
120,773
protected PType typeCheckLet ( INode node , LinkedList < PDefinition > localDefs , INode body , TypeCheckInfo question ) throws AnalysisException { Environment local = question . env ; for ( PDefinition d : localDefs ) { if ( d instanceof AExplicitFunctionDefinition ) { local = new FlatCheckedEnvironment ( question . a...
Type checks a let node
120,774
protected Map . Entry < PType , AMultiBindListDefinition > typecheckLetBeSt ( INode node , ILexLocation nodeLocation , PMultipleBind bind , PExp suchThat , INode body , TypeCheckInfo question ) throws AnalysisException { final PDefinition def = AstFactory . newAMultiBindListDefinition ( nodeLocation , question . assist...
Type check method for let be such that
120,775
public String hackResultName ( AFuncDeclIR func ) throws AnalysisException { SourceNode x = func . getSourceNode ( ) ; if ( x . getVdmNode ( ) instanceof AImplicitFunctionDefinition ) { AImplicitFunctionDefinition iFunc = ( AImplicitFunctionDefinition ) x . getVdmNode ( ) ; return iFunc . getResult ( ) . getPattern ( )...
FIXME Unhack result name extraction for implicit functions
120,776
public String hackInv ( ANamedTypeDeclIR type ) { ATypeDeclIR tDecl = ( ATypeDeclIR ) type . parent ( ) ; if ( tDecl . getInv ( ) != null ) { AFuncDeclIR invFunc = ( AFuncDeclIR ) tDecl . getInv ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "inv " ) ; sb . append ( invFunc . getFormalParams ( ) . get (...
FIXME Unhack invariant extraction for named types
120,777
public String hackInv ( ARecordDeclIR type ) { if ( type . getInvariant ( ) != null ) { AFuncDeclIR invFunc = ( AFuncDeclIR ) type . getInvariant ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "inv " ) ; sb . append ( invFunc . getFormalParams ( ) . get ( 0 ) . getPattern ( ) . toString ( ) ) ; sb . app...
FIXME Unhack invariant extraction for namedt ypes
120,778
public static String wrap ( String s ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "(" ) ; sb . append ( s ) ; sb . append ( ")" ) ; return sb . toString ( ) ; }
Wrap a string in parenthesis .
120,779
protected synchronized Long getStaticId ( String name , CPUResource cpuId ) { String nameFinal = name + cpuId . getNumber ( ) ; if ( staticIds . containsKey ( nameFinal ) ) { return staticIds . get ( nameFinal ) ; } else { RTDeployStaticMessage deployMessage = new RTDeployStaticMessage ( name , cpuId ) ; cachedStaticDe...
Timestamp the message
120,780
public void addListener ( IProblemChangedListener listener ) { if ( fListeners . isEmpty ( ) ) { VdmUIPlugin . getWorkspace ( ) . addResourceChangeListener ( this ) ; } fListeners . add ( listener ) ; }
Adds a listener for problem marker changes .
120,781
private void runPendingUpdates ( ) { IResource [ ] markerResources = null ; IResource [ ] annotationResources = null ; synchronized ( this ) { if ( ! fResourcesWithMarkerChanges . isEmpty ( ) ) { markerResources = ( IResource [ ] ) fResourcesWithMarkerChanges . toArray ( new IResource [ fResourcesWithMarkerChanges . si...
Notify all IProblemChangedListener . Must be called in the display thread .
120,782
protected void createTypeSpecificEditors ( Composite parent ) throws CoreException { setTitle ( "Line Breakpoint" ) ; IVdmLineBreakpoint breakpoint = ( IVdmLineBreakpoint ) getBreakpoint ( ) ; createConditionEditor ( parent ) ; }
Create the condition editor and associated editors .
120,783
private void createConditionEditor ( Composite parent ) throws CoreException { IVdmLineBreakpoint breakpoint = ( IVdmLineBreakpoint ) getBreakpoint ( ) ; String label = null ; if ( label == null ) { label = "Enable Condition" ; } Composite conditionComposite = SWTFactory . createGroup ( parent , EMPTY_STRING , 1 , 1 , ...
Creates the controls that allow the user to specify the breakpoint s condition
120,784
private void setConditionEnabled ( boolean enabled ) { fConditionEditor . setEnabled ( enabled ) ; fSuspendWhenLabel . setEnabled ( enabled ) ; fConditionIsTrue . setEnabled ( enabled ) ; fConditionHasChanged . setEnabled ( enabled ) ; }
Sets the enabled state of the condition editing controls .
120,785
public static Value freadval ( Value fval , Context ctxt ) { ValueList result = new ValueList ( ) ; try { File file = getFile ( fval ) ; LexTokenReader ltr = new LexTokenReader ( file , Dialect . VDM_PP , VDMJ . filecharset ) ; ExpressionReader reader = new ExpressionReader ( ltr ) ; reader . setCurrentModule ( "IO" ) ...
reading the data .
120,786
protected static File getFile ( Value fval ) { String path = stringOf ( fval ) . replace ( '/' , File . separatorChar ) ; File file = new File ( path ) ; if ( ! file . isAbsolute ( ) ) { file = new File ( Settings . baseDir , path ) ; } return file ; }
Gets the absolute path the file based on the filename parsed and the working dir of the IDE or the execution dir of VDMJ
120,787
protected static String stringOf ( Value val ) { StringBuilder s = new StringBuilder ( ) ; val = val . deref ( ) ; if ( val instanceof SeqValue ) { SeqValue sv = ( SeqValue ) val ; for ( Value v : sv . values ) { v = v . deref ( ) ; if ( v instanceof CharacterValue ) { CharacterValue cv = ( CharacterValue ) v ; s . app...
characters back to their quoted form .
120,788
protected void cyclicDependencyCheck ( List < PDefinition > defs ) { if ( System . getProperty ( "skip.cyclic.check" ) != null ) { return ; } if ( getErrorCount ( ) > 0 ) { return ; } Map < ILexNameToken , LexNameSet > dependencies = new HashMap < ILexNameToken , LexNameSet > ( ) ; LexNameSet skip = new LexNameSet ( ) ...
Check for cyclic dependencies between the free variables that definitions depend on and the definition of those variables .
120,789
private boolean reachable ( ILexNameToken sought , LexNameSet nextset , Map < ILexNameToken , LexNameSet > dependencies , Stack < ILexNameToken > stack ) { if ( nextset == null ) { return false ; } if ( nextset . contains ( sought ) ) { stack . push ( sought ) ; return true ; } for ( ILexNameToken nextname : nextset ) ...
Return true if the name sought is reachable via the next set of names passed using the dependency map . The stack passed records the path taken to find a cycle .
120,790
@ SuppressWarnings ( "unchecked" ) public void fillContextMenu ( IMenuManager menu ) { IStructuredSelection selection = ( IStructuredSelection ) getContext ( ) . getSelection ( ) ; boolean hasClosedProjects = false ; Iterator < Object > resources = selection . iterator ( ) ; while ( resources . hasNext ( ) && ( ! hasCl...
Adds the refresh resource actions to the context menu .
120,791
public void handleSuspend ( int detail ) { DebugEventHelper . fireExtendedEvent ( this , ExtendedDebugEventDetails . BEFORE_SUSPEND ) ; this . target . printLog ( new LogItem ( this . session . getInfo ( ) , "Break" , false , "Suspend" ) ) ; DebugEventHelper . fireChangeEvent ( this ) ; DebugEventHelper . fireSuspendEv...
VdmThreadStateManager . IStateChangeHandler
120,792
public static boolean isValidJavaIdentifier ( String s ) { if ( s == null || s . length ( ) == 0 ) { return false ; } if ( isJavaKeyword ( s ) ) { return false ; } char [ ] c = s . toCharArray ( ) ; if ( ! Character . isJavaIdentifierStart ( c [ 0 ] ) ) { return false ; } for ( int i = 1 ; i < c . length ; i ++ ) { if ...
Checks whether the given String is a valid Java identifier .
120,793
public static List < Integer > computeJavaIdentifierCorrections ( String s ) { List < Integer > correctionIndices = new LinkedList < Integer > ( ) ; if ( s == null || s . length ( ) == 0 ) { return correctionIndices ; } char [ ] c = s . toCharArray ( ) ; if ( ! Character . isJavaIdentifierStart ( c [ 0 ] ) ) { correcti...
Computes the indices of characters that need to be replaced with valid characters in order to make s a valid Java identifier . Please note that this method assumes that s is NOT a keyword .
120,794
protected VdmContentOutlinePage createOutlinePage ( ) { VdmContentOutlinePage page = new VdmContentOutlinePage ( this ) ; setOutlinePageInput ( page , getEditorInput ( ) ) ; page . addSelectionChangedListener ( createOutlineSelectionChangedListener ( ) ) ; return page ; }
Creates the outline page used with this editor .
120,795
public void selectAndReveal ( INode node ) { int [ ] offsetLength = this . locationSearcher . getNodeOffset ( node ) ; selectAndReveal ( offsetLength [ 0 ] , offsetLength [ 1 ] ) ; }
Selects a node existing within the ast presented by the editor
120,796
public void setHighlightRange ( INode node ) { try { int [ ] offsetLength = this . locationSearcher . getNodeOffset ( node ) ; Assert . isNotNull ( offsetLength ) ; Assert . isTrue ( offsetLength [ 0 ] > 0 , "Illegal start offset" ) ; Assert . isTrue ( offsetLength [ 0 ] > 0 , "Illegal offset length" ) ; super . setHig...
highlights a node in the text editor .
120,797
private IPreferenceStore createCombinedPreferenceStore ( IEditorInput input ) { List < IPreferenceStore > stores = new ArrayList < IPreferenceStore > ( 3 ) ; stores . add ( VdmUIPlugin . getDefault ( ) . getPreferenceStore ( ) ) ; stores . add ( EditorsUI . getPreferenceStore ( ) ) ; stores . add ( PlatformUI . getPref...
Creates and returns the preference store for this Java editor with the given input .
120,798
protected void setOutlinePageInput ( VdmContentOutlinePage page , IEditorInput input ) { if ( page == null ) return ; IVdmElement je = getInputVdmElement ( ) ; if ( je != null && je . exists ( ) ) page . setInput ( je ) ; else page . setInput ( null ) ; }
Sets the input of the editor s outline page .
120,799
protected void selectionChanged ( ) { if ( getSelectionProvider ( ) == null ) return ; INode element = computeHighlightRangeSourceReference ( ) ; synchronizeOutlinePage ( element ) ; setSelection ( element , false ) ; }
React to changed selection .