signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class KnowledgeBaseMonitoring { /** * Initialize the open mbean metadata */ private void initOpenMBeanInfo ( ) { } }
OpenMBeanAttributeInfoSupport [ ] attributes = new OpenMBeanAttributeInfoSupport [ 4 ] ; OpenMBeanConstructorInfoSupport [ ] constructors = new OpenMBeanConstructorInfoSupport [ 1 ] ; OpenMBeanOperationInfoSupport [ ] operations = new OpenMBeanOperationInfoSupport [ 2 ] ; MBeanNotificationInfo [ ] notifications = new MBeanNotificationInfo [ 0 ] ; try { // Define the attributes attributes [ 0 ] = new OpenMBeanAttributeInfoSupport ( ATTR_ID , "Knowledge Base Id" , SimpleType . STRING , true , false , false ) ; attributes [ 1 ] = new OpenMBeanAttributeInfoSupport ( ATTR_SESSION_COUNT , "Number of created sessions for this Knowledge Base" , SimpleType . LONG , true , false , false ) ; attributes [ 2 ] = new OpenMBeanAttributeInfoSupport ( ATTR_GLOBALS , "List of globals" , globalsTableType , true , false , false ) ; attributes [ 3 ] = new OpenMBeanAttributeInfoSupport ( ATTR_PACKAGES , "List of Packages" , new ArrayType ( 1 , SimpleType . STRING ) , true , false , false ) ; // No arg constructor constructors [ 0 ] = new OpenMBeanConstructorInfoSupport ( "KnowledgeBaseMonitoringMXBean" , "Constructs a KnowledgeBaseMonitoringMXBean instance." , new OpenMBeanParameterInfoSupport [ 0 ] ) ; // Operations OpenMBeanParameterInfo [ ] params = new OpenMBeanParameterInfoSupport [ 0 ] ; operations [ 0 ] = new OpenMBeanOperationInfoSupport ( OP_START_INTERNAL_MBEANS , "Creates, registers and starts all the dependent MBeans that allow monitor all the details in this KnowledgeBase." , params , SimpleType . VOID , MBeanOperationInfo . INFO ) ; operations [ 1 ] = new OpenMBeanOperationInfoSupport ( OP_STOP_INTERNAL_MBEANS , "Stops and disposes all the dependent MBeans that allow monitor all the details in this KnowledgeBase." , params , SimpleType . VOID , MBeanOperationInfo . INFO ) ; // Build the info info = new OpenMBeanInfoSupport ( this . getClass ( ) . getName ( ) , "Knowledge Base Monitor MXBean" , attributes , constructors , operations , notifications ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; }
public class FieldPath { /** * Encodes a list of field name segments in the server - accepted format . */ private String canonicalString ( ) { } }
ImmutableList < String > segments = getSegments ( ) ; StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < segments . size ( ) ; i ++ ) { if ( i > 0 ) { builder . append ( "." ) ; } // Escape backslashes and backticks . String escaped = segments . get ( i ) ; escaped = escaped . replace ( "\\" , "\\\\" ) . replace ( "`" , "\\`" ) ; if ( ! isValidIdentifier ( escaped ) ) { escaped = '`' + escaped + '`' ; } builder . append ( escaped ) ; } return builder . toString ( ) ;
public class HuLuIndexTool { /** * Lists a 1D array to the System console . */ public static void displayArray ( int [ ] array ) { } }
String line = "" ; for ( int f = 0 ; f < array . length ; f ++ ) { line += array [ f ] + " | " ; } logger . debug ( line ) ;
public class JSONObject { /** * Add a { @ link JSONLong } representing the supplied { @ code long } to the { @ code JSONObject } . * @ param key the key to use when storing the value * @ param value the value * @ return { @ code this } ( for chaining ) * @ throws NullPointerException if key is { @ code null } */ public JSONObject putValue ( String key , long value ) { } }
put ( key , JSONLong . valueOf ( value ) ) ; return this ;
public class NodeSet { /** * Insert a node at a given position . * @ param n Node to be added * @ param pos Offset at which the node is to be inserted , * with 0 being the first position . * @ throws RuntimeException thrown if this NodeSet is not of * a mutable type . */ public void insertNode ( Node n , int pos ) { } }
if ( ! m_mutable ) throw new RuntimeException ( XSLMessages . createXPATHMessage ( XPATHErrorResources . ER_NODESET_NOT_MUTABLE , null ) ) ; // " This NodeSet is not mutable ! " ) ; insertElementAt ( n , pos ) ;
public class AbstractStrongCounter { /** * Initializes the weak value . * @ param currentValue The current value . */ private synchronized void initCounterState ( Long currentValue ) { } }
if ( weakCounter == null ) { weakCounter = currentValue == null ? newCounterValue ( configuration ) : newCounterValue ( currentValue , configuration ) ; }
public class AdUnit { /** * Sets the adSenseSettings value for this AdUnit . * @ param adSenseSettings * AdSense specific settings . To overwrite this , set the { @ link * # adSenseSettingsSource } to * { @ link PropertySourceType # DIRECTLY _ SPECIFIED } when * setting the value of this field . */ public void setAdSenseSettings ( com . google . api . ads . admanager . axis . v201811 . AdSenseSettings adSenseSettings ) { } }
this . adSenseSettings = adSenseSettings ;
public class JavadocPopup { protected void initLayout ( ) { } }
setOpaque ( false ) ; setBorder ( BorderFactory . createLineBorder ( Scheme . active ( ) . getWindowBorder ( ) ) ) ; GridBagLayout gridBag = new GridBagLayout ( ) ; JPanel pane = new JPanel ( ) ; pane . addMouseListener ( this ) ; pane . addMouseMotionListener ( this ) ; pane . setLayout ( gridBag ) ; GridBagConstraints c = new GridBagConstraints ( ) ; _viewer = new HtmlViewer ( ) ; _viewer . setText ( _strHelpText ) ; _viewer . setBorder ( BorderFactory . createEmptyBorder ( 0 , 10 , 0 , 10 ) ) ; _viewer . addMouseListener ( this ) ; _viewer . addMouseMotionListener ( this ) ; _scroller = new JScrollPane ( _viewer ) ; _scroller . setBorder ( BorderFactory . createEmptyBorder ( 0 , 0 , 0 , 0 ) ) ; _scroller . setMaximumSize ( calcMaximumViewerSize ( ) ) ; _viewer . setBackground ( Scheme . active ( ) . getTooltipBackground ( ) ) ; c . anchor = GridBagConstraints . CENTER ; c . fill = GridBagConstraints . BOTH ; c . gridx = 0 ; c . gridy = 0 ; c . gridwidth = GridBagConstraints . REMAINDER ; c . gridheight = GridBagConstraints . REMAINDER ; c . weightx = 1 ; c . weighty = 1 ; pane . add ( _scroller , c ) ; _editorKeyListener = new EditorKeyListener ( ) ; add ( pane ) ; addSeparator ( ) ; addMouseListener ( this ) ; addMouseMotionListener ( this ) ;
public class ToastrResourceReference { /** * { @ inheritDoc } */ @ Override public List < HeaderItem > getDependencies ( ) { } }
final List < HeaderItem > dependencies = new ArrayList < HeaderItem > ( ) ; dependencies . add ( CssHeaderItem . forReference ( new CssResourceReference ( ToastrResourceReference . class , "toastr.min.css" ) ) ) ; return dependencies ;
public class AtomixCluster { /** * Builds a cluster service . */ protected static ManagedClusterMembershipService buildClusterMembershipService ( ClusterConfig config , BootstrapService bootstrapService , NodeDiscoveryProvider discoveryProvider , GroupMembershipProtocol membershipProtocol , Version version ) { } }
// If the local node has not be configured , create a default node . Member localMember = Member . builder ( ) . withId ( config . getNodeConfig ( ) . getId ( ) ) . withAddress ( config . getNodeConfig ( ) . getAddress ( ) ) . withHostId ( config . getNodeConfig ( ) . getHostId ( ) ) . withRackId ( config . getNodeConfig ( ) . getRackId ( ) ) . withZoneId ( config . getNodeConfig ( ) . getZoneId ( ) ) . withProperties ( config . getNodeConfig ( ) . getProperties ( ) ) . build ( ) ; return new DefaultClusterMembershipService ( localMember , version , new DefaultNodeDiscoveryService ( bootstrapService , localMember , discoveryProvider ) , bootstrapService , membershipProtocol ) ;
public class ServletHttpResponse { public void addIntHeader ( String name , int value ) { } }
try { _httpResponse . addIntField ( name , value ) ; } catch ( IllegalStateException e ) { LogSupport . ignore ( log , e ) ; }
public class BrokerHelper { /** * Returns an array containing values for all READ / WRITE attributes of the object * based on the specified { @ link org . apache . ojb . broker . metadata . ClassDescriptor } . * < br / > * NOTE : This method doesn ' t do any checks on the specified { @ link org . apache . ojb . broker . metadata . ClassDescriptor } * the caller is reponsible to pass a valid descriptor . * @ param cld The { @ link org . apache . ojb . broker . metadata . ClassDescriptor } to extract the RW - fields * @ param obj The object with target fields to extract . * @ throws MetadataException if there is an erros accessing obj field values */ public ValueContainer [ ] getAllRwValues ( ClassDescriptor cld , Object obj ) throws PersistenceBrokerException { } }
return getValuesForObject ( cld . getAllRwFields ( ) , obj , true ) ;
public class MethodTimer { /** * Function that register metrics . * @ param point * @ return * @ throws Throwable */ @ Around ( "execution(* *(..)) && @annotation(TimerJ)" ) public Object around ( ProceedingJoinPoint point ) throws Throwable { } }
String methodName = MethodSignature . class . cast ( point . getSignature ( ) ) . getMethod ( ) . getName ( ) ; String methodArgs = point . getArgs ( ) . toString ( ) ; MetricRegistry metricRegistry = Metrics . getRegistry ( ) ; Timer timer ; String metricName = "Starting method " + methodName + "at " + System . nanoTime ( ) ; synchronized ( this ) { if ( metricRegistry . getTimers ( ) . containsKey ( methodName ) ) { timer = metricRegistry . getTimers ( ) . get ( metricName ) ; } else { timer = metricRegistry . register ( metricName , new Timer ( ) ) ; } } Timer . Context before = timer . time ( ) ; Object result = point . proceed ( ) ; long timeAfter = before . stop ( ) ; logger . debug ( "Method " + methodName + " with args " + methodArgs + " executed in " + timeAfter + " ns" ) ; return result ;
public class CommerceOrderUtil { /** * Returns the commerce orders before and after the current commerce order in the ordered set where userId = & # 63 ; . * @ param commerceOrderId the primary key of the current commerce order * @ param userId the user ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the previous , current , and next commerce order * @ throws NoSuchOrderException if a commerce order with the primary key could not be found */ public static CommerceOrder [ ] findByUserId_PrevAndNext ( long commerceOrderId , long userId , OrderByComparator < CommerceOrder > orderByComparator ) throws com . liferay . commerce . exception . NoSuchOrderException { } }
return getPersistence ( ) . findByUserId_PrevAndNext ( commerceOrderId , userId , orderByComparator ) ;
public class Rewriter { /** * Make sure attempt isn ' t made to specify an accessor method for fields with multiple fragments , * since each variable needs unique accessors . */ @ Override public void endVisit ( PropertyAnnotation node ) { } }
FieldDeclaration field = ( FieldDeclaration ) node . getParent ( ) ; TypeMirror fieldType = field . getTypeMirror ( ) ; String getter = node . getGetter ( ) ; String setter = node . getSetter ( ) ; if ( field . getFragments ( ) . size ( ) > 1 ) { if ( getter != null ) { ErrorUtil . error ( field , "@Property getter declared for multiple fields" ) ; return ; } if ( setter != null ) { ErrorUtil . error ( field , "@Property setter declared for multiple fields" ) ; return ; } } else { // Check that specified accessors exist . TypeElement enclosingType = TreeUtil . getEnclosingTypeElement ( node ) ; if ( getter != null ) { if ( ElementUtil . findMethod ( enclosingType , getter ) == null ) { ErrorUtil . error ( field , "Non-existent getter specified: " + getter ) ; } } if ( setter != null ) { if ( ElementUtil . findMethod ( enclosingType , setter , TypeUtil . getQualifiedName ( fieldType ) ) == null ) { ErrorUtil . error ( field , "Non-existent setter specified: " + setter ) ; } } }
public class BadRequest { /** * < pre > * Describes all violations in a client request . * < / pre > * < code > repeated . google . rpc . BadRequest . FieldViolation field _ violations = 1 ; < / code > */ public com . google . rpc . BadRequest . FieldViolation getFieldViolations ( int index ) { } }
return fieldViolations_ . get ( index ) ;
public class RowAVLDisk { /** * Used exclusively by Cache to save the row to disk . New implementation in * 1.7.2 writes out only the Node data if the table row data has not * changed . This situation accounts for the majority of invocations as for * each row deleted or inserted , the Nodes for several other rows will * change . */ public void write ( RowOutputInterface out ) { } }
try { writeNodes ( out ) ; if ( hasDataChanged ) { out . writeData ( rowData , tTable . colTypes ) ; out . writeEnd ( ) ; hasDataChanged = false ; } } catch ( IOException e ) { }
public class Element { /** * Sets the position of the Element in 2D . * @ param v * the vertex of the position of the Element */ public void setPosition ( Vector3D v ) { } }
this . x = v . getX ( ) ; this . y = v . getY ( ) ; this . z = v . getZ ( ) ;
public class VarTypePrinter { /** * * * * * * Following from JEP - 286 Types . java * * * * * */ public Type upward ( Type t , List < Type > vars ) { } }
return t . map ( new TypeProjection ( vars ) , true ) ;
public class HBeanReferences { /** * Get a particular type of references identified by propertyName into key value * form . * @ param schemaName */ public static KeyValue getReferenceKeyValue ( byte [ ] rowkey , String propertyName , String schemaName , List < BeanId > refs , UniqueIds uids ) { } }
final byte [ ] pid = uids . getUsid ( ) . getId ( propertyName ) ; final byte [ ] sid = uids . getUsid ( ) . getId ( schemaName ) ; final byte [ ] qual = new byte [ ] { sid [ 0 ] , sid [ 1 ] , pid [ 0 ] , pid [ 1 ] } ; final byte [ ] iids = getIids2 ( refs , uids ) ; return new KeyValue ( rowkey , REF_COLUMN_FAMILY , qual , iids ) ;
public class FastHashMap { /** * Requires special handling during serialization process . * @ param stream the object output stream . * @ throws IOException if an I / O error occurs . */ private void writeObject ( ObjectOutputStream stream ) throws IOException { } }
stream . writeInt ( _capacity ) ; stream . writeInt ( _size ) ; int count = 0 ; EntryImpl < K , V > entry = _mapFirst ; while ( entry != null ) { stream . writeObject ( entry . _key ) ; stream . writeObject ( entry . _value ) ; count ++ ; entry = entry . _after ; } if ( count != _size ) { throw new IOException ( "FastMap Corrupted" ) ; }
public class Util { /** * Creates a slug from a string . * Does not strip markup . * @ param str The string . * @ return The slug for the string . */ public static final String slugify ( final String str ) { } }
StringBuilder buf = new StringBuilder ( ) ; boolean lastWasDash = false ; for ( char ch : str . toLowerCase ( ) . trim ( ) . toCharArray ( ) ) { if ( Character . isLetterOrDigit ( ch ) ) { buf . append ( ch ) ; lastWasDash = false ; } else { if ( ! lastWasDash ) { buf . append ( "-" ) ; lastWasDash = true ; } } } String slug = buf . toString ( ) ; if ( slug . length ( ) == 0 ) { return "" ; } if ( slug . charAt ( 0 ) == '-' ) { slug = slug . substring ( 1 ) ; } if ( slug . length ( ) > 0 && slug . charAt ( slug . length ( ) - 1 ) == '-' ) { slug = slug . substring ( 0 , slug . length ( ) - 1 ) ; } return slug ;
public class AmazonDynamoDBWaiters { /** * Builds a TableNotExists waiter by using custom parameters waiterParameters and other parameters defined in the * waiters specification , and then polls until it determines whether the resource entered the desired state or not , * where polling criteria is bound by either default polling strategy or custom polling strategy . */ public Waiter < DescribeTableRequest > tableNotExists ( ) { } }
return new WaiterBuilder < DescribeTableRequest , DescribeTableResult > ( ) . withSdkFunction ( new DescribeTableFunction ( client ) ) . withAcceptors ( new TableNotExists . IsResourceNotFoundExceptionMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 25 ) , new FixedDelayStrategy ( 20 ) ) ) . withExecutorService ( executorService ) . build ( ) ;
public class CronTriggerImpl { /** * NOT YET IMPLEMENTED : Returns the time before the given time that this < code > CronTrigger < / code > * will fire . */ private Date getTimeBefore ( Date endTime ) { } }
return ( cronEx == null ) ? null : cronEx . getTimeBefore ( endTime ) ;
public class Validator { /** * checks if a bean has been seen before in the dependencyPath . If not , it * resolves the InjectionPoints and adds the resolved beans to the set of * beans to be validated */ private static void reallyValidatePseudoScopedBean ( Bean < ? > bean , BeanManagerImpl beanManager , Set < Object > dependencyPath , Set < Bean < ? > > validatedBeans ) { } }
// see if we have already seen this bean in the dependency path if ( dependencyPath . contains ( bean ) ) { // create a list that shows the path to the bean List < Object > realDependencyPath = new ArrayList < Object > ( dependencyPath ) ; realDependencyPath . add ( bean ) ; throw ValidatorLogger . LOG . pseudoScopedBeanHasCircularReferences ( WeldCollections . toMultiRowString ( realDependencyPath ) ) ; } if ( validatedBeans . contains ( bean ) ) { return ; } dependencyPath . add ( bean ) ; for ( InjectionPoint injectionPoint : bean . getInjectionPoints ( ) ) { if ( ! injectionPoint . isDelegate ( ) ) { dependencyPath . add ( injectionPoint ) ; validatePseudoScopedInjectionPoint ( injectionPoint , beanManager , dependencyPath , validatedBeans ) ; dependencyPath . remove ( injectionPoint ) ; } } if ( bean instanceof DecorableBean < ? > ) { final List < Decorator < ? > > decorators = Reflections . < DecorableBean < ? > > cast ( bean ) . getDecorators ( ) ; if ( ! decorators . isEmpty ( ) ) { for ( final Decorator < ? > decorator : decorators ) { reallyValidatePseudoScopedBean ( decorator , beanManager , dependencyPath , validatedBeans ) ; } } } if ( bean instanceof AbstractProducerBean < ? , ? , ? > && ! ( bean instanceof EEResourceProducerField < ? , ? > ) ) { AbstractProducerBean < ? , ? , ? > producer = ( AbstractProducerBean < ? , ? , ? > ) bean ; if ( ! beanManager . isNormalScope ( producer . getDeclaringBean ( ) . getScope ( ) ) && ! producer . getAnnotated ( ) . isStatic ( ) ) { reallyValidatePseudoScopedBean ( producer . getDeclaringBean ( ) , beanManager , dependencyPath , validatedBeans ) ; } } validatedBeans . add ( bean ) ; dependencyPath . remove ( bean ) ;
public class LNGDoublePriorityQueue { /** * Rescores all priorities by multiplying them with the same factor . * @ param factor the factor to multiply with */ public void rescore ( double factor ) { } }
for ( int i = 0 ; i < this . prior . size ( ) ; i ++ ) this . prior . set ( i , this . prior . get ( i ) * factor ) ;
public class VolumeFromMarshaller { /** * Marshall the given parameter object . */ public void marshall ( VolumeFrom volumeFrom , ProtocolMarshaller protocolMarshaller ) { } }
if ( volumeFrom == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( volumeFrom . getSourceContainer ( ) , SOURCECONTAINER_BINDING ) ; protocolMarshaller . marshall ( volumeFrom . getReadOnly ( ) , READONLY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class MethodIntrospector { /** * Returns a { @ link MethodIntrospector } implementation for the given environment . */ public static MethodIntrospector instance ( ProcessingEnvironment env ) { } }
try { try { return JavacMethodIntrospector . instance ( env ) ; } catch ( LinkageError e ) { return ( MethodIntrospector ) IntrospectorClassLoader . create ( MethodIntrospector . class , env ) . loadClass ( JAVAC_METHOD_INTROSPECTOR ) . getMethod ( "instance" , ProcessingEnvironment . class ) . invoke ( null , env ) ; } } catch ( Exception | LinkageError e ) { return new NoMethodIntrospector ( ) ; }
public class LoggingHelper { /** * Helper method for formatting connection establishment messages . * @ param connectionName * The name of the connection * @ param host * The remote host * @ param connectionReason * The reason for establishing the connection * @ return A formatted message in the format : * " [ & lt ; connectionName & gt ; ] remote host [ & lt ; host & gt ; ] & lt ; connectionReason & gt ; " * < br / > * e . g . [ con1 ] remote host [ 123.123.123.123 ] connection to ECMG . */ public static String formatConnectionEstablishmentMessage ( final String connectionName , final String host , final String connectionReason ) { } }
return CON_ESTABLISHMENT_FORMAT . format ( new Object [ ] { connectionName , host , connectionReason } ) ;
public class JAXBHandle { /** * Returns the unmarshaller that converts a tree data structure * from XML to Java objects . * @ param reusewhether to reuse an existing unmarshaller * @ returnthe unmarshaller for the JAXB context * @ throws JAXBException if unmarshaller initialization fails */ public Unmarshaller getUnmarshaller ( boolean reuse ) throws JAXBException { } }
if ( ! reuse || unmarshaller == null ) { unmarshaller = context . createUnmarshaller ( ) ; } return unmarshaller ;
public class StoreRoutingPlan { /** * Checks if a given partition is stored in the node . * @ param partition * @ param nodeId * @ param cluster * @ param storeDef * @ return true if partition belongs to node for given store */ public static boolean checkPartitionBelongsToNode ( int partition , int nodeId , Cluster cluster , StoreDefinition storeDef ) { } }
List < Integer > nodePartitions = cluster . getNodeById ( nodeId ) . getPartitionIds ( ) ; List < Integer > replicatingPartitions = new RoutingStrategyFactory ( ) . updateRoutingStrategy ( storeDef , cluster ) . getReplicatingPartitionList ( partition ) ; replicatingPartitions . retainAll ( nodePartitions ) ; return replicatingPartitions . size ( ) > 0 ;
public class MySqlConnectionPoolBuilder { /** * Warning - Use only when the connection string is in host : port format without schema and other parameter . * example : mydb . company . com : 3308 * @ param connectionString host : port * @ param username user name for login . */ public static MySqlConnectionPoolBuilder newBuilder ( final String connectionString , final String username ) { } }
final String [ ] arr = connectionString . split ( ":" ) ; final String host = arr [ 0 ] ; final int port = Integer . parseInt ( arr [ 1 ] ) ; return newBuilder ( host , port , username ) ;
public class Channel { /** * Unregister an existing chaincode event listener . * @ param handle Chaincode event listener handle to be unregistered . * @ return True if the chaincode handler was found and removed . * @ throws InvalidArgumentException */ public boolean unregisterChaincodeEventListener ( String handle ) throws InvalidArgumentException { } }
boolean ret ; if ( shutdown ) { throw new InvalidArgumentException ( format ( "Channel %s has been shutdown." , name ) ) ; } checkHandle ( CHAINCODE_EVENTS_TAG , handle ) ; synchronized ( chainCodeListeners ) { ret = null != chainCodeListeners . remove ( handle ) ; } synchronized ( this ) { if ( null != blh && chainCodeListeners . isEmpty ( ) ) { unregisterBlockListener ( blh ) ; blh = null ; } } return ret ;
public class ClassIntrospectorImpl { /** * Returns the annotation of the annotationClass of the clazz or any of it super classes . * @ param clazz * The class to inspect . * @ param annotationClass * Class of the annotation to return * @ return The annotation of annnotationClass if found else null . */ @ Override public < T extends Annotation > T getAnnotation ( Class < T > annotationClass ) { } }
return AnnotationUtils . getAnnotation ( target , annotationClass ) ;
public class COSInputStream { /** * Seek without raising any exception . This is for use in * { @ code finally } clauses * @ param positiveTargetPos a target position which must be positive */ private void seekQuietly ( long positiveTargetPos ) { } }
try { seek ( positiveTargetPos ) ; } catch ( IOException ioe ) { LOG . debug ( "Ignoring IOE on seek of {} to {}" , uri , positiveTargetPos , ioe ) ; }
public class DefaultConfigurationProvider { /** * Saving a map into preferences , using a prefix for the prefs keys * @ since 5.6.5 * @ param pPrefs * @ param pEdit * @ param pMap * @ param pPrefix */ private static void save ( final SharedPreferences pPrefs , final SharedPreferences . Editor pEdit , final Map < String , String > pMap , final String pPrefix ) { } }
for ( final String key : pPrefs . getAll ( ) . keySet ( ) ) { if ( key . startsWith ( pPrefix ) ) { pEdit . remove ( key ) ; } } for ( final Map . Entry < String , String > entry : pMap . entrySet ( ) ) { final String key = pPrefix + entry . getKey ( ) ; pEdit . putString ( key , entry . getValue ( ) ) ; }
public class AbstractObservable { /** * Notify all changes of the observable to all observers only if the observable has changed . * Because of data encapsulation reasons this method is not included within the Observer * interface . * Attention ! This method is not thread safe against changes of the observable because the check if the observable has changed is * done by computing its hash value . Therefore if the observable is a collection and it is changed * while notifying a concurrent modification exception can occur . To avoid this compute the * observable hash yourself by setting a hash generator . * If this method is interrupted a rollback is done by reseting the latestHashValue . Thus the observable * has not changed and false is returned . * Note : In case the given observable is null this notification will be ignored . * @ param source the source of the notification * @ param observable the value which is notified * @ return true if the observable has changed * @ throws MultiException thrown if the notification to at least one observer fails * @ throws CouldNotPerformException thrown if the hash computation fails */ public boolean notifyObservers ( final S source , final T observable ) throws MultiException , CouldNotPerformException { } }
synchronized ( NOTIFICATION_MESSAGE_LOCK ) { long wholeTime = System . currentTimeMillis ( ) ; if ( observable == null ) { LOGGER . debug ( "Skip notification because observable is null!" ) ; return false ; } ExceptionStack exceptionStack = null ; final Map < Observer < S , T > , Future < Void > > notificationFutureList = new HashMap < > ( ) ; final ArrayList < Observer < S , T > > tempObserverList ; try { synchronized ( NOTIFICATION_PROGRESS_LOCK ) { notificationInProgress = true ; } final int observableHash = hashGenerator . computeHash ( observable ) ; if ( unchangedValueFilter && isValueAvailable ( ) && observableHash == latestValueHash ) { LOGGER . debug ( "Skip notification because " + this + " has not been changed!" ) ; return false ; } applyValueUpdate ( observable ) ; final int lastHashValue = latestValueHash ; latestValueHash = observableHash ; synchronized ( OBSERVER_LOCK ) { tempObserverList = new ArrayList < > ( observers ) ; } for ( final Observer < S , T > observer : tempObserverList ) { // skip ongoing notifications if shutdown was initiated or the thread was interrupted . if ( shutdownInitiated && Thread . currentThread ( ) . isInterrupted ( ) ) { latestValueHash = lastHashValue ; return false ; } if ( executorService == null ) { // synchronous notification long time = System . currentTimeMillis ( ) ; try { observer . update ( source , observable ) ; time = System . currentTimeMillis ( ) - time ; if ( time > 500 ) { LOGGER . debug ( "Notification to observer[{}] took: {}ms" , observer , time ) ; } } catch ( InterruptedException ex ) { latestValueHash = lastHashValue ; Thread . currentThread ( ) . interrupt ( ) ; return false ; } catch ( Exception ex ) { // TODO I do not know if this is useful generally , but it helps debugging if invalid service state observers are registered on a unit if ( ex instanceof ClassCastException ) { LOGGER . error ( "Probably defect observer [{}] registered on observable [{}]" , observer , this ) ; } exceptionStack = MultiException . push ( observer , new CouldNotPerformException ( "Observer[" + observer . getClass ( ) . getSimpleName ( ) + "] update failed!" , ex ) , exceptionStack ) ; } } else { // asynchronous notification notificationFutureList . put ( observer , executorService . submit ( ( ) -> { observer . update ( source , observable ) ; return null ; } ) ) ; } } } finally { assert observable != null ; synchronized ( NOTIFICATION_PROGRESS_LOCK ) { notificationInProgress = false ; NOTIFICATION_PROGRESS_LOCK . notifyAll ( ) ; } } // TODO : this check is wrong - > ! = but when implemented correctly leads bco not starting // handle exeception printing for async variant if ( executorService == null ) { for ( final Entry < Observer < S , T > , Future < Void > > notificationFuture : notificationFutureList . entrySet ( ) ) { try { notificationFuture . getValue ( ) . get ( ) ; } catch ( InterruptedException ex ) { Thread . currentThread ( ) . interrupt ( ) ; return true ; } catch ( Exception ex ) { exceptionStack = MultiException . push ( notificationFuture . getKey ( ) , new CouldNotPerformException ( "Observer[" + notificationFuture . getKey ( ) . getClass ( ) . getSimpleName ( ) + "] update failed!" , ex ) , exceptionStack ) ; } } } MultiException . checkAndThrow ( ( ) -> { String stringRep = observable . toString ( ) ; if ( stringRep . length ( ) > 80 ) { stringRep = stringRep . substring ( 0 , 80 ) + " [...]" ; } return "Could not notify Data[" + stringRep + "] to all observer!" ; } , exceptionStack ) ; wholeTime = System . currentTimeMillis ( ) - wholeTime ; if ( wholeTime > 500 ) { LOGGER . debug ( "Notification on observable[{}] took: {}ms" , observable . getClass ( ) . getName ( ) , wholeTime ) ; } return true ; }
public class TransactionImpl { /** * Prepare does the actual work of moving the changes at the object level * into storage ( the underlying rdbms for instance ) . prepare Can be called multiple times , and * does not release locks . * @ throws TransactionAbortedException if the transaction has been aborted * for any reason . * @ throws IllegalStateException Method called if transaction is * not in the proper state to perform this operation * @ throws TransactionNotInProgressException if the transaction is closed . */ protected void prepareCommit ( ) throws TransactionAbortedException , LockNotGrantedException { } }
if ( txStatus == Status . STATUS_MARKED_ROLLBACK ) { throw new TransactionAbortedExceptionOJB ( "Prepare Transaction: tx already marked for rollback" ) ; } if ( txStatus != Status . STATUS_ACTIVE ) { throw new IllegalStateException ( "Prepare Transaction: tx status is not 'active', status is " + TxUtil . getStatusString ( txStatus ) ) ; } try { txStatus = Status . STATUS_PREPARING ; doWriteObjects ( false ) ; txStatus = Status . STATUS_PREPARED ; } catch ( RuntimeException e ) { log . error ( "Could not prepare for commit" , e ) ; txStatus = Status . STATUS_MARKED_ROLLBACK ; throw e ; }
public class CronUtil { /** * 开始 * @ param isDeamon 是否以守护线程方式启动 , 如果为true , 则在调用 { @ link # stop ( ) } 方法后执行的定时任务立即结束 , 否则等待执行完毕才结束 。 */ synchronized public static void start ( boolean isDeamon ) { } }
if ( null == crontabSetting ) { // 尝试查找config / cron . setting setCronSetting ( CRONTAB_CONFIG_PATH ) ; } // 尝试查找cron . setting if ( null == crontabSetting ) { setCronSetting ( CRONTAB_CONFIG_PATH2 ) ; } if ( scheduler . isStarted ( ) ) { throw new UtilException ( "Scheduler has been started, please stop it first!" ) ; } schedule ( crontabSetting ) ; scheduler . start ( isDeamon ) ;
public class JavaURLContext { /** * Returns " java : " * @ return { @ link NamingConstants . JAVA _ NS } */ @ Override public String getNameInNamespace ( ) throws NamingException { } }
return base == null ? NamingConstants . JAVA_NS : base . toString ( ) ;
public class RepositoryApplicationConfiguration { /** * { @ link JpaTenantConfigurationManagement } bean . * @ return a new { @ link TenantConfigurationManagement } */ @ Bean @ ConditionalOnMissingBean TargetManagement targetManagement ( final EntityManager entityManager , final QuotaManagement quotaManagement , final TargetRepository targetRepository , final TargetMetadataRepository targetMetadataRepository , final RolloutGroupRepository rolloutGroupRepository , final DistributionSetRepository distributionSetRepository , final TargetFilterQueryRepository targetFilterQueryRepository , final TargetTagRepository targetTagRepository , final NoCountPagingRepository criteriaNoCountDao , final ApplicationEventPublisher eventPublisher , final BusProperties bus , final TenantAware tenantAware , final AfterTransactionCommitExecutor afterCommit , final VirtualPropertyReplacer virtualPropertyReplacer , final JpaProperties properties ) { } }
return new JpaTargetManagement ( entityManager , quotaManagement , targetRepository , targetMetadataRepository , rolloutGroupRepository , distributionSetRepository , targetFilterQueryRepository , targetTagRepository , criteriaNoCountDao , eventPublisher , bus , tenantAware , afterCommit , virtualPropertyReplacer , properties . getDatabase ( ) ) ;
public class JsonSerializationProcessor { /** * Returns true if the given document should be included in the * serialization . * @ param itemDocument * the document to check * @ return true if the document should be serialized */ private boolean includeDocument ( ItemDocument itemDocument ) { } }
for ( StatementGroup sg : itemDocument . getStatementGroups ( ) ) { // " P19 " is " place of birth " on Wikidata if ( ! "P19" . equals ( sg . getProperty ( ) . getId ( ) ) ) { continue ; } for ( Statement s : sg ) { if ( s . getMainSnak ( ) instanceof ValueSnak ) { Value v = s . getValue ( ) ; // " Q1731 " is " Dresden " on Wikidata if ( v instanceof ItemIdValue && "Q1731" . equals ( ( ( ItemIdValue ) v ) . getId ( ) ) ) { return true ; } } } } return false ;
public class DacGpioProviderBase { /** * Set the shutdown / terminate value that the DAC should apply to the given GPIO pin * when the class is destroyed / terminated . * @ param value the shutdown value to apply to the given pin ( s ) * @ param pin analog output pin ( vararg : one or more pins ) */ public void setShutdownValue ( Number value , Pin ... pin ) { } }
for ( Pin p : pin ) { shutdownValues [ p . getAddress ( ) ] = value . doubleValue ( ) ; }
public class HndlAccVarsRequest { /** * < p > Handle request . < / p > * @ param pReqVars Request scoped variables * @ param pRequestData Request Data * @ throws Exception - an exception */ @ Override public final void handle ( final Map < String , Object > pReqVars , final IRequestData pRequestData ) throws Exception { } }
AccSettings as = srvAccSettings . lazyGetAccSettings ( pReqVars ) ; String curSign ; if ( as . getUseCurrencySign ( ) ) { curSign = as . getCurrency ( ) . getItsSign ( ) ; } else { curSign = " " + as . getCurrency ( ) . getItsName ( ) + " " ; } pReqVars . put ( "quantityDp" , as . getQuantityPrecision ( ) ) ; pReqVars . put ( "priceDp" , as . getPricePrecision ( ) ) ; pReqVars . put ( "costDp" , as . getCostPrecision ( ) ) ; pReqVars . put ( "taxDp" , as . getTaxPrecision ( ) ) ; pReqVars . put ( "reportDp" , as . getBalancePrecision ( ) ) ; pReqVars . put ( "curSign" , curSign ) ; pReqVars . put ( "accSet" , as ) ; String lang = ( String ) pReqVars . get ( "lang" ) ; String langDef = ( String ) pReqVars . get ( "langDef" ) ; if ( lang != null && langDef != null && ! lang . equals ( langDef ) ) { List < I18nAccounting > i18nAccTmp ; List < I18nCurrency > i18nCurTmp ; synchronized ( this ) { if ( this . i18nAccountingList == null ) { try { this . logger . info ( null , HndlAccVarsRequest . class , "Refreshing I18N data..." ) ; this . srvDatabase . setIsAutocommit ( false ) ; this . srvDatabase . setTransactionIsolation ( ISrvDatabase . TRANSACTION_READ_UNCOMMITTED ) ; this . srvDatabase . beginTransaction ( ) ; List < I18nAccounting > i18nac = this . srvOrm . retrieveList ( pReqVars , I18nAccounting . class ) ; List < I18nCurrency > i18ncur = this . srvOrm . retrieveList ( pReqVars , I18nCurrency . class ) ; this . srvDatabase . commitTransaction ( ) ; // assigning fully initialized data : this . i18nAccountingList = i18nac ; this . i18nCurrencyList = i18ncur ; } catch ( Exception ex ) { if ( ! this . srvDatabase . getIsAutocommit ( ) ) { this . srvDatabase . rollBackTransaction ( ) ; } throw ex ; } finally { this . srvDatabase . releaseResources ( ) ; } } i18nAccTmp = this . i18nAccountingList ; i18nCurTmp = this . i18nCurrencyList ; } for ( I18nAccounting i18nAccounting : i18nAccTmp ) { if ( i18nAccounting . getLang ( ) . getItsId ( ) . equals ( lang ) ) { pReqVars . put ( "i18nAccounting" , i18nAccounting ) ; break ; } } for ( I18nCurrency i18nCurrency : i18nCurTmp ) { if ( i18nCurrency . getHasName ( ) . getItsId ( ) . equals ( as . getCurrency ( ) . getItsId ( ) ) && i18nCurrency . getLang ( ) . getItsId ( ) . equals ( lang ) ) { pReqVars . put ( "i18nCurrency" , i18nCurrency ) ; break ; } } } if ( this . additionalI18nReqHndl != null ) { this . additionalI18nReqHndl . handle ( pReqVars , pRequestData ) ; }
public class DBCluster { /** * Provides the list of option group memberships for this DB cluster . * @ return Provides the list of option group memberships for this DB cluster . */ public java . util . List < DBClusterOptionGroupStatus > getDBClusterOptionGroupMemberships ( ) { } }
if ( dBClusterOptionGroupMemberships == null ) { dBClusterOptionGroupMemberships = new com . amazonaws . internal . SdkInternalList < DBClusterOptionGroupStatus > ( ) ; } return dBClusterOptionGroupMemberships ;
public class CellList2TupleFunction { /** * { @ inheritDoc } */ @ Override public Tuple2 < Cells , Cells > apply ( Cells cells ) { } }
Cells keys = cells . getIndexCells ( ) ; Cells values = cells . getValueCells ( ) ; return new Tuple2 < > ( keys , values ) ;
public class PyExpressionGenerator { /** * Generate the given object . * @ param literal the null literal . * @ param it the target for the generated content . * @ param context the context . * @ return the literal . */ @ SuppressWarnings ( "static-method" ) protected XExpression _generate ( XNullLiteral literal , IAppendable it , IExtraLanguageGeneratorContext context ) { } }
appendReturnIfExpectedReturnedExpression ( it , context ) ; it . append ( "None" ) ; // $ NON - NLS - 1 $ return literal ;
public class BarrierBuffer { /** * Blocks the given channel index , from which a barrier has been received . * @ param channelIndex The channel index to block . */ private void onBarrier ( int channelIndex ) throws IOException { } }
if ( ! blockedChannels [ channelIndex ] ) { blockedChannels [ channelIndex ] = true ; numBarriersReceived ++ ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "{}: Received barrier from channel {}." , inputGate . getOwningTaskName ( ) , channelIndex ) ; } } else { throw new IOException ( "Stream corrupt: Repeated barrier for same checkpoint on input " + channelIndex ) ; }
public class CellPosition { /** * CellAddressのインスタンスを作成する 。 * @ param row 行番号 ( 0から始まる ) * @ param column 列番号 ( 0から始まる ) * @ return { @ link CellPosition } のインスタンス * @ throws IllegalArgumentException { @ literal row < 0 | | column < 0} */ public static CellPosition of ( int row , int column ) { } }
ArgUtils . notMin ( row , 0 , "row" ) ; ArgUtils . notMin ( column , 0 , "column" ) ; return new CellPosition ( row , column ) ;
public class DateTimeDialogFragment { /** * < p > Called when the user clicks outside the dialog or presses the < b > Back < / b > * button . < / p > * < p > < b > Note : < / b > Actual < b > Cancel < / b > button clicks are handled by { @ code mCancelButton } ' s * event handler . < / p > */ @ Override public void onCancel ( DialogInterface dialog ) { } }
super . onCancel ( dialog ) ; if ( mListener == null ) { throw new NullPointerException ( "Listener no longer exists in onCancel()" ) ; } mListener . onDateTimeCancel ( ) ;
public class ChannelUtil { /** * Returns a list of { @ link Channel } built from the list of * { @ link Channel . Builder } s * @ param channelBuilders * - list of Channel . Builder to be built . * @ return Collection of { @ link Channel } built from the channelBuilders */ public static Collection < Channel > toChannels ( Collection < Channel . Builder > channelBuilders ) { } }
Collection < Channel > channels = new HashSet < Channel > ( ) ; for ( Channel . Builder builder : channelBuilders ) { channels . add ( builder . build ( ) ) ; } return Collections . unmodifiableCollection ( channels ) ;
public class RaftContext { /** * Compacts the server logs . * @ return a future to be completed once the logs have been compacted */ public CompletableFuture < Void > compact ( ) { } }
ComposableFuture < Void > future = new ComposableFuture < > ( ) ; threadContext . execute ( ( ) -> stateMachine . compact ( ) . whenComplete ( future ) ) ; return future ;
public class Character { /** * Converts the specified character ( Unicode code point ) to its * UTF - 16 representation . If the specified code point is a BMP * ( Basic Multilingual Plane or Plane 0 ) value , the same value is * stored in { @ code dst [ dstIndex ] } , and 1 is returned . If the * specified code point is a supplementary character , its * surrogate values are stored in { @ code dst [ dstIndex ] } * ( high - surrogate ) and { @ code dst [ dstIndex + 1 ] } * ( low - surrogate ) , and 2 is returned . * @ param codePoint the character ( Unicode code point ) to be converted . * @ param dst an array of { @ code char } in which the * { @ code codePoint } ' s UTF - 16 value is stored . * @ param dstIndex the start index into the { @ code dst } * array where the converted value is stored . * @ return 1 if the code point is a BMP code point , 2 if the * code point is a supplementary code point . * @ exception IllegalArgumentException if the specified * { @ code codePoint } is not a valid Unicode code point . * @ exception NullPointerException if the specified { @ code dst } is null . * @ exception IndexOutOfBoundsException if { @ code dstIndex } * is negative or not less than { @ code dst . length } , or if * { @ code dst } at { @ code dstIndex } doesn ' t have enough * array element ( s ) to store the resulting { @ code char } * value ( s ) . ( If { @ code dstIndex } is equal to * { @ code dst . length - 1 } and the specified * { @ code codePoint } is a supplementary character , the * high - surrogate value is not stored in * { @ code dst [ dstIndex ] } . ) * @ since 1.5 */ public static int toChars ( int codePoint , char [ ] dst , int dstIndex ) { } }
if ( isBmpCodePoint ( codePoint ) ) { dst [ dstIndex ] = ( char ) codePoint ; return 1 ; } else if ( isValidCodePoint ( codePoint ) ) { toSurrogates ( codePoint , dst , dstIndex ) ; return 2 ; } else { throw new IllegalArgumentException ( ) ; }
public class MqttMessagingSkeleton { /** * the communication , e . g . a reply message must not be dropped */ private boolean isRequestMessageTypeThatCanBeDropped ( String messageType ) { } }
if ( messageType . equals ( Message . VALUE_MESSAGE_TYPE_REQUEST ) || messageType . equals ( Message . VALUE_MESSAGE_TYPE_ONE_WAY ) ) { return true ; } return false ;
public class PageFlowControlContainerFactory { /** * This is a generic routine that will retrieve a value from the Session through the * StorageHandler . * @ param request * @ param servletContext * @ param name The name of the value to be retrieved * @ return The requested value from the session */ private static Object getSessionVar ( HttpServletRequest request , ServletContext servletContext , String name ) { } }
StorageHandler sh = Handlers . get ( servletContext ) . getStorageHandler ( ) ; HttpServletRequest unwrappedRequest = PageFlowUtils . unwrapMultipart ( request ) ; RequestContext rc = new RequestContext ( unwrappedRequest , null ) ; String attrName = ScopedServletUtils . getScopedSessionAttrName ( name , unwrappedRequest ) ; return sh . getAttribute ( rc , attrName ) ;
public class LearnTool { /** * 增加一个新词到树中 * @ param newWord */ public void addTerm ( NewWord newWord ) { } }
NewWord temp = null ; SmartForest < NewWord > smartForest = null ; if ( ( smartForest = sf . getBranch ( newWord . getName ( ) ) ) != null && smartForest . getParam ( ) != null ) { temp = smartForest . getParam ( ) ; temp . update ( newWord . getNature ( ) , newWord . getAllFreq ( ) ) ; } else { count ++ ; if ( splitWord == null ) { newWord . setScore ( - 1 ) ; } else { newWord . setScore ( - splitWord . cohesion ( newWord . getName ( ) ) ) ; } synchronized ( sf ) { sf . add ( newWord . getName ( ) , newWord ) ; } }
public class HelloDory { /** * Add data to Movies and Actors tables . */ private void addData ( DoradusClient client ) { } }
// Now that the application is created , set the application name in the session so // we don ' t have to call . withParam ( " application " , " HelloSpider " ) for each command . client . setApplication ( "HelloSpider" ) ; // Add a batch of Movies , including links to Actors not yet inserted DBObjectBatch dbObjBatch = DBObjectBatch . builder ( ) . withObject ( DBObject . builder ( ) . withID ( "Spidy1" ) . withValue ( "Name" , "Spider-Man" ) . withValue ( "ReleaseDate" , "2002-05-03" ) . withValue ( "Cancelled" , false ) . withValue ( "Director" , "Sam Raimi" ) . withValues ( "Leads" , "TMaguire" , "KDunst" , "WDafoe" ) . withValue ( "Budget" , 240000000 ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "Spidy2" ) . withValue ( "Name" , "Spider-Man 2" ) . withValue ( "ReleaseDate" , "2004-06-04" ) . withValue ( "Cancelled" , false ) . withValue ( "Director" , "Sam Raimi" ) . withValues ( "Leads" , "TMaguire" , "KDunst" , "AMolina" ) . withValue ( "Budget" , 200000000 ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "Spidy3" ) . withValue ( "Name" , "Spider-Man 3" ) . withValue ( "ReleaseDate" , "2007-04-30" ) . withValue ( "Cancelled" , false ) . withValue ( "Director" , "Sam Raimi" ) . withValues ( "Leads" , "TMaguire" , "KDunst" , "TGrace" ) . withValue ( "Budget" , 258000000 ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "Spidy4" ) . withValue ( "Name" , "Spider-Man 4" ) . withValue ( "Cancelled" , true ) . withValue ( "Director" , "Sam Raimi" ) . withValues ( "Leads" , "TMaguire" , "KDunst" ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "Spidy5" ) . withValue ( "Name" , "The Amazing Spider Man" ) . withValue ( "ReleaseDate" , "2012-06-30" ) . withValue ( "Cancelled" , false ) . withValue ( "Director" , "Marc Webb" ) . withValues ( "Leads" , "AGarfield" , "EStone" , "RIfans" ) . withValue ( "Budget" , 230000000 ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "Spidy6" ) . withValue ( "Name" , "The Amazing Spider Man 2" ) . withValue ( "ReleaseDate" , "2014-05-14" ) . withValue ( "Cancelled" , false ) . withValue ( "Director" , "Marc Webb" ) . withValues ( "Leads" , "AGarfield" , "EStone" , "JFoxx" ) . withValue ( "Budget" , 230000000 ) . build ( ) ) . build ( ) ; Command command = Command . builder ( ) . withName ( "Add" ) . withParam ( "table" , "Movies" ) . withParam ( "batch" , dbObjBatch ) . build ( ) ; RESTResponse response = client . runCommand ( command ) ; if ( response . isFailed ( ) ) { throw new RuntimeException ( "Add batch failed: " + response . getBody ( ) ) ; } // Add a batch of Actors . Note that we don ' t have to set link inverses // because they are automatically inferred from the Movies batch . dbObjBatch = DBObjectBatch . builder ( ) . withObject ( DBObject . builder ( ) . withID ( "TMaguire" ) . withValue ( "FirstName" , "Tobey" ) . withValue ( "LastName" , "Maguire" ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "KDunst" ) . withValue ( "FirstName" , "Kirsten" ) . withValue ( "LastName" , "Dunst" ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "WDafoe" ) . withValue ( "FirstName" , "Willem" ) . withValue ( "LastName" , "Dafoe" ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "AMolina" ) . withValue ( "FirstName" , "Alfred" ) . withValue ( "LastName" , "Molina" ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "TGrace" ) . withValue ( "FirstName" , "Topher" ) . withValue ( "LastName" , "Grace" ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "AGarfield" ) . withValue ( "FirstName" , "Andrew" ) . withValue ( "LastName" , "Garfield" ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "EStone" ) . withValue ( "FirstName" , "Emma" ) . withValue ( "LastName" , "Stone" ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "RIfans" ) . withValue ( "FirstName" , "Rhys" ) . withValue ( "LastName" , "Ifans" ) . build ( ) ) . withObject ( DBObject . builder ( ) . withID ( "JFoxx" ) . withValue ( "FirstName" , "Jamie" ) . withValue ( "LastName" , "Foxx" ) . build ( ) ) . build ( ) ; command = Command . builder ( ) . withName ( "Add" ) . withParam ( "table" , "Actors" ) . withParam ( "batch" , dbObjBatch ) . build ( ) ; response = client . runCommand ( command ) ; if ( response . isFailed ( ) ) { throw new RuntimeException ( "Add batch failed: " + response . getBody ( ) ) ; }
public class ExampleImageStitching { /** * Given two input images create and display an image where the two have been overlayed on top of each other . */ public static < T extends ImageGray < T > > void stitch ( BufferedImage imageA , BufferedImage imageB , Class < T > imageType ) { } }
T inputA = ConvertBufferedImage . convertFromSingle ( imageA , null , imageType ) ; T inputB = ConvertBufferedImage . convertFromSingle ( imageB , null , imageType ) ; // Detect using the standard SURF feature descriptor and describer DetectDescribePoint detDesc = FactoryDetectDescribe . surfStable ( new ConfigFastHessian ( 1 , 2 , 200 , 1 , 9 , 4 , 4 ) , null , null , imageType ) ; ScoreAssociation < BrightFeature > scorer = FactoryAssociation . scoreEuclidean ( BrightFeature . class , true ) ; AssociateDescription < BrightFeature > associate = FactoryAssociation . greedy ( scorer , 2 , true ) ; // fit the images using a homography . This works well for rotations and distant objects . ModelMatcher < Homography2D_F64 , AssociatedPair > modelMatcher = FactoryMultiViewRobust . homographyRansac ( null , new ConfigRansac ( 60 , 3 ) ) ; Homography2D_F64 H = computeTransform ( inputA , inputB , detDesc , associate , modelMatcher ) ; renderStitching ( imageA , imageB , H ) ;
public class Logger { /** * Issue a log message with a level of FATAL using { @ link java . text . MessageFormat } - style formatting . * @ param format the message format string * @ param params the parameters */ public void fatalv ( String format , Object ... params ) { } }
doLog ( Level . FATAL , FQCN , format , params , null ) ;
public class Promise { /** * Blocks until a result is available , or timeout milliseconds have elapsed . Needs to be called with lock held * @ param timeout in ms * @ return An object * @ throws TimeoutException If a timeout occurred ( implies that timeout > 0) */ protected T _getResultWithTimeout ( final long timeout ) throws TimeoutException { } }
if ( timeout <= 0 ) cond . waitFor ( this :: hasResult ) ; else if ( ! cond . waitFor ( this :: hasResult , timeout , TimeUnit . MILLISECONDS ) ) throw new TimeoutException ( ) ; return result ;
public class LMAlgoFactoryDecorator { /** * This method calculates the landmark data for all weightings ( optionally in parallel ) or if already existent loads it . * @ return true if the preparation data for at least one weighting was calculated . * @ see com . graphhopper . routing . ch . CHAlgoFactoryDecorator # prepare ( StorableProperties ) for a very similar method */ public boolean loadOrDoWork ( final StorableProperties properties ) { } }
ExecutorCompletionService completionService = new ExecutorCompletionService < > ( threadPool ) ; int counter = 0 ; final AtomicBoolean prepared = new AtomicBoolean ( false ) ; for ( final PrepareLandmarks plm : preparations ) { counter ++ ; final int tmpCounter = counter ; final String name = AbstractWeighting . weightingToFileName ( plm . getWeighting ( ) , false ) ; completionService . submit ( new Runnable ( ) { @ Override public void run ( ) { if ( plm . loadExisting ( ) ) return ; LOGGER . info ( tmpCounter + "/" + getPreparations ( ) . size ( ) + " calling LM prepare.doWork for " + plm . getWeighting ( ) + " ... (" + getMemInfo ( ) + ")" ) ; prepared . set ( true ) ; Thread . currentThread ( ) . setName ( name ) ; plm . doWork ( ) ; properties . put ( Landmark . PREPARE + "date." + name , createFormatter ( ) . format ( new Date ( ) ) ) ; } } , name ) ; } threadPool . shutdown ( ) ; try { for ( int i = 0 ; i < preparations . size ( ) ; i ++ ) { completionService . take ( ) . get ( ) ; } } catch ( Exception e ) { threadPool . shutdownNow ( ) ; throw new RuntimeException ( e ) ; } return prepared . get ( ) ;
public class DObject { /** * Adds an event listener to this object . The listener will be notified when any events are * dispatched on this object that match their particular listener interface . * < p > Note that the entity adding itself as a listener should have obtained the object * reference by subscribing to it or should be acting on behalf of some other entity that * subscribed to the object , < em > and < / em > that it must be sure to remove itself from the * listener list ( via { @ link # removeListener } ) when it is done because unsubscribing from the * object ( done by whatever entity subscribed in the first place ) is not guaranteed to result * in the listeners added through that subscription being automatically removed ( in most cases , * they definitely will not be removed ) . * @ param listener the listener to be added . * @ param weak if true , retain only a weak reference to the listener ( do not prevent the * listener from being garbage - collected ) . * @ see EventListener * @ see AttributeChangeListener * @ see SetListener * @ see OidListListener */ public void addListener ( ChangeListener listener , boolean weak ) { } }
// only add the listener if they ' re not already there int idx = getListenerIndex ( listener ) ; if ( idx == - 1 ) { _listeners = ListUtil . add ( _listeners , weak ? new WeakReference < Object > ( listener ) : listener ) ; return ; } boolean oweak = _listeners [ idx ] instanceof WeakReference < ? > ; if ( weak == oweak ) { log . warning ( "Refusing repeat listener registration" , "dobj" , which ( ) , "list" , listener , new Exception ( ) ) ; } else { log . warning ( "Updating listener registered under different strength." , "dobj" , which ( ) , "list" , listener , "oweak" , oweak , "nweak" , weak , new Exception ( ) ) ; _listeners [ idx ] = weak ? new WeakReference < Object > ( listener ) : listener ; }
public class ListSecurityProfilesForTargetResult { /** * A list of security profiles and their associated targets . * @ param securityProfileTargetMappings * A list of security profiles and their associated targets . */ public void setSecurityProfileTargetMappings ( java . util . Collection < SecurityProfileTargetMapping > securityProfileTargetMappings ) { } }
if ( securityProfileTargetMappings == null ) { this . securityProfileTargetMappings = null ; return ; } this . securityProfileTargetMappings = new java . util . ArrayList < SecurityProfileTargetMapping > ( securityProfileTargetMappings ) ;
public class PersonViewHolder { /** * Optionally override onSetListeners to add listeners to the views . */ @ Override public void onSetListeners ( ) { } }
imageViewPerson . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { PersonHolderListener listener = getListener ( PersonHolderListener . class ) ; if ( listener != null ) { listener . onPersonImageClicked ( getItem ( ) ) ; } } } ) ;
public class AbstractElement { /** * Sets the value of a property with the added restriction that no other vertex can have that property . * @ param key The key of the unique property to mutate * @ param value The new value of the unique property */ public void propertyUnique ( P key , String value ) { } }
GraphTraversal < Vertex , Vertex > traversal = tx ( ) . getTinkerTraversal ( ) . V ( ) . has ( key . name ( ) , value ) ; if ( traversal . hasNext ( ) ) { Vertex vertex = traversal . next ( ) ; if ( ! vertex . equals ( element ( ) ) || traversal . hasNext ( ) ) { if ( traversal . hasNext ( ) ) vertex = traversal . next ( ) ; throw PropertyNotUniqueException . cannotChangeProperty ( element ( ) , vertex , key , value ) ; } } property ( key , value ) ;
public class PromotionFeedItem { /** * Gets the ordersOverAmount value for this PromotionFeedItem . * @ return ordersOverAmount * Orders over amount . Optional . * Cannot set both ordersOverAmount and promotionCode . */ public com . google . api . ads . adwords . axis . v201809 . cm . MoneyWithCurrency getOrdersOverAmount ( ) { } }
return ordersOverAmount ;
public class Vector { /** * Checks whether this vector compiles with given { @ code predicate } or not . * @ param predicate the vector predicate * @ return whether this vector compiles with predicate */ public boolean is ( VectorPredicate predicate ) { } }
boolean result = true ; VectorIterator it = iterator ( ) ; while ( it . hasNext ( ) ) { double x = it . next ( ) ; int i = it . index ( ) ; result = result && predicate . test ( i , x ) ; } return result ;
public class TemplateDrivenMultiBranchProject { /** * Overrides view initialization to use BranchListView instead of AllView . * < br > * { @ inheritDoc } */ @ Override protected void initViews ( List < View > views ) throws IOException { } }
BranchListView v = new BranchListView ( "All" , this ) ; v . setIncludeRegex ( ".*" ) ; views . add ( v ) ; v . save ( ) ;
public class JsiiRuntime { /** * Starts jsii - server as a child process if it is not already started . */ private void startRuntimeIfNeeded ( ) { } }
if ( childProcess != null ) { return ; } // If JSII _ DEBUG is set , enable traces . String jsiiDebug = System . getenv ( "JSII_DEBUG" ) ; if ( jsiiDebug != null && ! jsiiDebug . isEmpty ( ) && ! jsiiDebug . equalsIgnoreCase ( "false" ) && ! jsiiDebug . equalsIgnoreCase ( "0" ) ) { traceEnabled = true ; } // If JSII _ RUNTIME is set , use it to find the jsii - server executable // otherwise , we default to " jsii - runtime " from PATH . String jsiiRuntimeExecutable = System . getenv ( "JSII_RUNTIME" ) ; if ( jsiiRuntimeExecutable == null ) { jsiiRuntimeExecutable = prepareBundledRuntime ( ) ; } if ( traceEnabled ) { System . err . println ( "jsii-runtime: " + jsiiRuntimeExecutable ) ; } ProcessBuilder pb = new ProcessBuilder ( "node" , jsiiRuntimeExecutable ) ; if ( traceEnabled ) { pb . environment ( ) . put ( "JSII_DEBUG" , "1" ) ; } pb . environment ( ) . put ( "JSII_AGENT" , "Java/" + System . getProperty ( "java.version" ) ) ; try { this . childProcess = pb . start ( ) ; } catch ( IOException e ) { throw new JsiiException ( "Cannot find the 'jsii-runtime' executable (JSII_RUNTIME or PATH)" ) ; } try { OutputStreamWriter stdinStream = new OutputStreamWriter ( this . childProcess . getOutputStream ( ) , "UTF-8" ) ; InputStreamReader stdoutStream = new InputStreamReader ( this . childProcess . getInputStream ( ) , "UTF-8" ) ; InputStreamReader stderrStream = new InputStreamReader ( this . childProcess . getErrorStream ( ) , "UTF-8" ) ; this . stderr = new BufferedReader ( stderrStream ) ; this . stdout = new BufferedReader ( stdoutStream ) ; this . stdin = new BufferedWriter ( stdinStream ) ; handshake ( ) ; this . client = new JsiiClient ( this ) ; // if trace is enabled , start a thread that continuously reads from the child process ' s // STDERR and prints to my STDERR . if ( traceEnabled ) { startPipeErrorStreamThread ( ) ; } } catch ( IOException e ) { throw new JsiiException ( e ) ; }
public class ForkJoinPool { /** * Tries to activate or create a worker if too few are active . */ final void signalWork ( ) { } }
long c ; int u ; while ( ( u = ( int ) ( ( c = ctl ) >>> 32 ) ) < 0 ) { // too few active WorkQueue [ ] ws = workQueues ; int e , i ; WorkQueue w ; Thread p ; if ( ( e = ( int ) c ) > 0 ) { // at least one waiting if ( ws != null && ( i = e & SMASK ) < ws . length && ( w = ws [ i ] ) != null && w . eventCount == ( e | INT_SIGN ) ) { long nc = ( ( ( long ) ( w . nextWait & E_MASK ) ) | ( ( long ) ( u + UAC_UNIT ) << 32 ) ) ; if ( U . compareAndSwapLong ( this , CTL , c , nc ) ) { w . eventCount = ( e + E_SEQ ) & E_MASK ; if ( ( p = w . parker ) != null ) U . unpark ( p ) ; // activate and release break ; } } else break ; } else if ( e == 0 && ( u & SHORT_SIGN ) != 0 ) { // too few total long nc = ( long ) ( ( ( u + UTC_UNIT ) & UTC_MASK ) | ( ( u + UAC_UNIT ) & UAC_MASK ) ) << 32 ; if ( U . compareAndSwapLong ( this , CTL , c , nc ) ) { addWorker ( ) ; break ; } } else break ; }
public class LogRepositoryComponent { /** * Stops repository manager and unregisters LogRepository handler registered * during { @ link # start ( ) } call . This method should be called on server * shutdown . */ public static synchronized void stop ( ) { } }
// WsHandlerManager manager = ManagerAdmin . getWsHandlerManager ( ) ; if ( svSuperPid != null ) { LogRepositoryManager destManager = getManager ( LogRepositoryBaseImpl . LOGTYPE ) ; ( ( LogRepositorySubManagerImpl ) destManager ) . inactivateSubProcess ( ) ; } Logger manager = Logger . getLogger ( "" ) ; if ( binaryHandler != null ) { manager . removeHandler ( binaryHandler ) ; binaryHandler . stop ( ) ; binaryHandler = null ; } if ( textHandler != null ) { manager . removeHandler ( textHandler ) ; textHandler . stop ( ) ; textHandler = null ; } LogRepositorySpaceAlert . getInstance ( ) . stop ( ) ; // 694351
public class FacesContextImplBase { /** * Returns a mutable map of attributes associated with this faces context when * { @ link javax . faces . context . FacesContext . release } is called the map must be cleared ! * Note this map is not associated with the request map the request map still is accessible via the * { @ link javax . faces . context . FacesContext . getExternalContext . getRequestMap } method ! * Also the scope is different to the request map , this map has the scope of the context , and is cleared once the * release method on the context is called ! * Also the map does not cause any events according to the spec ! * @ since JSF 2.0 * @ throws IllegalStateException * if the current context already is released ! */ @ Override public final Map < Object , Object > getAttributes ( ) { } }
assertNotReleased ( ) ; if ( _attributes == null ) { _attributes = new HashMap < Object , Object > ( ) ; } return _attributes ;
public class BTools { /** * public static String getSIntA ( int [ ] intA ) { */ public static String getSIntA ( int ... intA ) { } }
String Info = "" ; if ( intA == null ) return "?" ; if ( intA . length == 0 ) return "?" ; for ( int K = 0 ; K < intA . length ; K ++ ) { Info += ( Info . isEmpty ( ) ) ? "" : ", " ; Info += BTools . getSInt ( intA [ K ] ) ; } return Info ;
public class CharacterRangeImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public NotificationChain basicSetRight ( Keyword newRight , NotificationChain msgs ) { } }
Keyword oldRight = right ; right = newRight ; if ( eNotificationRequired ( ) ) { ENotificationImpl notification = new ENotificationImpl ( this , Notification . SET , XtextPackage . CHARACTER_RANGE__RIGHT , oldRight , newRight ) ; if ( msgs == null ) msgs = notification ; else msgs . add ( notification ) ; } return msgs ;
public class ErlangDistributionTypeImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case BpsimPackage . ERLANG_DISTRIBUTION_TYPE__K : return getK ( ) ; case BpsimPackage . ERLANG_DISTRIBUTION_TYPE__MEAN : return getMean ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class KeyValueLocator { /** * Calculate the vbucket for the given key . * @ param key the key to calculate from . * @ param numPartitions the number of partitions in the bucket . * @ return the calculated partition . */ private static int partitionForKey ( byte [ ] key , int numPartitions ) { } }
CRC32 crc32 = new CRC32 ( ) ; crc32 . update ( key ) ; long rv = ( crc32 . getValue ( ) >> 16 ) & 0x7fff ; return ( int ) rv & numPartitions - 1 ;
public class DatalogConversionTools { /** * TODO : explain */ public DataNode createDataNode ( IntermediateQueryFactory iqFactory , DataAtom dataAtom , Collection < Predicate > tablePredicates ) { } }
if ( tablePredicates . contains ( dataAtom . getPredicate ( ) ) ) { return iqFactory . createExtensionalDataNode ( dataAtom ) ; } return iqFactory . createIntensionalDataNode ( dataAtom ) ;
public class Parser { /** * add : = add ( & lt ; PLUS & gt ; mul | & lt ; MINUS & gt ; mul ) * */ protected AstNode add ( boolean required ) throws ScanException , ParseException { } }
AstNode v = mul ( required ) ; if ( v == null ) { return null ; } while ( true ) { switch ( token . getSymbol ( ) ) { case PLUS : consumeToken ( ) ; v = createAstBinary ( v , mul ( true ) , AstBinary . ADD ) ; break ; case MINUS : consumeToken ( ) ; v = createAstBinary ( v , mul ( true ) , AstBinary . SUB ) ; break ; case EXTENSION : if ( getExtensionHandler ( token ) . getExtensionPoint ( ) == ExtensionPoint . ADD ) { v = getExtensionHandler ( consumeToken ( ) ) . createAstNode ( v , mul ( true ) ) ; break ; } default : return v ; } }
public class AvailableDelegationsInner { /** * Gets all of the available subnet delegations for this subscription in this region . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; AvailableDelegationInner & gt ; object */ public Observable < Page < AvailableDelegationInner > > listNextAsync ( final String nextPageLink ) { } }
return listNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < AvailableDelegationInner > > , Page < AvailableDelegationInner > > ( ) { @ Override public Page < AvailableDelegationInner > call ( ServiceResponse < Page < AvailableDelegationInner > > response ) { return response . body ( ) ; } } ) ;
public class FacebookJsonRestClient { /** * Extracts a URL from a result that consists of a URL only . * For JSON , that result is simply a String . * @ param url * @ return the URL */ protected URL extractURL ( Object url ) throws IOException { } }
if ( ! ( url instanceof String ) ) { return null ; } return ( null == url || "" . equals ( url ) ) ? null : new URL ( ( String ) url ) ;
public class ImageFilter { /** * Tests if the filter should do image filtering / processing . * This default implementation uses { @ link # triggerParams } to test if : * < dl > * < dt > { @ code mTriggerParams = = null } < / dt > * < dd > { @ code return true } < / dd > * < dt > { @ code mTriggerParams ! = null } , loop through parameters , and test * if { @ code pRequest } contains the parameter . If match < / dt > * < dd > { @ code return true } < / dd > * < dt > Otherwise < / dt > * < dd > { @ code return false } < / dd > * < / dl > * @ param pRequest the servlet request * @ return { @ code true } if the filter should do image filtering */ protected boolean trigger ( final ServletRequest pRequest ) { } }
// If triggerParams not set , assume always trigger if ( triggerParams == null ) { return true ; } // Trigger only for certain request parameters for ( String triggerParam : triggerParams ) { if ( pRequest . getParameter ( triggerParam ) != null ) { return true ; } } // Didn ' t trigger return false ;
public class DelegatingHttpEntityMessageConverter { /** * Sets the binaryMediaTypes . * @ param binaryMediaTypes */ public void setBinaryMediaTypes ( List < MediaType > binaryMediaTypes ) { } }
requestMessageConverters . stream ( ) . filter ( converter -> converter instanceof ByteArrayHttpMessageConverter ) . map ( ByteArrayHttpMessageConverter . class :: cast ) . forEach ( converter -> converter . setSupportedMediaTypes ( binaryMediaTypes ) ) ; responseMessageConverters . stream ( ) . filter ( converter -> converter instanceof ByteArrayHttpMessageConverter ) . map ( ByteArrayHttpMessageConverter . class :: cast ) . forEach ( converter -> converter . setSupportedMediaTypes ( binaryMediaTypes ) ) ;
public class MortarScopeDevHelper { /** * Format the scope hierarchy as a multi line string containing the scope names . * Can be given any scope in the hierarchy , will always print the whole scope hierarchy . * Also prints the Dagger modules containing entry points ( injects ) . We ' ve only tested this with * Dagger 1.1.0 , please report any bug you may find . */ public static String scopeHierarchyToString ( MortarScope mortarScope ) { } }
StringBuilder result = new StringBuilder ( "Mortar Hierarchy:\n" ) ; MortarScope rootScope = getRootScope ( mortarScope ) ; Node rootNode = new MortarScopeNode ( rootScope ) ; nodeHierarchyToString ( result , 0 , 0 , rootNode ) ; return result . toString ( ) ;
public class ClassProcessorTask { /** * / * package private */ boolean isAlreadyProcessed ( final CtClass ctClass , final ClassProcessor processor ) { } }
final ClassFile classFile = ctClass . getClassFile ( ) ; AnnotationsAttribute annotationAttribute = null ; for ( final Object attributeObject : classFile . getAttributes ( ) ) { if ( attributeObject instanceof AnnotationsAttribute ) { annotationAttribute = ( AnnotationsAttribute ) attributeObject ; final Annotation annotation = annotationAttribute . getAnnotation ( PROCESSED_ANNOTATION_CLASS ) ; if ( annotation != null ) { final MemberValue value = annotation . getMemberValue ( "value" ) ; _log . debug ( "Existing processed annotation on: " + ctClass . getName ( ) + " = " + value ) ; final ArrayMemberValue valueArray = ( ArrayMemberValue ) value ; for ( final MemberValue processorValue : valueArray . getValue ( ) ) { final StringMemberValue processorValueString = ( StringMemberValue ) processorValue ; if ( processor . getClass ( ) . getName ( ) . equals ( processorValueString . getValue ( ) ) ) { return true ; } } } } } _log . debug ( "No annotation attribute or processed annotation found on: " + ctClass . getName ( ) ) ; return false ;
public class PropertyCollection { /** * Returns an integer property value . * @ param name Property name . * @ param dflt Default value if a property value is not found . * @ return Property value or default value if property value not found . */ public int getValue ( String name , int dflt ) { } }
try { return Integer . parseInt ( getValue ( name , Integer . toString ( dflt ) ) ) ; } catch ( Exception e ) { return dflt ; }
public class WFG9 { /** * WFG9 t2 transformation */ public float [ ] t2 ( float [ ] z , int k ) { } }
float [ ] result = new float [ z . length ] ; for ( int i = 0 ; i < k ; i ++ ) { result [ i ] = ( new Transformations ( ) ) . sDecept ( z [ i ] , ( float ) 0.35 , ( float ) 0.001 , ( float ) 0.05 ) ; } for ( int i = k ; i < z . length ; i ++ ) { result [ i ] = ( new Transformations ( ) ) . sMulti ( z [ i ] , 30 , 95 , ( float ) 0.35 ) ; } return result ;
public class BMMImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . BMM__MM_NAME : return MM_NAME_EDEFAULT == null ? mmName != null : ! MM_NAME_EDEFAULT . equals ( mmName ) ; case AfplibPackage . BMM__TRIPLETS : return triplets != null && ! triplets . isEmpty ( ) ; } return super . eIsSet ( featureID ) ;
public class XBProjector { /** * { @ inheritDoc } */ @ Override @ SuppressWarnings ( "unchecked" ) @ Scope ( DocScope . IO ) public < T > T projectDOMNode ( final Node documentOrElement , final Class < T > projectionInterface ) { } }
ensureIsValidProjectionInterface ( projectionInterface ) ; if ( documentOrElement == null ) { throw new IllegalArgumentException ( "Parameter node must not be null" ) ; } final Map < Class < ? > , Object > mixinsForProjection = mixins . containsKey ( projectionInterface ) ? Collections . unmodifiableMap ( mixins . get ( projectionInterface ) ) : Collections . < Class < ? > , Object > emptyMap ( ) ; final ProjectionInvocationHandler projectionInvocationHandler = new ProjectionInvocationHandler ( XBProjector . this , documentOrElement , projectionInterface , mixinsForProjection , flags . contains ( Flags . TO_STRING_RENDERS_XML ) , flags . contains ( Flags . ABSENT_IS_EMPTY ) ) ; final Set < Class < ? > > interfaces = new HashSet < Class < ? > > ( ) ; interfaces . add ( projectionInterface ) ; interfaces . add ( DOMAccess . class ) ; interfaces . add ( Serializable . class ) ; if ( flags . contains ( Flags . SYNCHRONIZE_ON_DOCUMENTS ) ) { final Document document = DOMHelper . getOwnerDocumentFor ( documentOrElement ) ; InvocationHandler synchronizedInvocationHandler = new InvocationHandler ( ) { @ Override public Object invoke ( final Object proxy , final Method method , final Object [ ] args ) throws Throwable { synchronized ( document ) { return projectionInvocationHandler . invoke ( proxy , method , args ) ; } } } ; return ( ( T ) Proxy . newProxyInstance ( projectionInterface . getClassLoader ( ) , interfaces . toArray ( new Class < ? > [ interfaces . size ( ) ] ) , synchronizedInvocationHandler ) ) ; } return ( ( T ) Proxy . newProxyInstance ( projectionInterface . getClassLoader ( ) , interfaces . toArray ( new Class < ? > [ interfaces . size ( ) ] ) , projectionInvocationHandler ) ) ;
public class CmsHtmlImport { /** * Tests if all given input parameters for the HTML Import are valid , that is that all the * given folders do exist . < p > * @ param fi a file item if a file is uploaded per HTTP otherwise < code > null < / code > * @ param isdefault if this sets , then the destination and input directory can be empty * @ throws CmsIllegalArgumentException if some parameters are not valid */ public void validate ( FileItem fi , boolean isdefault ) throws CmsIllegalArgumentException { } }
// check the input directory and the HTTP upload file if ( fi == null ) { if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( m_inputDir ) && ! isdefault ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_INPUTDIR_1 , m_inputDir ) ) ; } else if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( m_inputDir ) ) { File inputDir = new File ( m_inputDir ) ; if ( ! inputDir . exists ( ) || inputDir . isFile ( ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_INPUTDIR_1 , m_inputDir ) ) ; } } } // check the destination directory try { if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( m_destinationDir ) && ! isdefault ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_DESTDIR_1 , m_destinationDir ) ) ; } else if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( m_destinationDir ) ) { m_cmsObject . readFolder ( m_destinationDir ) ; } } catch ( CmsException e ) { // an exception is thrown if the folder does not exist throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_DESTDIR_1 , m_destinationDir ) , e ) ; } // check the image gallery // only if flag for leaving images at original location is off if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( m_imageGallery ) ) { try { CmsFolder folder = m_cmsObject . readFolder ( m_imageGallery ) ; // check if folder is a image gallery String name = OpenCms . getResourceManager ( ) . getResourceType ( folder . getTypeId ( ) ) . getTypeName ( ) ; if ( ! name . equals ( "imagegallery" ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_IMGGALLERY_INVALID_1 , m_imageGallery ) ) ; } } catch ( CmsException e ) { // an exception is thrown if the folder does not exist throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_IMGGALLERY_1 , m_imageGallery ) , e ) ; } } // check the link gallery // only if flag for leaving external links at original location is off if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( m_linkGallery ) ) { try { CmsFolder folder = m_cmsObject . readFolder ( m_linkGallery ) ; // check if folder is a link gallery String name = OpenCms . getResourceManager ( ) . getResourceType ( folder . getTypeId ( ) ) . getTypeName ( ) ; if ( ! name . equals ( "linkgallery" ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_LINKGALLERY_INVALID_1 , m_linkGallery ) ) ; } } catch ( CmsException e ) { // an exception is thrown if the folder does not exist throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_LINKGALLERY_1 , m_linkGallery ) , e ) ; } } // check the download gallery if ( ( ! isExternal ( m_downloadGallery ) ) && ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( m_downloadGallery ) ) ) { try { CmsFolder folder = m_cmsObject . readFolder ( m_downloadGallery ) ; // check if folder is a download gallery String name = OpenCms . getResourceManager ( ) . getResourceType ( folder . getTypeId ( ) ) . getTypeName ( ) ; if ( ! name . equals ( "downloadgallery" ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_DOWNGALLERY_INVALID_1 , m_downloadGallery ) ) ; } } catch ( CmsException e ) { // an exception is thrown if the folder does not exist throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_DOWNGALLERY_1 , m_downloadGallery ) , e ) ; } } // check the template try { m_cmsObject . readResource ( m_template , CmsResourceFilter . ALL ) ; } catch ( CmsException e ) { // an exception is thrown if the template does not exist if ( ! isValidElement ( ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_TEMPLATE_1 , m_template ) , e ) ; } } // check the element if ( ! isValidElement ( ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_INVALID_ELEM_2 , m_element , m_template ) ) ; } // check if we are in an offline project if ( m_cmsObject . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . GUI_HTMLIMPORT_CONSTRAINT_OFFLINE_0 ) ) ; }
public class AbstractStreamEx { /** * Returns the minimum element of this stream according to the double values * extracted by provided function . This is a special case of a reduction . * This is a terminal operation . * This method is equivalent to * { @ code min ( Comparator . comparingDouble ( keyExtractor ) ) } , but may work * faster as keyExtractor function is applied only once per each input * element . * @ param keyExtractor a < a * href = " package - summary . html # NonInterference " > non - interfering < / a > , * < a href = " package - summary . html # Statelessness " > stateless < / a > * function to extract the double keys from this stream elements * @ return an { @ code Optional } describing the minimum element of this * stream , or an empty { @ code Optional } if the stream is empty * @ throws NullPointerException if the minimum element is null */ public Optional < T > minByDouble ( ToDoubleFunction < ? super T > keyExtractor ) { } }
return Box . asOptional ( reduce ( null , ( ObjDoubleBox < T > acc , T t ) -> { double val = keyExtractor . applyAsDouble ( t ) ; if ( acc == null ) return new ObjDoubleBox < > ( t , val ) ; if ( Double . compare ( val , acc . b ) < 0 ) { acc . b = val ; acc . a = t ; } return acc ; } , ( ObjDoubleBox < T > acc1 , ObjDoubleBox < T > acc2 ) -> ( acc1 == null || acc2 != null && Double . compare ( acc1 . b , acc2 . b ) > 0 ) ? acc2 : acc1 ) ) ;
public class TypeAnnotationPosition { /** * Create a { @ code TypeAnnotationPosition } for a throws clause . * @ param location The type path . * @ param type _ index The index of the exception . */ public static TypeAnnotationPosition methodThrows ( final List < TypePathEntry > location , final int type_index ) { } }
return methodThrows ( location , null , type_index , - 1 ) ;
public class EditsVisitor { /** * Convenience shortcut method to parse a specific token type */ public ShortToken visitShort ( EditsElement e ) throws IOException { } }
return ( ShortToken ) visit ( tokenizer . read ( new ShortToken ( e ) ) ) ;
public class NullAssigner { /** * { @ inheritDoc } */ @ Override public Object newGroupVariable ( final CmdLineCLA group , final Object target , final ICmdLineArg < ? > factoryValueArg ) throws ParseException { } }
return null ;
public class AStar { /** * Set the tool that permits to retreive the orinetation of the segments . * @ param tool the tool for retreiving the orientation of the segments . * @ return the old tool . */ public AStarSegmentOrientation < ST , PT > setSegmentOrientationTool ( AStarSegmentOrientation < ST , PT > tool ) { } }
final AStarSegmentOrientation < ST , PT > old = this . segmentOrientation ; this . segmentOrientation = tool ; return old ;
public class WRowExample { /** * Creates a row containing columns with the given widths . * @ param hgap the horizontal gap between columns , in pixels . * @ param colWidths the percentage widths for each column . * @ return a WRow containing columns with the given widths . */ private WRow createRow ( final int hgap , final int [ ] colWidths ) { } }
WRow row = new WRow ( hgap ) ; for ( int i = 0 ; i < colWidths . length ; i ++ ) { WColumn col = new WColumn ( colWidths [ i ] ) ; WPanel box = new WPanel ( WPanel . Type . BOX ) ; box . add ( new WText ( colWidths [ i ] + "%" ) ) ; col . add ( box ) ; row . add ( col ) ; } return row ;
public class IntIntHashMultiMap { /** * { @ inheritDoc } */ public boolean containsMapping ( int key , int value ) { } }
IntSet s = map . get ( key ) ; return s != null && s . contains ( value ) ;
public class QDate { /** * Gets values based on a field . */ public long get ( int field ) { } }
switch ( field ) { case TIME : return getLocalTime ( ) ; case YEAR : return getYear ( ) ; case MONTH : return getMonth ( ) ; case DAY_OF_MONTH : return getDayOfMonth ( ) ; case DAY : return getDayOfWeek ( ) ; case DAY_OF_WEEK : return getDayOfWeek ( ) ; case HOUR : return getHour ( ) ; case MINUTE : return getMinute ( ) ; case SECOND : return getSecond ( ) ; case MILLISECOND : return getMillisecond ( ) ; case TIME_ZONE : return getZoneOffset ( ) / 1000 ; default : return Long . MAX_VALUE ; }
public class EmbeddedMongoDB { /** * Sets the version for the EmbeddedMongoDB instance * Default is Version . Main . PRODUCTION * @ param version The version to set * @ return EmbeddedMongoDB instance */ public EmbeddedMongoDB withVersion ( Version . Main version ) { } }
Objects . requireNonNull ( version , "version can not be null" ) ; this . version = version ; return this ;
public class InterfaceMeta { /** * Scans this type for { @ link Interface } annotations and creates a native context if possible . * @ param type Any Java type . * @ return The associated { @ link InterfaceMeta } or { @ link # NO _ INTERFACE } if the type does not have a wayland interface * associated with it . */ public static InterfaceMeta get ( final Class < ? > type ) { } }
InterfaceMeta interfaceMeta = INTERFACE_MAP . get ( type ) ; if ( interfaceMeta == null ) { final Interface waylandInterface = type . getAnnotation ( Interface . class ) ; if ( waylandInterface == null ) { interfaceMeta = NO_INTERFACE ; } else { interfaceMeta = create ( waylandInterface . name ( ) , waylandInterface . version ( ) , waylandInterface . methods ( ) , waylandInterface . events ( ) ) ; } INTERFACE_MAP . put ( type , interfaceMeta ) ; } return interfaceMeta ;
public class MagicMimeEntry { /** * Match long . * @ param bbuf the bbuf * @ param bo the bo * @ param needMask the need mask * @ param lMask the l mask * @ return true , if successful * @ throws IOException Signals that an I / O exception has occurred . */ private boolean matchLong ( final ByteBuffer bbuf , final ByteOrder bo , final boolean needMask , final long lMask ) throws IOException { } }
bbuf . order ( bo ) ; long got ; final String testContent = getContent ( ) ; if ( testContent . startsWith ( "0x" ) ) { got = Long . parseLong ( testContent . substring ( 2 ) , 16 ) ; } else if ( testContent . startsWith ( "&" ) ) { got = Long . parseLong ( testContent . substring ( 3 ) , 16 ) ; } else { got = Long . parseLong ( testContent ) ; } long found = bbuf . getInt ( ) ; if ( needMask ) { found = ( short ) ( found & lMask ) ; } if ( got != found ) { return false ; } return true ;