idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
14,600 | public void exclusiveOr ( Area area ) { Area a = clone ( ) ; a . intersect ( area ) ; add ( area ) ; subtract ( a ) ; } | Computes the exclusive or of this area and the supplied area and sets this area to the result . |
14,601 | private static double [ ] adjustSize ( double [ ] array , int newSize ) { if ( newSize <= array . length ) { return array ; } double [ ] newArray = new double [ 2 * newSize ] ; System . arraycopy ( array , 0 , newArray , 0 , array . length ) ; return newArray ; } | the method check up the array size and necessarily increases it . |
14,602 | @ Path ( "/ipAddrInfo" ) public String getIPAddrInfo ( ) throws UnknownHostException { Properties clientProps = getPropeSenderProps ( ) ; StringBuffer buf = new StringBuffer ( ) ; InetAddress localhost = null ; NetworkInterface ni = null ; try { localhost = InetAddress . getLocalHost ( ) ; LOGGER . debug ( "Network Int... | Return the ip info of where the web host lives that supports the browser app . |
14,603 | @ Path ( "/launchProbe" ) @ Produces ( "application/txt" ) public String launchProbe ( ) throws IOException , UnsupportedPayloadType , ProbeSenderException , TransportException { Properties clientProps = getPropeSenderProps ( ) ; String multicastGroupAddr = clientProps . getProperty ( "multicastGroupAddr" , DEFAULT_MUL... | Actually launch a probe . |
14,604 | @ Path ( "/responses" ) @ Produces ( "application/json" ) public String getResponses ( ) throws UnknownHostException { Properties clientProps = getPropeSenderProps ( ) ; String listenerIPAddress = clientProps . getProperty ( "listenerIPAddress" ) ; String listenerPort = clientProps . getProperty ( "listenerPort" ) ; St... | Returns a list of the responses collected in the listener . |
14,605 | @ Path ( "/clearCache" ) @ Produces ( "application/json" ) public String clearCache ( ) throws UnknownHostException { Properties clientProps = getPropeSenderProps ( ) ; String listenerIPAddress = clientProps . getProperty ( "listenerIPAddress" ) ; String listenerPort = clientProps . getProperty ( "listenerPort" ) ; Str... | Clears the active response cache . |
14,606 | public double distance ( Vector3 point ) { double distance = - Float . MAX_VALUE ; for ( Plane plane : _planes ) { distance = Math . max ( distance , plane . distance ( point ) ) ; } return distance ; } | Determines the maximum signed distance of the point from the planes of the frustum . If the distance is less than or equal to zero the point lies inside the frustum . |
14,607 | public static Class < ? extends Command < ? extends CLIContext > > getCommandClass ( CLIContext context , String commandName ) { return context . getHostApplication ( ) . getCommands ( ) . get ( commandName . toLowerCase ( ) ) ; } | Get a command by name . |
14,608 | public static < T > DecomposableMatchBuilder0 < List < T > > nil ( ) { List < Matcher < Object > > matchers = Lists . of ( ) ; return new DecomposableMatchBuilder0 < List < T > > ( matchers , new ListConsNilFieldExtractor < > ( ) ) ; } | Matches an empty list . |
14,609 | public static void print ( ConsoleLevel level , String message ) { if ( level . compareTo ( _level ) <= 0 ) { if ( _printLogLevel ) { level . getStream ( ) . println ( level . name ( ) + ": " + message ) ; } else { level . getStream ( ) . println ( message ) ; } level . getStream ( ) . flush ( ) ; } } | Print the given message at the given level . |
14,610 | public R getMatch ( ) { for ( Pattern < T , R > pattern : patterns ) { if ( pattern . matches ( value ) ) { return pattern . apply ( value ) ; } } throw new MatchException ( "No match found for " + value ) ; } | Runs through the possible matches and executes the specified action of the first match and returns the result . |
14,611 | public void seedUsingPcmAudio ( byte [ ] data ) { byte [ ] key = new byte [ 64 ] ; for ( int i = 0 ; i < key . length ; i ++ ) { int x = 0 ; for ( int j = 0 ; j < 4 ; j ++ ) { x = ( x << 2 ) | ( 3 & data [ RandomSource . getInt ( data . length ) ] ) ; } key [ i ] = ( byte ) x ; } seed ( key ) ; initialized = true ; } | Seed the random generator with 2 least significant bits of randomly picked bytes within the provided PCM audio data |
14,612 | public int getInt ( ) { try { byte [ ] rand = fipsGenerator . getBytes ( 4 ) ; int result = rand [ 0 ] ; for ( int i = 1 ; i < 4 ; i ++ ) { result = ( result << 8 ) | rand [ i ] ; } return result ; } catch ( Throwable ex ) { BBPlatform . getPlatform ( ) . getLogger ( ) . logException ( "RandomGenerator.getInt() Falling... | Returns a random integer |
14,613 | public void getBytes ( byte [ ] buffer ) { try { fipsGenerator . getBytes ( buffer ) ; } catch ( Throwable ex ) { BBPlatform . getPlatform ( ) . getLogger ( ) . logException ( "RandomGenerator.getBytes() Falling back to RandomSource... " + ex . getMessage ( ) ) ; RandomSource . getBytes ( buffer ) ; } } | Generates random bytes filling the given buffer entirely |
14,614 | protected void checkBuf ( int pointCount , boolean checkMove ) { if ( checkMove && typeSize == 0 ) { throw new IllegalPathStateException ( "First segment must be a SEG_MOVETO" ) ; } if ( typeSize == types . length ) { byte [ ] tmp = new byte [ typeSize + BUFFER_CAPACITY ] ; System . arraycopy ( types , 0 , tmp , 0 , ty... | Checks points and types buffer size to add pointCount points . If necessary realloc buffers to enlarge size . |
14,615 | protected boolean isInside ( int cross ) { return ( rule == WIND_NON_ZERO ) ? Crossing . isInsideNonZero ( cross ) : Crossing . isInsideEvenOdd ( cross ) ; } | Checks cross count according to path rule to define is it point inside shape or not . |
14,616 | public static void subQuad ( double [ ] coef , double t0 , boolean left ) { if ( left ) { coef [ 2 ] = ( 1 - t0 ) * coef [ 0 ] + t0 * coef [ 2 ] ; coef [ 3 ] = ( 1 - t0 ) * coef [ 1 ] + t0 * coef [ 3 ] ; } else { coef [ 2 ] = ( 1 - t0 ) * coef [ 2 ] + t0 * coef [ 4 ] ; coef [ 3 ] = ( 1 - t0 ) * coef [ 3 ] + t0 * coef [... | t0 - ? |
14,617 | private boolean sendResponse ( String respondToURL , String payloadType , ResponseWrapper payload ) { String responseStr = null ; String contentType = null ; boolean success = true ; switch ( payloadType ) { case "XML" : { responseStr = payload . toXML ( ) ; contentType = "application/xml" ; break ; } case "JSON" : { r... | If the probe yields responses from the handler then send this method will send the responses to the given respondTo addresses . |
14,618 | public void run ( ) { ResponseWrapper response = null ; LOGGER . info ( "Received probe id: " + probe . getProbeId ( ) ) ; if ( ! isProbeHandled ( probe . getProbeId ( ) ) ) { if ( this . noBrowser && probe . isNaked ( ) ) { LOGGER . warn ( "Responder set to noBrowser mode. Discarding naked probe with id [" + probe . g... | Handle the probe . |
14,619 | protected static int fixRoots ( float [ ] res , int rc ) { int tc = 0 ; for ( int i = 0 ; i < rc ; i ++ ) { out : { for ( int j = i + 1 ; j < rc ; j ++ ) { if ( isZero ( res [ i ] - res [ j ] ) ) { break out ; } } res [ tc ++ ] = res [ i ] ; } } return tc ; } | Excludes double roots . Roots are double if they lies enough close with each other . |
14,620 | public static int intersectQuad ( float x1 , float y1 , float cx , float cy , float x2 , float y2 , float rx1 , float ry1 , float rx2 , float ry2 ) { if ( ( rx2 < x1 && rx2 < cx && rx2 < x2 ) || ( rx1 > x1 && rx1 > cx && rx1 > x2 ) || ( ry1 > y1 && ry1 > cy && ry1 > y2 ) ) { return 0 ; } if ( ry2 < y1 && ry2 < cy && ry... | Returns how many times rectangle stripe cross quad curve or the are intersect |
14,621 | public static int intersectPath ( PathIterator p , float x , float y , float w , float h ) { int cross = 0 ; int count ; float mx , my , cx , cy ; mx = my = cx = cy = 0f ; float [ ] coords = new float [ 6 ] ; float rx1 = x ; float ry1 = y ; float rx2 = x + w ; float ry2 = y + h ; while ( ! p . isDone ( ) ) { count = 0 ... | Returns how many times rectangle stripe cross path or the are intersect |
14,622 | public static int intersectShape ( IShape s , float x , float y , float w , float h ) { if ( ! s . bounds ( ) . intersects ( x , y , w , h ) ) { return 0 ; } return intersectPath ( s . pathIterator ( null ) , x , y , w , h ) ; } | Returns how many times rectangle stripe cross shape or the are intersect |
14,623 | public boolean isExpired ( ) { if ( _service . getTtl ( ) == 0 ) { return false ; } long t = this . cacheStartTime . getTime ( ) ; Date validTime = new Date ( t + ( _service . getTtl ( ) * ONE_MINUTE_IN_MILLIS ) ) ; Date now = new Date ( ) ; return ( now . getTime ( ) > validTime . getTime ( ) ) ; } | Determine if the service record is expired . The service record include a TTL that tells the client how many minutes the client can count on the information in the service record . If the cache times out then those service records that have expired should be expunged from the cache . |
14,624 | public Matrix4 setToTransform ( IVector3 translation , IQuaternion rotation ) { return setToRotation ( rotation ) . setTranslation ( translation ) ; } | Sets this to a matrix that first rotates then translates . |
14,625 | public Matrix4 setToTranslation ( IVector3 translation ) { return setToTranslation ( translation . x ( ) , translation . y ( ) , translation . z ( ) ) ; } | Sets this to a translation matrix . |
14,626 | public Matrix4 setToRotationScale ( IMatrix3 rotScale ) { return set ( rotScale . m00 ( ) , rotScale . m01 ( ) , rotScale . m02 ( ) , 0f , rotScale . m10 ( ) , rotScale . m11 ( ) , rotScale . m12 ( ) , 0f , rotScale . m20 ( ) , rotScale . m21 ( ) , rotScale . m22 ( ) , 0f , 0 , 0 , 0 , 1 ) ; } | Sets this to a rotation plus scale matrix . |
14,627 | public Matrix4 setToPerspective ( double fovy , double aspect , double near , double far ) { double f = 1f / Math . tan ( fovy / 2f ) , dscale = 1f / ( near - far ) ; return set ( f / aspect , 0f , 0f , 0f , 0f , f , 0f , 0f , 0f , 0f , ( far + near ) * dscale , 2f * far * near * dscale , 0f , 0f , - 1f , 0f ) ; } | Sets this to a perspective projection matrix . The formula comes from the OpenGL documentation for the gluPerspective function . |
14,628 | public Matrix4 setToFrustum ( double left , double right , double bottom , double top , double near , double far ) { return setToFrustum ( left , right , bottom , top , near , far , Vector3 . UNIT_Z ) ; } | Sets this to a perspective projection matrix . The formula comes from the OpenGL documentation for the glFrustum function . |
14,629 | public Matrix4 setToFrustum ( double left , double right , double bottom , double top , double near , double far , IVector3 nearFarNormal ) { double rrl = 1f / ( right - left ) ; double rtb = 1f / ( top - bottom ) ; double rnf = 1f / ( near - far ) ; double n2 = 2f * near ; double s = ( far + near ) / ( near * nearFarN... | Sets this to a perspective projection matrix . |
14,630 | public Matrix4 setToOrtho ( double left , double right , double bottom , double top , double near , double far , IVector3 nearFarNormal ) { double rlr = 1f / ( left - right ) ; double rbt = 1f / ( bottom - top ) ; double rnf = 1f / ( near - far ) ; double s = 2f / ( near * nearFarNormal . z ( ) - far * nearFarNormal . ... | Sets this to an orthographic projection matrix . |
14,631 | public static int distanceSq ( int x1 , int y1 , int x2 , int y2 ) { x2 -= x1 ; y2 -= y1 ; return x2 * x2 + y2 * y2 ; } | Returns the squared Euclidian distance between the specified two points . |
14,632 | public static int distance ( int x1 , int y1 , int x2 , int y2 ) { return ( int ) Math . sqrt ( distanceSq ( x1 , y1 , x2 , y2 ) ) ; } | Returns the Euclidian distance between the specified two points truncated to the nearest integer . |
14,633 | public static int manhattanDistance ( int x1 , int y1 , int x2 , int y2 ) { return Math . abs ( x2 - x1 ) + Math . abs ( y2 - y1 ) ; } | Returns the Manhattan distance between the specified two points . |
14,634 | public static double roundNearest ( double v , double target ) { target = Math . abs ( target ) ; if ( v >= 0 ) { return target * Math . floor ( ( v + 0.5f * target ) / target ) ; } else { return target * Math . ceil ( ( v - 0.5f * target ) / target ) ; } } | Rounds a value to the nearest multiple of a target . |
14,635 | public List < Probe > sendProbe ( Probe probe ) throws ProbeSenderException { List < Probe > actualProbesToSend ; try { actualProbesToSend = splitProbe ( probe ) ; } catch ( MalformedURLException | JAXBException | UnsupportedPayloadType e ) { throw new ProbeSenderException ( "Issue splitting the probe." , e ) ; } for (... | Send the probe . It will take the provided probe and then disassemble it into a number of smaller probes based on the max payload size of the transport provided . |
14,636 | private List < Probe > splitProbe ( Probe probe ) throws ProbeSenderException , JAXBException , MalformedURLException , UnsupportedPayloadType { List < Probe > actualProbeList = new ArrayList < Probe > ( ) ; int maxPayloadSize = this . probeTransport . maxPayloadSize ( ) ; LinkedList < ProbeIdEntry > combinedList = pro... | This method will take the given probe to send and then chop it up into smaller probes that will fit under the maximum packet size specified by the transport . This is important because Argo wants the UDP packets to not get chopped up by the network routers of at all possible . This makes the overall reliability of the ... |
14,637 | public String getDescription ( ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( "ProbeSender for " ) ; buf . append ( probeTransport . toString ( ) ) ; return buf . toString ( ) ; } | Return the description of the ProbeSender . |
14,638 | public byte [ ] getMyZid ( ) { ZrtpCacheEntry ce = cache . get ( LOCAL_ZID_KEY ) ; if ( ce != null ) { return ce . getData ( ) ; } else { byte [ ] zid = new byte [ 12 ] ; platform . getCrypto ( ) . getRandomGenerator ( ) . getBytes ( zid ) ; cache . put ( LOCAL_ZID_KEY , zid , null ) ; platform . getLogger ( ) . log ( ... | Retrieves this clients cached ZID . If there s no cached ZID i . e . on first run a random ZID is created and stored . |
14,639 | public void selectEntry ( byte [ ] remoteZID ) { platform . getLogger ( ) . log ( "ZRTPCache: selectEntry(" + platform . getUtils ( ) . byteToHexString ( remoteZID ) + ")" ) ; String zidString = new String ( remoteZID ) ; if ( currentZid != null && currentZid . equals ( zidString ) ) { return ; } currentZid = null ; cu... | Selects a cache entry base on remote ZID |
14,640 | public void updateEntry ( long expiryTime , boolean trust , byte [ ] retainedSecret , byte [ ] rs2 , String number ) { if ( platform . isVerboseLogging ( ) ) { platform . getLogger ( ) . log ( "ZRTPCache: updateEntry(" + expiryTime + ", " + trust + ", " + platform . getUtils ( ) . byteToHexString ( retainedSecret ) + "... | Updates the entry for the selected remote ZID . |
14,641 | public List < String > descriptionsForResponseIDs ( List < String > _ids , boolean payload , boolean pretty ) { List < String > descriptions = new ArrayList < String > ( ) ; for ( ServiceWrapper s : _cache ) { if ( _ids . isEmpty ( ) || _responseIds . contains ( s . getResponseId ( ) ) ) { StringBuffer buf = serviceDes... | Return the list of description strings for a list of response ids . |
14,642 | public List < String > descriptionsForProbeIDs ( List < String > _ids , boolean payload , boolean pretty ) { List < String > descriptions = new ArrayList < String > ( ) ; for ( ServiceWrapper s : _cache ) { if ( _ids . isEmpty ( ) || _probeIds . contains ( s . getProbeId ( ) ) ) { StringBuffer buf = serviceDesciption (... | Return the list of description strings for a list of probe ids . |
14,643 | public String asJSON ( boolean pretty ) { JSONSerializer ser = new JSONSerializer ( ) ; Gson gson = new Gson ( ) ; Gson prettyJson = new GsonBuilder ( ) . setPrettyPrinting ( ) . create ( ) ; JsonArray cacheArray = new JsonArray ( ) ; String cacheAsString ; for ( ServiceWrapper s : _cache ) { String json = ser . marsha... | Return the cache as JSON . |
14,644 | public void sendProbe ( Probe probe ) throws TransportException { LOGGER . info ( "Sending probe [" + probe . getProbeID ( ) + "] on network inteface [" + networkInterface . getName ( ) + "] at port [" + multicastAddress + ":" + multicastPort + "]" ) ; LOGGER . debug ( "Probe requesting TTL of [" + probe . getHopLimit ... | Actually send the probe out on the wire . |
14,645 | public ResponseWrapper unmarshal ( String payload ) throws ResponseParseException { Services xmlServices = parseResponsePayload ( payload ) ; ResponseWrapper response = constructResponseWrapperFromResponse ( xmlServices ) ; return response ; } | Translate the wireline string into an instance of a ResponseWrapper object . |
14,646 | public ServiceWrapper unmarshalService ( String payload ) throws ResponseParseException { Service xmlService = parseServicePayload ( payload ) ; ServiceWrapper service = constructServiceWrapperFromService ( xmlService ) ; return service ; } | Translate the wireline string to an instance of a ServiceWrapper object . |
14,647 | public < T > T get ( String key , T defaultValue ) { if ( map . containsKey ( key ) ) { Object value = map . get ( key ) ; return ( T ) ( value instanceof byte [ ] ? unmarshall ( ( byte [ ] ) value ) : value ) ; } return defaultValue ; } | Returns the value of the mapping with the specified key or the given default value . |
14,648 | public void setRespondToPayloadType ( String respondToPayloadType ) throws UnsupportedPayloadType { if ( respondToPayloadType == null || respondToPayloadType . isEmpty ( ) || ( ! respondToPayloadType . equals ( ProbeWrapper . JSON ) && ! respondToPayloadType . equals ( ProbeWrapper . XML ) ) ) throw new UnsupportedPayl... | set the payload type for the response from the Responder . It only support XML and JSON . |
14,649 | public LinkedList < ProbeIdEntry > getCombinedIdentifierList ( ) { LinkedList < ProbeIdEntry > combinedList = new LinkedList < ProbeIdEntry > ( ) ; for ( String id : this . getProbeWrapper ( ) . getServiceContractIDs ( ) ) { combinedList . add ( new ProbeIdEntry ( "scid" , id ) ) ; } for ( String id : this . getProbeWr... | Create and return a LinkedList of a combination of both scids and siids . This is a method that is used primarily in the creation of split packets . |
14,650 | public static boolean checkClientId ( boolean isLegacyAttributeList , String farEndClientID ) { if ( ZRTP . CLIENT_ID_LEGACY . equals ( farEndClientID ) ) return true ; if ( ZRTP . CLIENT_ID_RFC . equals ( farEndClientID ) ) return false ; boolean isPrintable = true ; for ( int i = 0 ; i < farEndClientID . length ( ) ;... | Legacy Client send ZRTP . CLIENT_ID_LEGACY or a non - printable ClientId |
14,651 | public static float pointRectDistanceSq ( IRectangle r , IPoint p ) { Point p2 = closestInteriorPoint ( r , p ) ; return Points . distanceSq ( p . x ( ) , p . y ( ) , p2 . x , p2 . y ) ; } | Returns the squared Euclidean distance between the given point and the nearest point inside the bounds of the given rectangle . If the supplied point is inside the rectangle the distance will be zero . |
14,652 | public void cacheAll ( ArrayList < ExpiringService > list ) { for ( ExpiringService service : list ) { cache . put ( service . getService ( ) . getId ( ) , service ) ; } } | Put a list of services in the cache . |
14,653 | public String asJSON ( ) { Gson gson = new Gson ( ) ; clearExpired ( ) ; Cache jsonCache = new Cache ( ) ; for ( ExpiringService svc : cache . values ( ) ) { jsonCache . cache . add ( svc . getService ( ) ) ; } String json = gson . toJson ( jsonCache ) ; return json ; } | Return the JSON string of the response cache . Leverage the Gson nature of the domain wireline classes |
14,654 | public void addRespondToURL ( String label , String url ) { RespondToURL respondToURL = new RespondToURL ( ) ; respondToURL . label = label ; respondToURL . url = url ; respondToURLs . add ( respondToURL ) ; } | Add a response URL to the probe . |
14,655 | public String asString ( ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( " PID: [ " ) . append ( this . id ) . append ( " ]" ) ; ; buf . append ( " CID: [ " ) . append ( this . clientId ) . append ( " ]" ) ; ; buf . append ( " DES: [ " ) . append ( this . desVersion ) . append ( " ]" ) ; ; buf . append ( "... | This will return the single - line textual representation . This was crafted for the command line client . Your mileage may vary . |
14,656 | public void setFrame ( XY loc , IDimension size ) { setFrame ( loc . x ( ) , loc . y ( ) , size . width ( ) , size . height ( ) ) ; } | Sets the location and size of the framing rectangle of this shape to the supplied values . |
14,657 | public void setFrame ( IRectangle r ) { setFrame ( r . x ( ) , r . y ( ) , r . width ( ) , r . height ( ) ) ; } | Sets the location and size of the framing rectangle of this shape to be equal to the supplied rectangle . |
14,658 | public void setFrameFromDiagonal ( XY p1 , XY p2 ) { setFrameFromDiagonal ( p1 . x ( ) , p1 . y ( ) , p2 . x ( ) , p2 . y ( ) ) ; } | Sets the location and size of the framing rectangle of this shape based on the supplied diagonal line . |
14,659 | public void setFrameFromCenter ( XY center , XY corner ) { setFrameFromCenter ( center . x ( ) , center . y ( ) , corner . x ( ) , corner . y ( ) ) ; } | Sets the location and size of the framing rectangle of this shape based on the supplied center and corner points . |
14,660 | public static Point inverseTransform ( double x , double y , double sx , double sy , double rotation , double tx , double ty , Point result ) { x -= tx ; y -= ty ; double sinnega = Math . sin ( - rotation ) , cosnega = Math . cos ( - rotation ) ; double nx = ( x * cosnega - y * sinnega ) ; double ny = ( x * sinnega + y... | Inverse transforms a point as specified storing the result in the point provided . |
14,661 | public void setServiceList ( ArrayList < ServiceWrapper > services ) { writeLock . lock ( ) ; try { LOGGER . info ( "Updating service list by " + Thread . currentThread ( ) . getName ( ) ) ; this . serviceList = services ; } finally { writeLock . unlock ( ) ; } } | As the Responder is multi - threaded make sure that the access to the services list which might change out if the user changes it is synchronized to make sure nothing weird happens . |
14,662 | public void initializeWithPropertiesFilename ( String filename ) throws ProbeHandlerConfigException { InputStream is ; if ( ConfigFileProbeHandlerPlugin . class . getResource ( filename ) != null ) { is = ConfigFileProbeHandlerPlugin . class . getResourceAsStream ( filename ) ; } else { try { is = new FileInputStream (... | Initialize the handler . |
14,663 | private void initializeTransports ( ArrayList < TransportConfig > transportConfigs ) { for ( TransportConfig config : transportConfigs ) { ClientProbeSenders transport = new ClientProbeSenders ( config ) ; try { transport . initialize ( this ) ; _clientSenders . add ( transport ) ; } catch ( TransportConfigException e ... | Initializes the Transports . |
14,664 | private void initializeLocalhostNI ( ) { InetAddress localhost ; try { localhost = InetAddress . getLocalHost ( ) ; NetworkInterface ni = NetworkInterface . getByInetAddress ( localhost ) ; if ( ni != null ) getNIList ( ) . add ( ni . getName ( ) ) ; } catch ( UnknownHostException | SocketException e ) { Console . seve... | Sets up the network interface list with at least the localhost NI . |
14,665 | public List < String > getAvailableNetworkInterfaces ( boolean requiresMulticast ) throws SocketException { Enumeration < NetworkInterface > nis = NetworkInterface . getNetworkInterfaces ( ) ; List < String > multicastNIs = new ArrayList < String > ( ) ; while ( nis . hasMoreElements ( ) ) { NetworkInterface ni = nis .... | This gets a list of all the available network interface names . |
14,666 | public ClientProbeSenders getClientTransportNamed ( String transportName ) { ClientProbeSenders found = null ; for ( ClientProbeSenders t : _clientSenders ) { if ( t . getName ( ) . equalsIgnoreCase ( transportName ) ) { found = t ; break ; } } return found ; } | Returns the client transport specified by given name . |
14,667 | public static < T extends Case3 < A , B , C > , A , B , C > DecomposableMatchBuilder0 < T > case3 ( Class < T > clazz , MatchesExact < A > a , MatchesExact < B > b , MatchesExact < C > c ) { List < Matcher < Object > > matchers = Lists . of ( ArgumentMatchers . eq ( a . t ) , ArgumentMatchers . eq ( b . t ) , ArgumentM... | Matches a case class of three elements . |
14,668 | public CommandResult execute ( T context ) { try { return innerExecute ( context ) ; } catch ( Exception e ) { Console . error ( e . getMessage ( ) ) ; return CommandResult . ERROR ; } } | Executes the command . The command line arguments contains all of the key - value pairs and switches but does not include the command name that came from the original arguments . |
14,669 | public long factMatching ( long n ) { return match ( n ) . when ( caseLong ( 0 ) ) . get ( ( ) -> 1L ) . when ( caseLong ( any ( ) ) ) . get ( i -> i * factMatching ( i - 1 ) ) . getMatch ( ) ; } | An implementation of factorial using motif pattern matching . |
14,670 | public static IShape createTransformedShape ( Transform t , IShape src ) { if ( src == null ) { return null ; } if ( src instanceof Path ) { return ( ( Path ) src ) . createTransformedShape ( t ) ; } PathIterator path = src . pathIterator ( t ) ; Path dst = new Path ( path . windingRule ( ) ) ; dst . append ( path , fa... | Creates and returns a new shape that is the supplied shape transformed by this transform s matrix . |
14,671 | private static void sort ( double [ ] coords1 , int length1 , double [ ] coords2 , int length2 , int [ ] array ) { int temp ; int length = length1 + length2 ; double x1 , y1 , x2 , y2 ; for ( int i = 1 ; i < length ; i ++ ) { if ( array [ i - 1 ] < length1 ) { x1 = coords1 [ 2 * array [ i - 1 ] ] ; y1 = coords1 [ 2 * a... | the array sorting |
14,672 | public void setFrameFromDiagonal ( float x1 , float y1 , float x2 , float y2 ) { float rx , ry , rw , rh ; if ( x1 < x2 ) { rx = x1 ; rw = x2 - x1 ; } else { rx = x2 ; rw = x1 - x2 ; } if ( y1 < y2 ) { ry = y1 ; rh = y2 - y1 ; } else { ry = y2 ; rh = y1 - y2 ; } setFrame ( rx , ry , rw , rh ) ; } | Sets the location and size of the framing rectangle of this shape based on the specified diagonal line . |
14,673 | public void setFrameFromCenter ( float centerX , float centerY , float cornerX , float cornerY ) { float width = Math . abs ( cornerX - centerX ) ; float height = Math . abs ( cornerY - centerY ) ; setFrame ( centerX - width , centerY - height , width * 2 , height * 2 ) ; } | Sets the location and size of the framing rectangle of this shape based on the specified center and corner points . |
14,674 | @ Path ( "/probeResponse" ) @ Consumes ( "application/json" ) public String handleJSONProbeResponse ( String probeResponseJSON ) { JSONSerializer serializer = new JSONSerializer ( ) ; ResponseWrapper response ; try { response = serializer . unmarshal ( probeResponseJSON ) ; } catch ( ResponseParseException e ) { String... | Inbound JSON responses get processed here . |
14,675 | public Circle set ( ICircle c ) { return set ( c . x ( ) , c . y ( ) , c . radius ( ) ) ; } | Sets the properties of this circle to be equal to those of the supplied circle . |
14,676 | public Circle set ( double x , double y , double radius ) { this . x = x ; this . y = y ; this . radius = radius ; return this ; } | Sets the properties of this circle to the supplied values . |
14,677 | public Matrix4 setToRotation ( float angle , float x , float y , float z ) { float c = FloatMath . cos ( angle ) , s = FloatMath . sin ( angle ) , omc = 1f - c ; float xs = x * s , ys = y * s , zs = z * s , xy = x * y , xz = x * z , yz = y * z ; return set ( x * x * omc + c , xy * omc - zs , xz * omc + ys , 0f , xy * o... | Sets this to a rotation matrix . The formula comes from the OpenGL documentation for the glRotatef function . |
14,678 | public Matrix4 setToReflection ( float x , float y , float z , float w ) { float x2 = - 2f * x , y2 = - 2f * y , z2 = - 2f * z ; float xy2 = x2 * y , xz2 = x2 * z , yz2 = y2 * z ; float x2y2z2 = x * x + y * y + z * z ; return set ( 1f + x2 * x , xy2 , xz2 , x2 * w * x2y2z2 , xy2 , 1f + y2 * y , yz2 , y2 * w * x2y2z2 , ... | Sets this to a reflection across the specified plane . |
14,679 | public Matrix4 set ( float [ ] values ) { return set ( values [ 0 ] , values [ 1 ] , values [ 2 ] , values [ 3 ] , values [ 4 ] , values [ 5 ] , values [ 6 ] , values [ 7 ] , values [ 8 ] , values [ 9 ] , values [ 10 ] , values [ 11 ] , values [ 12 ] , values [ 13 ] , values [ 14 ] , values [ 15 ] ) ; } | Copies the elements of a row - major array . |
14,680 | public void launch ( Object arg ) { ReconnectableMap . INSTANCE . dismiss ( key ) ; out . put ( "restore" , true ) ; out . put ( "arg" , arg ) ; launches . onNext ( arg ) ; } | Launches an observable providing an argument . Dismisses the previous observable instance if it is not completed yet . |
14,681 | public static < E > List < E > of ( E e1 , E e2 , E e3 , E e4 ) { List < E > list = new ArrayList < > ( ) ; list . add ( e1 ) ; list . add ( e2 ) ; list . add ( e3 ) ; list . add ( e4 ) ; return list ; } | Returns a list of the given elements in order . |
14,682 | public void run ( ) { LOGGER . debug ( "begin scan for config file changes ..." ) ; try { Date lastModified = new Date ( _xmlConfigFile . lastModified ( ) ) ; if ( _lastTimeRead == null || lastModified . after ( _lastTimeRead ) ) { LOGGER . info ( "loading config file changes ..." ) ; this . loadServiceConfigFile ( ) ;... | When the timer goes off look for changes to the specified xml config file . For comparison we are only interested in the last time we read the file . A null value for lastTimeRead means that we never read the file before . |
14,683 | private void loadServiceConfigFile ( ) throws ConfigurationException { Properties properties = _plugin . getConfiguration ( ) ; Configuration config = ConfigurationConverter . getConfiguration ( properties ) ; String xmlConfigFilename = config . getString ( "xmlConfigFilename" ) ; _config = new ServiceListConfiguration... | actually load the xml configuration file . If anything goes wrong throws an exception . This created a list of service records . When done set the service record list in the plugin . The plugin set function should be synchronized so that it won t squash any concurrent access to the old set of services . |
14,684 | public void initialize ( ArgoClientContext context ) throws TransportConfigException { transportProps = processPropertiesFile ( config . getPropertiesFilename ( ) ) ; createProbeSenders ( context ) ; } | Initialize the actual ProbeSenders . |
14,685 | public String getDescription ( ) { StringBuffer buf = new StringBuffer ( ) ; String transportName = config . getName ( ) ; for ( ProbeSender sender : senders ) { buf . append ( transportName ) . append ( " -- " ) . append ( isEnabled ( ) ? "Enabled" : "Disabled" ) . append ( " -- " ) . append ( sender . getDescription ... | return the text description of the transport and its associated ProbeSenders . |
14,686 | public String showConfiguration ( ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( "\n Client Transport Configuration\n" ) ; buf . append ( " Name ...................... " ) . append ( config . getName ( ) ) . append ( "\n" ) ; buf . append ( " Is Enabled................. " ) . append ( isEnabled (... | Show the configuration for a Client Transport . |
14,687 | public void close ( ) { for ( ProbeSender sender : getSenders ( ) ) { try { sender . close ( ) ; } catch ( TransportException e ) { LOGGER . warn ( "Issue closing the ProbeSender [" + sender . getDescription ( ) + "]" , e ) ; } } } | This closes any of the underlying resources that a ProbeSender might be using such as a connection to a server somewhere . |
14,688 | private void createProbeSenders ( ArgoClientContext context ) throws TransportConfigException { senders = new ArrayList < ProbeSender > ( ) ; if ( config . usesNetworkInterface ( ) ) { try { for ( String niName : context . getAvailableNetworkInterfaces ( config . requiresMulticast ( ) ) ) { try { Transport transport = ... | Create the actual ProbeSender instances given the configuration information . If the transport depends on Network Interfaces then create a ProbeSender for each NI we can find on this machine . |
14,689 | protected List < TypeVariableName > getTypeVariables ( TypeName t ) { return match ( t ) . when ( typeOf ( TypeVariableName . class ) ) . get ( v -> { if ( v . bounds . isEmpty ( ) ) { return ImmutableList . of ( v ) ; } else { return Stream . concat ( Stream . of ( v ) , v . bounds . stream ( ) . map ( b -> getTypeVar... | Returns a list of type variables for a given type . |
14,690 | protected List < TypeNameWithArity > createTypeArityList ( TypeName t , String extractVariableName , int maxArity ) { TypeName u = match ( t ) . when ( typeOf ( TypeVariableName . class ) ) . get ( x -> ( TypeName ) TypeVariableName . get ( "E" + x . name , x ) ) . orElse ( x -> x ) . getMatch ( ) ; List < TypeNameWith... | Returns a list of pairs of types and arities up to a given max arity . |
14,691 | protected TypeName [ ] createTypeVariables ( TypeName extractedType , String extractVariableName , int extractArity ) { List < TypeName > typeVariables = new ArrayList < > ( ) ; typeVariables . add ( extractedType ) ; if ( extractArity > 0 ) { typeVariables . addAll ( IntStream . rangeClosed ( 1 , extractArity ) . mapT... | Returns an array of type variables for a given type and arity . |
14,692 | protected static Object [ ] getMatcherStatementArgs ( int matchedCount ) { TypeName matcher = ParameterizedTypeName . get ( ClassName . get ( Matcher . class ) , TypeName . OBJECT ) ; TypeName listOfMatchers = ParameterizedTypeName . get ( ClassName . get ( List . class ) , matcher ) ; TypeName lists = TypeName . get (... | Returns the statement arguments for the match method matcher statement . |
14,693 | protected MatchType getMatchType ( TypeName m ) { return match ( m ) . when ( typeOf ( ParameterizedTypeName . class ) ) . get ( t -> { if ( isDecomposableBuilder ( t . rawType ) ) { return MatchType . DECOMPOSE ; } else if ( t . rawType . equals ( MATCH_ANY ) ) { return MatchType . ANY ; } else if ( t . rawType . equa... | Returns the type of match to use for a given type . |
14,694 | protected List < TypeName > getExtractedTypes ( TypeName permutationType , TypeName paramType ) { return match ( permutationType ) . when ( typeOf ( ParameterizedTypeName . class ) ) . get ( t -> { if ( isDecomposableBuilder ( t . rawType ) ) { return t . typeArguments . subList ( 1 , t . typeArguments . size ( ) ) ; }... | Returns the extracted type parameters . |
14,695 | protected List < TypeName > getReturnStatementArgs ( MatchType matchType , TypeName paramType ) { List < TypeName > extractA ; if ( matchType == MatchType . DECOMPOSE ) { TypeName u = match ( paramType ) . when ( typeOf ( TypeVariableName . class ) ) . get ( x -> ( TypeName ) TypeVariableName . get ( "E" + x . name , x... | Returns the statement arguments for the match method returns statement . |
14,696 | public static ProbeSender createMulticastProbeSender ( ) throws ProbeSenderException , TransportConfigException { Transport mcastTransport = new MulticastTransport ( "" ) ; ProbeSender gen = new ProbeSender ( mcastTransport ) ; return gen ; } | Create a Multicast ProbeSender with all the default values . The default values are the default multicast group address and port of the Argo protocol . The Network Interface is the NI associated with the localhost address . |
14,697 | public static ProbeSender createMulticastProbeSender ( String niName ) throws TransportConfigException { Transport mcastTransport = new MulticastTransport ( niName ) ; ProbeSender gen = new ProbeSender ( mcastTransport ) ; return gen ; } | Create a Multicast ProbeSender specifying the Network Interface to send on . |
14,698 | public static ProbeSender createSNSProbeSender ( String ak , String sk ) throws ProbeSenderException { Transport snsTransport = new AmazonSNSTransport ( ak , sk ) ; ProbeSender gen = new ProbeSender ( snsTransport ) ; return gen ; } | Create a AmazonSNS transport ProbeSender using the default values . |
14,699 | private void initializeHTTPClient ( ) { if ( _config . isHTTPSConfigured ( ) ) { try { KeyStore trustKeystore = getClientTruststore ( ) ; SSLContext sslContext = SSLContexts . custom ( ) . loadTrustMaterial ( trustKeystore , new TrustSelfSignedStrategy ( ) ) . build ( ) ; SSLConnectionSocketFactory sslsf = new SSLConne... | Create HTTP Client . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.