idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
10,000 | public boolean invert ( ) { double determinant = determinant ( ) ; if ( Math . abs ( determinant ) <= Double . MIN_VALUE ) { return false ; } double t00 = m00 ; double t01 = m01 ; double t02 = m02 ; double t10 = m10 ; double t11 = m11 ; double t12 = m12 ; m00 = t11 / determinant ; m10 = - t10 / determinant ; m01 = - t0... | Invert this matrix . Implementation stolen from OpenJDK . |
10,001 | public void setAdditionalField ( final String key , final Object value ) { this . additionalFields . put ( key , value ) ; } | Add additional field |
10,002 | public static Object getGenInstance ( Class < ? > cls , Object ... args ) throws ParserException { Class < ? > parserClass = getGenClass ( cls ) ; try { if ( args . length == 0 ) { return parserClass . newInstance ( ) ; } else { for ( Constructor constructor : parserClass . getConstructors ( ) ) { Class [ ] parameterTy... | Creates generated class instance either by using ClassLoader or by compiling it dynamically |
10,003 | public static Class < ? > getGenClass ( Class < ? > cls ) throws ParserException { GenClassname genClassname = cls . getAnnotation ( GenClassname . class ) ; if ( genClassname == null ) { throw new IllegalArgumentException ( "@GenClassname not set in " + cls ) ; } try { return loadGenClass ( cls ) ; } catch ( ClassNotF... | Creates generated class either by using ClassLoader |
10,004 | public static Object createDynamicInstance ( Class < ? > cls ) throws IOException { GenClassCompiler pc = GenClassCompiler . compile ( El . getTypeElement ( cls . getCanonicalName ( ) ) , null ) ; return pc . loadDynamic ( ) ; } | Creates instance of implementation class and loads it dynamic . This method is used in testing . |
10,005 | public static Class < ? > loadGenClass ( Class < ? > cls ) throws ClassNotFoundException { Class < ? > parserClass = map . get ( cls ) ; if ( parserClass == null ) { GenClassname genClassname = cls . getAnnotation ( GenClassname . class ) ; if ( genClassname == null ) { throw new IllegalArgumentException ( "@GenClassna... | Creates generated class by using ClassLoader . Return null if unable to load class |
10,006 | private String getObtainRequestPath ( String requestID , Boolean byResourceID , Boolean byDocID , Boolean idsOnly , String resumptionToken ) { String path = obtainPath ; if ( resumptionToken != null ) { path += "?" + resumptionTokenParam + "=" + resumptionToken ; return path ; } if ( requestID != null ) { path += "?" +... | Obtain the path used for an obtain request |
10,007 | private String getHarvestRequestPath ( String requestID , Boolean byResourceID , Boolean byDocID ) { String path = harvestPath ; if ( requestID != null ) { path += "?" + requestIDParam + "=" + requestID ; } else { return null ; } if ( byResourceID ) { path += "&" + byResourceIDParam + "=" + booleanTrueString ; } else {... | Obtain the path used for a harvest request |
10,008 | private LRResult getObtainJSONData ( String requestID , Boolean byResourceID , Boolean byDocID , Boolean idsOnly , String resumptionToken ) throws LRException { String path = getObtainRequestPath ( requestID , byResourceID , byDocID , idsOnly , resumptionToken ) ; JSONObject json = getJSONFromPath ( path ) ; return new... | Get a result from an obtain request If the resumption token is not null it will override the other parameters for ths request |
10,009 | public LRResult getHarvestJSONData ( String requestID , Boolean byResourceID , Boolean byDocID ) throws LRException { String path = getHarvestRequestPath ( requestID , byResourceID , byDocID ) ; JSONObject json = getJSONFromPath ( path ) ; return new LRResult ( json ) ; } | Get a result from a harvest request |
10,010 | private String getExtractRequestPath ( String dataServiceName , String viewName , Date from , Date until , Boolean idsOnly , String mainValue , Boolean partial , String mainName ) { String path = extractPath ; if ( viewName != null ) { path += "/" + viewName ; } else { return null ; } if ( dataServiceName != null ) { p... | Get an extract request path |
10,011 | private JSONObject getJSONFromPath ( String path ) throws LRException { JSONObject json = null ; String jsonTxt = null ; try { jsonTxt = LRClient . executeJsonGet ( importProtocol + "://" + nodeHost + path ) ; } catch ( Exception e ) { throw new LRException ( LRException . IMPORT_FAILED ) ; } try { json = new JSONObjec... | Get the data from the specified path as a JSONObject |
10,012 | private static int fontStyleToInt ( FontStyle style ) { switch ( style ) { case PLAIN : return java . awt . Font . PLAIN ; case BOLD : return java . awt . Font . BOLD ; case ITALIC : return java . awt . Font . ITALIC ; default : return java . awt . Font . PLAIN ; } } | Return a java . awt . Font style constant from FontStyle . |
10,013 | private static FontStyle intToFontStyle ( int style ) { switch ( style ) { case java . awt . Font . PLAIN : return FontStyle . PLAIN ; case java . awt . Font . BOLD : return FontStyle . BOLD ; case java . awt . Font . ITALIC : return FontStyle . ITALIC ; case java . awt . Font . BOLD + java . awt . Font . ITALIC : retu... | Return FontStyle enum value from java . awt . Font style constant . |
10,014 | private static FontStyle stringToFontStyle ( String style ) { if ( style . compareToIgnoreCase ( "plain" ) == 0 ) { return FontStyle . PLAIN ; } else if ( style . compareToIgnoreCase ( "bold" ) == 0 ) { return FontStyle . BOLD ; } else if ( style . compareToIgnoreCase ( "italic" ) == 0 ) { return FontStyle . ITALIC ; }... | Return FontStyle enum value from a font style name . |
10,015 | public void onReload ( final Container _container ) { final Set < Class < ? > > classesToRemove = new HashSet < > ( ) ; final Set < Class < ? > > classesToAdd = new HashSet < > ( ) ; for ( final Class < ? > c : getClasses ( ) ) { if ( ! this . cachedClasses . contains ( c ) ) { classesToAdd . add ( c ) ; } } for ( fina... | Perform a new search for resource classes and provider classes . |
10,016 | private void addInstSelect ( final Select _select , final AbstractDataElement < ? > _element , final Object _attrOrClass , final Type _currentType ) throws CacheReloadException { if ( StringUtils . isNotEmpty ( _element . getPath ( ) ) && ! this . instSelects . containsKey ( _element . getPath ( ) ) ) { final Select in... | Adds the inst select . |
10,017 | private Type evalMainType ( final Collection < Type > _baseTypes ) throws EFapsException { final Type ret ; if ( _baseTypes . size ( ) == 1 ) { ret = _baseTypes . iterator ( ) . next ( ) ; } else { final List < List < Type > > typeLists = new ArrayList < > ( ) ; for ( final Type type : _baseTypes ) { final List < Type ... | Gets the main type . |
10,018 | public Collection < Select > getAllSelects ( ) { final List < Select > ret = new ArrayList < > ( this . selects ) ; ret . addAll ( this . instSelects . values ( ) ) ; return Collections . unmodifiableCollection ( ret ) ; } | Gets the all data selects . |
10,019 | protected void unassignFromUserObjectInDb ( final Type _unassignType , final JAASSystem _jaasSystem , final AbstractUserObject _object ) throws EFapsException { Connection con = null ; try { con = Context . getConnection ( ) ; Statement stmt = null ; final StringBuilder cmd = new StringBuilder ( ) ; try { cmd . append ... | Unassign this user object from the given user object for given JAAS system . |
10,020 | protected void setStatusInDB ( final boolean _status ) throws EFapsException { Connection con = null ; try { con = Context . getConnection ( ) ; PreparedStatement stmt = null ; final StringBuilder cmd = new StringBuilder ( ) ; try { cmd . append ( " update T_USERABSTRACT set STATUS=? where ID=" ) . append ( getId ( ) )... | Method to set the status of a UserObject in the eFaps Database . |
10,021 | private void readFromDB4Access ( ) throws CacheReloadException { Statement stmt = null ; try { stmt = Context . getThreadContext ( ) . getConnectionResource ( ) . createStatement ( ) ; final ResultSet resultset = stmt . executeQuery ( "select " + "T_UIACCESS.USERABSTRACT " + "from T_UIACCESS " + "where T_UIACCESS.UIABS... | The instance method reads the access for this user interface object . |
10,022 | public String getPath ( ) { final StringBuilder path = new StringBuilder ( ) ; if ( getPrevious ( ) != null ) { path . append ( getPrevious ( ) . getPath ( ) ) ; } return path . toString ( ) ; } | Gets the path . |
10,023 | private Map < String , IEsjpSelect > getEsjpSelect ( final List < Instance > _instances ) throws Exception { final Map < String , IEsjpSelect > ret = new HashMap < > ( ) ; if ( ! _instances . isEmpty ( ) ) { for ( final Entry < String , AbstractSelect > entry : getAlias2Selects ( ) . entrySet ( ) ) { if ( entry . getVa... | Gets the esjp select . |
10,024 | private MultiPrintQuery getMultiPrint ( ) throws EFapsException { final MultiPrintQuery ret ; if ( getInstances ( ) . isEmpty ( ) ) { ret = new MultiPrintQuery ( QueryBldrUtil . getInstances ( this ) ) ; } else { final List < Instance > instances = new ArrayList < > ( ) ; for ( final String oid : getInstances ( ) ) { i... | Gets the multi print . |
10,025 | private void addUoM ( final UoM _uom ) { this . uoMs . add ( _uom ) ; if ( _uom . getId ( ) == this . baseUoMId ) { this . baseUoM = _uom ; } } | Method to add an UoM to this dimension . |
10,026 | public static UoM getUoM ( final Long _uoMId ) { final Cache < Long , UoM > cache = InfinispanCache . get ( ) . < Long , UoM > getCache ( Dimension . IDCACHE4UOM ) ; if ( ! cache . containsKey ( _uoMId ) ) { try { Dimension . getUoMFromDB ( Dimension . SQL_SELECT_UOM4ID , _uoMId ) ; } catch ( final CacheReloadException... | Static Method to get an UoM for an id . |
10,027 | public String getResumptionToken ( ) { String resumptionToken = null ; try { if ( data != null && data . has ( resumptionTokenParam ) ) { resumptionToken = data . getString ( resumptionTokenParam ) ; } } catch ( JSONException e ) { } return resumptionToken ; } | Returns the resumption token if it exists |
10,028 | public List < JSONObject > getResourceData ( ) { List < JSONObject > resources = new ArrayList < JSONObject > ( ) ; try { if ( data != null && data . has ( documentsParam ) ) { List < JSONObject > results = getDocuments ( ) ; for ( JSONObject json : results ) { if ( json . has ( documentParam ) ) { JSONObject result = ... | Returns resource data from obtain or harvest request |
10,029 | public List < JSONObject > getDocuments ( ) { List < JSONObject > documents = new ArrayList < JSONObject > ( ) ; try { if ( data != null && data . has ( documentsParam ) ) { JSONArray jsonDocuments = data . getJSONArray ( documentsParam ) ; for ( int i = 0 ; i < jsonDocuments . length ( ) ; i ++ ) { JSONObject document... | Returns documents from obtain request |
10,030 | public List < JSONObject > getRecords ( ) { List < JSONObject > records = new ArrayList < JSONObject > ( ) ; try { if ( data != null && data . has ( getRecordParam ) ) { JSONObject jsonGetRecord = data . getJSONObject ( getRecordParam ) ; if ( jsonGetRecord . has ( recordParam ) ) { JSONArray jsonRecords = jsonGetRecor... | Returns records from harvest request |
10,031 | public BigDecimal roundBigDecimal ( final BigDecimal number ) { int mscale = getMathScale ( ) ; if ( mscale >= 0 ) { return number . setScale ( mscale , getMathContext ( ) . getRoundingMode ( ) ) ; } else { return number ; } } | Ensure a big decimal is rounded by this arithmetic scale and rounding mode . |
10,032 | protected boolean isFloatingPointType ( Object left , Object right ) { return left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double ; } | Test if either left or right are either a Float or Double . |
10,033 | protected boolean isNumberable ( final Object o ) { return o instanceof Integer || o instanceof Long || o instanceof Byte || o instanceof Short || o instanceof Character ; } | Is Object a whole number . |
10,034 | protected Number narrowBigDecimal ( Object lhs , Object rhs , BigDecimal bigd ) { if ( isNumberable ( lhs ) || isNumberable ( rhs ) ) { try { long l = bigd . longValueExact ( ) ; if ( l <= Integer . MAX_VALUE && l >= Integer . MIN_VALUE ) { return Integer . valueOf ( ( int ) l ) ; } else { return Long . valueOf ( l ) ;... | Given a BigDecimal attempt to narrow it to an Integer or Long if it fits if one of the arguments is a numberable . |
10,035 | protected boolean narrowArguments ( Object [ ] args ) { boolean narrowed = false ; for ( int a = 0 ; a < args . length ; ++ a ) { Object arg = args [ a ] ; if ( arg instanceof Number ) { Object narg = narrow ( ( Number ) arg ) ; if ( narg != arg ) { narrowed = true ; } args [ a ] = narg ; } } return narrowed ; } | Replace all numbers in an arguments array with the smallest type that will fit . |
10,036 | public Object divide ( Object left , Object right ) { if ( left == null && right == null ) { return 0 ; } if ( isFloatingPointNumber ( left ) || isFloatingPointNumber ( right ) ) { double l = toDouble ( left ) ; double r = toDouble ( right ) ; if ( r == 0.0 ) { throw new ArithmeticException ( "/" ) ; } return new Doubl... | Divide the left value by the right . |
10,037 | public Object multiply ( Object left , Object right ) { if ( left == null && right == null ) { return 0 ; } if ( isFloatingPointNumber ( left ) || isFloatingPointNumber ( right ) ) { double l = toDouble ( left ) ; double r = toDouble ( right ) ; return new Double ( l * r ) ; } if ( left instanceof BigDecimal || right i... | Multiply the left value by the right . |
10,038 | public boolean matches ( Object left , Object right ) { if ( left == null && right == null ) { return true ; } if ( left == null || right == null ) { return false ; } final String arg = left . toString ( ) ; if ( right instanceof java . util . regex . Pattern ) { return ( ( java . util . regex . Pattern ) right ) . mat... | Test if left regexp matches right . |
10,039 | public Object bitwiseOr ( Object left , Object right ) { long l = toLong ( left ) ; long r = toLong ( right ) ; return Long . valueOf ( l | r ) ; } | Performs a bitwise or . |
10,040 | public Object bitwiseComplement ( Object val ) { long l = toLong ( val ) ; return Long . valueOf ( ~ l ) ; } | Performs a bitwise complement . |
10,041 | public boolean lessThan ( Object left , Object right ) { if ( ( left == right ) || ( left == null ) || ( right == null ) ) { return false ; } else { return compare ( left , right , "<" ) < 0 ; } } | Test if left < right . |
10,042 | public boolean greaterThan ( Object left , Object right ) { if ( ( left == right ) || left == null || right == null ) { return false ; } else { return compare ( left , right , ">" ) > 0 ; } } | Test if left > right . |
10,043 | public boolean lessThanOrEqual ( Object left , Object right ) { if ( left == right ) { return true ; } else if ( left == null || right == null ) { return false ; } else { return compare ( left , right , "<=" ) <= 0 ; } } | Test if left < = right . |
10,044 | public boolean greaterThanOrEqual ( Object left , Object right ) { if ( left == right ) { return true ; } else if ( left == null || right == null ) { return false ; } else { return compare ( left , right , ">=" ) >= 0 ; } } | Test if left > = right . |
10,045 | public int toInteger ( Object val ) { if ( val == null ) { return 0 ; } else if ( val instanceof Double ) { if ( ! Double . isNaN ( ( ( Double ) val ) . doubleValue ( ) ) ) { return 0 ; } else { return ( ( Double ) val ) . intValue ( ) ; } } else if ( val instanceof Number ) { return ( ( Number ) val ) . intValue ( ) ;... | Coerce to a int . |
10,046 | public BigInteger toBigInteger ( Object val ) { if ( val == null ) { return BigInteger . ZERO ; } else if ( val instanceof BigInteger ) { return ( BigInteger ) val ; } else if ( val instanceof Double ) { if ( ! Double . isNaN ( ( ( Double ) val ) . doubleValue ( ) ) ) { return new BigInteger ( val . toString ( ) ) ; } ... | Get a BigInteger from the object passed . Null and empty string maps to zero . |
10,047 | public BigDecimal toBigDecimal ( Object val ) { if ( val instanceof BigDecimal ) { return roundBigDecimal ( ( BigDecimal ) val ) ; } else if ( val == null ) { return BigDecimal . ZERO ; } else if ( val instanceof String ) { String string = ( ( String ) val ) . trim ( ) ; if ( "" . equals ( string ) ) { return BigDecima... | Get a BigDecimal from the object passed . Null and empty string maps to zero . |
10,048 | public double toDouble ( Object val ) { if ( val == null ) { return 0 ; } else if ( val instanceof Double ) { return ( ( Double ) val ) . doubleValue ( ) ; } else if ( val instanceof Number ) { return Double . parseDouble ( String . valueOf ( val ) ) ; } else if ( val instanceof Boolean ) { return ( ( Boolean ) val ) .... | Coerce to a double . |
10,049 | public Collection < ? > toCollection ( Object val ) { if ( val == null ) { return Collections . emptyList ( ) ; } else if ( val instanceof Collection < ? > ) { return ( Collection < ? > ) val ; } else if ( val . getClass ( ) . isArray ( ) ) { return newArrayList ( ( Object [ ] ) val ) ; } else if ( val instanceof Map <... | Coerce to a collection |
10,050 | protected boolean narrowAccept ( Class < ? > narrow , Class < ? > source ) { return narrow == null || narrow . equals ( source ) ; } | Whether we consider the narrow class as a potential candidate for narrowing the source . |
10,051 | protected Number narrowNumber ( Number original , Class < ? > narrow ) { if ( original == null ) { return original ; } Number result = original ; if ( original instanceof BigDecimal ) { BigDecimal bigd = ( BigDecimal ) original ; if ( bigd . compareTo ( BIGD_DOUBLE_MAX_VALUE ) > 0 ) { return original ; } else { try { l... | Given a Number return back the value attempting to narrow it to a target class . |
10,052 | public static AttributeSet get ( final String _typeName , final String _name ) throws CacheReloadException { return ( AttributeSet ) Type . get ( AttributeSet . evaluateName ( _typeName , _name ) ) ; } | Method to get the type from the cache . |
10,053 | public static AttributeSet find ( final String _typeName , final String _name ) throws CacheReloadException { AttributeSet ret = ( AttributeSet ) Type . get ( AttributeSet . evaluateName ( _typeName , _name ) ) ; if ( ret == null ) { if ( Type . get ( _typeName ) . getParentType ( ) != null ) { ret = AttributeSet . fin... | Method to get the type from the cache . Searches if not found in the type hierarchy . |
10,054 | private Set < Classification > getClassification ( final List < Long > _classIds ) throws CacheReloadException { final Set < Classification > noadd = new HashSet < > ( ) ; final Set < Classification > add = new HashSet < > ( ) ; if ( _classIds != null ) { for ( final Long id : _classIds ) { Classification clazz = ( Cla... | Method to get only the leaf of the classification tree . |
10,055 | protected boolean executeOneCompleteStmt ( final String _complStmt , final List < Instance > _instances ) throws EFapsException { final boolean ret = false ; ConnectionResource con = null ; try { con = Context . getThreadContext ( ) . getConnectionResource ( ) ; final Statement stmt = con . createStatement ( ) ; final ... | Method to execute one statement against the eFaps - DataBase . |
10,056 | public static void writeSourceToFile ( Class < ? > koanClass , String newSource ) { Path currentRelativePath = Paths . get ( "" ) ; String workingDirectory = currentRelativePath . toAbsolutePath ( ) . toString ( ) ; String packagePath = koanClass . getPackage ( ) . getName ( ) ; packagePath = packagePath . replace ( PA... | Write source to file . |
10,057 | protected Person createPerson ( final LoginContext _login ) throws EFapsException { Person person = null ; for ( final JAASSystem system : JAASSystem . getAllJAASSystems ( ) ) { final Set < ? > users = _login . getSubject ( ) . getPrincipals ( system . getPersonJAASPrincipleClass ( ) ) ; for ( final Object persObj : us... | The person represented in the JAAS login context is created and associated to eFaps . If the person is defined in more than one JAAS system the person is also associated to the other JAAS systems . |
10,058 | protected void updatePerson ( final LoginContext _login , final Person _person ) throws EFapsException { for ( final JAASSystem system : JAASSystem . getAllJAASSystems ( ) ) { final Set < ? > users = _login . getSubject ( ) . getPrincipals ( system . getPersonJAASPrincipleClass ( ) ) ; for ( final Object persObj : user... | The person information inside eFaps is update with information from JAAS login context . |
10,059 | protected void updateRoles ( final LoginContext _login , final Person _person ) throws EFapsException { for ( final JAASSystem system : JAASSystem . getAllJAASSystems ( ) ) { if ( system . getRoleJAASPrincipleClass ( ) != null ) { final Set < ? > rolesJaas = _login . getSubject ( ) . getPrincipals ( system . getRoleJAA... | The roles of the given person are updated with the information from the JAAS login context . |
10,060 | protected void updateGroups ( final LoginContext _login , final Person _person ) throws EFapsException { for ( final JAASSystem system : JAASSystem . getAllJAASSystems ( ) ) { if ( system . getGroupJAASPrincipleClass ( ) != null ) { final Set < ? > groupsJaas = _login . getSubject ( ) . getPrincipals ( system . getGrou... | The groups of the given person are updated with the information from the JAAS login context . |
10,061 | public Attachment updateWithUploadDetails ( UploadContentResponse response ) { this . id = response . getId ( ) ; this . url = response . getUrl ( ) ; this . size = response . getSize ( ) ; this . type = response . getType ( ) ; return this ; } | For internal use . Update attachment details with upload APIs response . |
10,062 | protected void initTableInfoUniqueKeys ( final Connection _con , final String _sql , final Map < String , TableInformation > _cache4Name ) throws SQLException { final String sqlStmt = new StringBuilder ( ) . append ( "select t.tablename as TABLE_NAME, c.CONSTRAINTNAME as INDEX_NAME, g.DESCRIPTOR as COLUMN_NAME" ) . app... | Fetches all unique keys for this table . Instead of using the JDBC meta data functionality a SQL statement on system tables are used because the JDBC meta data functionality returns for unique keys internal names and not the real names . Also if a unique key includes also columns with null values this unique keys are n... |
10,063 | private void backup ( final FileObject _backup , final int _number ) throws FileSystemException { if ( _number < this . numberBackup ) { final FileObject backFile = this . manager . resolveFile ( this . manager . getBaseFile ( ) , this . storeFileName + VFSStoreResource . EXTENSION_BACKUP + _number ) ; if ( backFile . ... | Method that deletes the oldest backup and moves the others one up . |
10,064 | public Xid [ ] recover ( final int _flag ) { if ( VFSStoreResource . LOG . isDebugEnabled ( ) ) { VFSStoreResource . LOG . debug ( "recover (flag = " + _flag + ")" ) ; } return null ; } | Obtains a list of prepared transaction branches from a resource manager . |
10,065 | Observable < ChatResult > sendMessageWithAttachments ( final String conversationId , final MessageToSend message , final List < Attachment > attachments ) { final MessageProcessor messageProcessor = attCon . createMessageProcessor ( message , attachments , conversationId , getProfileId ( ) ) ; return checkState ( ) . f... | Save and send message with attachments . |
10,066 | public Observable < ChatResult > handleParticipantsAdded ( final String conversationId ) { return persistenceController . getConversation ( conversationId ) . flatMap ( conversation -> { if ( conversation == null ) { return handleNoLocalConversation ( conversationId ) ; } else { return Observable . fromCallable ( ( ) -... | Handle participant added to a conversation Foundation SDK event . |
10,067 | private Observable < ChatResult > handleMessageError ( MessageProcessor mp , Throwable t ) { return persistenceController . updateStoreForSentError ( mp . getConversationId ( ) , mp . getTempId ( ) , mp . getSender ( ) ) . map ( success -> new ChatResult ( false , new ChatResult . Error ( 0 , t ) ) ) ; } | Handle failure when sent message . |
10,068 | Observable < RxComapiClient > checkState ( ) { final RxComapiClient client = clientReference . get ( ) ; if ( client == null ) { return Observable . error ( new ComapiException ( "No client instance available in controller." ) ) ; } else { return Observable . fromCallable ( ( ) -> client ) ; } } | Checks if controller state is correct . |
10,069 | Observable < ChatResult > handleNoLocalConversation ( String conversationId ) { return checkState ( ) . flatMap ( client -> client . service ( ) . messaging ( ) . getConversation ( conversationId ) . flatMap ( result -> { if ( result . isSuccessful ( ) && result . getResult ( ) != null ) { return persistenceController ... | When SDK detects missing conversation it makes query in services and saves in the saves locally . |
10,070 | Observable < ComapiResult < Void > > markDelivered ( String conversationId , Set < String > ids ) { final List < MessageStatusUpdate > updates = new ArrayList < > ( ) ; updates . add ( MessageStatusUpdate . builder ( ) . setMessagesIds ( ids ) . setStatus ( MessageStatus . delivered ) . setTimestamp ( DateHelper . getC... | Mark messages in a conversations as delivered . |
10,071 | String getProfileId ( ) { final RxComapiClient client = clientReference . get ( ) ; return client != null ? client . getSession ( ) . getProfileId ( ) : null ; } | Gets profile id from Foundation for the active user . |
10,072 | Observable < ChatResult > synchroniseStore ( ) { if ( isSynchronising . getAndSet ( true ) ) { log . i ( "Synchronisation in progress." ) ; return Observable . fromCallable ( ( ) -> new ChatResult ( true , null ) ) ; } log . i ( "Synchronising store." ) ; return synchroniseConversations ( ) . onErrorReturn ( t -> new C... | Check state for all conversations and update from services . |
10,073 | Observable < ChatResult > handleConversationCreated ( ComapiResult < ConversationDetails > result ) { if ( result . isSuccessful ( ) ) { return persistenceController . upsertConversation ( ChatConversation . builder ( ) . populate ( result . getResult ( ) , result . getETag ( ) ) . build ( ) ) . map ( success -> adapte... | Handles conversation create service response . |
10,074 | Observable < ChatResult > handleConversationDeleted ( String conversationId , ComapiResult < Void > result ) { if ( result . getCode ( ) != ETAG_NOT_VALID ) { return persistenceController . deleteConversation ( conversationId ) . map ( success -> adapter . adaptResult ( result , success ) ) ; } else { return checkState... | Handles conversation delete service response . |
10,075 | Observable < ChatResult > handleConversationUpdated ( ConversationUpdate request , ComapiResult < ConversationDetails > result ) { if ( result . isSuccessful ( ) ) { return persistenceController . upsertConversation ( ChatConversation . builder ( ) . populate ( result . getResult ( ) , result . getETag ( ) ) . build ( ... | Handles conversation update service response . |
10,076 | Observable < ChatResult > handleMessageStatusToUpdate ( String conversationId , List < MessageStatusUpdate > msgStatusList , ComapiResult < Void > result ) { if ( result . isSuccessful ( ) && msgStatusList != null && ! msgStatusList . isEmpty ( ) ) { return persistenceController . upsertMessageStatuses ( conversationId... | Handles message status update service response . |
10,077 | private Observable < Boolean > upsertTempMessage ( ChatMessage message ) { return persistenceController . updateStoreWithNewMessage ( message , noConversationListener ) . doOnError ( t -> log . e ( "Error saving temp message " + t . getLocalizedMessage ( ) ) ) . onErrorReturn ( t -> false ) ; } | Insert temporary message to the store for the ui to be responsive . |
10,078 | Observable < ChatResult > updateStoreWithSentMsg ( MessageProcessor mp , ComapiResult < MessageSentResponse > response ) { if ( response . isSuccessful ( ) ) { return persistenceController . updateStoreWithNewMessage ( mp . createFinalMessage ( response . getResult ( ) ) , noConversationListener ) . map ( success -> ad... | Handles message send service response . Will delete temporary message object . Same message but with correct message id will be inserted instead . |
10,079 | private Observable < ChatResult > synchroniseConversations ( ) { return checkState ( ) . flatMap ( client -> client . service ( ) . messaging ( ) . getConversations ( false ) . flatMap ( result -> persistenceController . loadAllConversations ( ) . map ( chatConversationBases -> compare ( result . isSuccessful ( ) , res... | Updates all conversation states . |
10,080 | ConversationComparison compare ( boolean successful , List < Conversation > remote , List < ChatConversationBase > local ) { return new ConversationComparison ( successful , makeMapFromDownloadedConversations ( remote ) , makeMapFromSavedConversations ( local ) ) ; } | Compares remote and local conversation lists . |
10,081 | Observable < ChatResult > synchroniseConversation ( String conversationId ) { return checkState ( ) . flatMap ( client -> client . service ( ) . messaging ( ) . queryMessages ( conversationId , null , 1 ) . map ( result -> { if ( result . isSuccessful ( ) && result . getResult ( ) != null ) { return ( long ) result . g... | Updates single conversation state . |
10,082 | private Observable < ConversationComparison > lookForMissingEvents ( final RxComapiClient client , ConversationComparison conversationComparison ) { if ( ! conversationComparison . isSuccessful || conversationComparison . conversationsToUpdate . isEmpty ( ) ) { return Observable . fromCallable ( ( ) -> conversationComp... | Checks services for missing events in stored conversations . |
10,083 | private Observable < ConversationComparison > updateLocalConversationList ( final ConversationComparison conversationComparison ) { return Observable . zip ( persistenceController . deleteConversations ( conversationComparison . conversationsToDelete ) , persistenceController . upsertConversations ( conversationCompari... | Update list of local conversations . |
10,084 | private Observable < Boolean > synchroniseEvents ( final RxComapiClient client , final List < ChatConversation > conversationsToUpdate , final List < Boolean > successes ) { final List < ChatConversation > limited = limitNumberOfConversations ( conversationsToUpdate ) ; if ( limited . isEmpty ( ) ) { return Observable ... | Synchronise missing events for the list of locally stored conversations . |
10,085 | private Observable < ComapiResult < ConversationEventsResponse > > queryEventsRecursively ( final RxComapiClient client , final String conversationId , final long lastEventId , final int count , final List < Boolean > successes ) { return client . service ( ) . messaging ( ) . queryConversationEvents ( conversationId ,... | Synchronise missing events for particular conversation . |
10,086 | private Observable < ComapiResult < ConversationEventsResponse > > processEventsQueryResponse ( ComapiResult < ConversationEventsResponse > result , final List < Boolean > successes ) { ConversationEventsResponse response = result . getResult ( ) ; successes . add ( result . isSuccessful ( ) ) ; if ( response != null &... | Process the event query response . Calls appropraiate persistance controller methods for received events . |
10,087 | private List < ChatConversation > limitNumberOfConversations ( List < ChatConversation > conversations ) { List < ChatConversation > noEmptyConversations = new ArrayList < > ( ) ; for ( ChatConversation c : conversations ) { if ( c . getLastRemoteEventId ( ) != null && c . getLastRemoteEventId ( ) >= 0 ) { noEmptyConve... | Limits number of conversations to check and synchronise . Emty conversations wont be synchronised . The synchronisation will take place for twenty conversations updated most recently . |
10,088 | public Observable < Boolean > handleMessage ( final ChatMessage message ) { String sender = message . getSentBy ( ) ; Observable < Boolean > replaceMessages = persistenceController . updateStoreWithNewMessage ( message , noConversationListener ) ; if ( ! TextUtils . isEmpty ( sender ) && ! sender . equals ( getProfileI... | Handle incomming message . Replace temporary message with received one and mark as delivered . |
10,089 | public void analyzeEndStop ( ) { DFA < T > dfa = constructDFA ( new Scope < DFAState < T > > ( "analyzeEndStop" ) ) ; for ( DFAState < T > s : dfa ) { if ( s . isAccepting ( ) ) { if ( s . isEndStop ( ) ) { for ( NFAState < T > n : s . getNfaSet ( ) ) { if ( n . isAccepting ( ) ) { n . setEndStop ( true ) ; } } } } } } | Marks all nfa states that can be accepting to end stop . |
10,090 | public DFA < T > constructDFA ( Scope < DFAState < T > > scope ) { return new DFA < > ( first . constructDFA ( scope ) , scope . count ( ) ) ; } | Constructs a dfa from using first nfa state as starting state . |
10,091 | public void concat ( NFA < T > nfa ) { last . addEpsilon ( nfa . getFirst ( ) ) ; last = nfa . last ; } | Concatenates this to nfa by making epsilon move from this last to nfa first . |
10,092 | public static Application getApplicationFromSource ( final File _versionFile , final List < String > _classpathElements , final File _eFapsDir , final File _outputDir , final List < String > _includes , final List < String > _excludes , final Map < String , String > _file2typeMapping ) throws InstallationException { fi... | Returns the application definition read from a source directory . |
10,093 | public static Application getApplicationFromClassPath ( final String _application , final List < String > _classpath ) throws InstallationException { return Application . getApplicationsFromClassPath ( _application , _classpath ) . get ( _application ) ; } | Method to get the applications from the class path . |
10,094 | public static Map < String , Application > getApplicationsFromClassPath ( final String _application , final List < String > _classpath ) throws InstallationException { final Map < String , Application > appls = new HashMap < > ( ) ; try { final ClassLoader parent = Application . class . getClassLoader ( ) ; final List ... | Method to get all applications from the class path . |
10,095 | public void updateLastVersion ( final String _userName , final String _password , final Set < Profile > _profiles ) throws Exception { reloadCache ( ) ; Context . begin ( ) ; EFapsClassLoader . getOfflineInstance ( getClass ( ) . getClassLoader ( ) ) ; final Map < String , Integer > latestVersions = this . install . ge... | Updates the last installed version . |
10,096 | protected void reloadCache ( ) throws InstallationException { try { LOG . info ( "Reloading Cache" ) ; Context . begin ( ) ; if ( RunLevel . isInitialisable ( ) ) { RunLevel . init ( "shell" ) ; RunLevel . execute ( ) ; } Context . commit ( ) ; } catch ( final EFapsException e ) { throw new InstallationException ( "Rel... | Reloads the eFaps cache . |
10,097 | public String getString ( long start , int length ) { if ( length == 0 ) { return "" ; } if ( array != null ) { int ps = ( int ) ( start % size ) ; int es = ( int ) ( ( start + length ) % size ) ; if ( ps < es ) { return new String ( array , ps , length ) ; } else { StringBuilder sb = new StringBuilder ( ) ; sb . appen... | Returns string from buffer |
10,098 | static Map < String , Set < String > > groupNameToSet ( GravityNameValue [ ] nameValues ) { Map < String , Set < String > > result = new HashMap < > ( ) ; for ( GravityNameValue nameValue : nameValues ) { if ( nameValue . name == null || nameValue . value == null ) continue ; if ( ! result . containsKey ( nameValue . n... | Transform grouped into a map of name to a linked set of values |
10,099 | protected void setFileInfo ( final String _filename , final long _fileLength ) throws EFapsException { if ( ! _filename . equals ( this . fileName ) || _fileLength != this . fileLength ) { ConnectionResource res = null ; try { res = Context . getThreadContext ( ) . getConnectionResource ( ) ; final AbstractDatabase < ?... | Set the info for the file in this store reosurce . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.