idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
41,000 | public static AirlineCheckinTemplateBuilder addAirlineCheckinTemplate ( String introMessage , String locale , String pnrNumber , String checkinUrl ) { return new AirlineCheckinTemplateBuilder ( introMessage , locale , pnrNumber , checkinUrl ) ; } | Adds an Airline Checkin Template to the response . |
41,001 | public static AirlineFlightUpdateTemplateBuilder addAirlineFlightUpdateTemplate ( String introMessage , String locale , String pnrNumber , UpdateType updateType ) { return new AirlineFlightUpdateTemplateBuilder ( introMessage , locale , pnrNumber , updateType ) ; } | Adds an Airline Flight Update Template to the response . |
41,002 | public static byte [ ] i2cConfigRequest ( int delayInMicroseconds ) { if ( delayInMicroseconds < 0 ) { throw new IllegalArgumentException ( "Delay cannot be less than 0 microseconds." ) ; } if ( delayInMicroseconds > 255 ) { throw new IllegalArgumentException ( "Delay cannot be greater than 255 microseconds." ) ; } byt... | Creates SysEx message that configures I2C setup . |
41,003 | public static byte [ ] analogReport ( boolean enable ) { byte [ ] result = new byte [ 32 ] ; byte flag = ( byte ) ( enable ? 1 : 0 ) ; for ( byte i = 0 , j = 0 ; i < 16 ; i ++ ) { result [ j ++ ] = ( byte ) ( REPORT_ANALOG | i ) ; result [ j ++ ] = flag ; } return result ; } | Builds message to enable or disable reporting from Firmata device on change of analog input . |
41,004 | public static byte [ ] digitalReport ( boolean enable ) { byte [ ] result = new byte [ 32 ] ; byte flag = ( byte ) ( enable ? 1 : 0 ) ; for ( byte i = 0 , j = 0 ; i < 16 ; i ++ ) { result [ j ++ ] = ( byte ) ( REPORT_DIGITAL | i ) ; result [ j ++ ] = flag ; } return result ; } | Builds message to enable or disable reporting from Firmata device on change of digital input . |
41,005 | public static byte [ ] setMode ( byte pinId , Pin . Mode mode ) { if ( mode == Pin . Mode . UNSUPPORTED ) { throw new IllegalArgumentException ( "Cannot set unsupported mode to pin " + pinId ) ; } return new byte [ ] { SET_PIN_MODE , pinId , ( byte ) mode . ordinal ( ) } ; } | Creates the message that assigns particular mode to specified pin . |
41,006 | public static byte [ ] stringMessage ( String message ) { byte [ ] bytes = message . getBytes ( ) ; byte [ ] result = new byte [ bytes . length * 2 + 3 ] ; result [ 0 ] = START_SYSEX ; result [ 1 ] = STRING_DATA ; result [ result . length - 1 ] = END_SYSEX ; for ( int i = 0 ; i < bytes . length ; i ++ ) { byte b = byte... | Encodes the string as a SysEx message . |
41,007 | public static byte [ ] setDisplayClock ( byte divideRatio , byte oscillatorFrequency ) { if ( divideRatio < 0 || oscillatorFrequency < 0 ) { throw new IllegalArgumentException ( "Divide ratio and oscillator frequency must be non-negative." ) ; } byte param = ( byte ) ( ( oscillatorFrequency << 4 ) & divideRatio ) ; ret... | timing configuration commands |
41,008 | protected void bufferize ( byte b ) { if ( index == buffer . length ) { byte [ ] newBuffer = new byte [ buffer . length * 2 ] ; System . arraycopy ( buffer , 0 , newBuffer , 0 , index ) ; buffer = newBuffer ; } buffer [ index ++ ] = b ; } | Stores the byte to the internal buffer in order to get a chunk of data latter . |
41,009 | private void shutdown ( ) throws IOException { ready . set ( false ) ; sendMessage ( FirmataMessageFactory . analogReport ( false ) ) ; sendMessage ( FirmataMessageFactory . digitalReport ( false ) ) ; parser . stop ( ) ; transport . stop ( ) ; } | Tries to release all resources and properly terminate the connection to the hardware . |
41,010 | public void init ( ) { turnOff ( ) ; command ( setDisplayClock ( ( byte ) 0 , ( byte ) 8 ) ) ; command ( setMultiplexRatio ( size . height ) ) ; command ( setDisplayOffset ( 0 ) ) ; command ( setDisplayStartLine ( 0 ) ) ; command ( setMemoryAddressingMode ( MemoryAddressingMode . HORIZONTAL ) ) ; command ( setHorizonta... | Prepares the device to operation . |
41,011 | public void dim ( boolean dim ) { byte contrast ; if ( dim ) { contrast = 0 ; } else { if ( vccState == VCC . EXTERNAL ) { contrast = ( byte ) 0x9F ; } else { contrast = ( byte ) 0xCF ; } } command ( setContrast ( contrast ) ) ; } | Dims the display |
41,012 | public void process ( byte b ) { if ( b == END_SYSEX ) { byte [ ] buffer = convertI2CBuffer ( getBuffer ( ) ) ; byte address = buffer [ 0 ] ; byte register = buffer [ 1 ] ; byte [ ] message = new byte [ buffer . length - 2 ] ; System . arraycopy ( buffer , 2 , message , 0 , buffer . length - 2 ) ; Event event = new Eve... | Collects I2C message from individual bytes . |
41,013 | public void drawRect ( int x , int y , int w , int h , Color color ) { drawHorizontalLine ( x , y , w , color ) ; drawHorizontalLine ( x , y + h - 1 , w , color ) ; drawVerticalLine ( x , y , h , color ) ; drawVerticalLine ( x + w - 1 , y , h , color ) ; } | Draw a rectangle |
41,014 | public void drawBitmap ( int x , int y , byte [ ] [ ] bitmap , boolean opaque ) { int h = bitmap . length ; if ( h == 0 ) { return ; } int w = bitmap [ 0 ] . length ; if ( w == 0 ) { return ; } for ( int i = 0 ; i < h ; i ++ ) { if ( y + i >= 0 && y + i < height ) { for ( int j = 0 ; j < w ; j ++ ) { if ( x + j * 8 >= ... | Draws a bitmap . Each byte of data contains values for 8 consecutive pixels in a row . |
41,015 | public void drawImage ( int x , int y , BufferedImage image , boolean opaque , boolean invert ) { drawBitmap ( x , y , convertToBitmap ( image , invert ) , opaque ) ; } | Draws an image . The image is grayscalled before drawing . |
41,016 | public final void bsf ( Register dst , Register src ) { assert ( ! dst . isRegType ( REG_GPB ) ) ; emitX86 ( INST_BSF , dst , src ) ; } | Bit Scan Forward . |
41,017 | public final void bsr ( Register dst , Mem src ) { assert ( ! dst . isRegType ( REG_GPB ) ) ; emitX86 ( INST_BSR , dst , src ) ; } | Bit Scan Reverse . |
41,018 | public final void call ( Register dst ) { assert ( dst . isRegType ( is64 ( ) ? REG_GPQ : REG_GPD ) ) ; emitX86 ( INST_CALL , dst ) ; } | Call Procedure . |
41,019 | public final void cmov ( CONDITION cc , Register dst , Register src ) { emitX86 ( conditionToCMovCC ( cc ) , dst , src ) ; } | Conditional Move . |
41,020 | public final void mov_ptr ( Register dst , long src ) { assert dst . index ( ) == 0 ; emitX86 ( INST_MOV_PTR , dst , Immediate . imm ( src ) ) ; } | Move byte word dword or qword from absolute address |
41,021 | public final void pop ( Register dst ) { assert ( dst . isRegType ( REG_GPW ) || dst . isRegType ( is64 ( ) ? REG_GPQ : REG_GPD ) ) ; emitX86 ( INST_POP , dst ) ; } | ! or segment register . |
41,022 | public final void shld ( Mem dst , Register src1 , Immediate src2 ) { emitX86 ( INST_SHLD , dst , src1 , src2 ) ; } | Double Precision Shift Left . |
41,023 | public final void fild ( Mem src ) { assert ( src . size ( ) == 2 || src . size ( ) == 4 || src . size ( ) == 8 ) ; emitX86 ( INST_FILD , src ) ; } | ! preserved . |
41,024 | public final void fstp ( Mem dst ) { assert ( dst . size ( ) == 4 || dst . size ( ) == 8 || dst . size ( ) == 10 ) ; emitX86 ( INST_FSTP , dst ) ; } | ! and pop register stack . |
41,025 | public final void extractps ( XMMRegister dst , XMMRegister src , Immediate imm8 ) { emitX86 ( INST_EXTRACTPS , dst , src , imm8 ) ; } | Extract Packed SP - FP Value |
41,026 | public final void roundps ( XMMRegister dst , XMMRegister src , Immediate imm8 ) { emitX86 ( INST_ROUNDPS , dst , src , imm8 ) ; } | ! Round Packed SP - FP Values |
41,027 | static void writeTrampoline ( ByteBuffer buf , long target ) { buf . put ( ( byte ) 0xFF ) ; buf . put ( ( byte ) 0x25 ) ; buf . putInt ( 0 ) ; buf . putLong ( target ) ; } | Write trampoline into code at address |
41,028 | private static void mergeWildcardTypes ( final List < Type > types , final Type ... addition ) { if ( types . isEmpty ( ) ) { Collections . addAll ( types , addition ) ; return ; } for ( Type add : addition ) { final Class < ? > addClass = GenericsUtils . resolveClass ( add ) ; final Iterator < Type > it = types . iter... | Adds new types to wildcard if types are not already contained . If added type is more specific then already contained type then it replace such type . |
41,029 | private static void removeDuplicateContracts ( final Class < ? > type , final Set < Class < ? > > contracts ) { if ( contracts . isEmpty ( ) ) { return ; } Iterator < Class < ? > > it = contracts . iterator ( ) ; while ( it . hasNext ( ) ) { if ( it . next ( ) . isAssignableFrom ( type ) ) { it . remove ( ) ; } } it = ... | After common types resolution we have some base class and set of common interfaces . These interfaces may contain duplicates or be already covered by base class . |
41,030 | public static Map < Class < ? > , LinkedHashMap < String , Type > > resolve ( final Class < ? > type , final LinkedHashMap < String , Type > rootGenerics , final Class < ? > ... ignoreClasses ) { return resolve ( type , rootGenerics , Collections . < Class < ? > , LinkedHashMap < String , Type > > emptyMap ( ) , Arrays... | Analyze class hierarchy and resolve actual generic values for all composing types . Root type generics are known . |
41,031 | @ SuppressWarnings ( "PMD.LooseCoupling" ) public static LinkedHashMap < String , Type > createGenericsMap ( final Class < ? > type , final List < ? extends Type > generics ) { final TypeVariable < ? extends Class < ? > > [ ] params = type . getTypeParameters ( ) ; if ( params . length != generics . size ( ) ) { throw ... | LinkedHashMap indicates stored order important for context |
41,032 | private static Type resolveGenericArrayTypeVariables ( final GenericArrayType type , final Map < String , Type > generics , final boolean countPreservedVariables ) { final Type componentType = resolveTypeVariables ( type . getGenericComponentType ( ) , generics , countPreservedVariables ) ; return ArrayTypeUtils . toAr... | May produce array class instead of generic array type . This is possible due to wildcard or parameterized type shrinking . |
41,033 | public static Type getMoreSpecificType ( final Type one , final Type two ) { return isMoreSpecific ( one , two ) ? one : two ; } | Not resolved type variables are resolved to Object . |
41,034 | public static void walk ( final Type one , final Type two , final TypesVisitor visitor ) { final Map < String , Type > oneKnownGenerics = new IgnoreGenericsMap ( GenericsResolutionUtils . resolveGenerics ( one , IGNORE_VARS ) ) ; final Map < String , Type > twoKnownGenerics = new IgnoreGenericsMap ( GenericsResolutionU... | Walk will stop if visitor tells it s enough or when hierarchy incompatibility will be found . |
41,035 | private static boolean isLowerBoundCompatible ( final WildcardType type , final Class ... with ) { boolean res = true ; if ( type . getLowerBounds ( ) . length > 0 ) { final Class < ? > lower = GenericsUtils . resolveClassIgnoringVariables ( type . getLowerBounds ( ) [ 0 ] ) ; for ( Class < ? > target : with ) { if ( !... | Check that wildcard s lower bound type is not less then any of provided types . |
41,036 | public UnknownGenericException rethrowWithType ( final Class < ? > type ) { final boolean sameType = contextType != null && contextType . equals ( type ) ; if ( ! sameType && contextType != null ) { throw new IllegalStateException ( "Context type can't be changed" ) ; } return sameType ? this : new UnknownGenericExcept... | Throw more specific exception . |
41,037 | private Schema getSchema ( Resolver pResolver , ValidationSet pValidationSet ) throws MojoExecutionException { String schemaLanguage = pValidationSet . getSchemaLanguage ( ) ; if ( schemaLanguage == null || "" . equals ( schemaLanguage ) ) { schemaLanguage = XMLConstants . W3C_XML_SCHEMA_NS_URI ; } final String publicI... | Reads a validation sets schema . |
41,038 | private void validate ( final Resolver pResolver , ValidationSet pValidationSet , Schema pSchema , File pFile , ValidationErrorHandler errorHandler ) throws MojoExecutionException { errorHandler . setContext ( pFile ) ; try { if ( pSchema == null ) { getLog ( ) . debug ( "Parsing " + pFile . getPath ( ) ) ; parse ( pRe... | Called for parsing or validating a single file . |
41,039 | private void parse ( Resolver pResolver , ValidationSet pValidationSet , File pFile , ErrorHandler errorHandler ) throws IOException , SAXException , ParserConfigurationException { XMLReader xr = newSAXParserFactory ( pValidationSet ) . newSAXParser ( ) . getXMLReader ( ) ; if ( pResolver != null ) { xr . setEntityReso... | Called for validating a single file . |
41,040 | private void validate ( Resolver pResolver , ValidationSet pValidationSet , ValidationErrorHandler errorHandler ) throws MojoExecutionException , MojoFailureException { final Schema schema = getSchema ( pResolver , pValidationSet ) ; final File [ ] files = getFiles ( pValidationSet . getDir ( ) , pValidationSet . getIn... | Called for validating a set of XML files against a common schema . |
41,041 | public static TransformerFactory newTransformerFactory ( String factoryClassName , ClassLoader classLoader ) throws NoSuchMethodException , IllegalAccessException , InvocationTargetException { Class < ? > [ ] methodTypes = new Class [ ] { String . class , ClassLoader . class } ; Method method = TransformerFactory . cla... | public for use by unit test |
41,042 | public void execute ( ) throws MojoExecutionException , MojoFailureException { if ( isSkipping ( ) ) { getLog ( ) . debug ( "Skipping execution, as demanded by user." ) ; return ; } if ( transformationSets == null || transformationSets . length == 0 ) { throw new MojoFailureException ( "No TransformationSets configured... | Called by Maven to run the plugin . |
41,043 | public void characters ( char [ ] ch , int start , int length ) throws SAXException { charBuffer . append ( ch , start , length ) ; charLineNumber = locator . getLineNumber ( ) ; } | Stores the passed characters into a character buffer . |
41,044 | public void endElement ( String uri , String localName , String qName ) throws SAXException { flushCharacters ( ) ; if ( stack . isEmpty ( ) ) { throw new IllegalStateException ( "Stack must not be empty when closing the element " + qName + " around line " + locator . getLineNumber ( ) + " and column " + locator . getC... | Checks indentation for an end element . |
41,045 | public void startElement ( String uri , String localName , String qName , Attributes attributes ) throws SAXException { flushCharacters ( ) ; IndentCheckSaxHandler . ElementEntry currentEntry = new ElementEntry ( qName , lastIndent ) ; if ( ! stack . isEmpty ( ) ) { IndentCheckSaxHandler . ElementEntry parentEntry = st... | Checks indentation for a start element . |
41,046 | protected File asAbsoluteFile ( File f ) { if ( f . isAbsolute ( ) ) { return f ; } return new File ( getBasedir ( ) , f . getPath ( ) ) ; } | Converts the given file into an file with an absolute path . |
41,047 | protected void setCatalogs ( List < File > pCatalogFiles , List < URL > pCatalogUrls ) throws MojoExecutionException { if ( catalogs == null || catalogs . length == 0 ) { return ; } for ( int i = 0 ; i < catalogs . length ; i ++ ) { try { URL url = new URL ( catalogs [ i ] ) ; pCatalogUrls . add ( url ) ; } catch ( Mal... | Returns the plugins catalog files . |
41,048 | protected Resolver getResolver ( ) throws MojoExecutionException { List < File > catalogFiles = new ArrayList < File > ( ) ; List < URL > catalogUrls = new ArrayList < URL > ( ) ; setCatalogs ( catalogFiles , catalogUrls ) ; return new Resolver ( getBasedir ( ) , catalogFiles , catalogUrls , getLocator ( ) , catalogHan... | Creates a new resolver . |
41,049 | protected String [ ] getFileNames ( File pDir , String [ ] pIncludes , String [ ] pExcludes ) throws MojoFailureException , MojoExecutionException { if ( pDir == null ) { throw new MojoFailureException ( "A ValidationSet or TransformationSet" + " requires a nonempty 'dir' child element." ) ; } final File dir = asAbsolu... | Scans a directory for files and returns a set of path names . |
41,050 | protected String [ ] getExcludes ( String [ ] origExcludes , boolean skipDefaultExcludes ) { if ( skipDefaultExcludes ) { return origExcludes ; } String [ ] defaultExcludes = FileUtils . getDefaultExcludes ( ) ; if ( origExcludes == null || origExcludes . length == 0 ) { return defaultExcludes ; } String [ ] result = n... | Calculates the exclusions to use when searching files . |
41,051 | protected Object activateProxy ( ) { if ( settings == null ) { return null ; } final Proxy proxy = settings . getActiveProxy ( ) ; if ( proxy == null ) { return null ; } final List < String > properties = new ArrayList < String > ( ) ; final String protocol = proxy . getProtocol ( ) ; final String prefix = isEmpty ( pr... | Called to install the plugins proxy settings . |
41,052 | protected void passivateProxy ( Object pProperties ) { if ( pProperties == null ) { return ; } @ SuppressWarnings ( "unchecked" ) final List < String > properties = ( List < String > ) pProperties ; for ( Iterator < String > iter = properties . iterator ( ) ; iter . hasNext ( ) ; ) { final String key = iter . next ( ) ... | Called to restore the proxy settings which have been installed when the plugin was invoked . |
41,053 | private void addQueryParameters ( HttpRequestBase request , Map < String , String > params ) { if ( params != null ) { URIBuilder builder = new URIBuilder ( request . getURI ( ) ) ; for ( Map . Entry < String , String > param : params . entrySet ( ) ) { builder . addParameter ( param . getKey ( ) , param . getValue ( )... | Modifies request in place to add on any query parameters |
41,054 | private static AlgorithmException wrapException ( Throwable throwable ) { if ( throwable == null ) { return null ; } else if ( throwable instanceof AlgorithmException ) { return ( AlgorithmException ) throwable ; } else { return new AlgorithmException ( throwable . getMessage ( ) , wrapException ( throwable . getCause ... | Constructs a new algorithm exception from an existing throwable . This replaces all Exceptions in the cause hierarchy to be replaced with AlgorithmException for inter - jvm communication safety . |
41,055 | public DataFile putFile ( File file ) throws APIException , FileNotFoundException { DataFile dataFile = new DataFile ( client , trimmedPath + "/" + file . getName ( ) ) ; dataFile . put ( file ) ; return dataFile ; } | Convenience wrapper for putting a File |
41,056 | public void create ( ) throws APIException { CreateDirectoryRequest reqObj = new CreateDirectoryRequest ( this . getName ( ) , null ) ; Gson gson = new Gson ( ) ; JsonElement inputJson = gson . toJsonTree ( reqObj ) ; String url = this . getParent ( ) . getUrl ( ) ; HttpResponse response = this . client . post ( url , ... | Creates this directory via the Algorithmia Data API |
41,057 | public void delete ( boolean forceDelete ) throws APIException { HttpResponse response = client . delete ( getUrl ( ) + "?force=" + forceDelete ) ; HttpClientHelpers . throwIfNotOk ( response ) ; } | Creates this directory vi the Algorithmia Data API |
41,058 | protected DirectoryListResponse getPage ( String marker , Boolean getAcl ) throws APIException { String url = getUrl ( ) ; Map < String , String > params = new HashMap < String , String > ( ) ; if ( marker != null ) { params . put ( "marker" , marker ) ; } if ( getAcl ) { params . put ( "acl" , getAcl . toString ( ) ) ... | Gets a single page of the directory listing . Subsquent pages are fetched with the returned marker value . |
41,059 | private static String getTrimmedPath ( String path ) { String result = path ; if ( result . endsWith ( "/" ) ) { result = result . substring ( 0 , result . length ( ) - 1 ) ; } return result ; } | a slash and those that don t . |
41,060 | public boolean exists ( ) throws APIException { HttpResponse response = client . head ( getUrl ( ) ) ; int status = response . getStatusLine ( ) . getStatusCode ( ) ; if ( status != 200 && status != 404 ) { throw APIException . fromHttpResponse ( response ) ; } return ( 200 == status ) ; } | Returns whether the file exists in the Data API |
41,061 | public File getFile ( ) throws APIException , IOException { String filename = getName ( ) ; int extensionIndex = filename . lastIndexOf ( '.' ) ; String body ; String ext ; if ( extensionIndex <= 0 ) { body = filename ; ext = "" ; } else { body = filename . substring ( 0 , extensionIndex ) ; ext = filename . substring ... | Gets the data for this file and saves it to a local temporary file |
41,062 | public InputStream getInputStream ( ) throws APIException , IOException { final HttpResponse response = client . get ( getUrl ( ) ) ; HttpClientHelpers . throwIfNotOk ( response ) ; return response . getEntity ( ) . getContent ( ) ; } | Gets the data for this file as an InputStream |
41,063 | public void put ( String data , Charset charset ) throws APIException { HttpResponse response = client . put ( getUrl ( ) , new StringEntity ( data , charset ) ) ; HttpClientHelpers . throwIfNotOk ( response ) ; } | Upload string data to this file as text using a custom Charset |
41,064 | public void put ( byte [ ] data ) throws APIException { HttpResponse response = client . put ( getUrl ( ) , new ByteArrayEntity ( data , ContentType . APPLICATION_OCTET_STREAM ) ) ; HttpClientHelpers . throwIfNotOk ( response ) ; } | Upload raw data to this file as binary |
41,065 | public void put ( InputStream is ) throws APIException { HttpResponse response = client . put ( getUrl ( ) , new InputStreamEntity ( is , - 1 , ContentType . APPLICATION_OCTET_STREAM ) ) ; HttpClientHelpers . throwIfNotOk ( response ) ; } | Upload raw data to this file as an input stream |
41,066 | public AlgoResponse pipe ( Object input ) throws APIException { if ( input instanceof String ) { return pipeRequest ( ( String ) input , ContentType . Text ) ; } else if ( input instanceof byte [ ] ) { return pipeBinaryRequest ( ( byte [ ] ) input ) ; } else { return pipeRequest ( gson . toJsonTree ( input ) . toString... | Calls the Algorithmia API for a given input . Attempts to automatically serialize the input to JSON . |
41,067 | public FutureAlgoResponse pipeAsync ( Object input ) { final Gson gson = new Gson ( ) ; final JsonElement inputJson = gson . toJsonTree ( input ) ; return pipeJsonAsync ( inputJson . toString ( ) ) ; } | Calls the Algorithmia API asynchronously for a given input . Attempts to automatically serialize the input to JSON . The future response will complete when the algorithm has completed or errored |
41,068 | public < R > R execute ( MailChimpMethod < R > method ) throws IOException , MailChimpException { final Gson gson = MailChimpGsonFactory . createGson ( ) ; JsonElement result = execute ( buildUrl ( method ) , gson . toJsonTree ( method ) , method . getMetaInfo ( ) . version ( ) ) ; if ( result . isJsonObject ( ) ) { Js... | Execute MailChimp API method . |
41,069 | public void close ( ) { try { connection . close ( ) ; } catch ( IOException e ) { log . log ( Level . WARNING , "Could not close connection" , e ) ; } } | Release resources associated with the connection to MailChimp API service point . |
41,070 | public Object remove ( Object key ) { if ( key instanceof String && reflective . containsKey ( ( String ) key ) ) { throw new ReflectiveValueRemovalException ( ( String ) key ) ; } else { return regular . remove ( key ) ; } } | Removes a regular mapping for a key from this map if it is present . |
41,071 | public static < T extends MailChimpObject > T fromJson ( String json , Class < T > clazz ) { try { return MailChimpGsonFactory . createGson ( ) . fromJson ( json , clazz ) ; } catch ( JsonParseException e ) { throw new IllegalArgumentException ( e ) ; } } | Deserializes an object from JSON . |
41,072 | public final Method getMetaInfo ( ) { for ( Class < ? > c = getClass ( ) ; c != null ; c = c . getSuperclass ( ) ) { Method a = c . getAnnotation ( Method . class ) ; if ( a != null ) { return a ; } } throw new IllegalArgumentException ( "Neither " + getClass ( ) + " nor its superclasses are annotated with " + Method .... | Get the MailChimp API method meta - info . |
41,073 | public final Type getResultType ( ) { Type type = resultTypeToken . getType ( ) ; if ( type instanceof Class || type instanceof ParameterizedType || type instanceof GenericArrayType ) { return type ; } else { throw new IllegalArgumentException ( "Cannot resolve result type: " + resultTypeToken ) ; } } | Get the method result type . |
41,074 | private void postCreatedOrEnabledUser ( UserDetails userDetails , Map < String , Object > userInfo ) { if ( oAuth2PostCreatedOrEnabledUserService != null ) { oAuth2PostCreatedOrEnabledUserService . postCreatedOrEnabledUser ( userDetails , userInfo ) ; } } | Extension point to allow sub classes to optionally do some processing after a user has been created or enabled . For example they could set something in the session so that the authentication success handler can treat the first log in differently . |
41,075 | public void afterPropertiesSet ( ) throws Exception { Assert . notNull ( userAuthorisationUri , "The userAuthorisationUri must be set" ) ; Assert . notNull ( redirectUri , "The redirectUri must be set" ) ; Assert . notNull ( accessTokenUri , "The accessTokenUri must be set" ) ; Assert . notNull ( clientId , "The client... | Check whether all required properties have been set |
41,076 | protected void checkStateParameter ( HttpSession session , Map < String , String [ ] > parameters ) throws AuthenticationException { String originalState = ( String ) session . getAttribute ( oAuth2ServiceProperties . getStateParamName ( ) ) ; String receivedStates [ ] = parameters . get ( oAuth2ServiceProperties . get... | Check the state parameter to ensure it is the same as was originally sent . Subclasses can override this behaviour if they so choose but it is not recommended . |
41,077 | public void afterPropertiesSet ( ) { super . afterPropertiesSet ( ) ; Assert . notNull ( oAuth2ServiceProperties ) ; Assert . isTrue ( oAuth2ServiceProperties . getRedirectUri ( ) . toString ( ) . endsWith ( super . getFilterProcessesUrl ( ) ) , "The filter must be configured to be listening on the redirect_uri in OAut... | Check properties are set |
41,078 | public void bind ( Object item ) { this . item = item ; if ( onItemBindListener != null ) { onItemBindListener . onItemBind ( itemView , item , getAdapterPosition ( ) ) ; } } | Called to update view |
41,079 | public static boolean startsWithPrefix ( final String input ) { boolean ret = false ; if ( input != null ) { ret = input . toLowerCase ( ) . startsWith ( PREFIX_BIGINT_DASH_CHECKSUM ) ; } else { ret = false ; } return ret ; } | Utility to test if the input string can even - possibly - be a BigIntStringChecksum encoded . This is check is necessary but not sufficient for the input string to parse correctly . |
41,080 | public static BigIntStringChecksum fromString ( String bics ) { boolean returnIsNegative = false ; BigIntStringChecksum ret = null ; if ( bics == null ) { createThrow ( "Input cannot be null" , bics ) ; } if ( startsWithPrefix ( bics ) ) { String noprefix = bics . substring ( PREFIX_BIGINT_DASH_CHECKSUM . length ( ) ) ... | Take input string and create the instance . As of version 1 . 3 . 2 forward the case of the INPUT is not relevant . Note however that when the Checksum CCCCCC is computed the hex hhhhhh - string is LOWER CASE . |
41,081 | public static BigIntStringChecksum fromStringOrNull ( String bics ) { BigIntStringChecksum ret ; if ( bics == null ) { ret = null ; } else if ( ! startsWithPrefix ( bics ) ) { ret = null ; } else { try { ret = fromString ( bics ) ; if ( ret . asBigInteger ( ) == null ) { throw new SecretShareException ( "Programmer err... | Take string as input and either return an instance or return null . |
41,082 | public static void setOptOut ( final Context context , boolean optOut ) { SharedPreferences pref = context . getSharedPreferences ( PREF_NAME , Context . MODE_PRIVATE ) ; Editor editor = pref . edit ( ) ; editor . putBoolean ( KEY_OPT_OUT , optOut ) ; editor . apply ( ) ; } | Set opt out flag . If it is true the rate dialog will never shown unless app data is cleared . |
41,083 | public static EasyLinearEquation createForPolynomial ( final BigInteger [ ] xarray , final BigInteger [ ] fofxarray ) { if ( xarray . length != fofxarray . length ) { throw new SecretShareException ( "Unequal length arrays are not allowed" ) ; } final int numRows = xarray . length ; final int numCols = xarray . length ... | Create solver for polynomial equations . |
41,084 | public static EasyLinearEquation create ( BigInteger [ ] [ ] inMatrix ) { EasyLinearEquation ret = null ; final int width = inMatrix [ 0 ] . length ; for ( BigInteger [ ] row : inMatrix ) { if ( width != row . length ) { throw new SecretShareException ( "All rows must be " + width + " wide" ) ; } } List < Row > rows = ... | Most typical factory for BigInteger arrays . |
41,085 | public static BigInteger getPrimeUsedFor8192bigSecretPayload ( ) { BigInteger p8192one = new BigInteger ( "279231522718570477942523966651848412786" + "755625471035569262549193264568660953374" + "539575363644038451708729333066699816198" + "469916126929965359120284410819859854028" + "5642000125036014053218841152583803405... | All primes were tested with 100 000 iterations of Miller - Rabin |
41,086 | private static BigInteger checkAndReturn ( String which , BigInteger expected , String asbigintcs ) { BigInteger other = BigIntStringChecksum . fromString ( asbigintcs ) . asBigInteger ( ) ; if ( expected . equals ( other ) ) { return expected ; } else { throw new SecretShareException ( which + " failure" ) ; } } | Guard against accidental changes to the strings . |
41,087 | public SplitSecretOutput split ( final BigInteger secret , final Random random ) { if ( secret == null ) { throw new SecretShareException ( "Secret cannot be null" ) ; } if ( secret . signum ( ) <= 0 ) { throw new SecretShareException ( "Secret cannot be negative" ) ; } if ( publicInfo . getPrimeModulus ( ) != null ) {... | Split the secret into pieces where the caller controls the random instance . |
41,088 | public CombineOutput combine ( final List < ShareInfo > usetheseshares ) { CombineOutput ret = null ; sanityCheckPublicInfos ( publicInfo , usetheseshares ) ; if ( true ) { println ( " SOLVING USING THESE SHARES, mod=" + publicInfo . getPrimeModulus ( ) ) ; for ( ShareInfo si : usetheseshares ) { println ( " " + si .... | Combine the shares generated by the split to recover the secret . |
41,089 | public ParanoidOutput combineParanoid ( List < ShareInfo > shares , ParanoidInput paranoidInput ) { ParanoidOutput ret = performParanoidCombines ( shares , paranoidInput ) ; if ( paranoidInput != null ) { if ( ret . getReconstructedMap ( ) . size ( ) != 1 ) { throw new SecretShareException ( "Paranoid combine failed, o... | This version does the combines and throws an exception if there is not 100% agreement . |
41,090 | public ParanoidOutput performParanoidCombines ( List < ShareInfo > shares , ParanoidInput paranoidInput ) { if ( paranoidInput == null ) { return ParanoidOutput . createEmpty ( ) ; } else { return performParanoidCombinesNonNull ( shares , paranoidInput ) ; } } | This version just collects all of the reconstructed secrets . |
41,091 | public static PolyEquationImpl create ( final int ... args ) { BigInteger [ ] bigints = new BigInteger [ args . length ] ; for ( int i = 0 , n = args . length ; i < n ; i ++ ) { bigints [ i ] = BigInteger . valueOf ( args [ i ] ) ; } return new PolyEquationImpl ( bigints ) ; } | Helper factory to create instances . Accepts int converts them to BigInteger and calls the constructor . |
41,092 | public E [ ] [ ] addMatrix ( E [ ] [ ] matrix1 , E [ ] [ ] matrix2 ) { if ( ( matrix1 . length != matrix2 . length ) || ( matrix1 [ 0 ] . length != matrix2 [ 0 ] . length ) ) { throw new SecretShareException ( "The matrices do not have the same size" ) ; } E [ ] [ ] result = create ( matrix1 . length , matrix1 [ 0 ] . ... | Add two matrices . |
41,093 | public E [ ] [ ] multiplyMatrix ( E [ ] [ ] matrix1 , E [ ] [ ] matrix2 ) { if ( matrix1 [ 0 ] . length != matrix2 . length ) { throw new SecretShareException ( "The matrices do not have compatible size" ) ; } E [ ] [ ] result = create ( matrix1 . length , matrix2 [ 0 ] . length ) ; for ( int i = 0 ; i < result . lengt... | Multiply two matrices . |
41,094 | public E determinant ( E [ ] [ ] matrix , int r , int s , int i , int j ) { E a , b , c , d ; a = matrix [ r ] [ s ] ; b = matrix [ r ] [ j ] ; c = matrix [ i ] [ s ] ; d = matrix [ i ] [ j ] ; E ad = multiply ( a , d ) ; E bc = multiply ( b , c ) ; E ret = subtract ( ad , bc ) ; return ret ; } | Return the determinant . |
41,095 | public static void print ( String string , Number [ ] [ ] matrix2 , PrintStream out ) { if ( out == null ) { return ; } out . println ( string ) ; printResult ( matrix2 , out ) ; } | Print this array - array . |
41,096 | public static void printResult ( Number [ ] [ ] m1 , PrintStream out ) { if ( out == null ) { return ; } for ( int i = 0 ; i < m1 . length ; i ++ ) { for ( int j = 0 ; j < m1 [ 0 ] . length ; j ++ ) { out . print ( " " + m1 [ i ] [ j ] ) ; } out . println ( "" ) ; } } | Print array - array . |
41,097 | public static void printResult ( Number [ ] [ ] m1 , Number [ ] [ ] m2 , Number [ ] [ ] m3 , char op , PrintStream out ) { for ( int i = 0 ; i < m1 . length ; i ++ ) { for ( int j = 0 ; j < m1 [ 0 ] . length ; j ++ ) { out . print ( " " + m1 [ i ] [ j ] ) ; } if ( i == m1 . length / 2 ) { out . print ( " " + op + " "... | Print matrices the operator and their operation result . |
41,098 | public synchronized static Index createIndex ( Class < ? > type ) { Index index = indices . get ( type ) ; if ( index == null ) { try { Indexer indexer = new Indexer ( ) ; Class < ? > currentType = type ; while ( currentType != null ) { String className = currentType . getName ( ) . replace ( "." , "/" ) + ".class" ; I... | Creates an annotation index for the given entity type |
41,099 | public ModelNode fromChangeset ( Map < String , Object > changeSet , String ... wildcards ) { ClassInfo clazz = null ; Class < ? > currentType = getType ( ) ; while ( clazz == null ) { clazz = index . getClassByName ( DotName . createSimple ( currentType . getCanonicalName ( ) ) ) ; if ( clazz == null ) { currentType =... | Turns a changeset into a composite write attribute operation . The keys to the changeset are the java property names of the attributes that have been modified . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.