idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
120,600
public static boolean hasTranslator ( final int mainNumber , final String dptId ) { try { final MainType t = getMainType ( getMainNumber ( mainNumber , dptId ) ) ; if ( t != null ) return t . getSubTypes ( ) . get ( dptId ) != null ; } catch ( final NumberFormatException e ) { } catch ( final KNXException e ) { } retur...
Does a lookup if the specified DPT is supported by a DPT translator .
120,601
public static DPTXlator createTranslator ( final String dptId , final byte ... data ) throws KNXException , KNXIllegalArgumentException { final DPTXlator t = createTranslator ( 0 , dptId ) ; if ( data . length > 0 ) t . setData ( data ) ; return t ; }
Creates a DPT translator for the given datapoint type ID .
120,602
public static KNXNetworkLinkIP newSecureRoutingLink ( final NetworkInterface netif , final InetAddress mcGroup , final byte [ ] groupKey , final Duration latencyTolerance , final KNXMediumSettings settings ) throws KNXException { return new KNXNetworkLinkIP ( ROUTING , SecureConnection . newRouting ( netif , mcGroup , ...
Creates a new secure network link using the KNX IP Secure Routing protocol .
120,603
public static KNXMediumSettings create ( final int medium , final IndividualAddress device ) { switch ( medium ) { case MEDIUM_TP1 : return new TPSettings ( device ) ; case MEDIUM_PL110 : return new PLSettings ( device , null ) ; case MEDIUM_RF : return new RFSettings ( device ) ; case MEDIUM_KNXIP : return new KnxIPSe...
Creates the medium settings for the specified KNX medium .
120,604
public static RawFrame create ( final int mediumType , final byte [ ] data , final int offset , final boolean extBusmon ) throws KNXFormatException { switch ( mediumType ) { case KNXMediumSettings . MEDIUM_TP1 : return createTP1 ( data , offset ) ; case KNXMediumSettings . MEDIUM_PL110 : return createPL110 ( data , off...
Creates a raw frame out of a byte array for the specified communication medium . This method just invokes one of the other medium type specific creation methods according the given medium type .
120,605
public static RawFrame createTP1 ( final byte [ ] data , final int offset ) throws KNXFormatException { final int ctrl = data [ offset ] & 0xff ; if ( ( ctrl & 0x10 ) == 0x10 ) { if ( ( ctrl & 0x40 ) == 0x00 ) return new TP1LData ( data , offset ) ; else if ( ctrl == 0xF0 ) return new TP1LPollData ( data , offset ) ; t...
Creates a raw frame out of a byte array for the TP1 communication medium .
120,606
private boolean skipComment ( final String s ) throws KNXMLException { if ( s . startsWith ( "!--" ) ) { String comment = s ; while ( canRead ( ) && ! comment . endsWith ( "--" ) ) comment = read ( '>' ) ; return true ; } return false ; }
checks if < marks begin of a comment and if so skips over it
120,607
public String getProperty ( final int objIndex , final int pid ) throws KNXException , InterruptedException { return getPropertyTranslated ( objIndex , pid , 1 , 1 ) . getValue ( ) ; }
Gets the first property element using the associated property data type of the requested property .
120,608
public Description getDescriptionByIndex ( final int objIndex , final int propIndex ) throws KNXException , InterruptedException { return createDesc ( objIndex , pa . getDescription ( objIndex , 0 , propIndex ) ) ; }
Gets the property description based on the property index .
120,609
public void scanProperties ( final boolean allProperties , final Consumer < Description > consumer ) throws KNXException , InterruptedException { for ( int index = 0 ; scan ( index , allProperties , consumer ) > 0 ; ++ index ) ; }
Does a property description scan of the properties in all interface objects .
120,610
public void scanProperties ( final int objIndex , final boolean allProperties , final Consumer < Description > consumer ) throws KNXException , InterruptedException { scan ( objIndex , allProperties , consumer ) ; }
Does a property description scan of the properties of one interface object .
120,611
public static SearchResponse from ( final KNXnetIPHeader h , final byte [ ] data , final int offset ) throws KNXFormatException { final int svcType = h . getServiceType ( ) ; if ( svcType != KNXnetIPHeader . SEARCH_RES && svcType != KNXnetIPHeader . SearchResponse ) throw new KNXIllegalArgumentException ( "not a search...
Creates a new search response from a byte array .
120,612
public static TunnelingFeature newGet ( final int channelId , final int seq , final InterfaceFeature featureId ) { return new TunnelingFeature ( KNXnetIPHeader . TunnelingFeatureGet , channelId , seq , featureId , Success ) ; }
Creates a new tunneling feature - get service .
120,613
public static TunnelingFeature newResponse ( final int channelId , final int seq , final InterfaceFeature featureId , final ReturnCode result , final byte ... featureValue ) { return new TunnelingFeature ( KNXnetIPHeader . TunnelingFeatureResponse , channelId , seq , featureId , result , featureValue ) ; }
Creates a new tunneling feature - response service .
120,614
public static TunnelingFeature newSet ( final int channelId , final int seq , final InterfaceFeature featureId , final byte ... featureValue ) { return new TunnelingFeature ( KNXnetIPHeader . TunnelingFeatureSet , channelId , seq , featureId , Success , featureValue ) ; }
Creates a new tunneling feature - set service .
120,615
public static TunnelingFeature newInfo ( final int channelId , final int seq , final InterfaceFeature featureId , final byte ... featureValue ) { return new TunnelingFeature ( KNXnetIPHeader . TunnelingFeatureInfo , channelId , seq , featureId , Success , featureValue ) ; }
Creates a new tunneling feature - info service .
120,616
public static KNXAddress create ( final XmlReader r ) throws KNXMLException { if ( r . getEventType ( ) != XmlReader . START_ELEMENT ) r . nextTag ( ) ; if ( r . getEventType ( ) == XmlReader . START_ELEMENT ) { final String type = r . getAttributeValue ( null , ATTR_TYPE ) ; if ( GroupAddress . ATTR_GROUP . equals ( t...
Creates a KNX address from xml input the KNX address element is expected to be the current or next element from the parser .
120,617
public void save ( final XmlWriter w ) throws KNXMLException { w . writeStartElement ( TAG_ADDRESS ) ; w . writeAttribute ( ATTR_TYPE , getType ( ) ) ; w . writeCharacters ( toString ( ) ) ; w . writeEndElement ( ) ; }
Writes the KNX address in XML format to the supplied writer .
120,618
public static SearchRequest from ( final KNXnetIPHeader h , final byte [ ] data , final int offset ) throws KNXFormatException { final int svcType = h . getServiceType ( ) ; if ( svcType != KNXnetIPHeader . SEARCH_REQ && svcType != KNXnetIPHeader . SearchRequest ) throw new KNXIllegalArgumentException ( "not a search r...
Creates a new search request from a byte array .
120,619
public void loop ( ) throws IOException { final long start = System . currentTimeMillis ( ) ; final byte [ ] buf = new byte [ maxRcvBuf ] ; try { if ( timeout > 0 ) s . setSoTimeout ( timeout ) ; while ( ! quit ) { if ( total > 0 ) { final long now = System . currentTimeMillis ( ) ; int to = ( int ) ( start + total - n...
Runs the looper .
120,620
public Destination getDestination ( final IndividualAddress remote ) { final AggregatorProxy proxy = proxies . get ( remote ) ; return proxy != null ? proxy . getDestination ( ) : null ; }
Returns the destination object for the remote individual address if such exists .
120,621
static RFLData newForTransmitOnlyDevice ( final boolean batteryOk , final int frameType , final int frameNumber , final byte [ ] serial , final GroupAddress dst , final byte [ ] tpdu ) { return new RFLData ( batteryOk , true , frameType , frameNumber , serial , new IndividualAddress ( 0x05ff ) , dst , tpdu ) ; }
- datapoints shall be numbered as DP1 = GroupAddr 0x0001 DP2 = 0x0002 ...
120,622
static String replace ( final String text , final boolean toReference ) { return toReference ? replaceWithRef ( text ) : replaceFromRef ( text ) ; }
wrapper for reference replacement
120,623
private int coding ( final String unit ) throws KNXFormatException { expUnitAdjustment = 0 ; switch ( unit ) { case "Wh" : return 0b00000000 ; case "MWh" : expUnitAdjustment = 6 ; return 0b10000000 ; case "kJ" : expUnitAdjustment = 3 ; return 0b00001000 ; case "GJ" : expUnitAdjustment = 9 ; return 0b10001000 ; case "l"...
try to find the coding based on unit
120,624
final int setParity ( final int parity ) { try { return setControl ( PARITY , parity ) ; } catch ( final IOException e ) { logger . error ( "set parity failed" , e ) ; } return 0 ; }
return previous parity mode
120,625
public void save ( final XmlWriter w ) throws KNXMLException { w . writeStartElement ( TAG_DATAPOINT ) ; w . writeAttribute ( ATTR_STATEBASED , Boolean . toString ( stateBased ) ) ; w . writeAttribute ( ATTR_NAME , name ) ; w . writeAttribute ( ATTR_MAINNUMBER , Integer . toString ( mainNo ) ) ; w . writeAttribute ( AT...
Saves this datapoint in XML format to the supplied XML writer .
120,626
@ SuppressWarnings ( "unused" ) protected boolean handleServiceType ( final KNXnetIPHeader h , final byte [ ] data , final int offset , final InetAddress src , final int port ) throws KNXFormatException , IOException { return false ; }
This stub always returns false .
120,627
protected final void setState ( final int newState ) { if ( closing < 2 ) { if ( internalState == OK && newState == ClientConnection . CEMI_CON_PENDING ) return ; internalState = newState ; if ( updateState ) state = newState ; } else state = internalState = CLOSED ; }
Request to set this connection into a new connection state .
120,628
protected boolean checkChannelId ( final int id , final String svcType ) { if ( id == channelId ) return true ; logger . warn ( "received service " + svcType + " with wrong channel ID " + id + ", expected " + channelId + " - ignored" ) ; return false ; }
Validates channel id received in a packet against the one assigned to this connection .
120,629
protected ServiceRequest getServiceRequest ( final KNXnetIPHeader h , final byte [ ] data , final int offset ) throws KNXFormatException { try { return PacketHelper . getServiceRequest ( h , data , offset ) ; } catch ( final KNXFormatException e ) { final ServiceRequest req = PacketHelper . getEmptyServiceRequest ( h ,...
Extracts the service request out of the supplied packet data .
120,630
public static CEMI fromEmi ( final byte [ ] frame ) throws KNXFormatException { if ( frame . length < 4 ) throw new KNXFormatException ( "EMI frame too short" ) ; int mc = frame [ 0 ] & 0xff ; boolean domainBcast = true ; if ( mc == Emi1_LSysBcast_req || mc == Emi1_LSysBcast_con || mc == Emi1_LSysBcast_ind ) domainBcas...
Creates a new cEMI message out of the supplied EMI frame .
120,631
int init ( final ByteArrayInputStream is , final boolean parseDoA ) throws KNXFormatException { final int ctrl = is . read ( ) ; if ( ( ctrl & 0x53 ) != 0x10 ) throw new KNXFormatException ( "invalid control field" , ctrl ) ; type = LDATA_FRAME ; ext = ( ctrl & 0x80 ) == 0 ; repetition = ( ctrl & 0x20 ) == 0 ; p = Prio...
Inits the basic fields for TP1 and PL110 L - Data format reading the input stream .
120,632
public static void updateDeviceList ( ) throws SecurityException , UsbException { ( ( org . usb4java . javax . Services ) UsbHostManager . getUsbServices ( ) ) . scan ( ) ; }
Scans for USB device connection changes so subsequent traversals provide an updated view of attached USB interfaces .
120,633
public static List < UsbDevice > getKnxDevices ( ) { final List < UsbDevice > knx = new ArrayList < > ( ) ; for ( final UsbDevice d : getDevices ( ) ) { final int vendor = d . getUsbDeviceDescriptor ( ) . idVendor ( ) & 0xffff ; for ( final int v : vendorIds ) if ( v == vendor ) knx . add ( d ) ; } return knx ; }
Returns the list of KNX devices currently attached to the host based on known KNX vendor IDs .
120,634
public static List < UsbDevice > getVirtualSerialKnxDevices ( ) throws SecurityException { final List < UsbDevice > knx = new ArrayList < > ( ) ; for ( final UsbDevice d : getDevices ( ) ) { final int vendor = d . getUsbDeviceDescriptor ( ) . idVendor ( ) & 0xffff ; final int product = d . getUsbDeviceDescriptor ( ) . ...
internal use only
120,635
public final DD0 deviceDescriptor ( ) throws KNXPortClosedException , KNXTimeoutException , InterruptedException { return DD0 . from ( ( int ) toUnsigned ( getFeature ( BusAccessServerFeature . DeviceDescriptorType0 ) ) ) ; }
Returns the KNX device descriptor type 0 of the USB interface .
120,636
private void removeClaimedInterfaceNumberOnWindows ( ) { try { final Class < ? extends UsbDevice > c = dev . getClass ( ) ; final Class < ? > abstractDevice = c . getSuperclass ( ) ; final Field field = abstractDevice . getDeclaredField ( "claimedInterfaceNumbers" ) ; field . setAccessible ( true ) ; final Object set =...
Subsequent claims of that interface then always fail .
120,637
private static String trimAtNull ( final String s ) { final int end = s . indexOf ( ( char ) 0 ) ; return end > - 1 ? s . substring ( 0 , end ) : s ; }
sometimes the usb4java high - level API returns strings which exceed past the null terminator
120,638
private static UsbDevice findDeviceByNameLowLevel ( final String name ) throws KNXException { final List < String > list = getDeviceDescriptionsLowLevel ( ) ; if ( name . isEmpty ( ) ) list . removeIf ( i -> ! isKnxInterfaceId ( i . substring ( i . indexOf ( "ID" ) + 3 , i . indexOf ( "\n" ) ) ) ) ; else list . removeI...
string . Pass that ID to findDevice . which will do the lookup by ID .
120,639
private static List < String > getDeviceDescriptionsLowLevel ( ) { final Context ctx = new Context ( ) ; final int err = LibUsb . init ( ctx ) ; if ( err != 0 ) { slogger . error ( "LibUsb initialization error {}: {}" , - err , LibUsb . strError ( err ) ) ; return Collections . emptyList ( ) ; } try { final DeviceList ...
This method avoids any further issues down the road by using the ASCII descriptors .
120,640
public static int getAPDUService ( final byte [ ] apdu ) { if ( apdu . length < 2 ) throw new KNXIllegalArgumentException ( "getting APDU service from [0x" + toHex ( apdu , "" ) + "], APCI length < 2" ) ; final int apci4 = ( apdu [ 0 ] & 0x03 ) << 2 | ( apdu [ 1 ] & 0xC0 ) >> 6 ; final int apci6 = apdu [ 1 ] & 0x3f ; i...
Returns the application layer service of a given protocol data unit .
120,641
public static int getTPDUService ( final byte [ ] tpdu ) { final int ctrl = tpdu [ 0 ] & 0xff ; if ( ( ctrl & 0xFC ) == 0 ) return 0 ; if ( ( ctrl & 0xFC ) == 0x04 ) return 0x04 ; if ( ( ctrl & 0xC0 ) == 0x40 ) return T_DATA_CONNECTED ; if ( ctrl == T_CONNECT ) return T_CONNECT ; if ( ctrl == T_DISCONNECT ) return T_DI...
Returns the transport layer service of a given protocol data unit .
120,642
public static JettyServerContract launchServerContract ( int port , HttpObject ... objects ) { JettyServerContract server = new JettyServerDelegate ( new Server ( port ) ) ; server . setHandler ( new HttpObjectsJettyHandler ( Collections . singletonList ( new GenericHeaderField ( "Cache-Control" , "no-cache" ) ) , obje...
Replaced checked exceptions with unchecked exceptions .
120,643
private void setC4Document ( C4Document c4doc ) { synchronized ( lock ) { replaceC4Document ( c4doc ) ; data = null ; if ( c4doc != null && ! c4doc . deleted ( ) ) { data = c4doc . getSelectedBody2 ( ) ; } updateDictionary ( ) ; } }
Sets c4doc and updates my root dictionary
120,644
public ReplicatorConfiguration setHeaders ( Map < String , String > headers ) { if ( readonly ) { throw new IllegalStateException ( "ReplicatorConfiguration is readonly mode." ) ; } this . headers = new HashMap < > ( headers ) ; return getReplicatorConfiguration ( ) ; }
Sets the extra HTTP headers to send in all requests to the remote target .
120,645
public ReplicatorConfiguration setPullFilter ( ReplicationFilter pullFilter ) { if ( readonly ) { throw new IllegalStateException ( "ReplicatorConfiguration is readonly mode." ) ; } this . pullFilter = pullFilter ; return getReplicatorConfiguration ( ) ; }
Sets a filter object for validating whether the documents can be pulled from the remote endpoint . Only documents for which the object returns true are replicated .
120,646
public ReplicatorConfiguration setPushFilter ( ReplicationFilter pushFilter ) { if ( readonly ) { throw new IllegalStateException ( "ReplicatorConfiguration is readonly mode." ) ; } this . pushFilter = pushFilter ; return getReplicatorConfiguration ( ) ; }
Sets a filter object for validating whether the documents can be pushed to the remote endpoint .
120,647
public MutableArray setData ( List < Object > data ) { synchronized ( lock ) { internalArray . clear ( ) ; for ( Object obj : data ) { internalArray . append ( Fleece . toCBLObject ( obj ) ) ; } return this ; } }
Set an array as a content . Allowed value types are List Date Map Number null String Array Blob and Dictionary . The List and Map must contain only the above types . Setting the new array content will replcace the current data including the existing Array and Dictionary objects .
120,648
public MutableArray setValue ( int index , Object value ) { synchronized ( lock ) { if ( Fleece . valueWouldChange ( value , internalArray . get ( index ) , internalArray ) && ( ! internalArray . set ( index , Fleece . toCBLObject ( value ) ) ) ) { throwRangeException ( index ) ; } return this ; } }
Set an object at the given index .
120,649
public MutableArray setString ( int index , String value ) { return setValue ( index , value ) ; }
Sets an String object at the given index .
120,650
public MutableArray setNumber ( int index , Number value ) { return setValue ( index , value ) ; }
Sets an NSNumber object at the given index .
120,651
public MutableArray setBlob ( int index , Blob value ) { return setValue ( index , value ) ; }
Sets a Blob object at the given index .
120,652
public MutableArray setDate ( int index , Date value ) { return setValue ( index , value ) ; }
Sets a Date object at the given index .
120,653
public MutableArray setArray ( int index , Array value ) { return setValue ( index , value ) ; }
Sets a Array object at the given index .
120,654
public MutableArray setDictionary ( int index , Dictionary value ) { return setValue ( index , value ) ; }
Sets a Dictionary object at the given index .
120,655
public MutableArray addValue ( Object value ) { synchronized ( lock ) { internalArray . append ( Fleece . toCBLObject ( value ) ) ; return this ; } }
Adds an object to the end of the array .
120,656
public MutableArray insertValue ( int index , Object value ) { synchronized ( lock ) { if ( ! internalArray . insert ( index , Fleece . toCBLObject ( value ) ) ) { throwRangeException ( index ) ; } return this ; } }
Inserts an object at the given index .
120,657
public MutableArray insertString ( int index , String value ) { return insertValue ( index , value ) ; }
Inserts a String object at the given index .
120,658
public MutableArray insertNumber ( int index , Number value ) { return insertValue ( index , value ) ; }
Inserts a Number object at the given index .
120,659
public MutableArray insertBlob ( int index , Blob value ) { return insertValue ( index , value ) ; }
Inserts a Blob object at the given index .
120,660
public MutableArray insertDate ( int index , Date value ) { return insertValue ( index , value ) ; }
Inserts a Date object at the given index .
120,661
public MutableArray insertArray ( int index , Array value ) { return insertValue ( index , value ) ; }
Inserts an Array object at the given index .
120,662
public MutableArray insertDictionary ( int index , Dictionary value ) { return insertValue ( index , value ) ; }
Inserts a Dictionary object at the given index .
120,663
public MutableArray remove ( int index ) { synchronized ( lock ) { if ( ! internalArray . remove ( index ) ) { throwRangeException ( index ) ; } return this ; } }
Removes the object at the given index .
120,664
public FLSliceResult getContents ( C4BlobKey blobKey ) throws LiteCoreException { return new FLSliceResult ( getContents ( handle , blobKey . getHandle ( ) ) ) ; }
Reads the entire contents of a blob into memory . Caller is responsible for freeing it .
120,665
public C4BlobReadStream openReadStream ( C4BlobKey blobKey ) throws LiteCoreException { return new C4BlobReadStream ( openReadStream ( handle , blobKey . getHandle ( ) ) ) ; }
Opens a blob for reading as a random - access byte stream .
120,666
public MValue get ( long index ) { if ( index < 0 || index >= values . size ( ) ) { return MValue . EMPTY ; } MValue value = values . get ( ( int ) index ) ; if ( value . isEmpty ( ) && ( baseArray != null ) ) { value = new MValue ( baseArray . get ( index ) ) ; values . set ( ( int ) index , value ) ; } return value ;...
Returns a reference to the MValue of the item at the given index . If the index is out of range returns an empty MValue .
120,667
public static String getVersionInfo ( ) { String info = versionInfo . get ( ) ; if ( info == null ) { info = String . format ( Locale . ENGLISH , VERSION_INFO , getLibInfo ( ) , getSysInfo ( ) ) ; versionInfo . compareAndSet ( null , info ) ; } return info ; }
This is the full library build and environment information .
120,668
public static String getLibInfo ( ) { String info = libInfo . get ( ) ; if ( info == null ) { info = String . format ( Locale . ENGLISH , LIB_INFO , C4 . getVersion ( ) ) ; libInfo . compareAndSet ( null , info ) ; } return info ; }
This is the short library build information .
120,669
public static String getSysInfo ( ) { String info = sysInfo . get ( ) ; if ( info == null ) { info = String . format ( Locale . ENGLISH , SYS_INFO , System . getProperty ( "os.name" , "unknown" ) ) ; sysInfo . compareAndSet ( null , info ) ; } return info ; }
This is information about the system on which we are running .
120,670
public Map < String , Object > toMap ( ) { synchronized ( lock ) { final Map < String , Object > result = new HashMap < > ( ) ; for ( String key : internalDict ) { result . put ( key , Fleece . toObject ( getMValue ( internalDict , key ) . asNative ( internalDict ) ) ) ; } return result ; } }
Gets content of the current object as an Map . The values contained in the returned Map object are all JSON based values .
120,671
public String getString ( int index ) { check ( index ) ; final Object obj = fleeceValueToObject ( index ) ; return obj instanceof String ? ( String ) obj : null ; }
The projecting result value at the given index as a String object
120,672
public Number getNumber ( int index ) { check ( index ) ; return CBLConverter . asNumber ( fleeceValueToObject ( index ) ) ; }
The projecting result value at the given index as a Number object
120,673
public int getInt ( int index ) { check ( index ) ; final FLValue flValue = values . get ( index ) ; return flValue != null ? ( int ) flValue . asInt ( ) : 0 ; }
The projecting result value at the given index as a integer value
120,674
public float getFloat ( int index ) { check ( index ) ; final FLValue flValue = values . get ( index ) ; return flValue != null ? flValue . asFloat ( ) : 0.0F ; }
The projecting result value at the given index as a float value
120,675
public double getDouble ( int index ) { check ( index ) ; final FLValue flValue = values . get ( index ) ; return flValue != null ? flValue . asDouble ( ) : 0.0 ; }
The projecting result value at the given index as a double value
120,676
public boolean getBoolean ( int index ) { check ( index ) ; final FLValue flValue = values . get ( index ) ; return flValue != null && flValue . asBool ( ) ; }
The projecting result value at the given index as a boolean value
120,677
public Blob getBlob ( int index ) { check ( index ) ; final Object obj = fleeceValueToObject ( index ) ; return obj instanceof Blob ? ( Blob ) obj : null ; }
The projecting result value at the given index as a Blob object
120,678
public Date getDate ( int index ) { check ( index ) ; return DateUtils . fromJson ( getString ( index ) ) ; }
The projecting result value at the given index as an Array object
120,679
public Array getArray ( int index ) { check ( index ) ; final Object obj = fleeceValueToObject ( index ) ; return obj instanceof Array ? ( Array ) obj : null ; }
The projecting result value at the given index as a Array object
120,680
public Dictionary getDictionary ( int index ) { check ( index ) ; final Object obj = fleeceValueToObject ( index ) ; return obj instanceof Dictionary ? ( Dictionary ) obj : null ; }
The projecting result value at the given index as a Dictionary object
120,681
public List < Object > toList ( ) { final List < Object > array = new ArrayList < > ( ) ; for ( int i = 0 ; i < count ( ) ; i ++ ) { array . add ( values . get ( i ) . asObject ( ) ) ; } return array ; }
Gets all values as an List . The value types of the values contained in the returned List object are Array Blob Dictionary Number types String and null .
120,682
public Map < String , Object > toMap ( ) { final List < Object > values = toList ( ) ; final Map < String , Object > dict = new HashMap < > ( ) ; for ( String name : rs . getColumnNames ( ) . keySet ( ) ) { final int index = indexForColumnName ( name ) ; if ( index >= 0 ) { dict . put ( name , values . get ( index ) ) ...
Gets all values as a Dictionary . The value types of the values contained in the returned Dictionary object are Array Blob Dictionary Number types String and null .
120,683
public Expression isNullOrMissing ( ) { return new UnaryExpression ( this , UnaryExpression . OpType . Null ) . or ( new UnaryExpression ( this , UnaryExpression . OpType . Missing ) ) ; }
Creates an IS NULL OR MISSING expression that evaluates whether or not the current expression is null or missing .
120,684
public static void throwException ( int domain , int code , String msg ) throws LiteCoreException { throw new LiteCoreException ( domain , code , msg ) ; }
NOTE called to throw LiteCoreException from native code to Java
120,685
public void compact ( ) throws CouchbaseLiteException { synchronized ( lock ) { mustBeOpen ( ) ; try { getC4Database ( ) . compact ( ) ; } catch ( LiteCoreException e ) { throw CBLStatus . convertException ( e ) ; } } }
Compacts the database file by deleting unused attachment files and vacuuming the SQLite database
120,686
public void close ( ) throws CouchbaseLiteException { synchronized ( lock ) { if ( c4db == null ) { return ; } Log . i ( DOMAIN , "Closing %s at path %s" , this , getC4Database ( ) . getPath ( ) ) ; if ( activeReplications . size ( ) > 0 ) { throw new CouchbaseLiteException ( "Cannot close the database. Please stop al...
Closes a database .
120,687
public void delete ( ) throws CouchbaseLiteException { synchronized ( lock ) { mustBeOpen ( ) ; Log . i ( DOMAIN , "Deleting %s at path %s" , this , getC4Database ( ) . getPath ( ) ) ; if ( activeReplications . size ( ) > 0 ) { throw new CouchbaseLiteException ( "Cannot delete the database. Please stop all of the repl...
Deletes a database .
120,688
private boolean save ( Document document , boolean deletion , ConcurrencyControl concurrencyControl ) throws CouchbaseLiteException { if ( deletion && ! document . exists ( ) ) { throw new CouchbaseLiteException ( "Cannot delete a document that has not yet been saved." , CBLError . Domain . CBLITE , CBLError . Code . N...
The main save method .
120,689
void start ( ) { synchronized ( lock ) { if ( query . getDatabase ( ) == null ) { throw new IllegalArgumentException ( "associated database should not be null." ) ; } observing = true ; releaseResultSet ( ) ; query . getDatabase ( ) . getActiveLiveQueries ( ) . add ( this ) ; if ( dbListenerToken == null ) { dbListener...
Starts observing database changes and reports changes in the query result .
120,690
private void stop ( boolean removeFromList ) { synchronized ( lock ) { observing = false ; willUpdate = false ; if ( query != null && query . getDatabase ( ) != null && dbListenerToken != null ) { query . getDatabase ( ) . removeChangeListener ( dbListenerToken ) ; dbListenerToken = null ; } if ( removeFromList && quer...
Stops observing database changes .
120,691
public C4Replicator createReplicator ( C4Socket openSocket , int push , int pull , byte [ ] options , C4ReplicatorListener listener , Object replicatorContext ) throws LiteCoreException { return new C4Replicator ( handle , openSocket . handle , push , pull , options , listener , replicatorContext ) ; }
- Fleece - related
120,692
void addNetworkReachabilityListener ( NetworkReachabilityListener listener ) { synchronized ( listeners ) { listeners . add ( listener ) ; if ( listeners . size ( ) == 1 ) { startListening ( ) ; } } }
Add Network Reachability Listener
120,693
void removeNetworkReachabilityListener ( NetworkReachabilityListener listener ) { synchronized ( listeners ) { listeners . remove ( listener ) ; if ( listeners . size ( ) == 0 ) { stopListening ( ) ; } } }
Remove Network Reachability Listener
120,694
void notifyListenersNetworkReachable ( ) { final Set < NetworkReachabilityListener > copy = new HashSet < > ( listeners ) ; for ( NetworkReachabilityListener listener : copy ) { if ( listener != null ) { listener . networkReachable ( ) ; } } }
Notify listeners that the network is now reachable
120,695
void notifyListenersNetworkUneachable ( ) { final Set < NetworkReachabilityListener > copy = new HashSet < > ( listeners ) ; for ( NetworkReachabilityListener listener : copy ) { if ( listener != null ) { listener . networkUnreachable ( ) ; } } }
Notify listeners that the network is now unreachable
120,696
public Object getValue ( int index ) { synchronized ( lock ) { return getMValue ( internalArray , index ) . asNative ( internalArray ) ; } }
Gets value at the given index as an object . The object types are Blob Array Dictionary Number or String based on the underlying data type ; or nil if the value is nil .
120,697
public String getString ( int index ) { synchronized ( lock ) { final Object obj = getMValue ( internalArray , index ) . asNative ( internalArray ) ; return obj instanceof String ? ( String ) obj : null ; } }
Gets value at the given index as a String . Returns null if the value doesn t exist or its value is not a String .
120,698
public Number getNumber ( int index ) { synchronized ( lock ) { return CBLConverter . asNumber ( getMValue ( internalArray , index ) . asNative ( internalArray ) ) ; } }
Gets value at the given index as a Number . Returns null if the value doesn t exist or its value is not a Number .
120,699
public int getInt ( int index ) { synchronized ( lock ) { return CBLConverter . asInteger ( getMValue ( internalArray , index ) , internalArray ) ; } }
Gets value at the given index as an int . 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 .