idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
15,500 | public MDecimal getHz ( ) { MDecimal result = new MDecimal ( currentUnit . getConverterTo ( HERTZ ) . convert ( doubleValue ( ) ) ) ; logger . trace ( MMarker . GETTER , "Converting from {} to Hertz : {}" , currentUnit , result ) ; return result ; } | Hz is the SI unit |
15,501 | public static byte [ ] encodeSHA ( byte [ ] rgbValue ) throws NoSuchAlgorithmException { MessageDigest md = MessageDigest . getInstance ( "SHA" ) ; md . update ( rgbValue ) ; rgbValue = md . digest ( ) ; return rgbValue ; } | Returns the string run through the SHA hash . |
15,502 | public static byte [ ] encodeToBytes ( byte [ ] bytes ) { try { char [ ] chars = Base64 . encode ( bytes ) ; String string = new String ( chars ) ; return string . getBytes ( DEFAULT_ENCODING ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; return null ; } } | Encode this string as base64 . |
15,503 | public static String decode ( String string ) { try { byte [ ] bytes = Base64 . decode ( string . toCharArray ( ) ) ; return new String ( bytes , DEFAULT_ENCODING ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; return null ; } } | Decode this base64 string to a regular string . |
15,504 | public void set ( int i , int j , T v ) { consumer . set ( i , j , v ) ; } | Sets item at i j |
15,505 | public void runTask ( ) { String strProcess = this . getProperty ( DBParams . PROCESS ) ; BaseProcess job = ( BaseProcess ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( strProcess ) ; if ( job != null ) { this . runProcess ( job , m_properties ) ; } else { String strClass = this . getProperty ( "standalone" ) ; if ( ( strClass != null ) && ( strClass . length ( ) > 0 ) ) { try { if ( strClass . indexOf ( '.' ) == 0 ) strClass = Constants . ROOT_PACKAGE + strClass . substring ( 1 ) ; Class < ? > c = Class . forName ( strClass ) ; if ( c != null ) { Class < ? > [ ] parameterTypes = { String [ ] . class } ; Method method = c . getMethod ( "main" , parameterTypes ) ; Object [ ] args = new Object [ 1 ] ; Map < String , Object > properties = m_properties ; String [ ] rgArgs = Utility . propertiesToArgs ( properties ) ; args [ 0 ] = rgArgs ; method . invoke ( null , args ) ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } } } | Get the name of this process and run it . |
15,506 | public Object doGetData ( ) { String data = ( String ) super . doGetData ( ) ; FileListener listener = this . getRecord ( ) . getListener ( PropertiesStringFileListener . class ) ; if ( this . getComponent ( 0 ) == null ) if ( enableConversion ) if ( listener != null ) if ( listener . isEnabled ( ) ) data = Utility . replaceResources ( data , null , null , this . getRecord ( ) . getRecordOwner ( ) , true ) ; return data ; } | DoGetData Method . |
15,507 | public BasePanel getSubScreen ( BasePanel parentScreen , ScreenLocation screenLocation , Map < String , Object > properties , int screenNo ) { switch ( screenNo ) { case 0 : return new LogicFileGridScreen ( null , screenLocation , parentScreen , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , properties ) ; case 1 : return new FieldDataGridScreen ( null , screenLocation , parentScreen , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , properties ) ; case 2 : return new KeyInfoGridScreen ( null , screenLocation , parentScreen , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , properties ) ; case 3 : return new ClassFieldsGridScreen ( null , screenLocation , parentScreen , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , properties ) ; case 4 : return new ScreenInGridScreen ( null , screenLocation , parentScreen , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , properties ) ; case 5 : return new ClassInfoDescScreen ( null , screenLocation , parentScreen , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , properties ) ; case 6 : return new ClassInfoHelpScreen ( null , screenLocation , parentScreen , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , properties ) ; case 7 : return new ClassResourceGridScreen ( null , screenLocation , parentScreen , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , properties ) ; case 8 : return new ClassIssueGridScreen ( null , screenLocation , parentScreen , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , properties ) ; case 9 : return new FileHdrScreen ( null , screenLocation , parentScreen , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , properties ) ; case 10 : return new ExportRecordsScreen ( null , screenLocation , parentScreen , null , ScreenConstants . DONT_DISPLAY_FIELD_DESC , properties ) ; } return null ; } | GetSubScreen Method . |
15,508 | public void start ( Supplier < ExecutorService > executorFactory ) throws IOException { future = executorFactory . get ( ) . submit ( this ) ; } | Start virtual circuit |
15,509 | public void waitForFinish ( ) throws IOException { if ( future == null ) { throw new IllegalStateException ( "not started" ) ; } try { future . get ( ) ; } catch ( InterruptedException | ExecutionException ex ) { throw new IOException ( ex ) ; } } | Wait until other peer has closed connection or virtual circuit is closed by interrupt . |
15,510 | public void setRequestCompletionFilter ( ITraceFilterExt val ) { RequestWriter requestWriter = ( RequestWriter ) m_connection . getTraceWriter ( ) ; requestWriter . getRequestSeparator ( ) . setRequestCompletionFilter ( val ) ; } | The request api will consider a thread is completed processing when a particular method fires an exit event . Which method? The one indicated on the parameters of this method . As you d expect this needs to be called before events start firing . This the inTrace client will not be running in the same JVM as the system being monitored it would not be possible to type these parameters with java . lang . Class and java . reflect . Method . |
15,511 | public void onApplicationEvent ( final ContextRefreshedEvent event ) { if ( ! hasStarted ) { hasStarted = true ; log . info ( Markers . AUDIT , message ) ; } } | Logs the provided message at log level info when it first receives an event |
15,512 | public ParameterizedOperator operator ( Point2D . Double ... controlPoints ) { if ( controlPoints . length != length ) { throw new IllegalArgumentException ( "control-points length not " + length ) ; } double [ ] cp = convert ( controlPoints ) ; return operator ( cp ) ; } | Creates Bezier function for fixed control points . |
15,513 | public ParameterizedOperator operator ( double ... controlPoints ) { if ( controlPoints . length != 2 * length ) { throw new IllegalArgumentException ( "control-points length not " + length ) ; } return operator ( controlPoints , 0 ) ; } | Creates Bezier function for fixed control points . Note that it is not same if you pass an array or separate parameters . Array is not copied so if you modify it it will make change . If you want to have function with immutable control points use separate parameters or copy the array . |
15,514 | private ParameterizedOperator derivative ( double ... controlPoints ) { if ( controlPoints . length != 2 * length ) { throw new IllegalArgumentException ( "control-points length not " + length ) ; } return derivative ( controlPoints , 0 ) ; } | Create first derivative function for fixed control points . |
15,515 | private ParameterizedOperator secondDerivative ( double ... controlPoints ) { if ( controlPoints . length != 2 * length ) { throw new IllegalArgumentException ( "control-points length not " + length ) ; } return secondDerivative ( controlPoints , 0 ) ; } | Create second derivative function for fixed control points . |
15,516 | public static BezierCurve getInstance ( int degree ) { if ( degree < 1 ) { throw new IllegalArgumentException ( "illegal degree" ) ; } switch ( degree ) { case 1 : return LINE ; case 2 : return QUAD ; case 3 : return CUBIC ; default : return new BezierCurve ( degree ) ; } } | Creates or gets BezierCurve instance |
15,517 | public static void main ( String args [ ] ) { Map < String , Object > properties = null ; if ( args != null ) { properties = new Hashtable < String , Object > ( ) ; Util . parseArgs ( properties , args ) ; } BaseApplication app = new MainApplication ( null , properties , null ) ; app . getTaskScheduler ( ) . addTask ( new MessageReceivingPopClient ( ) ) ; } | Run this stand - alone . |
15,518 | public Object doRemoteAction ( String strCommand , Map < String , Object > properties ) throws DBException , RemoteException { return null ; } | Do a remote action . Not implemented . |
15,519 | public void setDfn ( String dfn ) { this . dfn = VistAUtil . validateIEN ( dfn ) ? dfn : null ; } | Sets the DFN of the associated patient if any . |
15,520 | public PreferredValueMakersRegistry add ( Matcher < ? > settableMatcher , Maker < ? > maker ) { Preconditions . checkNotNull ( settableMatcher ) ; Preconditions . checkNotNull ( maker ) ; makers . put ( settableMatcher , maker ) ; return this ; } | Add a maker with custom matcher . |
15,521 | public static boolean valueMatchesRegularExpression ( String val , String regexp ) { Pattern p = cache . get ( regexp ) ; if ( p == null ) { p = Pattern . compile ( regexp ) ; cache . put ( regexp , p ) ; } return valueMatchesRegularExpression ( val , p ) ; } | Returns true only if the value matches the regular expression only once and exactly . |
15,522 | public static boolean valueMatchesRegularExpression ( String val , Pattern regexp ) { Matcher m = regexp . matcher ( val ) ; try { return m . matches ( ) ; } catch ( StackOverflowError e ) { e . printStackTrace ( ) ; System . out . println ( "-> [" + val + "][" + regexp + "]" ) ; System . out . println ( "-> " + val . length ( ) ) ; System . exit ( 0 ) ; } return false ; } | Returns true only if the value matches the regular expression at least once . |
15,523 | public static Payload decode ( String base64 ) { JsonObject json = decodeToJson ( base64 ) ; Payload payload = new Payload ( ) ; json . keySet ( ) . forEach ( key -> { switch ( key ) { case "iss" : payload . issuer = json . getString ( key ) ; break ; case "sub" : payload . subject = json . getString ( key ) ; break ; case "aud" : payload . audience = json . getString ( key ) ; break ; case "exp" : payload . expires = new Long ( json . get ( key ) . toString ( ) ) ; break ; case "nbf" : payload . notBefore = new Long ( json . get ( key ) . toString ( ) ) ; break ; case "iat" : payload . issuedAt = new Long ( json . get ( key ) . toString ( ) ) ; break ; case "jti" : payload . jwtId = json . getString ( key ) ; break ; default : payload . add ( key , json . getString ( key ) ) ; } } ) ; return payload ; } | Decode the base64 - string to Payload . |
15,524 | @ SuppressWarnings ( { "unchecked" } ) public boolean perform ( TherianContext context , final Convert < ? , ? > convert ) { return new Delegate ( convert ) . perform ( context , convert ) ; } | specifically avoid doing typed ops as we want to catch stuff that slips through the cracks |
15,525 | private static Iterable < String > getAssociationTables ( EntityClass entityClass ) { Iterable < Settable > association = filter ( entityClass . getElements ( ) , and ( or ( has ( ManyToMany . class ) , has ( ElementCollection . class ) ) , has ( JoinTable . class ) ) ) ; return transform ( association , new Function < Settable , String > ( ) { public String apply ( Settable input ) { JoinTable annotation = input . getAnnotation ( JoinTable . class ) ; return annotation . name ( ) ; } } ) ; } | This will find all ManyToMany and ElementCollection annotated tables . |
15,526 | public final void createCatalog ( ClusterName targetCluster , CatalogMetadata catalogMetadata ) throws ExecutionException , UnsupportedException { try { connectionHandler . startJob ( targetCluster . getName ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Creating catalog [" + catalogMetadata . getName ( ) . getName ( ) + "] in cluster [" + targetCluster . getName ( ) + "]" ) ; } createCatalog ( catalogMetadata , connectionHandler . getConnection ( targetCluster . getName ( ) ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Catalog [" + catalogMetadata . getName ( ) . getName ( ) + "] has been created successfully in cluster [" + targetCluster . getName ( ) + "]" ) ; } } finally { connectionHandler . endJob ( targetCluster . getName ( ) ) ; } } | This method creates a catalog . |
15,527 | public final void createTable ( ClusterName targetCluster , TableMetadata tableMetadata ) throws UnsupportedException , ExecutionException { try { connectionHandler . startJob ( targetCluster . getName ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Creating table [" + tableMetadata . getName ( ) . getName ( ) + "] in cluster [" + targetCluster . getName ( ) + "]" ) ; } createTable ( tableMetadata , connectionHandler . getConnection ( targetCluster . getName ( ) ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Catalog [" + tableMetadata . getName ( ) . getName ( ) + "] has been created successfully in cluster [" + targetCluster . getName ( ) + "]" ) ; } } finally { connectionHandler . endJob ( targetCluster . getName ( ) ) ; } } | This method creates a table . |
15,528 | public final void dropCatalog ( ClusterName targetCluster , CatalogName name ) throws UnsupportedException , ExecutionException { try { connectionHandler . startJob ( targetCluster . getName ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Dropping catalog [" + name . getName ( ) + "] in cluster [" + targetCluster . getName ( ) + "]" ) ; } dropCatalog ( name , connectionHandler . getConnection ( targetCluster . getName ( ) ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Catalog [" + name . getName ( ) + "] has been drepped successfully in cluster [" + targetCluster . getName ( ) + "]" ) ; } } finally { connectionHandler . endJob ( targetCluster . getName ( ) ) ; } } | This method drop a catalog . |
15,529 | public final void dropTable ( ClusterName targetCluster , TableName name ) throws UnsupportedException , ExecutionException { try { connectionHandler . startJob ( targetCluster . getName ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Dropping table [" + name . getName ( ) + "] in cluster [" + targetCluster . getName ( ) + "]" ) ; } dropTable ( name , connectionHandler . getConnection ( targetCluster . getName ( ) ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Table [" + name . getName ( ) + "] has been drepped successfully in cluster [" + targetCluster . getName ( ) + "]" ) ; } } finally { connectionHandler . endJob ( targetCluster . getName ( ) ) ; } } | This method drop a table . |
15,530 | public final void createIndex ( ClusterName targetCluster , IndexMetadata indexMetadata ) throws UnsupportedException , ExecutionException { try { connectionHandler . startJob ( targetCluster . getName ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Creating index [" + indexMetadata . getName ( ) . getName ( ) + "] in cluster [" + targetCluster . getName ( ) + "]" ) ; } createIndex ( indexMetadata , connectionHandler . getConnection ( targetCluster . getName ( ) ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Index [" + indexMetadata . getName ( ) . getName ( ) + "] has been created successfully in cluster [" + targetCluster . getName ( ) + "]" ) ; } } finally { connectionHandler . endJob ( targetCluster . getName ( ) ) ; } } | This method creates an index . |
15,531 | public final void alterTable ( ClusterName targetCluster , TableName name , AlterOptions alterOptions ) throws UnsupportedException , ExecutionException { try { connectionHandler . startJob ( targetCluster . getName ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Altering table[" + name . getName ( ) + "] in cluster [" + targetCluster . getName ( ) + "]" ) ; } alterTable ( name , alterOptions , connectionHandler . getConnection ( targetCluster . getName ( ) ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Table [" + name . getName ( ) + "] has been altered successfully in cluster [" + targetCluster . getName ( ) + "]" ) ; } } finally { connectionHandler . endJob ( targetCluster . getName ( ) ) ; } } | This method add delete or modify columns in an existing table . |
15,532 | public final void alterCatalog ( ClusterName targetCluster , CatalogName catalogName , Map < Selector , Selector > options ) throws UnsupportedException , ExecutionException { try { connectionHandler . startJob ( targetCluster . getName ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Altering catalog[" + catalogName . getName ( ) + "] in cluster [" + targetCluster . getName ( ) + "]" ) ; } alterCatalog ( catalogName , options , connectionHandler . getConnection ( targetCluster . getName ( ) ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Catalog [" + catalogName . getName ( ) + "] has been altered successfully in cluster [" + targetCluster . getName ( ) + "]" ) ; } } finally { connectionHandler . endJob ( targetCluster . getName ( ) ) ; } } | Alter options in an existing table . |
15,533 | public void notifyStart ( String projectApiId , String projectVersion , String category ) { try { if ( isStarted ( ) ) { JSONObject startNotification = new JSONObject ( ) . put ( "project" , new JSONObject ( ) . put ( "apiId" , projectApiId ) . put ( "version" , projectVersion ) ) . put ( "category" , category ) ; socket . emit ( "run:start" , startNotification ) ; } else { LOGGER . log ( Level . WARNING , "Probe Dock RT is not available to send the start notification" ) ; } } catch ( Exception e ) { LOGGER . log ( Level . INFO , "Unable to send the start notification to the agent. Cause: " + e . getMessage ( ) ) ; if ( LOGGER . getLevel ( ) == Level . FINEST ) { LOGGER . log ( Level . FINEST , "Exception: " , e ) ; } } } | Send a starting notification to the agent |
15,534 | public void notifyEnd ( String projectApiId , String projectVersion , String category , long duration ) { try { if ( isStarted ( ) ) { JSONObject endNotification = new JSONObject ( ) . put ( "project" , new JSONObject ( ) . put ( "apiId" , projectApiId ) . put ( "version" , projectVersion ) ) . put ( "category" , category ) . put ( "duration" , duration ) ; socket . emit ( "run:end" , endNotification ) ; } else { LOGGER . log ( Level . WARNING , "Probe Dock RT is not available to send the end notification" ) ; } } catch ( Exception e ) { LOGGER . log ( Level . INFO , "Unable to send the end notification to the agent. Cause: " + e . getMessage ( ) ) ; if ( LOGGER . getLevel ( ) == Level . FINEST ) { LOGGER . log ( Level . FINEST , "Exception:" , e ) ; } } } | Send a ending notification to the agent |
15,535 | public void send ( TestRun testRun ) { try { if ( isStarted ( ) ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; new JsonSerializer ( ) . serializePayload ( new OutputStreamWriter ( baos ) , testRun , false ) ; socket . emit ( "payload" , new String ( baos . toByteArray ( ) ) ) ; } else { LOGGER . log ( Level . WARNING , "Probe Dock RT is not available to send the test results" ) ; } } catch ( Exception e ) { LOGGER . log ( Level . WARNING , "Unable to send the result to the agent. Cause: " + e . getMessage ( ) ) ; if ( LOGGER . getLevel ( ) == Level . FINEST ) { LOGGER . log ( Level . FINEST , "Exception: " , e ) ; } } } | Send a test result to the agent . This is a best effort and when the request failed there is no crash |
15,536 | public List < FilterDefinition > getFilters ( ) { try { if ( isStarted ( ) ) { final FilterAcknowledger acknowledger = new FilterAcknowledger ( ) ; new Thread ( new Runnable ( ) { public void run ( ) { try { LOGGER . finest ( "Retrieve filters" ) ; socket . emit ( "filters:get" , acknowledger ) ; } catch ( Exception e ) { LOGGER . finest ( "Unable to get the filters: " + e . getMessage ( ) ) ; synchronized ( acknowledger ) { acknowledger . notify ( ) ; } } } } ) . start ( ) ; synchronized ( acknowledger ) { acknowledger . wait ( ) ; } if ( ! acknowledger . hasFilters ( ) ) { for ( FilterDefinition filter : acknowledger . getFilters ( ) ) { LOGGER . info ( "Filter element: " + filter ) ; } } return acknowledger . getFilters ( ) ; } } catch ( Exception e ) { LOGGER . warning ( "Unable to retrieve the filters from the agent. Cause: " + e . getMessage ( ) ) ; e . printStackTrace ( ) ; if ( LOGGER . getLevel ( ) == Level . FINEST ) { LOGGER . log ( Level . FINEST , "Exception: " , e ) ; } } return null ; } | Try to get a filter list from the agent |
15,537 | private Socket createConnectedSocket ( final String url ) { try { final Socket initSocket = IO . socket ( url ) ; final Callback callback = new Callback ( ) ; initSocket . on ( Socket . EVENT_CONNECT , callback ) ; initSocket . on ( Socket . EVENT_CONNECT_ERROR , callback ) ; initSocket . on ( Socket . EVENT_CONNECT_TIMEOUT , callback ) ; initSocket . on ( Socket . EVENT_CONNECT_ERROR , callback ) ; initSocket . on ( Socket . EVENT_DISCONNECT , callback ) ; initSocket . on ( Socket . EVENT_ERROR , callback ) ; LOGGER . finest ( "Connection to Probe Dock RT" ) ; new Thread ( new Runnable ( ) { public void run ( ) { initSocket . connect ( ) ; } } ) . start ( ) ; synchronized ( callback ) { callback . wait ( ) ; } if ( ! initSocket . connected ( ) ) { LOGGER . warning ( "Probe Dock RT is not available" ) ; return null ; } return initSocket ; } catch ( URISyntaxException | InterruptedException e ) { LOGGER . log ( Level . WARNING , "Unknown error" , e ) ; } return null ; } | Create a new connection to the agent |
15,538 | public void push ( double value ) { if ( top >= stack . length ) { stack = Arrays . copyOf ( stack , ( int ) ( stack . length * growFactor ) ) ; } stack [ top ++ ] = value ; } | Adds value to the top . |
15,539 | public void dup ( ) { if ( top < 1 ) { throw new EmptyStackException ( ) ; } if ( top >= stack . length ) { stack = Arrays . copyOf ( stack , ( int ) ( stack . length * growFactor ) ) ; } top ++ ; stack [ top - 1 ] = stack [ top - 2 ] ; } | Top element is pushed . |
15,540 | public void fixRecord ( Record record ) { super . fixRecord ( record ) ; if ( this . getProperty ( "field" ) != null ) { BaseField field = this . getMainRecord ( ) . getField ( this . getProperty ( "field" ) . toString ( ) ) ; if ( field != null ) this . fixCapitalization ( field ) ; } } | FixRecord Method . |
15,541 | public void dispose ( final FullTextSession session ) { if ( session != null && session . isOpen ( ) ) { logger . trace ( "Disposing of hibernate fulltext session." ) ; session . close ( ) ; } } | Dispose of the fulltext session if it hasn t already been closed . |
15,542 | public static TranslatedContentSpecWrapper getTranslatedContentSpecById ( final DataProviderFactory providerFactory , final Integer id , final Integer rev ) { final CollectionWrapper < TranslatedContentSpecWrapper > translatedContentSpecs = providerFactory . getProvider ( ContentSpecProvider . class ) . getContentSpecTranslations ( id , rev ) ; if ( translatedContentSpecs != null ) { final List < TranslatedContentSpecWrapper > translatedContentSpecItems = translatedContentSpecs . getItems ( ) ; for ( final TranslatedContentSpecWrapper translatedContentSpec : translatedContentSpecItems ) { if ( rev != null && translatedContentSpec . getContentSpecRevision ( ) . equals ( rev ) ) { return translatedContentSpec ; } else if ( rev == null ) { return translatedContentSpec ; } } } return null ; } | Gets a translated content spec based on a content spec id and revision |
15,543 | public static TranslatedContentSpecWrapper getClosestTranslatedContentSpecById ( final DataProviderFactory providerFactory , final Integer id , final Integer rev ) { final CollectionWrapper < TranslatedContentSpecWrapper > translatedContentSpecs = providerFactory . getProvider ( ContentSpecProvider . class ) . getContentSpec ( id , rev ) . getTranslatedContentSpecs ( ) ; TranslatedContentSpecWrapper closestTranslation = null ; if ( translatedContentSpecs != null && translatedContentSpecs . getItems ( ) != null ) { final List < TranslatedContentSpecWrapper > entities = translatedContentSpecs . getItems ( ) ; for ( final TranslatedContentSpecWrapper translatedContentSpec : entities ) { if ( ( closestTranslation == null || closestTranslation . getContentSpecRevision ( ) < translatedContentSpec . getContentSpecRevision ( ) ) && ( rev == null || translatedContentSpec . getContentSpecRevision ( ) <= rev ) ) { closestTranslation = translatedContentSpec ; } } } return closestTranslation ; } | Gets a translated content spec based on a id and revision . The translated content spec that is returned will be less then or equal to the revision that is passed . If the revision is null then the latest translated content spec will be returned . |
15,544 | public static Map < Integer , List < TagWrapper > > getCategoryMappingFromTagList ( final Collection < TagWrapper > tags ) { final HashMap < Integer , List < TagWrapper > > mapping = new HashMap < Integer , List < TagWrapper > > ( ) ; for ( final TagWrapper tag : tags ) { final List < CategoryInTagWrapper > catList = tag . getCategories ( ) . getItems ( ) ; if ( catList != null ) { for ( final CategoryInTagWrapper cat : catList ) { if ( ! mapping . containsKey ( cat . getId ( ) ) ) { mapping . put ( cat . getId ( ) , new ArrayList < TagWrapper > ( ) ) ; } mapping . get ( cat . getId ( ) ) . add ( tag ) ; } } } return mapping ; } | Converts a list of tags into a mapping of categories to tags . The key is the Category and the value is a List of Tags for that category . |
15,545 | public static TopicWrapper getCSNodeTopicEntity ( final CSNodeWrapper node , final TopicProvider topicProvider ) { if ( ! isNodeATopic ( node ) ) return null ; return topicProvider . getTopic ( node . getEntityId ( ) , node . getEntityRevision ( ) ) ; } | Gets the CSNode Topic entity that is represented by the node . |
15,546 | public static boolean isNodeATopic ( final BaseCSNodeWrapper < ? > node ) { switch ( node . getNodeType ( ) ) { case CommonConstants . CS_NODE_TOPIC : case CommonConstants . CS_NODE_INITIAL_CONTENT_TOPIC : case CommonConstants . CS_NODE_META_DATA_TOPIC : return true ; default : return false ; } } | Checks to see if the node is some representation of a Topic entity . |
15,547 | public static boolean isNodeALevel ( final BaseCSNodeWrapper < ? > node ) { switch ( node . getNodeType ( ) ) { case CommonConstants . CS_NODE_APPENDIX : case CommonConstants . CS_NODE_CHAPTER : case CommonConstants . CS_NODE_PART : case CommonConstants . CS_NODE_PREFACE : case CommonConstants . CS_NODE_PROCESS : case CommonConstants . CS_NODE_SECTION : case CommonConstants . CS_NODE_INITIAL_CONTENT : return true ; default : return false ; } } | Checks to see if an entity node is a level representation . |
15,548 | public static boolean hasContentSpecMetaDataChanged ( final String metaDataName , final String currentValue , final ContentSpecWrapper contentSpecEntity ) { final CSNodeWrapper metaData = contentSpecEntity . getMetaData ( metaDataName ) ; if ( metaData != null && metaData . getAdditionalText ( ) != null && ! metaData . getAdditionalText ( ) . equals ( currentValue ) ) { return true ; } else if ( ( metaData == null || metaData . getAdditionalText ( ) == null ) && currentValue != null ) { return true ; } else { return false ; } } | Checks to see if a Content Spec Meta Data element has changed . |
15,549 | public static LocaleWrapper findLocaleFromString ( final CollectionWrapper < LocaleWrapper > locales , final String localeString ) { if ( localeString == null ) return null ; for ( final LocaleWrapper locale : locales . getItems ( ) ) { if ( localeString . equals ( locale . getValue ( ) ) ) { return locale ; } } return null ; } | Finds the matching locale entity from a locale string . |
15,550 | public static LocaleWrapper findTranslationLocaleFromString ( final LocaleProvider localeProvider , final String localeString ) { if ( localeString == null ) return null ; final CollectionWrapper < LocaleWrapper > locales = localeProvider . getLocales ( ) ; for ( final LocaleWrapper locale : locales . getItems ( ) ) { if ( localeString . equals ( locale . getValue ( ) ) ) { return locale ; } } return null ; } | Finds the matching locale entity from a translation locale string . |
15,551 | public String firstMandatoryNullProperty ( ) { for ( String property : model . propertyList ) { if ( model . mandatorySet . contains ( property ) && model . defaultMap . get ( property ) == null && data . get ( property ) == null ) { return property ; } } return firstMandatoryNullProperty ( model . propertyList ) ; } | Returns The first in property order property which is mandatory and is not set . If all mandatory properties have values returns null . |
15,552 | public void populate ( Map < String , String [ ] > map ) { for ( Entry < String , String [ ] > entry : map . entrySet ( ) ) { String property = entry . getKey ( ) ; if ( model . typeMap . containsKey ( property ) ) { String [ ] values = entry . getValue ( ) ; if ( values . length > 1 ) { throw new UnsupportedOperationException ( property + " has multivalue " + values ) ; } if ( values . length == 1 ) { set ( property , values [ 0 ] ) ; } } } } | Convenience method to support ServletRequest . |
15,553 | public static void writeCSV ( DataObjectModel model , Collection < ? extends DataObject > collection , OutputStream os ) throws IOException { BufferedOutputStream bos = new BufferedOutputStream ( os ) ; OutputStreamWriter osw = new OutputStreamWriter ( bos , "ISO-8859-1" ) ; CSVWriter writer = new CSVWriter ( osw , ',' , '"' , "\r\n" ) ; String [ ] line = model . getProperties ( ) ; writer . writeNext ( line ) ; for ( DataObject dob : collection ) { int index = 0 ; for ( String property : model . getPropertyList ( ) ) { Object value = dob . get ( property ) ; if ( value != null ) { line [ index ++ ] = value . toString ( ) ; } else { line [ index ++ ] = "" ; } } writer . writeNext ( line ) ; } writer . flush ( ) ; } | Writes collection of DataObjects in csv format . OutputStream is not closed after operation . |
15,554 | public static HashMap < String , String > getUrlVariables ( final Filter filter ) { final HashMap < String , String > vars = new HashMap < String , String > ( ) ; for ( final FilterTag filterTag : filter . getFilterTags ( ) ) { final Tag tag = filterTag . getTag ( ) ; final Integer tagState = filterTag . getTagState ( ) ; if ( tagState == CommonFilterConstants . MATCH_TAG_STATE ) { vars . put ( CommonFilterConstants . MATCH_TAG + tag . getTagId ( ) , CommonFilterConstants . MATCH_TAG_STATE + "" ) ; } else if ( tagState == CommonFilterConstants . NOT_MATCH_TAG_STATE ) { vars . put ( CommonFilterConstants . MATCH_TAG + tag . getTagId ( ) , CommonFilterConstants . NOT_MATCH_TAG_STATE + "" ) ; } else if ( tagState == CommonFilterConstants . GROUP_TAG_STATE ) { vars . put ( CommonFilterConstants . GROUP_TAG + tag . getTagId ( ) , CommonFilterConstants . GROUP_TAG_STATE + "" ) ; } } for ( final FilterCategory filterCategory : filter . getFilterCategories ( ) ) { final Category category = filterCategory . getCategory ( ) ; final Project project = filterCategory . getProject ( ) ; if ( filterCategory . getCategoryState ( ) == CommonFilterConstants . CATEGORY_INTERNAL_AND_STATE ) { vars . put ( CommonFilterConstants . CATEORY_INTERNAL_LOGIC + category . getCategoryId ( ) + ( project == null ? "" : "-" + project . getProjectId ( ) ) , CommonFilterConstants . AND_LOGIC ) ; } else if ( filterCategory . getCategoryState ( ) == CommonFilterConstants . CATEGORY_EXTERNAL_OR_STATE ) { vars . put ( CommonFilterConstants . CATEORY_EXTERNAL_LOGIC + category . getCategoryId ( ) + ( project == null ? "" : "-" + project . getProjectId ( ) ) , CommonFilterConstants . OR_LOGIC ) ; } } int count = 1 ; for ( final FilterLocale filterLocale : filter . getFilterLocales ( ) ) { final Integer localeState = filterLocale . getLocaleState ( ) ; if ( localeState == CommonFilterConstants . MATCH_TAG_STATE ) { vars . put ( CommonFilterConstants . MATCH_LOCALE + count , filterLocale . getLocaleName ( ) + CommonFilterConstants . MATCH_TAG_STATE ) ; } else if ( localeState == CommonFilterConstants . NOT_MATCH_TAG_STATE ) { vars . put ( CommonFilterConstants . MATCH_LOCALE + count , filterLocale . getLocaleName ( ) + CommonFilterConstants . NOT_MATCH_TAG_STATE ) ; } count ++ ; } boolean foundFilterField = false ; boolean foundFilterFieldLogic = false ; for ( final FilterField filterField : filter . getFilterFields ( ) ) { try { vars . put ( filterField . getField ( ) , URLEncoder . encode ( filterField . getValue ( ) , "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } if ( ! filterField . getField ( ) . equals ( CommonFilterConstants . LOGIC_FILTER_VAR ) ) foundFilterField = true ; else foundFilterFieldLogic = true ; } if ( foundFilterField && ! foundFilterFieldLogic ) vars . put ( CommonFilterConstants . LOGIC_FILTER_VAR , FilterConstants . LOGIC_FILTER_VAR_DEFAULT_VALUE ) ; return vars ; } | Translate the contents of this filter its tags and categories into variables that can be appended to a url |
15,555 | static NessEvent createEvent ( @ JsonProperty ( "user" ) final UUID user , @ JsonProperty ( "timestamp" ) final DateTime timestamp , @ JsonProperty ( "id" ) final UUID id , @ JsonProperty ( "type" ) final NessEventType type , @ JsonProperty ( "payload" ) final Map < String , ? extends Object > payload ) { return new NessEvent ( user , timestamp , type , payload , id ) ; } | Create a new event from over - the - wire json . |
15,556 | public static NessEvent createEvent ( final UUID user , final DateTime timestamp , final NessEventType type , final Map < String , ? extends Object > payload ) { return new NessEvent ( user , timestamp , type , payload , UUID . randomUUID ( ) ) ; } | Create a new event . |
15,557 | public static NessEvent createEvent ( final UUID user , final NessEventType type ) { return new NessEvent ( user , new DateTime ( DateTimeZone . UTC ) , type , Collections . < String , Object > emptyMap ( ) , UUID . randomUUID ( ) ) ; } | Convenience constructor that assumes no payload . |
15,558 | public BaseField getHistorySourceDate ( ) { if ( m_fldSourceHistoryDate == null ) { if ( m_iSourceDateSeq != null ) m_fldSourceHistoryDate = this . getOwner ( ) . getField ( m_iSourceDateSeq ) ; else if ( this . getHistoryRecord ( ) instanceof VirtualRecord ) m_fldSourceHistoryDate = this . getOwner ( ) . getField ( VirtualRecord . LAST_CHANGED ) ; } return m_fldSourceHistoryDate ; } | Get the date source from this record |
15,559 | public Date bumpTime ( DateTimeField fieldTarget ) { Date dateBefore = fieldTarget . getDateTime ( ) ; Calendar calTarget = fieldTarget . getCalendar ( ) ; calTarget . add ( Calendar . SECOND , 1 ) ; fieldTarget . setCalendar ( calTarget , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ; return dateBefore ; } | Bump time field by a second . |
15,560 | public FieldSchema getField ( String name ) { for ( FieldSchema field : fieldSchemas ) if ( field . getName ( ) . equals ( name ) ) return field ; return null ; } | Returns the schema for the field on this annotation class whose name matches the provided name . This method returns null if no field matches . |
15,561 | public static void copyFile ( File in , File out ) throws IOException { FileChannel inChannel = new FileInputStream ( in ) . getChannel ( ) ; FileChannel outChannel = new FileOutputStream ( out ) . getChannel ( ) ; try { inChannel . transferTo ( 0 , inChannel . size ( ) , outChannel ) ; } catch ( IOException e ) { throw e ; } finally { if ( inChannel != null ) { inChannel . close ( ) ; } if ( outChannel != null ) { outChannel . close ( ) ; } } } | Copy file a file from one location to another . |
15,562 | private boolean adjustParam ( DenseMatrix64F X , DenseMatrix64F Y , double prevCost ) { double lambda = initialLambda ; double difference = 1000 ; for ( int iter = 0 ; iter < iter1 && difference > maxDifference ; iter ++ ) { computeDandH ( param , X , Y ) ; boolean foundBetter = false ; for ( int i = 0 ; i < iter2 ; i ++ ) { computeA ( A , H , lambda ) ; if ( ! solve ( A , d , negDelta ) ) { return false ; } subtract ( param , negDelta , tempParam ) ; double cost = cost ( tempParam , X , Y ) ; if ( cost < prevCost ) { foundBetter = true ; param . set ( tempParam ) ; difference = prevCost - cost ; prevCost = cost ; lambda /= 10.0 ; } else { lambda *= 10.0 ; } } if ( ! foundBetter ) break ; } finalCost = prevCost ; return true ; } | Iterate until the difference between the costs is insignificant or it iterates too many times |
15,563 | private void computeDandH ( DenseMatrix64F param , DenseMatrix64F x , DenseMatrix64F y ) { func . compute ( param , x , tempDH ) ; subtractEquals ( tempDH , y ) ; if ( jacobianFactory != null ) { jacobianFactory . computeJacobian ( param , x , jacobian ) ; } else { computeNumericalJacobian ( param , x , jacobian ) ; } int numParam = param . getNumElements ( ) ; int length = y . getNumElements ( ) ; for ( int i = 0 ; i < numParam ; i ++ ) { double total = 0 ; for ( int j = 0 ; j < length ; j ++ ) { total += tempDH . get ( j , 0 ) * jacobian . get ( i , j ) ; } d . set ( i , 0 , total / length ) ; } multTransB ( jacobian , jacobian , H ) ; scale ( 1.0 / length , H ) ; } | Computes the d and H parameters . Where d is the average error gradient and H is an approximation of the hessian . |
15,564 | public BaseSessionProxy checkForSession ( String strClassAndID ) { int iColon = strClassAndID . indexOf ( CLASS_SEPARATOR ) ; String strSessionClass = null ; if ( iColon != - 1 ) strSessionClass = strClassAndID . substring ( 0 , iColon ) ; String strID = strClassAndID . substring ( iColon + 1 ) ; if ( REMOTE_SESSION . equals ( strSessionClass ) ) return new SessionProxy ( this , strID ) ; if ( REMOTE_TABLE . equals ( strSessionClass ) ) return new TableProxy ( this , strID ) ; if ( REMOTE_BASE_SESSION . equals ( strSessionClass ) ) return new BaseSessionProxy ( this , strID ) ; return null ; } | Check for session . |
15,565 | protected String getDefaultBaseUrlRegex ( ) { String baseUrl = getBaseUrl ( ) ; return baseUrl == null ? null : Pattern . quote ( baseUrl ) ; } | Default base URL regex for pages . Override this for different value . |
15,566 | protected File getDefaultReportDir ( ) { File reportsRootDir = getReportsRootDir ( ) ; if ( reportsRootDir == null ) { throw new SebException ( "Reports root directory is null" ) ; } if ( ! reportsRootDir . exists ( ) ) { try { Files . createDirectories ( reportsRootDir . toPath ( ) ) ; } catch ( IOException e ) { throw new SebException ( "Reports root directory does not exists and can not be created " + reportsRootDir ) ; } } else if ( ! reportsRootDir . isDirectory ( ) ) { throw new SebException ( "Reports root directory is not directory " + reportsRootDir ) ; } else if ( ! reportsRootDir . canWrite ( ) ) { throw new SebException ( "Reports root directory is not writable " + reportsRootDir ) ; } File reportDir = new SebUtils ( ) . getUniqueFilePath ( reportsRootDir , LocalDateTime . now ( ) . format ( Seb . FILE_DATE_FORMATTER ) , null ) . toFile ( ) ; try { Files . createDirectories ( reportDir . toPath ( ) ) ; } catch ( IOException e ) { throw new SebException ( "Report directory can not be created " + reportDir ) ; } return reportDir ; } | Returns directory for storing Seb report files . As default unique directory is created inside reports root directory . Override this for different value . |
15,567 | protected List < SebListener > getDefaultListeners ( ) { return new ArrayList < > ( Arrays . asList ( new ConfigListener ( ) , new LoggingListener ( ) , new SebLogListener ( ) , new WebDriverLogListener ( ) , new PageSourceListener ( ) , new ScreenshotListener ( ) ) ) ; } | Returns default list of Seb event listeners . Override this for different value . |
15,568 | protected Level getDefaultLogLevel ( ) { String levelStr = getProperty ( LOG_LEVEL ) ; Level level = null ; if ( levelStr != null ) { level = Level . parse ( levelStr ) ; } if ( level == null ) level = Level . INFO ; return level ; } | Basic log level . Override this for different value . |
15,569 | public String getTitle ( ) { for ( int i = 0 ; i < this . getSFieldCount ( ) ; i ++ ) { if ( this . getSField ( i ) instanceof BaseScreen ) return ( ( BaseScreen ) this . getSField ( i ) ) . getTitle ( ) ; } return super . getTitle ( ) ; } | Title for this screen . |
15,570 | public void print ( CharSequence charSequence ) { try { consoleReader . println ( charSequence ) ; consoleReader . flush ( ) ; } catch ( IOException e ) { throw new IllegalStateException ( "Can't write to console" , e ) ; } } | Print charSequence to console |
15,571 | public void setCompleters ( List < Completer > completers ) { for ( Completer completer : consoleReader . getCompleters ( ) ) { consoleReader . removeCompleter ( completer ) ; } if ( Iterables . size ( completers ) > 1 ) { Completer completer = new AggregateCompleter ( completers ) ; consoleReader . addCompleter ( completer ) ; } for ( Completer completer : completers ) { consoleReader . addCompleter ( completer ) ; } } | Remove all completers and add the new ones . If completers contains more then one element create an AggregateCompleter with the completers and add it . |
15,572 | public String getInput ( ) { try { String ret = consoleReader . readLine ( ) ; if ( ret != null ) { ret = ret . trim ( ) ; } if ( ret != null && ! ret . isEmpty ( ) && consoleReader . isHistoryEnabled ( ) && history != null ) { history . add ( ret ) ; history . flush ( ) ; } return ret ; } catch ( IOException e ) { throw new IllegalStateException ( "Can't read from console" , e ) ; } } | Get User input |
15,573 | private String format ( double duration , Units units ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( numberFormat . format ( duration ) ) ; builder . append ( ' ' ) ; builder . append ( units . display ( ) ) ; return builder . toString ( ) ; } | Build time duration representation for given numeric value and units . |
15,574 | public String getMetaRedirect ( ) { if ( this . getProperty ( XMLTags . META_REDIRECT ) != null ) return this . getProperty ( XMLTags . META_REDIRECT ) ; return DBConstants . BLANK ; } | Get the name of the meta tag . |
15,575 | public String getThisURL ( ) { String strURL = DBConstants . BLANK ; strURL = Utility . addURLParam ( strURL , DBParams . RECORD , this . getProperty ( DBParams . RECORD ) , false ) ; strURL = Utility . addURLParam ( strURL , DBParams . SCREEN , this . getProperty ( DBParams . SCREEN ) , false ) ; strURL = Utility . addURLParam ( strURL , DBParams . CLASS , this . getProperty ( DBParams . CLASS ) , false ) ; strURL = Utility . addURLParam ( strURL , DBParams . COMMAND , this . getProperty ( DBParams . COMMAND ) , false ) ; strURL = Utility . addURLParam ( strURL , DBParams . MENU , this . getProperty ( DBParams . MENU ) , false ) ; return strURL ; } | Get the URL to display this page . |
15,576 | void executeStartupCommands ( ) { if ( m_startupCommands != null ) { StringBuilder sb = new StringBuilder ( ) ; for ( IAgentCommand cmd : m_startupCommands ) { sb . append ( cmd . getMessage ( ) ) ; } getControlThread ( ) . sendMessage ( sb . toString ( ) ) ; } } | Immediately after the connection is first established execute all the commands in this . m_startupCommands . This method concatenates the commands of all those given in the array and attempts to execute them in a single round - trip call . |
15,577 | public String getNamespaceFromVersion ( String version ) { MessageVersion recMessageVersion = this . getMessageVersion ( version ) ; String namespace = this . getField ( MessageControl . BASE_NAMESPACE ) . toString ( ) ; if ( namespace == null ) namespace = DBConstants . BLANK ; if ( ( recMessageVersion != null ) && ( ! recMessageVersion . getField ( MessageVersion . NAMESPACE ) . isNull ( ) ) ) namespace += recMessageVersion . getField ( MessageVersion . NAMESPACE ) . toString ( ) ; return namespace ; } | GetNamespaceFromVersion Method . |
15,578 | public MessageVersion getMessageVersion ( String version ) { MessageVersion recMessageVersion = this . getMessageVersion ( ) ; recMessageVersion . setKeyArea ( MessageVersion . CODE_KEY ) ; version = MessageControl . fixVersion ( version ) ; recMessageVersion . getField ( MessageVersion . CODE ) . setString ( version ) ; try { if ( version != null ) if ( recMessageVersion . seek ( DBConstants . EQUALS ) ) { return recMessageVersion ; } } catch ( DBException e ) { e . printStackTrace ( ) ; } return ( MessageVersion ) ( ( ReferenceField ) this . getField ( MessageControl . DEFAULT_VERSION_ID ) ) . getReference ( ) ; } | GetMessageVersion Method . |
15,579 | public String getNumericVersionFromVersion ( String version ) { MessageVersion recMessageVersion = this . getMessageVersion ( version ) ; String numericVersion = DBConstants . BLANK ; if ( ( recMessageVersion != null ) && ( ! recMessageVersion . getField ( MessageVersion . NAMESPACE ) . isNull ( ) ) ) numericVersion = recMessageVersion . getField ( MessageVersion . NUMERIC_VERSION ) . toString ( ) ; if ( ( numericVersion == null ) || ( numericVersion . length ( ) == 0 ) ) numericVersion = "1.000" ; return numericVersion ; } | GetNumericVersionFromVersion Method . |
15,580 | public String getIdFromVersion ( String version ) { MessageVersion recMessageVersion = this . getMessageVersion ( version ) ; String idVersion = DBConstants . BLANK ; if ( ( idVersion != null ) && ( ! recMessageVersion . getField ( MessageVersion . NAMESPACE ) . isNull ( ) ) ) idVersion = recMessageVersion . getField ( MessageVersion . VERSION_ID ) . toString ( ) ; if ( ( idVersion == null ) || ( idVersion . length ( ) == 0 ) ) idVersion = "OTA" + version ; return idVersion ; } | GetIdFromVersion Method . |
15,581 | public static String fixVersion ( String version ) { if ( version != null ) if ( version . length ( ) > 0 ) { version = version . toUpperCase ( ) ; if ( Character . isLetter ( version . charAt ( 0 ) ) ) version = version . substring ( 1 , version . length ( ) ) + version . substring ( 0 , 1 ) ; } return version ; } | FixVersion Method . |
15,582 | public String getVersionFromSchemaLocation ( String schemaLocation ) { MessageVersion recMessageVersion = this . getMessageVersion ( ) ; recMessageVersion . close ( ) ; try { while ( recMessageVersion . hasNext ( ) ) { recMessageVersion . next ( ) ; String messageSchemaLocation = this . getSchemaLocation ( recMessageVersion , DBConstants . BLANK ) ; if ( schemaLocation . startsWith ( messageSchemaLocation ) ) return recMessageVersion . getField ( MessageVersion . CODE ) . toString ( ) ; } } catch ( DBException e ) { e . printStackTrace ( ) ; } return null ; } | GetVersionFromSchemaLocation Method . |
15,583 | public Date getEndDate ( ) { if ( ( m_startTime != null ) && ( m_endTime != null ) ) { if ( m_endTime . before ( m_startTime ) ) return m_startTime ; } return m_endTime ; } | Get the ending time of this service . |
15,584 | public int setString ( String strString , boolean bDisplayOption , int iMoveMode ) { if ( this . getNextConverter ( ) != null ) return this . getNextConverter ( ) . setString ( strString , bDisplayOption , iMoveMode ) ; else return super . setString ( strString , bDisplayOption , iMoveMode ) ; } | Convert and move string to this field . Set the current string of the current next converter .. |
15,585 | public ScreenComponent setupDefaultView ( ScreenLoc itsLocation , ComponentParent targetScreen , Convert convert , int iDisplayFieldDesc , Map < String , Object > properties ) { ScreenComponent sField = null ; Converter converter = this . getNextConverter ( ) ; if ( converter != null ) sField = converter . setupDefaultView ( itsLocation , targetScreen , convert , iDisplayFieldDesc , properties ) ; else sField = super . setupDefaultView ( itsLocation , targetScreen , converter , iDisplayFieldDesc , properties ) ; if ( sField != null ) { converter . removeComponent ( sField ) ; sField . setConverter ( this ) ; } return sField ; } | Set up the default control for this field . Adds the default screen control for the current converter and makes me it s converter . |
15,586 | public Converter getNextConverter ( ) { BaseTable currentTable = m_MergeRecord . getTable ( ) . getCurrentTable ( ) ; if ( currentTable == null ) return null ; if ( m_FieldSeq != - 1 ) { if ( m_strLinkedRecord == null ) return currentTable . getRecord ( ) . getField ( m_FieldSeq ) ; else return currentTable . getRecord ( ) . getField ( m_strLinkedRecord , m_FieldSeq ) ; } else { for ( int index = 0 ; index < m_vArray . size ( ) ; index ++ ) { InfoList infoList = ( InfoList ) m_vArray . elementAt ( index ) ; Record pQueryTable = currentTable . getRecord ( ) . getRecord ( infoList . m_strFileName ) ; if ( pQueryTable != null ) { String strLinkFileName = infoList . m_strLinkFileName ; int iFieldSeq = infoList . m_iFieldSeq ; Converter field = infoList . m_converter ; if ( field != null ) return field ; if ( strLinkFileName != null ) return currentTable . getRecord ( ) . getField ( strLinkFileName , iFieldSeq ) ; return pQueryTable . getField ( iFieldSeq ) ; } } } return null ; } | Get the Current converter . |
15,587 | public static List < Field > getInstanceFields ( Class type ) { List < Field > fields = Lists . newArrayList ( type . getDeclaredFields ( ) ) ; return ImmutableList . copyOf ( Iterables . filter ( fields , InstanceFieldPredicate . PREDICATE ) ) ; } | Return all non - static and non - transient fields . |
15,588 | public static IDataEncoder getEncoder ( final String mimeType ) throws ClassNotFoundException , IllegalAccessException , InstantiationException { populateCache ( ) ; if ( ! cache . containsKey ( mimeType ) ) { throw new ClassNotFoundException ( String . format ( "IDataEncoder for" + " mimeType [%s] not found." , mimeType ) ) ; } Class < ? extends IDataEncoder > encoderClass = cache . get ( mimeType ) ; return encoderClass . newInstance ( ) ; } | Retrieve a encoder for a specified mime type . |
15,589 | public < T > T asObject ( String string , Class < T > valueType ) throws BugError { if ( string . length ( ) > 1 ) { throw new ConverterException ( "Trying to convert a larger string into a single character." ) ; } return ( T ) ( Character ) string . charAt ( 0 ) ; } | Return the first character from given string . |
15,590 | public String [ ] getFileList ( ) { String [ ] files = null ; String strFilename = this . getProperty ( "filename" ) ; if ( strFilename != null ) { files = new String [ 1 ] ; files [ 0 ] = strFilename ; } String strDirname = this . getProperty ( "folder" ) ; if ( strDirname != null ) { FileList list = new FileList ( strDirname ) ; files = list . getFileNames ( ) ; if ( ! strDirname . endsWith ( "/" ) ) strDirname += "/" ; for ( int i = 0 ; i < files . length ; i ++ ) { files [ i ] = strDirname + files [ i ] ; } } return files ; } | Get the list of files to read thru and import . |
15,591 | void add ( Scalar o ) { if ( ! type . equals ( o . type ) ) { throw new UnsupportedOperationException ( "Action with wrong kind of class" ) ; } value += o . value ; } | Add o value to this |
15,592 | void subtract ( Scalar o ) { if ( ! type . equals ( o . type ) ) { throw new UnsupportedOperationException ( "Action with wrong kind of class" ) ; } value -= o . value ; } | Subtract o value from this |
15,593 | protected void destroyRepository ( ) { final RepositoryImpl repository = ( RepositoryImpl ) getRepository ( ) ; repository . shutdown ( ) ; LOG . info ( "Destroyed repository at {}" , repository . getConfig ( ) . getHomeDir ( ) ) ; } | Closes the admin session and in case of local transient respository for unit test shuts down the repository and cleans all temporary files . |
15,594 | protected RepositoryImpl createRepository ( ) throws IOException { try { final RepositoryConfig config = createRepositoryConfiguration ( ) ; return RepositoryImpl . create ( config ) ; } catch ( final ConfigurationException e ) { LOG . error ( "Configuration invalid" , e ) ; throw new AssertionError ( e . getMessage ( ) , e ) ; } catch ( RepositoryException e ) { LOG . error ( "Could not create repository" , e ) ; throw new AssertionError ( e . getMessage ( ) , e ) ; } } | Creates a transient repository with files in the local temp directory . |
15,595 | public static final String delimitedLower ( String text , String delim ) { return stream ( text ) . map ( ( String s ) -> { return s . toLowerCase ( ) ; } ) . collect ( Collectors . joining ( delim ) ) ; } | Return camel - case if delim = - |
15,596 | public static final String delimited ( String text , String delim ) { return stream ( text ) . collect ( Collectors . joining ( delim ) ) ; } | Returns Camel - Case if delim = - |
15,597 | public int compare ( final Issue i1 , final Issue i2 ) { if ( null == i1 && null == i2 ) { return 0 ; } else if ( null == i1 ) { return 1 ; } else if ( null == i2 ) { return - 1 ; } else { return i1 . getCreatedOn ( ) . compareTo ( i2 . getCreatedOn ( ) ) ; } } | Compare creation date of given issues . |
15,598 | public ExecutorCommand < V > withExcludedExceptions ( List < Class < ? extends Exception > > excludedExceptions ) { config . setExcludedExceptions ( excludedExceptions ) ; return this ; } | If wrapped method throws one of passed exceptions breaker will pass it without opening connection . |
15,599 | public < V > V invoke ( Callable < V > callable ) throws Exception { return service . executeSynchronously ( callable , config ) ; } | Invokes callable synchronously with respecting circuit logic and cache logic if configured . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.