signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class TargetTcpProxyClient { /** * Creates a TargetTcpProxy resource in the specified project using the data included in the
* request .
* < p > Sample code :
* < pre > < code >
* try ( TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient . create ( ) ) {
* ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ;
* TargetTcpProxy targetTcpProxyResource = TargetTcpProxy . newBuilder ( ) . build ( ) ;
* Operation response = targetTcpProxyClient . insertTargetTcpProxy ( project , targetTcpProxyResource ) ;
* < / code > < / pre >
* @ param project Project ID for this request .
* @ param targetTcpProxyResource A TargetTcpProxy resource . This resource defines a TCP proxy . ( = =
* resource _ for beta . targetTcpProxies = = ) ( = = resource _ for v1 . targetTcpProxies = = )
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation insertTargetTcpProxy ( ProjectName project , TargetTcpProxy targetTcpProxyResource ) { } } | InsertTargetTcpProxyHttpRequest request = InsertTargetTcpProxyHttpRequest . newBuilder ( ) . setProject ( project == null ? null : project . toString ( ) ) . setTargetTcpProxyResource ( targetTcpProxyResource ) . build ( ) ; return insertTargetTcpProxy ( request ) ; |
public class GroovyClassLoader { /** * loads a class from a file or a parent classloader .
* This method does call loadClass ( String , boolean , boolean , boolean )
* with the last parameter set to false .
* @ throws CompilationFailedException if compilation was not successful */
public Class loadClass ( final String name , boolean lookupScriptFiles , boolean preferClassOverScript ) throws ClassNotFoundException , CompilationFailedException { } } | return loadClass ( name , lookupScriptFiles , preferClassOverScript , false ) ; |
public class OStreamSerializerAnyStatic { /** * Re - Create any object if the class has a public constructor that accepts a String as unique parameter . */
public Object fromStream ( final byte [ ] iStream ) throws IOException { } } | if ( iStream == null || iStream . length == 0 ) // NULL VALUE
return null ; try { return constructor . newInstance ( iStream ) ; } catch ( Exception e ) { OLogManager . instance ( ) . error ( this , "Error on unmarshalling content of class: " + constructor . getDeclaringClass ( ) , e , OSerializationException . class ) ; } return null ; |
public class PatternsImpl { /** * Returns an application version ' s patterns .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param getPatternsOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; PatternRuleInfo & gt ; object */
public Observable < ServiceResponse < List < PatternRuleInfo > > > getPatternsWithServiceResponseAsync ( UUID appId , String versionId , GetPatternsOptionalParameter getPatternsOptionalParameter ) { } } | if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( versionId == null ) { throw new IllegalArgumentException ( "Parameter versionId is required and cannot be null." ) ; } final Integer skip = getPatternsOptionalParameter != null ? getPatternsOptionalParameter . skip ( ) : null ; final Integer take = getPatternsOptionalParameter != null ? getPatternsOptionalParameter . take ( ) : null ; return getPatternsWithServiceResponseAsync ( appId , versionId , skip , take ) ; |
public class SerializationUtility { /** * This deserializes a byte array into an object .
* @ param array The object to be deserialized .
* @ return The deserialized object . */
private static final Serializable deserialize ( byte [ ] array , int offset , int length ) throws IOException , ClassNotFoundException { } } | ByteArrayInputStream byteArrayInputStream = null ; ObjectInputStream objectInputStream = null ; try { byteArrayInputStream = new ByteArrayInputStream ( array , offset , length ) ; byteArrayInputStream . mark ( array . length ) ; objectInputStream = new ObjectInputStream ( byteArrayInputStream ) ; return ( Serializable ) objectInputStream . readObject ( ) ; } catch ( ClassNotFoundException cnfe ) { ClassLoader cl = getClassLoader ( ) ; if ( cl != null ) { byteArrayInputStream . reset ( ) ; objectInputStream = new WsObjectInputStream ( byteArrayInputStream , cl ) ; return ( Serializable ) objectInputStream . readObject ( ) ; } else { throw cnfe ; } } catch ( NoClassDefFoundError cnfe ) { ClassLoader cl = getClassLoader ( ) ; if ( cl != null ) { byteArrayInputStream . reset ( ) ; objectInputStream = new WsObjectInputStream ( byteArrayInputStream , cl ) ; return ( Serializable ) objectInputStream . readObject ( ) ; } else { throw cnfe ; } } catch ( StreamCorruptedException cnfe ) { ClassLoader cl = getClassLoader ( ) ; if ( cl != null ) { byteArrayInputStream . reset ( ) ; objectInputStream = new WsObjectInputStream ( byteArrayInputStream , cl ) ; return ( Serializable ) objectInputStream . readObject ( ) ; } else { throw cnfe ; } } finally { if ( byteArrayInputStream != null ) { byteArrayInputStream . close ( ) ; } if ( objectInputStream != null ) { objectInputStream . close ( ) ; } } |
public class AWSCodeBuildClient { /** * Imports the source repository credentials for an AWS CodeBuild project that has its source code stored in a
* GitHub , GitHub Enterprise , or Bitbucket repository .
* @ param importSourceCredentialsRequest
* @ return Result of the ImportSourceCredentials operation returned by the service .
* @ throws InvalidInputException
* The input value that was provided is not valid .
* @ throws AccountLimitExceededException
* An AWS service limit was exceeded for the calling AWS account .
* @ sample AWSCodeBuild . ImportSourceCredentials
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / codebuild - 2016-10-06 / ImportSourceCredentials "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ImportSourceCredentialsResult importSourceCredentials ( ImportSourceCredentialsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeImportSourceCredentials ( request ) ; |
public class VideoRenderer { /** * Use picasso to render the video thumbnail into the thumbnail widget using a temporal
* placeholder .
* @ param video to get the rendered thumbnail . */
private void renderThumbnail ( Video video ) { } } | Picasso . with ( getContext ( ) ) . cancelRequest ( thumbnail ) ; Picasso . with ( getContext ( ) ) . load ( video . getThumbnail ( ) ) . placeholder ( R . drawable . placeholder ) . into ( thumbnail ) ; |
public class TrueTypeFontUnicode { /** * Creates a ToUnicode CMap to allow copy and paste from Acrobat .
* @ param metrics metrics [ 0 ] contains the glyph index and metrics [ 2]
* contains the Unicode code
* @ return the stream representing this CMap or < CODE > null < / CODE > */
private PdfStream getToUnicode ( Object metrics [ ] ) { } } | metrics = filterCmapMetrics ( metrics ) ; if ( metrics . length == 0 ) return null ; StringBuffer buf = new StringBuffer ( "/CIDInit /ProcSet findresource begin\n" + "12 dict begin\n" + "begincmap\n" + "/CIDSystemInfo\n" + "<< /Registry (TTX+0)\n" + "/Ordering (T42UV)\n" + "/Supplement 0\n" + ">> def\n" + "/CMapName /TTX+0 def\n" + "/CMapType 2 def\n" + "1 begincodespacerange\n" + "<0000><FFFF>\n" + "endcodespacerange\n" ) ; int size = 0 ; for ( int k = 0 ; k < metrics . length ; ++ k ) { if ( size == 0 ) { if ( k != 0 ) { buf . append ( "endbfrange\n" ) ; } size = Math . min ( 100 , metrics . length - k ) ; buf . append ( size ) . append ( " beginbfrange\n" ) ; } -- size ; int metric [ ] = ( int [ ] ) metrics [ k ] ; String fromTo = toHex ( metric [ 0 ] ) ; buf . append ( fromTo ) . append ( fromTo ) . append ( toHex ( metric [ 2 ] ) ) . append ( '\n' ) ; } buf . append ( "endbfrange\n" + "endcmap\n" + "CMapName currentdict /CMap defineresource pop\n" + "end end\n" ) ; String s = buf . toString ( ) ; PdfStream stream = new PdfStream ( PdfEncodings . convertToBytes ( s , null ) ) ; stream . flateCompress ( compressionLevel ) ; return stream ; |
public class Clustering { /** * get a cluster from the clustering */
public Cluster get ( int index ) { } } | if ( index < clusters . size ( ) ) { return clusters . get ( index ) ; } return null ; |
public class AuthorizationHeaderHandler { /** * Sets the authorization header created from the session on the soap client .
* @ param soapClient the SOAP client to set the HTTP header on
* @ param adsSession the session
* @ throws AuthenticationException if the authorization header could not be
* created */
@ SuppressWarnings ( "unchecked" ) /* See constructor comments . */
public void setAuthorization ( Object soapClient , AdsSession adsSession ) throws AuthenticationException { } } | final String authorizationHeader = authorizationHeaderProvider . getAuthorizationHeader ( adsSession , soapClientHandler . getEndpointAddress ( soapClient ) ) ; soapClientHandler . putAllHttpHeaders ( soapClient , new HashMap < String , String > ( ) { { put ( "Authorization" , authorizationHeader ) ; } } ) ; |
public class DependencyAnalyzer { /** * Checks if any of the imports is listed in the " alwaysForbidden " section .
* @ param dependencies
* Dependencies to use .
* @ param classInfo
* Information extracted from the class .
* @ return List of errors - may be empty but is never < code > null < / code > . */
private static List < DependencyError > checkAlwaysForbiddenSection ( final Dependencies dependencies , final ClassInfo classInfo ) { } } | final List < DependencyError > errors = new ArrayList < DependencyError > ( ) ; final Iterator < String > importedPackages = classInfo . getImports ( ) . iterator ( ) ; while ( importedPackages . hasNext ( ) ) { final String importedPackage = importedPackages . next ( ) ; final NotDependsOn ndo = Utils . findForbiddenByName ( dependencies . getAlwaysForbidden ( ) , importedPackage ) ; if ( ndo != null ) { errors . add ( new DependencyError ( classInfo . getName ( ) , importedPackage , ndo . getComment ( ) ) ) ; } } return errors ; |
public class CPInstanceUtil { /** * Returns the last cp instance in the ordered set where groupId = & # 63 ; .
* @ param groupId the group ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp instance , or < code > null < / code > if a matching cp instance could not be found */
public static CPInstance fetchByGroupId_Last ( long groupId , OrderByComparator < CPInstance > orderByComparator ) { } } | return getPersistence ( ) . fetchByGroupId_Last ( groupId , orderByComparator ) ; |
public class HistoryCommand { /** * { @ inheritDoc }
* @ see jp . co . future . uroborosql . client . command . ReplCommand # execute ( org . jline . reader . LineReader , java . lang . String [ ] , jp . co . future . uroborosql . config . SqlConfig , java . util . Properties ) */
@ Override public boolean execute ( final LineReader reader , final String [ ] parts , final SqlConfig sqlConfig , final Properties props ) { } } | PrintWriter writer = reader . getTerminal ( ) . writer ( ) ; writer . println ( "HISTORY:" ) ; writer . flush ( ) ; List < String > keywords = new ArrayList < > ( ) ; if ( parts . length > 1 ) { keywords . addAll ( Arrays . asList ( Arrays . copyOfRange ( parts , 1 , parts . length ) ) ) ; } int sizeLen = String . valueOf ( reader . getHistory ( ) . size ( ) ) . length ( ) ; reader . getHistory ( ) . forEach ( entry -> { try { String value = entry . line ( ) ; if ( keywords . isEmpty ( ) || keywords . stream ( ) . anyMatch ( s -> value . contains ( s ) ) ) { writer . println ( String . format ( "%" + sizeLen + "d : %s" , entry . index ( ) + 1 , value ) ) ; } } catch ( Exception e ) { // do nothing
} } ) ; writer . flush ( ) ; return true ; |
public class WeldConfiguration { /** * Process the given string key and value . First try to convert the < code > stringKey < / code > - unsupported keys are ignored . Then delegate to
* { @ link # processKeyValue ( Map , ConfigurationKey , Object ) } .
* @ param properties
* @ param stringKey
* @ param value */
private void processKeyValue ( Map < ConfigurationKey , Object > properties , String stringKey , Object value ) { } } | processKeyValue ( properties , stringKey , value , false ) ; |
public class PassThruTable { /** * Get the table ' s database .
* @ return The database for this table . */
public BaseDatabase getDatabase ( ) { } } | BaseDatabase database = super . getDatabase ( ) ; if ( database == null ) if ( this . getNextTable ( ) != null ) database = this . getNextTable ( ) . getDatabase ( ) ; return database ; |
public class KbFunctionWrapper { /** * = = = = | Public methods | = = = = = / / */
@ Override public < O extends KbObject > O findOrCreateFunctionalTerm ( Class < O > retType , Object ... args ) throws KbTypeException , CreateException { } } | return wrapped ( ) . findOrCreateFunctionalTerm ( retType , args ) ; |
public class LruTraceCache { /** * Value of trace cache in a readable format .
* @ return trace cache value */
public synchronized String printStack ( ) { } } | StringBuilder sb = new StringBuilder ( ) ; Set < Map . Entry < String , TraceObject > > set = entrySet ( ) ; for ( Map . Entry < String , TraceObject > entry : set ) { TraceObject traceObj = entry . getValue ( ) ; String key = entry . getKey ( ) ; String indicator = "" ; switch ( traceObj . getIndicatorFlag ( ) ) { case TraceObject . NOT_COMPRESSED : break ; case TraceObject . COMPRESSED_PROTOCOL_NOT_COMPRESSED_PACKET : indicator = " (compressed protocol - packet not compressed)" ; break ; case TraceObject . COMPRESSED_PROTOCOL_COMPRESSED_PACKET : indicator = " (compressed protocol - packet compressed)" ; break ; default : break ; } if ( traceObj . isSend ( ) ) { sb . append ( "\nsend at -exchange:" ) ; } else { sb . append ( "\nread at -exchange:" ) ; } sb . append ( key ) . append ( indicator ) . append ( Utils . hexdump ( traceObj . getBuf ( ) ) ) ; traceObj . remove ( ) ; } this . clear ( ) ; return sb . toString ( ) ; |
public class Main { /** * Helper to get the parent file for a given file .
* Added to simulate File . getParentFile ( ) from JDK 1.2.
* @ param file File to find parent of . Must not be < code > null < / code > .
* @ return Parent file or null if none
* @ deprecated since 1.6 . x */
@ Deprecated private File getParentFile ( final File file ) { } } | final File parent = file . getParentFile ( ) ; if ( parent != null && args . msgOutputLevel >= Project . MSG_VERBOSE ) { System . out . println ( "Searching in " + parent . getAbsolutePath ( ) ) ; } return parent ; |
public class TimeZone { /** * Android changed param s / ID / id */
public static TimeZone getTimeZone ( String id ) { } } | if ( id == null ) { throw new NullPointerException ( "id == null" ) ; } // Special cases ? These can clone an existing instance .
if ( id . length ( ) == 3 ) { if ( id . equals ( "GMT" ) ) { return ( TimeZone ) GMTHolder . INSTANCE . clone ( ) ; } if ( id . equals ( "UTC" ) ) { return ( TimeZone ) UTCHolder . INSTANCE . clone ( ) ; } } // Native time zone ?
TimeZone zone = NativeTimeZone . get ( id ) ; // Custom time zone ?
if ( zone == null && id . length ( ) > 3 && id . startsWith ( "GMT" ) ) { zone = getCustomTimeZone ( id ) ; } // We never return null ; on failure we return the equivalent of " GMT " .
return ( zone != null ) ? zone : ( TimeZone ) GMTHolder . INSTANCE . clone ( ) ; |
public class InputLambdaProcessorUpdateMarshaller { /** * Marshall the given parameter object . */
public void marshall ( InputLambdaProcessorUpdate inputLambdaProcessorUpdate , ProtocolMarshaller protocolMarshaller ) { } } | if ( inputLambdaProcessorUpdate == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( inputLambdaProcessorUpdate . getResourceARNUpdate ( ) , RESOURCEARNUPDATE_BINDING ) ; protocolMarshaller . marshall ( inputLambdaProcessorUpdate . getRoleARNUpdate ( ) , ROLEARNUPDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Filters { /** * Adapts a filter with { @ link URI } base type to a filter with { @ link URIResponse } base type .
* @ param original the original filter .
* @ return the adapted filter . */
public static AbstractFilter < URIResponse > adaptFilterURI2URIResponse ( final Filter < URI > original ) { } } | return new AbstractFilter < URIResponse > ( ) { @ Override public boolean apply ( URIResponse x ) { return original . apply ( x . uri ( ) ) ; } @ Override public String toString ( ) { return original . toString ( ) ; } @ Override public Filter < URIResponse > copy ( ) { return adaptFilterURI2URIResponse ( original . copy ( ) ) ; } } ; |
public class Log4JLogger { /** * Log a message to the Log4j Logger with < code > ERROR < / code > priority . */
public void error ( Object message ) { } } | if ( IS12 ) { getLogger ( ) . log ( FQCN , Level . ERROR , message , null ) ; } else { getLogger ( ) . log ( FQCN , Level . ERROR , message , null ) ; } |
public class JobScheduleEnableHeaders { /** * Set the time at which the resource was last modified .
* @ param lastModified the lastModified value to set
* @ return the JobScheduleEnableHeaders object itself . */
public JobScheduleEnableHeaders withLastModified ( DateTime lastModified ) { } } | if ( lastModified == null ) { this . lastModified = null ; } else { this . lastModified = new DateTimeRfc1123 ( lastModified ) ; } return this ; |
public class FastABOD { /** * Full kernel - based version .
* @ param db Database
* @ param relation Data relation
* @ param ids IDs
* @ param abodvalues Score storage
* @ param minmaxabod Min / max storage */
private void fastABOD ( Database db , Relation < V > relation , DBIDs ids , WritableDoubleDataStore abodvalues , DoubleMinMax minmaxabod ) { } } | // Build a kernel matrix , to make O ( n ^ 3 ) slightly less bad .
SimilarityQuery < V > sq = db . getSimilarityQuery ( relation , kernelFunction ) ; KernelMatrix kernelMatrix = new KernelMatrix ( sq , relation , ids ) ; MeanVariance s = new MeanVariance ( ) ; KNNHeap nn = DBIDUtil . newHeap ( k ) ; for ( DBIDIter pA = ids . iter ( ) ; pA . valid ( ) ; pA . advance ( ) ) { final double simAA = kernelMatrix . getSimilarity ( pA , pA ) ; // Choose the k - min nearest
nn . clear ( ) ; for ( DBIDIter nB = relation . iterDBIDs ( ) ; nB . valid ( ) ; nB . advance ( ) ) { if ( DBIDUtil . equal ( nB , pA ) ) { continue ; } double simBB = kernelMatrix . getSimilarity ( nB , nB ) ; double simAB = kernelMatrix . getSimilarity ( pA , nB ) ; double sqdAB = simAA + simBB - simAB - simAB ; if ( ! ( sqdAB > 0. ) ) { continue ; } nn . insert ( sqdAB , nB ) ; } KNNList nl = nn . toKNNList ( ) ; s . reset ( ) ; DoubleDBIDListIter iB = nl . iter ( ) , iC = nl . iter ( ) ; for ( ; iB . valid ( ) ; iB . advance ( ) ) { double sqdAB = iB . doubleValue ( ) ; double simAB = kernelMatrix . getSimilarity ( pA , iB ) ; if ( ! ( sqdAB > 0. ) ) { continue ; } for ( iC . seek ( iB . getOffset ( ) + 1 ) ; iC . valid ( ) ; iC . advance ( ) ) { double sqdAC = iC . doubleValue ( ) ; double simAC = kernelMatrix . getSimilarity ( pA , iC ) ; if ( ! ( sqdAC > 0. ) ) { continue ; } // Exploit bilinearity of scalar product :
// < B - A , C - A > = < B , C - A > - < A , C - A >
// = < B , C > - < B , A > - < A , C > + < A , A >
double simBC = kernelMatrix . getSimilarity ( iB , iC ) ; double numerator = simBC - simAB - simAC + simAA ; double div = 1. / ( sqdAB * sqdAC ) ; s . put ( numerator * div , FastMath . sqrt ( div ) ) ; } } final double abof = s . getNaiveVariance ( ) ; minmaxabod . put ( abof ) ; abodvalues . putDouble ( pA , abof ) ; } |
public class SimpleFibonacciHeap { /** * ( unfair ) Link y as a child of x . */
private Node < K , V > link ( Node < K , V > y , Node < K , V > x ) { } } | y . parent = x ; Node < K , V > child = x . child ; if ( child == null ) { x . child = y ; y . next = y ; y . prev = y ; } else { y . prev = child ; y . next = child . next ; child . next = y ; y . next . prev = y ; } return x ; |
public class JDBCConnector { /** * Returns an OntopConnection , the main object that a client should use to
* access the query answering services of Quest . With the QuestConnection
* you can get a QuestStatement to execute queries .
* Note , the OntopConnection is not a normal JDBC connection . It is a
* wrapper of one of the N JDBC connections that quest ' s connection pool
* starts on initialization . Calling . close ( ) will not actually close the
* connection , with will just release it back to the pool .
* to close all connections you must call DBConnector . close ( ) . */
@ Override public OntopConnection getConnection ( ) throws OntopConnectionException { } } | return new SQLConnection ( this , queryReformulator , getSQLPoolConnection ( ) , iriDictionary , dbMetadata , inputQueryFactory , termFactory , typeFactory , rdfFactory , settings ) ; |
public class AmazonCloudSearchClient { /** * Configures a suggester for a domain . A suggester enables you to display possible matches before users finish
* typing their queries . When you configure a suggester , you must specify the name of the text field you want to
* search for possible matches and a unique name for the suggester . For more information , see < a
* href = " http : / / docs . aws . amazon . com / cloudsearch / latest / developerguide / getting - suggestions . html "
* target = " _ blank " > Getting Search Suggestions < / a > in the < i > Amazon CloudSearch Developer Guide < / i > .
* @ param defineSuggesterRequest
* Container for the parameters to the < code > < a > DefineSuggester < / a > < / code > operation . Specifies the name of
* the domain you want to update and the suggester configuration .
* @ return Result of the DefineSuggester operation returned by the service .
* @ throws BaseException
* An error occurred while processing the request .
* @ throws InternalException
* An internal error occurred while processing the request . If this problem persists , report an issue from
* the < a href = " http : / / status . aws . amazon . com / " target = " _ blank " > Service Health Dashboard < / a > .
* @ throws LimitExceededException
* The request was rejected because a resource limit has already been met .
* @ throws InvalidTypeException
* The request was rejected because it specified an invalid type definition .
* @ throws ResourceNotFoundException
* The request was rejected because it attempted to reference a resource that does not exist .
* @ sample AmazonCloudSearch . DefineSuggester */
@ Override public DefineSuggesterResult defineSuggester ( DefineSuggesterRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDefineSuggester ( request ) ; |
public class LexiconContextGenerator { /** * Load vi personal names .
* @ param filename the filename */
public static void loadViPersonalNames ( String filename ) { } } | try { FileInputStream in = new FileInputStream ( filename ) ; if ( hsViFamilyNames == null ) { hsViFamilyNames = new HashSet ( ) ; hsViLastNames = new HashSet ( ) ; hsViMiddleNames = new HashSet ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( in , "UTF-8" ) ) ; String line ; while ( ( line = reader . readLine ( ) ) != null ) { line = line . trim ( ) ; if ( line . equals ( "" ) ) continue ; // line = line . toLowerCase ( ) ;
int idxSpace = line . indexOf ( ' ' ) ; int lastIdxSpace = line . lastIndexOf ( ' ' ) ; if ( idxSpace != - 1 ) { String strFamilyName = line . substring ( 0 , idxSpace ) ; hsViFamilyNames . add ( strFamilyName ) ; } if ( ( idxSpace != - 1 ) && ( lastIdxSpace > idxSpace + 1 ) ) { String strMiddleName = line . substring ( idxSpace + 1 , lastIdxSpace - 1 ) ; hsViMiddleNames . add ( strMiddleName ) ; } if ( lastIdxSpace != - 1 ) { String strLastName = line . substring ( lastIdxSpace + 1 , line . length ( ) ) ; hsViLastNames . add ( strLastName ) ; } } in . close ( ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; System . err . print ( e . getMessage ( ) ) ; } |
public class NetFlowV5Parser { /** * < pre >
* | BYTES | CONTENTS | DESCRIPTION |
* | 0-3 | srcaddr | Source IP address |
* | 4-7 | dstaddr | Destination IP address |
* | 8-11 | nexthop | IP address of next hop router |
* | 12-13 | input | SNMP index of input interface |
* | 14-15 | output | SNMP index of output interface |
* | 16-19 | dPkts | Packets in the flow |
* | 20-23 | dOctets | Total number of Layer 3 bytes in the packets of the flow |
* | 24-27 | first | SysUptime at start of flow |
* | 28-31 | last | SysUptime at the time the last packet of the flow was received |
* | 32-33 | srcport | TCP / UDP source port number or equivalent |
* | 34-35 | dstport | TCP / UDP destination port number or equivalent |
* | 36 | pad1 | Unused ( zero ) bytes |
* | 37 | tcp _ flags | Cumulative OR of TCP flags |
* | 38 | prot | IP protocol type ( for example , TCP = 6 ; UDP = 17 ) |
* | 39 | tos | IP type of service ( ToS ) |
* | 40-41 | src _ as | Autonomous system number of the source , either origin or peer |
* | 42-43 | dst _ as | Autonomous system number of the destination , either origin or peer |
* | 44 | src _ mask | Source address prefix mask bits |
* | 45 | dst _ mask | Destination address prefix mask bits |
* | 46-47 | pad2 | Unused ( zero ) bytes |
* < / pre > */
private static NetFlowV5Record parseRecord ( ByteBuf bb ) { } } | final InetAddress srcAddr = ByteBufUtils . readInetAddress ( bb ) ; final InetAddress dstAddr = ByteBufUtils . readInetAddress ( bb ) ; final InetAddress nextHop = ByteBufUtils . readInetAddress ( bb ) ; final int inputIface = bb . readUnsignedShort ( ) ; final int outputIface = bb . readUnsignedShort ( ) ; final long packetCount = bb . readUnsignedInt ( ) ; final long octetCount = bb . readUnsignedInt ( ) ; final long first = bb . readUnsignedInt ( ) ; final long last = bb . readUnsignedInt ( ) ; final int srcPort = bb . readUnsignedShort ( ) ; final int dstPort = bb . readUnsignedShort ( ) ; bb . readByte ( ) ; // unused pad1
final short tcpFlags = bb . readUnsignedByte ( ) ; final short protocol = bb . readUnsignedByte ( ) ; final short tos = bb . readUnsignedByte ( ) ; final int srcAs = bb . readUnsignedShort ( ) ; final int dstAs = bb . readUnsignedShort ( ) ; final short srcMask = bb . readUnsignedByte ( ) ; final short dstMask = bb . readUnsignedByte ( ) ; return NetFlowV5Record . create ( srcAddr , dstAddr , nextHop , inputIface , outputIface , packetCount , octetCount , first , last , srcPort , dstPort , tcpFlags , protocol , tos , srcAs , dstAs , srcMask , dstMask ) ; |
public class nsrpcnode { /** * Use this API to fetch nsrpcnode resources of given names . */
public static nsrpcnode [ ] get ( nitro_service service , String ipaddress [ ] ) throws Exception { } } | if ( ipaddress != null && ipaddress . length > 0 ) { nsrpcnode response [ ] = new nsrpcnode [ ipaddress . length ] ; nsrpcnode obj [ ] = new nsrpcnode [ ipaddress . length ] ; for ( int i = 0 ; i < ipaddress . length ; i ++ ) { obj [ i ] = new nsrpcnode ( ) ; obj [ i ] . set_ipaddress ( ipaddress [ i ] ) ; response [ i ] = ( nsrpcnode ) obj [ i ] . get_resource ( service ) ; } return response ; } return null ; |
public class ParamValidators { /** * build a map of all Validator implementations by their class type and required value */
private static ConcurrentHashMap < Class , List < ParamValidator > > getValidatorsMap ( ) { } } | // use < ConcurrentHashMap > in case validators are added while initializing parameters through < getValidator > method .
ConcurrentHashMap < Class , List < ParamValidator > > map = new ConcurrentHashMap ( ) ; addValidators ( map , ParamValidator . class , new ParamValidator ( true ) , new ParamValidator ( false ) ) ; // default validator
addValidators ( map , FileValidator . class , new FileValidator ( true ) , new FileValidator ( false ) ) ; addValidators ( map , URLValidator . class , new URLValidator ( true ) , new URLValidator ( false ) ) ; addValidators ( map , HEXValidator . class , new HEXValidator ( true ) , new HEXValidator ( false ) ) ; return map ; |
public class ELHelper { /** * This method will process a configuration value for any configuration setting in
* { @ link LdapIdentityStoreDefinition } or { @ link DatabaseIdentityStoreDefinition } that
* is a string and whose name is NOT a " * Expression " . It will first check to see if it
* is a EL expression . It it is , it will return the evaluated expression ; otherwise , it
* will return the literal String .
* @ param name The name of the property . Used for error messages .
* @ param expression The value returned from from the identity store definition , which can
* either be a literal String or an EL expression .
* @ param immediateOnly Return null if the value is a deferred EL expression .
* @ param mask Set whether to mask the expression and result . Useful for when passwords might
* be contained in either the expression or the result .
* @ return The String value . */
@ FFDCIgnore ( ELException . class ) @ Trivial protected String processString ( String name , String expression , boolean immediateOnly , boolean mask ) { } } | final String methodName = "processString" ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , methodName , new Object [ ] { name , ( expression == null ) ? null : mask ? OBFUSCATED_STRING : expression , immediateOnly , mask } ) ; } String result ; boolean immediate = false ; try { Object obj = evaluateElExpression ( expression , mask ) ; if ( obj == null ) { throw new IllegalArgumentException ( "EL expression '" + ( mask ? OBFUSCATED_STRING : expression ) + "' for '" + name + "'evaluated to null." ) ; } else if ( obj instanceof String ) { result = ( String ) obj ; immediate = isImmediateExpression ( expression , mask ) ; } else { throw new IllegalArgumentException ( "Expected '" + name + "' to evaluate to a String value." ) ; } } catch ( ELException e ) { result = expression ; immediate = true ; } String finalResult = ( immediateOnly && ! immediate ) ? null : result ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , methodName , ( finalResult == null ) ? null : mask ? OBFUSCATED_STRING : finalResult ) ; } return finalResult ; |
public class CmsFileBuffer { /** * Gets the contents of this buffer as a byte array . < p >
* @ return the file content */
public byte [ ] getContents ( ) { } } | byte [ ] contents = new byte [ m_buffer . size ( ) ] ; m_buffer . readBytes ( contents , 0 , 0 , m_buffer . size ( ) ) ; return contents ; |
public class XmlUtils { /** * Converts an attribute value representing an xsd : boolean value to a
* boolean using the rules as stated in the XML specification .
* @ param lexicalXSDBoolean The string - value of the boolean
* @ return the boolean value represented by { @ code lexicalXSDBoolean }
* @ throws java . lang . IllegalArgumentException When { @ code lexicalXSDBoolean } does fit
* the lexical space of the XSD boolean datatype */
public static boolean parseBoolean ( String lexicalXSDBoolean ) { } } | final boolean result ; switch ( lexicalXSDBoolean ) { case "true" : case "1" : result = true ; break ; case "false" : case "0" : result = false ; break ; default : throw new IllegalArgumentException ( "'" + lexicalXSDBoolean + "' is not a valid xs:boolean value" ) ; } return result ; |
public class GitLabApiForm { /** * Fluent method for adding a List type query and form parameters to a get ( ) or post ( ) call .
* @ param < T > the type contained by the List
* @ param name the name of the field / attribute to add
* @ param values a List containing the values of the field / attribute to add
* @ param required the field is required flag
* @ return this GitLabAPiForm instance
* @ throws IllegalArgumentException if a required parameter is null or empty */
public < T > GitLabApiForm withParam ( String name , List < T > values , boolean required ) throws IllegalArgumentException { } } | if ( values == null || values . isEmpty ( ) ) { if ( required ) { throw new IllegalArgumentException ( name + " cannot be empty or null" ) ; } return ( this ) ; } for ( T value : values ) { if ( value != null ) { this . param ( name + "[]" , value . toString ( ) ) ; } } return ( this ) ; |
public class HystrixPropertiesStrategy { /** * Construct an implementation of { @ link HystrixThreadPoolProperties } for { @ link HystrixThreadPool } instances with { @ link HystrixThreadPoolKey } .
* < b > Default Implementation < / b >
* Constructs instance of { @ link HystrixPropertiesThreadPoolDefault } .
* @ param threadPoolKey
* { @ link HystrixThreadPoolKey } representing the name or type of { @ link HystrixThreadPool }
* @ param builder
* { @ link com . netflix . hystrix . HystrixThreadPoolProperties . Setter } with default overrides as injected via { @ link HystrixCommand } to the { @ link HystrixThreadPool } implementation .
* The builder will return NULL for each value if no override was provided .
* @ return Implementation of { @ link HystrixThreadPoolProperties } */
public HystrixThreadPoolProperties getThreadPoolProperties ( HystrixThreadPoolKey threadPoolKey , HystrixThreadPoolProperties . Setter builder ) { } } | return new HystrixPropertiesThreadPoolDefault ( threadPoolKey , builder ) ; |
public class CohenKappaAgreement { /** * Computes the maximum possible value of the kappa coefficient for the
* provided study . In case of balanced off - marginals ( i . e . , an equal
* disagreement for each pair of categories ) , the maximum kappa is 1.
* In other cases , it decreases with a higher discrepancy of the
* distribution of disagreements . */
public double calculateMaximumAgreement ( ) { } } | double A_O = calculateMaximumObservedAgreement ( ) ; double A_E = calculateExpectedAgreement ( ) ; if ( A_E == 0.0 ) return A_O ; else return ( A_O - A_E ) / ( 1.0 - A_E ) ; |
public class HadoopArchives { /** * delete the tmp job directory */
private void cleanJobDirectory ( ) { } } | try { FileSystem jobfs = jobDirectory . getFileSystem ( conf ) ; jobfs . delete ( jobDirectory , true ) ; } catch ( IOException ioe ) { LOG . warn ( "Unable to clean tmp directory " + jobDirectory , ioe ) ; } |
public class SipServletMessageImpl { /** * ( non - Javadoc )
* @ see javax . servlet . sip . SipServletMessage # setAcceptLanguage ( java . util . Locale ) */
public void setAcceptLanguage ( Locale locale ) { } } | checkCommitted ( ) ; AcceptLanguageHeader alh = SipFactoryImpl . headerFactory . createAcceptLanguageHeader ( locale ) ; this . message . setHeader ( alh ) ; |
public class Caster { /** * cast a Object to a char value ( primitive value type )
* @ param o Object to cast
* @ param defaultValue
* @ return casted char value */
public static char toCharValue ( Object o , char defaultValue ) { } } | if ( o instanceof Character ) return ( ( Character ) o ) . charValue ( ) ; else if ( o instanceof Boolean ) return ( char ) ( ( ( ( Boolean ) o ) . booleanValue ( ) ) ? 1 : 0 ) ; else if ( o instanceof Double ) return ( char ) ( ( ( Double ) o ) . doubleValue ( ) ) ; else if ( o instanceof Number ) return ( char ) ( ( ( Number ) o ) . doubleValue ( ) ) ; else if ( o instanceof String ) { String str = o . toString ( ) ; if ( str . length ( ) > 0 ) return str . charAt ( 0 ) ; return defaultValue ; } else if ( o instanceof ObjectWrap ) { return toCharValue ( ( ( ObjectWrap ) o ) . getEmbededObject ( toCharacter ( defaultValue ) ) , defaultValue ) ; } else if ( o == null ) return toCharValue ( "" , defaultValue ) ; return defaultValue ; |
public class EthiopicChronology { /** * Obtains a Ethiopic zoned date - time from another date - time object .
* @ param temporal the date - time object to convert , not null
* @ return the Ethiopic zoned date - time , not null
* @ throws DateTimeException if unable to create the date - time */
@ Override @ SuppressWarnings ( "unchecked" ) public ChronoZonedDateTime < EthiopicDate > zonedDateTime ( TemporalAccessor temporal ) { } } | return ( ChronoZonedDateTime < EthiopicDate > ) super . zonedDateTime ( temporal ) ; |
public class CollectionComposer { /** * / * Internal helper methods */
protected void _closeChild ( ) { } } | if ( _child != null ) { Object value = _child . _safeFinish ( ) ; _collection . add ( value ) ; _child = null ; } |
public class AzkabanJobHelper { /** * Get Project Id by an Azkaban Project Name .
* @ param sessionId Session Id .
* @ param azkabanProjectConfig Azkaban Project Config that contains project Name .
* @ return Project Id .
* @ throws IOException */
public static String getProjectId ( String sessionId , AzkabanProjectConfig azkabanProjectConfig ) throws IOException { } } | log . info ( "Getting project Id for project: " + azkabanProjectConfig . getAzkabanProjectName ( ) ) ; String projectId = AzkabanAjaxAPIClient . getProjectId ( sessionId , azkabanProjectConfig ) ; log . info ( "Project id: " + projectId ) ; return projectId ; |
public class SimpleDocTreeVisitor { /** * { @ inheritDoc } This implementation calls { @ code defaultAction } .
* @ param node { @ inheritDoc }
* @ param p { @ inheritDoc }
* @ return the result of { @ code defaultAction } */
@ Override public R visitText ( TextTree node , P p ) { } } | return defaultAction ( node , p ) ; |
public class ResqueDateFormatThreadLocal { /** * NOTE : DateFormats returned from this method are for use by the caller ' s
* thread only .
* @ return a configured DateFormat */
public static DateFormat getInstance ( ) { } } | if ( instance == null ) { synchronized ( instanceLock ) { if ( instance == null ) { instance = new ResqueDateFormatThreadLocal ( ) ; } } } return instance . get ( ) ; |
public class TokenRequest { /** * Executes request for an access token , and returns the HTTP response .
* To execute and parse the response to { @ link TokenResponse } , instead use { @ link # execute ( ) } .
* Callers should call { @ link HttpResponse # disconnect } when the returned HTTP response object is
* no longer needed . However , { @ link HttpResponse # disconnect } does not have to be called if the
* response stream is properly closed . Example usage :
* < pre >
* HttpResponse response = tokenRequest . executeUnparsed ( ) ;
* try {
* process the HTTP response object
* } finally {
* response . disconnect ( ) ;
* < / pre >
* @ return successful access token response , which can then be parsed directly using
* { @ link HttpResponse # parseAs ( Class ) } or some other parsing method
* @ throws TokenResponseException for an error response */
public final HttpResponse executeUnparsed ( ) throws IOException { } } | // must set clientAuthentication as last execute interceptor in case it needs to sign request
HttpRequestFactory requestFactory = transport . createRequestFactory ( new HttpRequestInitializer ( ) { public void initialize ( HttpRequest request ) throws IOException { if ( requestInitializer != null ) { requestInitializer . initialize ( request ) ; } final HttpExecuteInterceptor interceptor = request . getInterceptor ( ) ; request . setInterceptor ( new HttpExecuteInterceptor ( ) { public void intercept ( HttpRequest request ) throws IOException { if ( interceptor != null ) { interceptor . intercept ( request ) ; } if ( clientAuthentication != null ) { clientAuthentication . intercept ( request ) ; } } } ) ; } } ) ; // make request
HttpRequest request = requestFactory . buildPostRequest ( tokenServerUrl , new UrlEncodedContent ( this ) ) ; request . setParser ( new JsonObjectParser ( jsonFactory ) ) ; request . setThrowExceptionOnExecuteError ( false ) ; HttpResponse response = request . execute ( ) ; if ( response . isSuccessStatusCode ( ) ) { return response ; } throw TokenResponseException . from ( jsonFactory , response ) ; |
public class DiskArtifactStore { /** * { @ inheritDoc } */
public Metadata getMetadata ( String path ) throws IOException , MetadataNotFoundException { } } | File file = root ; String [ ] parts = StringUtils . strip ( path , "/" ) . split ( "/" ) ; for ( int i = 0 ; i < parts . length ; i ++ ) { file = new File ( file , parts [ i ] ) ; } file = new File ( file , "maven-metadata.xml" ) ; if ( ! file . isFile ( ) ) { throw new MetadataNotFoundException ( path ) ; } MetadataXpp3Reader reader = new MetadataXpp3Reader ( ) ; InputStream inputStream = null ; try { inputStream = new FileInputStream ( file ) ; return reader . read ( inputStream ) ; } catch ( XmlPullParserException e ) { IOException ioe = new IOException ( e . getMessage ( ) ) ; ioe . initCause ( e ) ; throw ioe ; } finally { IOUtils . closeQuietly ( inputStream ) ; } |
public class SQLiteDelegate { /** * Convenience method for reading all rows in the table of database .
* @ return Collection objects
* @ throws Exception on error */
@ Override public synchronized Collection < T > readAll ( ) throws Exception { } } | Cursor cursor = db . query ( transformer . getTableName ( ) , transformer . getFields ( ) , null , null , null , null , null ) ; Collection < T > list = getAllCursor ( cursor ) ; return list ; |
public class FutureManagementChannel { /** * Open a channel .
* @ param connection the connection
* @ param serviceType the service type
* @ param options the channel options
* @ param deadline time , in ms since the epoch , by which the channel must be created ,
* or { @ code null } if the caller is not imposing a specific deadline .
* Ignored if less than 10s from the current time , with 10s used as the
* default if this is { @ code null }
* @ return the opened channel
* @ throws IOException if there is a remoting problem opening the channel or it cannot be opened in a reasonable amount of time */
final Channel openChannel ( final Connection connection , final String serviceType , final OptionMap options , final Long deadline ) throws IOException { } } | final IoFuture < Channel > futureChannel = connection . openChannel ( serviceType , options ) ; long waitTime = deadline == null ? 10000 : Math . max ( 10000 , deadline - System . currentTimeMillis ( ) ) ; futureChannel . await ( waitTime , TimeUnit . MILLISECONDS ) ; if ( futureChannel . getStatus ( ) == IoFuture . Status . WAITING ) { futureChannel . cancel ( ) ; throw ProtocolLogger . ROOT_LOGGER . channelTimedOut ( ) ; } return futureChannel . get ( ) ; |
public class ForkJoinTask { /** * Returns a new { @ code ForkJoinTask } that performs the { @ code run }
* method of the given { @ code Runnable } as its action , and returns
* the given result upon { @ link # join } .
* @ param runnable the runnable action
* @ param result the result upon completion
* @ return the task */
public static < T > ForkJoinTask < T > adapt ( Runnable runnable , T result ) { } } | return new AdaptedRunnable < T > ( runnable , result ) ; |
public class Sql2o { /** * Creates a { @ link Query }
* @ param query the sql query string
* @ param returnGeneratedKeys boolean value indicating if the database should return any generated keys .
* @ return the { @ link Query } instance
* @ deprecated create queries with { @ link org . sql2o . Connection } class instead , using try - with - resource blocks
* < code >
* try ( Connection con = sql2o . open ( ) ) {
* return sql2o . createQuery ( query , name , returnGeneratedKeys ) . executeAndFetch ( Pojo . class ) ;
* < / code > */
@ Deprecated public Query createQuery ( String query , boolean returnGeneratedKeys ) { } } | return new Connection ( this , true ) . createQuery ( query , returnGeneratedKeys ) ; |
public class StreamSource { /** * Returns an input stream , without freeing the results */
public InputStream openInputStream ( ) throws IOException { } } | StreamSource indirectSource = _indirectSource ; if ( indirectSource != null ) { return indirectSource . openInputStream ( ) ; } TempOutputStream out = _out ; if ( out != null ) { return out . openInputStreamNoFree ( ) ; } // System . err . println ( " OpenInputStream : fail to open input stream for " + this ) ;
throw new IOException ( L . l ( "{0}: no input stream is available" , this ) ) ; |
public class RedirectFilter { /** * The interception method . It just returns a { @ code REDIRECT } result to the computed URI .
* @ param route the route
* @ param context the filter context
* @ return the result
* @ throws Exception if anything bad happen */
@ Override public Result call ( final Route route , final RequestContext context ) throws Exception { } } | URI redirectedURI = rewriteURI ( context . request ( ) ) ; logger . debug ( "Redirecting request - rewriting {} to {}" , context . request ( ) . uri ( ) , redirectedURI ) ; if ( redirectedURI == null ) { return onRewriteFailed ( context ) ; } return Results . redirect ( redirectedURI . toString ( ) ) ; |
public class Container { /** * < p > registerBinder . < / p >
* @ param configuration a { @ link org . glassfish . jersey . server . ResourceConfig } object .
* @ since 0.1.6e */
protected void registerBinder ( ResourceConfig configuration ) { } } | configuration . register ( new AbstractBinder ( ) { @ Override protected void configure ( ) { bind ( Container . this ) . to ( Container . class ) . proxy ( false ) ; } } ) ; configuration . registerInstances ( new ContainerLifecycleListener ( ) { @ Override public void onStartup ( org . glassfish . jersey . server . spi . Container container ) { SystemEventBus . publish ( new StartupEvent ( Container . this , application ) ) ; logger . trace ( Messages . get ( "info.container.startup" ) ) ; } @ Override public void onReload ( org . glassfish . jersey . server . spi . Container container ) { SystemEventBus . publish ( new ReloadedEvent ( Container . this , application ) ) ; logger . trace ( Messages . get ( "info.container.reload" ) ) ; } @ Override public void onShutdown ( org . glassfish . jersey . server . spi . Container container ) { logger . info ( "Container onShutdown" ) ; SystemEventBus . publish ( new ShutdownEvent ( Container . this , application ) ) ; logger . trace ( Messages . get ( "info.container.shutdown" ) ) ; } } ) ; |
public class TileCollidableModel { /** * Called when a collision occurred on a specified axis .
* @ param result The result reference .
* @ param category The collision category reference . */
private void onCollided ( CollisionResult result , CollisionCategory category ) { } } | for ( final TileCollidableListener listener : listeners ) { listener . notifyTileCollided ( result , category ) ; } |
public class ClaimBean { /** * { @ inheritDoc } */
@ Override public String getName ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getName" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getName" , name ) ; } return name ; |
public class CommerceNotificationTemplateWrapper { /** * Returns the localized subject of this commerce notification template in the language , optionally using the default language if no localization exists for the requested language .
* @ param languageId the ID of the language
* @ param useDefault whether to use the default language if no localization exists for the requested language
* @ return the localized subject of this commerce notification template */
@ Override public String getSubject ( String languageId , boolean useDefault ) { } } | return _commerceNotificationTemplate . getSubject ( languageId , useDefault ) ; |
public class MatchCondition { /** * { @ inheritDoc } */
@ Override public Query query ( Schema schema ) { } } | if ( field == null || field . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Field name required" ) ; } if ( value == null || value instanceof String && ( ( String ) value ) . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Field value required" ) ; } ColumnMapperSingle < ? > columnMapper = getMapper ( schema , field ) ; Class < ? > clazz = columnMapper . baseClass ( ) ; Query query ; if ( clazz == String . class ) { String value = ( String ) columnMapper . queryValue ( field , this . value ) ; String analyzedValue = analyze ( field , value , schema ) ; if ( analyzedValue == null ) { throw new IllegalArgumentException ( "Value discarded by analyzer" ) ; } Term term = new Term ( field , analyzedValue ) ; query = new TermQuery ( term ) ; } else if ( clazz == Integer . class ) { Integer value = ( Integer ) columnMapper . queryValue ( field , this . value ) ; query = NumericRangeQuery . newIntRange ( field , value , value , true , true ) ; } else if ( clazz == Long . class ) { Long value = ( Long ) columnMapper . queryValue ( field , this . value ) ; query = NumericRangeQuery . newLongRange ( field , value , value , true , true ) ; } else if ( clazz == Float . class ) { Float value = ( Float ) columnMapper . queryValue ( field , this . value ) ; query = NumericRangeQuery . newFloatRange ( field , value , value , true , true ) ; } else if ( clazz == Double . class ) { Double value = ( Double ) columnMapper . queryValue ( field , this . value ) ; query = NumericRangeQuery . newDoubleRange ( field , value , value , true , true ) ; } else { String message = String . format ( "Match queries are not supported by %s mapper" , clazz . getSimpleName ( ) ) ; throw new UnsupportedOperationException ( message ) ; } query . setBoost ( boost ) ; return query ; |
public class MSPDIReader { /** * Reads the availability table from the file .
* @ param resource MPXJ resource instance
* @ param periods MSPDI availability periods */
private void readAvailabilityTable ( Resource resource , AvailabilityPeriods periods ) { } } | if ( periods != null ) { AvailabilityTable table = resource . getAvailability ( ) ; List < AvailabilityPeriod > list = periods . getAvailabilityPeriod ( ) ; for ( AvailabilityPeriod period : list ) { Date start = period . getAvailableFrom ( ) ; Date end = period . getAvailableTo ( ) ; Number units = DatatypeConverter . parseUnits ( period . getAvailableUnits ( ) ) ; Availability availability = new Availability ( start , end , units ) ; table . add ( availability ) ; } Collections . sort ( table ) ; } |
public class AbstractHttpTransport { /** * Returns the JavaScript code for calling the client - side module name id registration function
* to register name ids for the transport synthetic modules .
* @ return the registration JavaScript or an empty string if no synthetic modules . */
protected String clientRegisterSyntheticModules ( ) { } } | final String methodName = "clientRegisterSyntheticModules" ; // $ NON - NLS - 1 $
boolean traceLogging = log . isLoggable ( Level . FINER ) ; if ( traceLogging ) { log . entering ( sourceClass , methodName ) ; } StringBuffer sb = new StringBuffer ( ) ; Map < String , Integer > map = getModuleIdMap ( ) ; if ( map != null && getModuleIdRegFunctionName ( ) != null ) { Collection < String > names = getSyntheticModuleNames ( ) ; if ( names != null && names . size ( ) > 0 ) { // register the text plugin name ( combo / text ) and name id with the client
sb . append ( getModuleIdRegFunctionName ( ) ) . append ( "([[[" ) ; // $ NON - NLS - 1 $
int i = 0 ; for ( String name : names ) { if ( map . get ( name ) != null ) { sb . append ( i ++ == 0 ? "" : "," ) . append ( "\"" ) . append ( name ) . append ( "\"" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ / / $ NON - NLS - 3 $ / / $ NON - NLS - 4 $
} } sb . append ( "]],[[" ) ; // $ NON - NLS - 1 $
i = 0 ; for ( String name : names ) { Integer id = map . get ( name ) ; if ( id != null ) { sb . append ( i ++ == 0 ? "" : "," ) . append ( id . intValue ( ) ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
} } sb . append ( "]]]);" ) ; // $ NON - NLS - 1 $
} } if ( traceLogging ) { log . exiting ( sourceClass , methodName , sb . toString ( ) ) ; } return sb . toString ( ) ; |
public class DefaultPluginRegistry { /** * Reads the plugin into an object . This method will fail if the plugin is not valid .
* This could happen if the file is not a java archive , or if the plugin spec file is
* missing from the archive , etc . */
protected Plugin readPluginFile ( PluginCoordinates coordinates , File pluginFile ) throws Exception { } } | try { PluginClassLoader pluginClassLoader = createPluginClassLoader ( pluginFile ) ; URL specFile = pluginClassLoader . getResource ( PluginUtils . PLUGIN_SPEC_PATH ) ; if ( specFile == null ) { throw new Exception ( Messages . i18n . format ( "DefaultPluginRegistry.MissingPluginSpecFile" , PluginUtils . PLUGIN_SPEC_PATH ) ) ; // $ NON - NLS - 1 $
} else { PluginSpec spec = PluginUtils . readPluginSpecFile ( specFile ) ; Plugin plugin = new Plugin ( spec , coordinates , pluginClassLoader ) ; // TODO use logger when available
System . out . println ( "Read apiman plugin: " + spec ) ; // $ NON - NLS - 1 $
return plugin ; } } catch ( Exception e ) { throw new Exception ( Messages . i18n . format ( "DefaultPluginRegistry.InvalidPlugin" , pluginFile . getAbsolutePath ( ) ) , e ) ; // $ NON - NLS - 1 $
} |
public class Generators { /** * constructs a day generator that generates dates in the current month that
* fall on one of the given days of the year .
* @ param yearDays elements in [ - 366,366 ] ! = 0 */
static Generator byYearDayGenerator ( int [ ] yearDays , final DateValue dtStart ) { } } | final int [ ] uYearDays = Util . uniquify ( yearDays ) ; return new Generator ( ) { int year = dtStart . year ( ) ; int month = dtStart . month ( ) ; int [ ] dates ; int i = 0 ; { checkMonth ( ) ; } void checkMonth ( ) { // now , calculate the first week of the month
int doyOfMonth1 = TimeUtils . dayOfYear ( year , month , 1 ) ; int nDays = TimeUtils . monthLength ( year , month ) ; int nYearDays = TimeUtils . yearLength ( year ) ; IntSet udates = new IntSet ( ) ; for ( int j = 0 ; j < uYearDays . length ; j ++ ) { int yearDay = uYearDays [ j ] ; if ( yearDay < 0 ) { yearDay += nYearDays + 1 ; } int date = yearDay - doyOfMonth1 ; if ( date >= 1 && date <= nDays ) { udates . add ( date ) ; } } dates = udates . toIntArray ( ) ; } @ Override boolean generate ( DTBuilder builder ) { if ( year != builder . year || month != builder . month ) { year = builder . year ; month = builder . month ; checkMonth ( ) ; i = 0 ; } if ( i >= dates . length ) { return false ; } builder . day = dates [ i ++ ] ; return true ; } @ Override public String toString ( ) { return "byYearDayGenerator" ; } } ; |
public class DSet { /** * Removes from the set the entry whose key matches the supplied key . This should not be called
* directly , instead the associated < code > removeFrom { Set } ( ) < / code > method should be called on
* the distributed object that contains the set in question .
* @ return the old matching entry if found and removed , null if not found . */
protected E removeKey ( Comparable < ? > key ) { } } | // don ' t fail , but generate a warning if we ' re passed a null key
if ( key == null ) { log . warning ( "Requested to remove null key." , new Exception ( ) ) ; return null ; } // look up this entry ' s position in our set
int eidx = ArrayUtil . binarySearch ( _entries , 0 , _size , new SimpleEntry < Comparable < ? > > ( key ) , ENTRY_COMP ) ; // if we found it , remove it
if ( eidx >= 0 ) { // extract the old entry
E oldEntry = _entries [ eidx ] ; _size -- ; if ( ( _entries . length > INITIAL_CAPACITY ) && ( _size < _entries . length / 8 ) ) { // if we ' re using less than 1/8 of our capacity , shrink by half
@ SuppressWarnings ( "unchecked" ) E [ ] newEnts = ( E [ ] ) new Entry [ _entries . length / 2 ] ; System . arraycopy ( _entries , 0 , newEnts , 0 , eidx ) ; System . arraycopy ( _entries , eidx + 1 , newEnts , eidx , _size - eidx ) ; _entries = newEnts ; } else { // shift entries past the removed one downwards
System . arraycopy ( _entries , eidx + 1 , _entries , eidx , _size - eidx ) ; _entries [ _size ] = null ; } _modCount ++ ; return oldEntry ; } else { return null ; } |
public class Compiler { /** * Returns the compiler version baked into the jar . */
@ GwtIncompatible ( "java.util.ResourceBundle" ) public static String getReleaseVersion ( ) { } } | ResourceBundle config = ResourceBundle . getBundle ( CONFIG_RESOURCE ) ; return config . getString ( "compiler.version" ) ; |
public class AllianceApi { /** * Get alliance icon Get the icon urls for a alliance - - - This route expires
* daily at 11:05
* @ param allianceId
* An EVE alliance ID ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ return AllianceIconsResponse
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public AllianceIconsResponse getAlliancesAllianceIdIcons ( Integer allianceId , String datasource , String ifNoneMatch ) throws ApiException { } } | ApiResponse < AllianceIconsResponse > resp = getAlliancesAllianceIdIconsWithHttpInfo ( allianceId , datasource , ifNoneMatch ) ; return resp . getData ( ) ; |
public class typed { /** * Count aggregate function .
* @ since 2.0.0 */
public static < T > TypedColumn < T , Long > count ( MapFunction < T , Object > f ) { } } | return new TypedCount < T > ( f ) . toColumnJava ( ) ; |
public class MethodIdentifier { /** * Construct a new instance using string names for the return and parameter types .
* @ param returnType the return type name
* @ param name the method name
* @ param parameterTypes the method parameter type names
* @ return the identifier */
public static MethodIdentifier getIdentifier ( final String returnType , final String name , final String ... parameterTypes ) { } } | return new MethodIdentifier ( returnType , name , parameterTypes ) ; |
public class EsMarshalling { /** * Unmarshals the given map source into a bean .
* @ param source the source
* @ return the user */
public static UserBean unmarshallUser ( Map < String , Object > source ) { } } | if ( source == null ) { return null ; } UserBean bean = new UserBean ( ) ; bean . setUsername ( asString ( source . get ( "username" ) ) ) ; bean . setEmail ( asString ( source . get ( "email" ) ) ) ; bean . setFullName ( asString ( source . get ( "fullName" ) ) ) ; bean . setJoinedOn ( asDate ( source . get ( "joinedOn" ) ) ) ; postMarshall ( bean ) ; return bean ; |
public class ClassFile { /** * Add a method to this class .
* @ param ret Is null if method returns void .
* @ param params May be null if method accepts no parameters . */
public MethodInfo addMethod ( Modifiers modifiers , String methodName , TypeDesc ret , TypeDesc ... params ) { } } | return addMethod ( modifiers , methodName , null , ret , params ) ; |
public class ListT { /** * / * ( non - Javadoc )
* @ see com . oath . cyclops . types . stream . CyclopsCollectable # collectors ( )
* @ Override
* public Collectable < T > collectors ( ) {
* return this ; */
@ Override public < R > ListT < W , R > unitIterable ( final Iterable < R > it ) { } } | return of ( run . unitIterable ( it ) . map ( i -> ListX . of ( i ) ) ) ; |
public class Parser { /** * 11.4 Unary Operator */
private ParseTree parseUnaryExpression ( ) { } } | SourcePosition start = getTreeStartLocation ( ) ; if ( peekUnaryOperator ( ) ) { Token operator = nextToken ( ) ; ParseTree operand = parseUnaryExpression ( ) ; return new UnaryExpressionTree ( getTreeLocation ( start ) , operator , operand ) ; } else if ( peekAwaitExpression ( ) ) { return parseAwaitExpression ( ) ; } else { return parseUpdateExpression ( ) ; } |
public class MucConfigFormManager { /** * Set the owners of the room .
* @ param newOwners a collection of JIDs to become the new owners of the room .
* @ return a reference to this object .
* @ throws MucConfigurationNotSupportedException if the MUC service does not support this option .
* @ see # MUC _ ROOMCONFIG _ ROOMOWNERS */
public MucConfigFormManager setRoomOwners ( Collection < ? extends Jid > newOwners ) throws MucConfigurationNotSupportedException { } } | if ( ! supportsRoomOwners ( ) ) { throw new MucConfigurationNotSupportedException ( MUC_ROOMCONFIG_ROOMOWNERS ) ; } owners . clear ( ) ; owners . addAll ( newOwners ) ; return this ; |
public class ListServiceActionsResult { /** * An object containing information about the service actions associated with the provisioning artifact .
* @ param serviceActionSummaries
* An object containing information about the service actions associated with the provisioning artifact . */
public void setServiceActionSummaries ( java . util . Collection < ServiceActionSummary > serviceActionSummaries ) { } } | if ( serviceActionSummaries == null ) { this . serviceActionSummaries = null ; return ; } this . serviceActionSummaries = new java . util . ArrayList < ServiceActionSummary > ( serviceActionSummaries ) ; |
public class SymbolType { /** * Builds a symbol for a type variable from a TypeVariable .
* @ param typeVariable The loaded type variable by reflection
* @ return a SymbolType that represents a variable ( for generics )
* @ throws InvalidTypeException when the type cannot be loaded */
public static SymbolType typeVariableOf ( TypeVariable < ? > typeVariable ) throws InvalidTypeException { } } | return valueOf ( typeVariable , null ) . cloneAsTypeVariable ( typeVariable . getName ( ) ) ; |
public class dnsmxrec { /** * Use this API to add dnsmxrec resources . */
public static base_responses add ( nitro_service client , dnsmxrec resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { dnsmxrec addresources [ ] = new dnsmxrec [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { addresources [ i ] = new dnsmxrec ( ) ; addresources [ i ] . domain = resources [ i ] . domain ; addresources [ i ] . mx = resources [ i ] . mx ; addresources [ i ] . pref = resources [ i ] . pref ; addresources [ i ] . ttl = resources [ i ] . ttl ; } result = add_bulk_request ( client , addresources ) ; } return result ; |
public class Logging { /** * Log a message at the ' fine ' debugging level .
* You should check isDebugging ( ) before building the message .
* @ param message Informational log message .
* @ param e Exception */
public void debugFine ( CharSequence message , Throwable e ) { } } | log ( Level . FINE , message , e ) ; |
public class ElemNumber { /** * Convert a long integer into roman numerals .
* @ param val Value to convert .
* @ param prefixesAreOK true _ to enable prefix notation ( e . g . 4 = " IV " ) ,
* false _ to disable prefix notation ( e . g . 4 = " IIII " ) .
* @ return Roman numeral string .
* @ see DecimalToRoman
* @ see m _ romanConvertTable */
protected String long2roman ( long val , boolean prefixesAreOK ) { } } | if ( val <= 0 ) { return getZeroString ( ) ; } String roman = "" ; int place = 0 ; if ( val <= 3999L ) { do { while ( val >= m_romanConvertTable [ place ] . m_postValue ) { roman += m_romanConvertTable [ place ] . m_postLetter ; val -= m_romanConvertTable [ place ] . m_postValue ; } if ( prefixesAreOK ) { if ( val >= m_romanConvertTable [ place ] . m_preValue ) { roman += m_romanConvertTable [ place ] . m_preLetter ; val -= m_romanConvertTable [ place ] . m_preValue ; } } place ++ ; } while ( val > 0 ) ; } else { roman = XSLTErrorResources . ERROR_STRING ; } return roman ; |
public class GridGenerator { /** * Method sets the maximal 3d dimensions to given min and max values . */
public void setDimension ( double minx , double maxx , double miny , double maxy , double minz , double maxz ) { } } | this . minx = minx ; this . maxx = maxx ; this . miny = miny ; this . maxy = maxy ; this . minz = minz ; this . maxz = maxz ; |
public class UcsApi { /** * Assign the interaction to a contact
* @ param id id of the Interaction ( required )
* @ param assignInteractionToContactData ( required )
* @ return ApiSuccessResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiSuccessResponse assignInteractionToContact ( String id , AssignInteractionToContactData assignInteractionToContactData ) throws ApiException { } } | ApiResponse < ApiSuccessResponse > resp = assignInteractionToContactWithHttpInfo ( id , assignInteractionToContactData ) ; return resp . getData ( ) ; |
public class NGAExtensions { /** * Delete the Tile Scaling extension including the extension entries and
* custom tables
* @ param geoPackage
* GeoPackage
* @ since 3.2.0 */
public static void deleteTileScalingExtension ( GeoPackageCore geoPackage ) { } } | TileScalingDao tileScalingDao = geoPackage . getTileScalingDao ( ) ; ExtensionsDao extensionsDao = geoPackage . getExtensionsDao ( ) ; try { if ( tileScalingDao . isTableExists ( ) ) { geoPackage . dropTable ( tileScalingDao . getTableName ( ) ) ; } if ( extensionsDao . isTableExists ( ) ) { extensionsDao . deleteByExtension ( TileTableScaling . EXTENSION_NAME ) ; } } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to delete Tile Scaling extension and table. GeoPackage: " + geoPackage . getName ( ) , e ) ; } |
public class FelixClassLoaderHandler { /** * Adds the bundle .
* @ param bundleWiring
* the bundle wiring
* @ param classLoader
* the classloader
* @ param classpathOrderOut
* the classpath order out
* @ param bundles
* the bundles
* @ param scanSpec
* the scan spec
* @ param log
* the log */
private static void addBundle ( final Object bundleWiring , final ClassLoader classLoader , final ClasspathOrder classpathOrderOut , final Set < Object > bundles , final ScanSpec scanSpec , final LogNode log ) { } } | // Track the bundles we ' ve processed to prevent loops
bundles . add ( bundleWiring ) ; // Get the revision for this wiring
final Object revision = ReflectionUtils . invokeMethod ( bundleWiring , "getRevision" , false ) ; // Get the contents
final Object content = ReflectionUtils . invokeMethod ( revision , "getContent" , false ) ; final String location = content != null ? getContentLocation ( content ) : null ; if ( location != null ) { // Add the bundle object
classpathOrderOut . addClasspathEntry ( location , classLoader , scanSpec , log ) ; // And any embedded content
final List < ? > embeddedContent = ( List < ? > ) ReflectionUtils . invokeMethod ( revision , "getContentPath" , false ) ; if ( embeddedContent != null ) { for ( final Object embedded : embeddedContent ) { if ( embedded != content ) { final String embeddedLocation = embedded != null ? getContentLocation ( embedded ) : null ; if ( embeddedLocation != null ) { classpathOrderOut . addClasspathEntry ( embeddedLocation , classLoader , scanSpec , log ) ; } } } } } |
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getSamplingRatiosRG ( ) { } } | if ( samplingRatiosRGEClass == null ) { samplingRatiosRGEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 432 ) ; } return samplingRatiosRGEClass ; |
public class BasicBinder { /** * Register a Marshaller with the given source and target class .
* The marshaller is used as follows : Instances of the source can be marshalled into the target class .
* @ param source The source ( input ) class
* @ param target The target ( output ) class
* @ param converter The ToMarshaller to be registered
* @ param qualifier The qualifier for which the marshaller must be registered */
public final < S , T > void registerMarshaller ( Class < S > source , Class < T > target , ToMarshaller < S , T > converter , Class < ? extends Annotation > qualifier ) { } } | registerMarshaller ( new ConverterKey < S , T > ( source , target , qualifier == null ? DefaultBinding . class : qualifier ) , converter ) ; |
public class LongBinaryOperatorBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static LongBinaryOperator longBinaryOperatorFrom ( Consumer < LongBinaryOperatorBuilder > buildingFunction ) { } } | LongBinaryOperatorBuilder builder = new LongBinaryOperatorBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class TwitterStreamImpl { /** * / * Streaming API */
@ Override public TwitterStream firehose ( final int count ) { } } | ensureAuthorizationEnabled ( ) ; ensureStatusStreamListenerIsSet ( ) ; startHandler ( new TwitterStreamConsumer ( Mode . status ) { @ Override public StatusStream getStream ( ) throws TwitterException { return getFirehoseStream ( count ) ; } } ) ; return this ; |
public class VarOptItemsSketch { /** * / * The analysis of this case is similar to that of the general heavy case .
* The one small technical difference is that since R < 2 , we must grab an M item
* to have a valid starting point for continue _ by _ growing _ candidate _ set ( ) */
private void updateHeavyREq1 ( final T item , final double weight , final boolean mark ) { } } | assert m_ == 0 ; assert r_ == 1 ; assert ( r_ + h_ ) == k_ ; push ( item , weight , mark ) ; // new item into H
popMinToMRegion ( ) ; // pop lightest back into M
// Any set of two items is downsample - able to one item ,
// so the two lightest items are a valid starting point for the following
final int mSlot = k_ - 1 ; // array is k + 1 , 1 in R , so slot before is M
growCandidateSet ( weights_ . get ( mSlot ) + totalWtR_ , 2 ) ; |
public class DefaultGroovyMethods { /** * Reverse the items in an array . If mutate is true , the original array is modified in place and returned .
* Otherwise , a new array containing the reversed items is produced .
* @ param self an array
* @ param mutate true if the array itself should be reversed in place and returned , false if a new array should be created
* @ return an array containing the reversed items
* @ since 1.8.1 */
@ SuppressWarnings ( "unchecked" ) public static < T > T [ ] reverse ( T [ ] self , boolean mutate ) { } } | if ( ! mutate ) { return ( T [ ] ) toList ( new ReverseListIterator < T > ( Arrays . asList ( self ) ) ) . toArray ( ) ; } List < T > items = Arrays . asList ( self ) ; Collections . reverse ( items ) ; System . arraycopy ( items . toArray ( ) , 0 , self , 0 , items . size ( ) ) ; return self ; |
public class ShapePath { /** * Add an arc to the ShapePath .
* @ param left the X coordinate of the left side of the rectangle containing the arc
* oval .
* @ param top the Y coordinate of the top of the rectangle containing the arc oval .
* @ param right the X coordinate of the right side of the rectangle containing the arc
* oval .
* @ param bottom the Y coordinate of the bottom of the rectangle containing the arc oval .
* @ param startAngle start angle of the arc .
* @ param sweepAngle sweep angle of the arc . */
public void addArc ( float left , float top , float right , float bottom , float startAngle , float sweepAngle ) { } } | PathArcOperation operation = new PathArcOperation ( left , top , right , bottom ) ; operation . startAngle = startAngle ; operation . sweepAngle = sweepAngle ; operations . add ( operation ) ; ArcShadowOperation arcShadowOperation = new ArcShadowOperation ( operation ) ; float endAngle = startAngle + sweepAngle ; // Flip the startAngle and endAngle when drawing the shadow inside the bounds . They represent
// the angles from the center of the circle to the start or end of the arc , respectively . When
// the shadow is drawn inside the arc , it is going the opposite direction .
boolean drawShadowInsideBounds = sweepAngle < 0 ; addShadowCompatOperation ( arcShadowOperation , drawShadowInsideBounds ? ( 180 + startAngle ) % 360 : startAngle , drawShadowInsideBounds ? ( 180 + endAngle ) % 360 : endAngle ) ; endX = ( left + right ) * 0.5f + ( right - left ) / 2 * ( float ) Math . cos ( Math . toRadians ( startAngle + sweepAngle ) ) ; endY = ( top + bottom ) * 0.5f + ( bottom - top ) / 2 * ( float ) Math . sin ( Math . toRadians ( startAngle + sweepAngle ) ) ; |
public class OrchidContextImpl { private < T extends OrchidService > void initializeService ( Class < T > serviceClass , T service ) { } } | services . put ( serviceClass , service ) ; |
public class CmsResourceManager { /** * Loads the requested resource and writes the contents to the response stream . < p >
* @ param req the current HTTP request
* @ param res the current HTTP response
* @ param cms the current OpenCms user context
* @ param resource the requested resource
* @ throws ServletException if something goes wrong
* @ throws IOException if something goes wrong
* @ throws CmsException if something goes wrong */
public void loadResource ( CmsObject cms , CmsResource resource , HttpServletRequest req , HttpServletResponse res ) throws ServletException , IOException , CmsException { } } | res . setContentType ( getMimeType ( resource . getName ( ) , cms . getRequestContext ( ) . getEncoding ( ) ) ) ; I_CmsResourceLoader loader = getLoader ( resource ) ; loader . load ( cms , resource , req , res ) ; |
public class DateTimeZone { /** * Sets the default time zone .
* NOTE : Calling this method does < i > not < / i > set the { @ code java . util . TimeZone } default .
* @ param zone the default datetime zone object , must not be null
* @ throws IllegalArgumentException if the zone is null
* @ throws SecurityException if the application has insufficient security rights */
public static void setDefault ( DateTimeZone zone ) throws SecurityException { } } | SecurityManager sm = System . getSecurityManager ( ) ; if ( sm != null ) { sm . checkPermission ( new JodaTimePermission ( "DateTimeZone.setDefault" ) ) ; } if ( zone == null ) { throw new IllegalArgumentException ( "The datetime zone must not be null" ) ; } cDefault . set ( zone ) ; |
public class IonReaderTextRawX { /** * returns the type of the next value in the stream .
* it calls hasNext to assure that the value has been properly
* started , since hasNext prepares a value as a side effect of
* determining whether or not a value is pending .
* A NoSuchElementException is thrown if there are not values remaining .
* Once called if there is a value available it ' s contents can
* be accessed through the other public API ' s ( such as getLong ( ) ) .
* @ return type of the next value , or null if there is none . */
public IonType next ( ) { } } | if ( ! hasNext ( ) ) { return null ; } if ( _value_type == null && _scanner . isUnfinishedToken ( ) ) { try { token_contents_load ( _scanner . getToken ( ) ) ; } catch ( IOException e ) { throw new IonException ( e ) ; } } _has_next_called = false ; return _value_type ; |
public class ArrayUtils { /** * Returns the last element ( at index 0 ) in the { @ code array } .
* @ param < T > { @ link Class } type of elements in the array .
* @ param array array from which to extract the last element .
* @ param defaultValue default value to return if the given array is { @ literal null } or empty .
* @ return the last element in the array or return the { @ code defaultValue } if the { @ code array }
* is { @ literal null } or empty .
* @ see # getElementAt ( Object [ ] , int , Object ) */
public static < T > T getLast ( T [ ] array , T defaultValue ) { } } | return getElementAt ( array , Math . max ( 0 , nullSafeLength ( array ) - 1 ) , defaultValue ) ; |
public class IntervalFactory { /** * Returns at interval specified by the given start and finish and
* granularities .
* @ param start a { @ link Long } representing the start of the interval . If
* < code > null < / code > , the < code > start < / code > will be unbounded .
* @ param startGran the { @ link Granularity } of the start of the interval .
* The < code > start < / code > parameter ' s interpretation depends on the
* { @ link Granularity } implementation provided .
* @ param finish a { @ link Long } representing the finish of the interval . If
* < code > null < / code > , the < code > finish < / code > will be unbounded .
* @ param finishGran the { @ link Granularity } of the finish of the interval .
* The < code > start < / code > parameter ' s interpretation depends on the
* { @ link Granularity } implementation provided .
* @ return an { @ link Interval } . */
public Interval getInstance ( Long start , Granularity startGran , Long finish , Granularity finishGran ) { } } | List < Object > key = Arrays . asList ( new Object [ ] { start , startGran , finish , finishGran } ) ; Interval result ; synchronized ( cache ) { result = cache . get ( key ) ; if ( result == null ) { if ( start == null || finish == null ) { result = new DefaultInterval ( start , startGran , finish , finishGran ) ; } else { result = new SimpleInterval ( start , startGran , finish , finishGran ) ; } cache . put ( key , result ) ; } } return result ; |
public class ElemLiteralResult { /** * Set a literal result attribute ( used for xsl attributes ) .
* @ param att literal result attribute to add */
public void addLiteralResultAttribute ( String att ) { } } | if ( null == m_xslAttr ) m_xslAttr = new ArrayList ( ) ; m_xslAttr . add ( att ) ; |
public class TupleMRBuilder { /** * Adds an input file associated with a TupleFile .
* A specific " Target Schema " is specified , which should be backwards - compatible with the Schema in the
* Tuple File ( new nullable fields are allowed , not used old fields too ) . */
public void addTupleInput ( Path path , Schema targetSchema , TupleMapper < ITuple , NullWritable > tupleMapper ) { } } | addInput ( path , new TupleInputFormat ( targetSchema ) , tupleMapper ) ; |
public class CmsWidgetDialog { /** * Writes the dialog html code , only if the < code > { @ link # ACTION _ DEFAULT } < / code > is set . < p >
* @ throws JspException if dialog actions fail
* @ throws IOException if writing to the JSP out fails , or in case of errors forwarding to the required result page */
public void writeDialog ( ) throws IOException , JspException { } } | if ( isForwarded ( ) ) { return ; } switch ( getAction ( ) ) { case ACTION_CANCEL : case ACTION_ERROR : case ACTION_SAVE : break ; case ACTION_DEFAULT : default : // ACTION : show dialog ( default )
setParamAction ( DIALOG_SAVE ) ; JspWriter out = getJsp ( ) . getJspContext ( ) . getOut ( ) ; out . print ( defaultActionHtml ( ) ) ; } |
public class CmsSecurityManager { /** * Checks if the specified resource is inside the current project . < p >
* The project " view " is determined by a set of path prefixes .
* If the resource starts with any one of this prefixes , it is considered to
* be " inside " the project . < p >
* @ param context the current request context
* @ param resourcename the specified resource name ( full path )
* @ return < code > true < / code > , if the specified resource is inside the current project */
public boolean isInsideCurrentProject ( CmsRequestContext context , String resourcename ) { } } | boolean result = false ; CmsDbContext dbc = m_dbContextFactory . getDbContext ( context ) ; try { result = m_driverManager . isInsideCurrentProject ( dbc , resourcename ) ; } finally { dbc . clear ( ) ; } return result ; |
public class Tag { /** * Creates the values dictionary . */
public void createValuesDictionary ( ) { } } | tagValueDescriptions = new HashMap < String , String > ( ) ; if ( valueCodes != null && valueDescriptions != null && valueCodes . size ( ) > 0 && valueCodes . size ( ) == valueDescriptions . size ( ) ) { for ( int i = 0 ; i < valueCodes . size ( ) ; i ++ ) { tagValueDescriptions . put ( valueCodes . get ( i ) + "" , valueDescriptions . get ( i ) ) ; } } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < }
* { @ link CmisContentStreamType } { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "contentStream" , scope = CreateDocument . class ) public JAXBElement < CmisContentStreamType > createCreateDocumentContentStream ( CmisContentStreamType value ) { } } | return new JAXBElement < CmisContentStreamType > ( _CreateDocumentContentStream_QNAME , CmisContentStreamType . class , CreateDocument . class , value ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.