idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
38,100 | @ SuppressWarnings ( "unchecked" ) public void setJsonToken ( HashMap < String , Object > jRTObject , Story storyContext ) throws Exception { threads . clear ( ) ; List < Object > jThreads = ( List < Object > ) jRTObject . get ( "threads" ) ; for ( Object jThreadTok : jThreads ) { HashMap < String , Object > jThreadObj... | look up RTObjects from paths for currentContainer within elements . |
38,101 | public Iterable < Entry < String , ProfileNode > > getDescendingOrderedNodes ( ) { if ( nodes == null ) return null ; List < Entry < String , ProfileNode > > averageStepTimes = new LinkedList < Entry < String , ProfileNode > > ( nodes . entrySet ( ) ) ; Collections . sort ( averageStepTimes , new Comparator < Entry < S... | Returns a sorted enumerable of the nodes in descending order of how long they took to run . |
38,102 | VariablePointerValue resolveVariablePointer ( VariablePointerValue varPointer ) throws Exception { int contextIndex = varPointer . getContextIndex ( ) ; if ( contextIndex == - 1 ) contextIndex = getContextIndexOfVariableNamed ( varPointer . getVariableName ( ) ) ; RTObject valueOfVariablePointedTo = getRawVariableWithN... | or the exact position of a temporary on the callstack . |
38,103 | StoryState copy ( ) { StoryState copy = new StoryState ( story ) ; copy . getOutputStream ( ) . addAll ( outputStream ) ; outputStreamDirty ( ) ; copy . currentChoices . addAll ( currentChoices ) ; if ( hasError ( ) ) { copy . currentErrors = new ArrayList < String > ( ) ; copy . currentErrors . addAll ( currentErrors ... | I wonder if there s a sensible way to enforce that .. ?? |
38,104 | void trimWhitespaceFromFunctionEnd ( ) { assert ( callStack . getCurrentElement ( ) . type == PushPopType . Function ) ; int functionStartPoint = callStack . getCurrentElement ( ) . functionStartInOuputStream ; if ( functionStartPoint == - 1 ) { functionStartPoint = 0 ; } for ( int i = outputStream . size ( ) - 1 ; i >... | whitespace is trimmed in one go here when we pop the function . |
38,105 | public HashMap < String , Object > getJsonToken ( ) throws Exception { HashMap < String , Object > obj = new HashMap < String , Object > ( ) ; HashMap < String , Object > choiceThreads = null ; for ( Choice c : currentChoices ) { c . originalThreadIndex = c . getThreadAtGeneration ( ) . threadIndex ; if ( callStack . g... | Object representation of full JSON state . Usually you should use LoadJson and ToJson since they serialise directly to String for you . But it may be useful to get the object representation so that you can integrate it into your own serialisation system . |
38,106 | void pushToOutputStream ( RTObject obj ) { StringValue text = obj instanceof StringValue ? ( StringValue ) obj : null ; if ( text != null ) { List < StringValue > listText = trySplittingHeadTailWhitespace ( text ) ; if ( listText != null ) { for ( StringValue textObj : listText ) { pushToOutputStreamIndividual ( textOb... | in dealing with them later . |
38,107 | void removeExistingGlue ( ) { for ( int i = outputStream . size ( ) - 1 ; i >= 0 ; i -- ) { RTObject c = outputStream . get ( i ) ; if ( c instanceof Glue ) { outputStream . remove ( i ) ; } else if ( c instanceof ControlCommand ) { break ; } } outputStreamDirty ( ) ; } | Only called when non - whitespace is appended |
38,108 | List < StringValue > trySplittingHeadTailWhitespace ( StringValue single ) { String str = single . value ; int headFirstNewlineIdx = - 1 ; int headLastNewlineIdx = - 1 ; for ( int i = 0 ; i < str . length ( ) ; ++ i ) { char c = str . charAt ( i ) ; if ( c == '\n' ) { if ( headFirstNewlineIdx == - 1 ) headFirstNewlineI... | - A newline on its own is returned in an list for consistency . |
38,109 | public String report ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( String . format ( "%d CONTINUES / LINES:\n" , numContinues ) ) ; sb . append ( String . format ( "TOTAL TIME: %s\n" , formatMillisecs ( continueTotal ) ) ) ; sb . append ( String . format ( "SNAPSHOTTING: %s\n" , formatMillisecs ( snapT... | Generate a printable report based on the data recording during profiling . |
38,110 | public String megalog ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "Step type\tDescription\tPath\tTime\n" ) ; for ( StepDetails step : stepDetails ) { sb . append ( step . type ) ; sb . append ( "\t" ) ; sb . append ( step . obj . toString ( ) ) ; sb . append ( "\t" ) ; sb . append ( step . obj . getP... | Create a large log of all the internal instructions that were evaluated while profiling was active . Log is in a tab - separated format for easy loading into a spreadsheet application . |
38,111 | public void awaitNanos ( final long timeout ) throws InterruptedException { long remaining = timeout ; queueLock . lock ( ) ; try { while ( test ( ) && remaining > 0 ) { remaining = condition . awaitNanos ( remaining ) ; } } finally { queueLock . unlock ( ) ; } } | wake me when the condition is satisfied or timeout |
38,112 | public void await ( ) throws InterruptedException { queueLock . lock ( ) ; try { while ( test ( ) ) { condition . await ( ) ; } } finally { queueLock . unlock ( ) ; } } | wake if signal is called or wait indefinitely |
38,113 | public boolean push ( final N n ) { if ( stackTop < size ) { stack [ ( stackTop ++ ) & mask ] = n ; return true ; } return false ; } | add an element to the stack |
38,114 | public void clear ( ) { for ( int i = 1 ; i <= 2 * m + 3 ; i ++ ) { n [ i ] = i + 1 ; } f [ 1 ] = 0F ; f [ 2 * m + 3 ] = 1F ; for ( int i = 1 ; i <= m ; i ++ ) { f [ 2 * i + 1 ] = quantiles [ i - 1 ] ; } for ( int i = 1 ; i <= m + 1 ; i ++ ) { f [ 2 * i ] = ( f [ 2 * i - 1 ] + f [ 2 * i + 1 ] ) / 2F ; } for ( int i = 1... | clear existing samples |
38,115 | public void add ( final float x ) { if ( isInitializing ) { q [ ni ++ ] = x ; if ( ni == 2 * m + 3 + 1 ) { Arrays . sort ( q ) ; isInitializing = false ; } } else { addMeasurement ( x ) ; } } | Add a measurement to estimate |
38,116 | public float [ ] getEstimates ( ) throws InsufficientSamplesException { if ( ! isInitializing ) { for ( int i = 1 ; i <= m ; i ++ ) { e [ i - 1 ] = q [ 2 * i + 1 ] ; } return e ; } else { throw new InsufficientSamplesException ( ) ; } } | get the estimates based on the last sample |
38,117 | public static void print ( final PrintStream out , final String name , final Percentile p ) { if ( p . isReady ( ) ) { try { final StringBuilder sb = new StringBuilder ( 512 ) ; final float [ ] q = p . getQuantiles ( ) ; final float [ ] e = p . getEstimates ( ) ; final int SCREENWIDTH = 80 ; sb . append ( name ) ; sb .... | print a nice histogram of percentiles |
38,118 | public final boolean push ( final N n ) { int spin = 0 ; for ( ; ; ) { final long writeLock = seqLock . tryWriteLock ( ) ; if ( writeLock > 0L ) { try { final int stackTop = this . stackTop . get ( ) ; if ( size > stackTop ) { try { stack . set ( stackTop , n ) ; stackNotEmptyCondition . signal ( ) ; return true ; } fi... | add an element to the stack failing if the stack is unable to grow |
38,119 | public final N peek ( ) { int spin = 0 ; for ( ; ; ) { final long readLock = seqLock . readLock ( ) ; final int stackTop = this . stackTop . get ( ) ; if ( stackTop > 0 ) { final N n = stack . get ( stackTop - 1 ) ; if ( seqLock . readLockHeld ( readLock ) ) { return n ; } } else { return null ; } spin = Condition . pr... | peek at the top of the stack |
38,120 | public final void clear ( ) { int spin = 0 ; for ( ; ; ) { final long writeLock = seqLock . tryWriteLock ( ) ; if ( writeLock > 0L ) { final int stackTop = this . stackTop . get ( ) ; if ( stackTop > 0 ) { try { for ( int i = 0 ; i < stackTop ; i ++ ) { stack . set ( i , null ) ; } stackNotFullCondition . signal ( ) ; ... | clear the stack - does not null old references |
38,121 | public static int getCapacity ( int capacity ) { int c = 1 ; if ( capacity >= MAX_POWER2 ) { c = MAX_POWER2 ; } else { while ( c < capacity ) c <<= 1 ; } if ( isPowerOf2 ( c ) ) { return c ; } else { throw new RuntimeException ( "Capacity is not a power of 2." ) ; } } | return the next power of two after |
38,122 | public static Class < ? > getPrimitiveType ( Class < ? > wrapperType ) { if ( Boolean . class . equals ( wrapperType ) ) { return Boolean . TYPE ; } else if ( Byte . class . equals ( wrapperType ) ) { return Byte . TYPE ; } else if ( Character . class . equals ( wrapperType ) ) { return Character . TYPE ; } else if ( S... | Returns the corresponding primitive type for the given primitive wrapper or null if the type is not a primitive wrapper . |
38,123 | private static String getEncodingName ( final InputStream is , final byte [ ] start , final int count ) { final int b0 = start [ 0 ] & 0xFF ; final int b1 = start [ 1 ] & 0xFF ; final int b2 = start [ 2 ] & 0xFF ; if ( count > 1 ) { if ( b0 == 0xFE && b1 == 0xFF ) return "UTF-16BE" ; if ( b0 == 0xFF && b1 == 0xFE ) ret... | the detection is done equally to the one in xerces parser |
38,124 | private int restart ( final boolean basic , final Destination dst , final int eraseCode , final int channel ) throws KNXTimeoutException , KNXRemoteException , KNXLinkClosedException , KNXDisconnectException , InterruptedException { int time = 0 ; if ( basic ) { send ( dst , priority , DataUnitBuilder . createLengthOpt... | for erase codes 1 3 4 the channel should be 0 |
38,125 | List < byte [ ] > readProperty2 ( final Destination dst , final int objIndex , final int propertyId , final int start , final int elements ) throws KNXTimeoutException , KNXRemoteException , KNXDisconnectException , KNXLinkClosedException , InterruptedException { return readProperty ( dst , objIndex , propertyId , star... | as readProperty but collects all responses until response timeout is reached |
38,126 | private void send ( final Destination d , final Priority p , final byte [ ] apdu , final int response ) throws KNXTimeoutException , KNXDisconnectException , KNXLinkClosedException { svcResponse = response ; if ( d . isConnectionOriented ( ) ) { tl . connect ( d ) ; tl . sendData ( d , p , apdu ) ; } else tl . sendData... | helper which sets the expected svc response and sends in CO or CL mode |
38,127 | private static byte [ ] extractPropertyElements ( final byte [ ] apdu , final int objIndex , final int propertyId , final int elements ) throws KNXRemoteException { final int oi = apdu [ 2 ] & 0xff ; final int pid = apdu [ 3 ] & 0xff ; if ( oi != objIndex || pid != propertyId ) throw new KNXInvalidResponseException ( S... | returns property read . res element values |
38,128 | private static Collection < ? extends KNXAddress > ensureDeviceAck ( final KNXMediumSettings settings , final Collection < ? extends KNXAddress > acknowledge ) { if ( settings . getMedium ( ) != KNXMediumSettings . MEDIUM_TP1 ) throw new KNXIllegalArgumentException ( "TP-UART link supports only TP1 medium" ) ; final In... | if possible add this link to the list of addresses to acknowledge |
38,129 | public void setProperty ( final int objectType , final int objectInstance , final int propertyId , final int start , final int elements , final byte ... data ) throws KNXTimeoutException , KNXRemoteException , KNXPortClosedException , InterruptedException { final CEMIDevMgmt req = new CEMIDevMgmt ( CEMIDevMgmt . MC_PRO... | Sets property value elements of an interface object property . |
38,130 | public byte [ ] getProperty ( final int objectType , final int objectInstance , final int propertyId , final int start , final int elements ) throws KNXTimeoutException , KNXRemoteException , KNXPortClosedException , InterruptedException { final CEMIDevMgmt req = new CEMIDevMgmt ( CEMIDevMgmt . MC_PROPREAD_REQ , object... | Gets property value elements of an interface object property . |
38,131 | private Optional < InetAddress > onSameSubnet ( final InetAddress remote ) { try { return Collections . list ( NetworkInterface . getNetworkInterfaces ( ) ) . stream ( ) . flatMap ( ni -> ni . getInterfaceAddresses ( ) . stream ( ) ) . filter ( ia -> ia . getAddress ( ) instanceof Inet4Address ) . peek ( ia -> logger .... | finds a local IPv4 address with its network prefix matching the remote address |
38,132 | private Destination getOrCreateDestination ( final IndividualAddress device , final boolean keepAlive , final boolean verifyByServer ) { final Destination d = ( ( TransportLayerImpl ) tl ) . getDestination ( device ) ; return d != null ? d : tl . createDestination ( device , true , keepAlive , verifyByServer ) ; } | work around for implementation in TL which unconditionally throws if dst exists |
38,133 | public void activateBusmonitor ( ) throws IOException { logger . debug ( "activate TP-UART busmonitor" ) ; os . write ( ActivateBusmon ) ; busmonSequence = 0 ; busmon = true ; } | Activate busmonitor mode the TP - UART controller is set completely passive . |
38,134 | private static byte [ ] cEmiToTP1 ( final byte [ ] frame ) { final int stdMaxApdu = 15 ; final int cEmiPrefix = 10 ; final boolean std = frame . length <= cEmiPrefix + stdMaxApdu ; final byte [ ] tp1 ; if ( std ) { tp1 = new byte [ frame . length - 2 ] ; int i = 0 ; tp1 [ i ++ ] = ( byte ) ( ( frame [ 2 ] & 0xfc ) | St... | returns a TP1 std or ext frame |
38,135 | public static HidReport createFeatureService ( final BusAccessServerService service , final BusAccessServerFeature feature , final byte [ ] frame ) { return new HidReport ( service , feature , frame ) ; } | Creates a new report for use with the Bus Access Server feature service . |
38,136 | public static List < HidReport > create ( final KnxTunnelEmi emi , final byte [ ] frame ) { final List < HidReport > l = new ArrayList < > ( ) ; final EnumSet < PacketType > packetType = EnumSet . of ( PacketType . Start ) ; int maxData = maxDataStartPacket ; if ( frame . length > maxData ) packetType . add ( PacketTyp... | Creates a new report containing an EMI frame . |
38,137 | private byte [ ] unifyLData ( final CEMI ldata , final boolean emptySrc , final List < Integer > types ) { final byte [ ] data ; if ( ldata instanceof CEMILDataEx ) { final CEMILDataEx ext = ( ( CEMILDataEx ) ldata ) ; final List < AddInfo > additionalInfo = ext . additionalInfo ( ) ; synchronized ( additionalInfo ) { ... | additional info . types provides the list of add . info types we want to keep everything else is removed |
38,138 | public static LibraryAdapter open ( final Logger logger , final String portId , final int baudrate , final int idleTimeout ) throws KNXException { Throwable t = null ; if ( CommConnectionAdapter . isAvailable ( ) ) { logger . debug ( "open Java ME serial port connection (CommConnection) for {}" , portId ) ; try { retur... | Factory method to open a serial connection using one of the available library adapters . |
38,139 | private void setRepeat ( final boolean repeat ) { final boolean flag = mc == MC_LDATA_IND ? ! repeat : repeat ; if ( flag ) ctrl1 |= 0x20 ; else ctrl1 &= 0xDF ; } | Sets the repeat flag in control field using the message code type for decision . |
38,140 | 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 . |
38,141 | 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 . |
38,142 | 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 . |
38,143 | 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 . |
38,144 | 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 . |
38,145 | 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 . |
38,146 | 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 |
38,147 | 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 . |
38,148 | 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 . |
38,149 | 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 . |
38,150 | 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 . |
38,151 | 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 . |
38,152 | 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 . |
38,153 | 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 . |
38,154 | 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 . |
38,155 | 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 . |
38,156 | 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 . |
38,157 | 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 . |
38,158 | 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 . |
38,159 | 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 . |
38,160 | 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 . |
38,161 | 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 ... |
38,162 | static String replace ( final String text , final boolean toReference ) { return toReference ? replaceWithRef ( text ) : replaceFromRef ( text ) ; } | wrapper for reference replacement |
38,163 | 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 |
38,164 | 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 |
38,165 | 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 . |
38,166 | @ 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 . |
38,167 | 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 . |
38,168 | 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 . |
38,169 | 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 . |
38,170 | 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 . |
38,171 | 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 . |
38,172 | 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 . |
38,173 | 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 . |
38,174 | 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 |
38,175 | 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 . |
38,176 | 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 . |
38,177 | 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 |
38,178 | 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 . |
38,179 | 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 . |
38,180 | 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 . |
38,181 | 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 . |
38,182 | 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 . |
38,183 | 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 |
38,184 | 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 . |
38,185 | 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 . |
38,186 | 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 . |
38,187 | 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 . |
38,188 | 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 . |
38,189 | public MutableArray setString ( int index , String value ) { return setValue ( index , value ) ; } | Sets an String object at the given index . |
38,190 | public MutableArray setNumber ( int index , Number value ) { return setValue ( index , value ) ; } | Sets an NSNumber object at the given index . |
38,191 | public MutableArray setBlob ( int index , Blob value ) { return setValue ( index , value ) ; } | Sets a Blob object at the given index . |
38,192 | public MutableArray setDate ( int index , Date value ) { return setValue ( index , value ) ; } | Sets a Date object at the given index . |
38,193 | public MutableArray setArray ( int index , Array value ) { return setValue ( index , value ) ; } | Sets a Array object at the given index . |
38,194 | public MutableArray setDictionary ( int index , Dictionary value ) { return setValue ( index , value ) ; } | Sets a Dictionary object at the given index . |
38,195 | public MutableArray addValue ( Object value ) { synchronized ( lock ) { internalArray . append ( Fleece . toCBLObject ( value ) ) ; return this ; } } | Adds an object to the end of the array . |
38,196 | 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 . |
38,197 | public MutableArray insertString ( int index , String value ) { return insertValue ( index , value ) ; } | Inserts a String object at the given index . |
38,198 | public MutableArray insertNumber ( int index , Number value ) { return insertValue ( index , value ) ; } | Inserts a Number object at the given index . |
38,199 | public MutableArray insertBlob ( int index , Blob value ) { return insertValue ( index , value ) ; } | Inserts a Blob object at the given index . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.