signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class CommerceTaxFixedRateAddressRelLocalServiceWrapper { /** * Creates a new commerce tax fixed rate address rel with the primary key . Does not add the commerce tax fixed rate address rel to the database . * @ param commerceTaxFixedRateAddressRelId the primary key for the new commerce tax fixed rate address rel * @ return the new commerce tax fixed rate address rel */ @ Override public com . liferay . commerce . tax . engine . fixed . model . CommerceTaxFixedRateAddressRel createCommerceTaxFixedRateAddressRel ( long commerceTaxFixedRateAddressRelId ) { } }
return _commerceTaxFixedRateAddressRelLocalService . createCommerceTaxFixedRateAddressRel ( commerceTaxFixedRateAddressRelId ) ;
public class ImageLoader { /** * Tries to load image from specified file . * @ param file the image file * @ return loaded Image . * @ throws ImageLoaderException if no image could be loaded from the file . * @ since 1.0 */ public static BufferedImage loadImage ( File file ) { } }
try { BufferedImage bimg = ImageIO . read ( file ) ; if ( bimg == null ) { throw new ImageLoaderException ( "Could not load Image! ImageIO.read() returned null." ) ; } return bimg ; } catch ( IOException e ) { throw new ImageLoaderException ( e ) ; }
public class NodePropertiesSummaryMarshaller { /** * Marshall the given parameter object . */ public void marshall ( NodePropertiesSummary nodePropertiesSummary , ProtocolMarshaller protocolMarshaller ) { } }
if ( nodePropertiesSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( nodePropertiesSummary . getIsMainNode ( ) , ISMAINNODE_BINDING ) ; protocolMarshaller . marshall ( nodePropertiesSummary . getNumNodes ( ) , NUMNODES_BINDING ) ; protocolMarshaller . marshall ( nodePropertiesSummary . getNodeIndex ( ) , NODEINDEX_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DescribeWorkspacesConnectionStatusResult { /** * Information about the connection status of the WorkSpace . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setWorkspacesConnectionStatus ( java . util . Collection ) } or * { @ link # withWorkspacesConnectionStatus ( java . util . Collection ) } if you want to override the existing values . * @ param workspacesConnectionStatus * Information about the connection status of the WorkSpace . * @ return Returns a reference to this object so that method calls can be chained together . */ public DescribeWorkspacesConnectionStatusResult withWorkspacesConnectionStatus ( WorkspaceConnectionStatus ... workspacesConnectionStatus ) { } }
if ( this . workspacesConnectionStatus == null ) { setWorkspacesConnectionStatus ( new com . amazonaws . internal . SdkInternalList < WorkspaceConnectionStatus > ( workspacesConnectionStatus . length ) ) ; } for ( WorkspaceConnectionStatus ele : workspacesConnectionStatus ) { this . workspacesConnectionStatus . add ( ele ) ; } return this ;
public class FetcherFactory { /** * 获取抓取器实例 , 记得释放资源 , 它依赖Conf模块 */ public static FetcherMgr getFetcherMgr ( ) throws Exception { } }
if ( ! ConfigMgr . isInit ( ) ) { throw new Exception ( "ConfigMgr should be init before FetcherFactory.getFetcherMgr" ) ; } // 获取一个默认的抓取器 RestfulMgr restfulMgr = RestfulFactory . getRestfulMgrNomal ( ) ; FetcherMgr fetcherMgr = new FetcherMgrImpl ( restfulMgr , DisClientConfig . getInstance ( ) . CONF_SERVER_URL_RETRY_TIMES , DisClientConfig . getInstance ( ) . confServerUrlRetrySleepSeconds , DisClientConfig . getInstance ( ) . enableLocalDownloadDirInClassPath , DisClientConfig . getInstance ( ) . userDefineDownloadDir , DisClientSysConfig . getInstance ( ) . LOCAL_DOWNLOAD_DIR , DisClientConfig . getInstance ( ) . getHostList ( ) ) ; return fetcherMgr ;
public class OmsVectorWriter { /** * Fast write access mode . * @ param path the vector file path . * @ param featureCollection the { @ link FeatureCollection } to write . * @ throws IOException */ public static void writeVector ( String path , SimpleFeatureCollection featureCollection ) throws IOException { } }
OmsVectorWriter writer = new OmsVectorWriter ( ) ; writer . file = path ; writer . inVector = featureCollection ; writer . process ( ) ;
public class TopicProducerSpringProvider { /** * 发送kafka消息 ( 可选择是否异步发送 ) * @ param topicName * @ param message * @ param asynSend 是否异步发送 * @ return */ public boolean publish ( String topicName , DefaultMessage message , boolean asynSend ) { } }
if ( routeEnv != null ) topicName = routeEnv + "." + topicName ; return producer . publish ( topicName , message , asynSend ) ;
public class RuleSessionImpl { /** * / * ( non - Javadoc ) * @ see nz . co . senanque . rules . RuleSession # exclude ( nz . co . senanque . validationengine . ProxyField , java . lang . String , nz . co . senanque . rules . RuleContext ) */ public void exclude ( RuleProxyField ruleProxyField , String key , RuleContext ruleContext ) { } }
if ( key . equals ( ruleProxyField . getValue ( ) ) ) // this does not match when it should { String message = m_messageSourceAccessor . getMessage ( "nz.co.senanque.rules.invalid.exclude" , new Object [ ] { ruleProxyField . getPropertyMetadata ( ) . getLabelName ( ) , key } ) ; throw new InferenceException ( message ) ; } s_log . debug ( "Excluding {} for {}" , key , ruleProxyField . getProxyField ( ) . getFieldName ( ) ) ; if ( ! isExcluded ( ruleProxyField . getProxyField ( ) , key ) ) // only do this if not already excluded { Exclude exclude = new Exclude ( ruleProxyField . getProxyField ( ) , key , ruleContext ) ; m_excludes . add ( exclude ) ; s_log . debug ( "{}excluding: {} {}" , new Object [ ] { m_indenter , ruleProxyField , key } ) ; }
public class ESResponseWrapper { /** * Gets the aggregated result . * @ param internalAggs * the internal aggs * @ param identifier * the identifier * @ param exp * the exp * @ return the aggregated result */ private Object getAggregatedResult ( InternalAggregations internalAggs , String identifier , Expression exp ) { } }
switch ( identifier ) { case Expression . MIN : return ( ( ( InternalMin ) internalAggs . get ( exp . toParsedText ( ) ) ) . getValue ( ) ) ; case Expression . MAX : return ( ( ( InternalMax ) internalAggs . get ( exp . toParsedText ( ) ) ) . getValue ( ) ) ; case Expression . AVG : return ( ( ( InternalAvg ) internalAggs . get ( exp . toParsedText ( ) ) ) . getValue ( ) ) ; case Expression . SUM : return ( ( ( InternalSum ) internalAggs . get ( exp . toParsedText ( ) ) ) . getValue ( ) ) ; case Expression . COUNT : return ( ( ( InternalValueCount ) internalAggs . get ( exp . toParsedText ( ) ) ) . getValue ( ) ) ; } throw new KunderaException ( "No support for " + identifier + " aggregation." ) ;
public class JsApiMessageImpl { /** * Set the transportVersion field in the message header to the given value . * This method is package visibility as it is also used by JsJmsMessageImpl * @ param value The value for the field , which must be a String . */ final void setTransportVersion ( Object value ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setTransportVersion" , value ) ; getHdr2 ( ) . setField ( JsHdr2Access . TRANSPORTVERSION_DATA , value ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "setTransportVersion" ) ;
public class IceAgent { /** * Fires an event when all candidate pairs are selected . * @ param candidatePair * The selected candidate pair */ private void fireCandidatePairSelectedEvent ( ) { } }
// Stop the ICE Agent this . stop ( ) ; // Fire the event to all listener List < IceEventListener > listeners ; synchronized ( this . iceListeners ) { listeners = new ArrayList < IceEventListener > ( this . iceListeners ) ; } SelectedCandidatesEvent event = new SelectedCandidatesEvent ( this ) ; for ( IceEventListener listener : listeners ) { listener . onSelectedCandidates ( event ) ; }
public class PureXbasePackageImpl { /** * Complete the initialization of the package and its meta - model . This * method is guarded to have no affect on any invocation but its first . * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void initializePackageContents ( ) { } }
if ( isInitialized ) return ; isInitialized = true ; // Initialize package setName ( eNAME ) ; setNsPrefix ( eNS_PREFIX ) ; setNsURI ( eNS_URI ) ; // Obtain other dependent packages XtypePackage theXtypePackage = ( XtypePackage ) EPackage . Registry . INSTANCE . getEPackage ( XtypePackage . eNS_URI ) ; XbasePackage theXbasePackage = ( XbasePackage ) EPackage . Registry . INSTANCE . getEPackage ( XbasePackage . eNS_URI ) ; // Create type parameters // Set bounds for type parameters // Add supertypes to classes // Initialize classes and features ; add operations and parameters initEClass ( modelEClass , Model . class , "Model" , ! IS_ABSTRACT , ! IS_INTERFACE , IS_GENERATED_INSTANCE_CLASS ) ; initEReference ( getModel_ImportSection ( ) , theXtypePackage . getXImportSection ( ) , null , "importSection" , null , 0 , 1 , Model . class , ! IS_TRANSIENT , ! IS_VOLATILE , IS_CHANGEABLE , IS_COMPOSITE , ! IS_RESOLVE_PROXIES , ! IS_UNSETTABLE , IS_UNIQUE , ! IS_DERIVED , IS_ORDERED ) ; initEReference ( getModel_Block ( ) , theXbasePackage . getXBlockExpression ( ) , null , "block" , null , 0 , 1 , Model . class , ! IS_TRANSIENT , ! IS_VOLATILE , IS_CHANGEABLE , IS_COMPOSITE , ! IS_RESOLVE_PROXIES , ! IS_UNSETTABLE , IS_UNIQUE , ! IS_DERIVED , IS_ORDERED ) ; // Create resource createResource ( eNS_URI ) ;
public class XsdDataItem { /** * Called when some child ( or child of a child ) has a REDEFINES clause . We * look up our children for an item matching the COBOL name of the REDEFINES * object . If found , we update its isRedefined member , otherwise we * propagate the request to our own parent . * @ param cobolName the redefines object . */ public void updateRedefinition ( final String cobolName ) { } }
boolean found = false ; for ( XsdDataItem child : getChildren ( ) ) { if ( child . getCobolName ( ) . equals ( cobolName ) ) { child . setIsRedefined ( true ) ; found = true ; break ; } } if ( ! found && getParent ( ) != null ) { getParent ( ) . updateRedefinition ( cobolName ) ; }
public class AbstractExpressionBasedDAOValidatorRule { /** * Methode de construction de la requete * @ param target Objet cible * @ returnRequete */ protected Query buildQuery ( Object target ) { } }
// Si le modele est null if ( expressionModel == null ) return null ; // Instanciation de la requete Query query = this . entityManager . createQuery ( expressionModel . getComputedExpression ( ) ) ; // MAP des parametres Map < String , String > parameters = expressionModel . getParameters ( ) ; // Si la MAP n ' est pas vide if ( parameters != null && parameters . size ( ) > 0 ) { // Ensemble des cles Set < String > keys = parameters . keySet ( ) ; // Parcours de l ' ensemble des cles for ( String key : keys ) { // Ajout du parametre query . setParameter ( key , DAOValidatorHelper . evaluateValueExpression ( parameters . get ( key ) , target ) ) ; } } // On retourne la requete return query ;
public class LongTuples { /** * Returns a comparator that compares tuples based on the specified * { @ link Order } . If the given order is < code > null < / code > , then * < code > null < / code > will be returned . * @ param order The { @ link Order } * @ return The comparator . */ public static Comparator < LongTuple > comparator ( Order order ) { } }
if ( order == Order . LEXICOGRAPHICAL ) { return ( t0 , t1 ) -> compareLexicographically ( t0 , t1 ) ; } if ( order == Order . COLEXICOGRAPHICAL ) { return ( t0 , t1 ) -> compareColexicographically ( t0 , t1 ) ; } return null ;
public class Streams { /** * Read the data from the input stream and write to the outputstream , filtering with an Ant FilterSet . * @ param in inputstream * @ param out outputstream * @ param set FilterSet to use * @ throws java . io . IOException if thrown by underlying io operations */ public static void copyStreamWithFilterSet ( final InputStream in , final OutputStream out , final FilterSet set ) throws IOException { } }
final BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ; final BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( out ) ) ; String lSep = System . getProperty ( "line.separator" ) ; String line = reader . readLine ( ) ; while ( null != line ) { writer . write ( set . replaceTokens ( line ) ) ; writer . write ( lSep ) ; line = reader . readLine ( ) ; } writer . flush ( ) ;
public class Utils { /** * Resolves the setter name for the property whose name is ' propertyName ' whose type is ' valueType ' * in the entity bean whose class is ' entityClass ' . * If we don ' t find a setter following Java ' s naming conventions , before throwing an exception we try to * resolve the setter following Scala ' s naming conventions . * @ param propertyName the field name of the property whose setter we want to resolve . * @ param entityClass the bean class object in which we want to search for the setter . * @ param valueType the class type of the object that we want to pass to the setter . * @ return the resolved setter . */ @ SuppressWarnings ( "unchecked" ) public static Method findSetter ( String propertyName , Class entityClass , Class valueType ) { } }
Method setter ; String setterName = "set" + propertyName . substring ( 0 , 1 ) . toUpperCase ( ) + propertyName . substring ( 1 ) ; try { setter = entityClass . getMethod ( setterName , valueType ) ; } catch ( NoSuchMethodException e ) { // let ' s try with scala setter name try { setter = entityClass . getMethod ( propertyName + "_$eq" , valueType ) ; } catch ( NoSuchMethodException e1 ) { throw new DeepIOException ( e1 ) ; } } return setter ;
public class ClassDiscoveryUtil { /** * Returns an array of concrete classes in the given package that implement * all of the specified interfaces . * @ param basePackage the name of the package containing the classes to discover * @ param requiredInterfaces the intefaces that the returned classes must implement * @ return an array of concrete classes in the given package that implement the * specified interface */ public static Class [ ] getClasses ( String basePackage , Class [ ] requiredInterfaces ) { } }
List classes = new ArrayList ( ) ; ClassCriteria criteria = new ClassCriteria ( requiredInterfaces ) ; String basePath = basePackage . replace ( '.' , File . separatorChar ) ; String [ ] resourcesNames = classpathResources . getResources ( basePath , criteria ) ; for ( int i = 0 ; i < resourcesNames . length ; i ++ ) { String resourceName = resourcesNames [ i ] ; if ( resourceName == null ) { continue ; } String className = getClassName ( resourceName ) ; try { Class c = Class . forName ( className ) ; classes . add ( c ) ; } catch ( ClassNotFoundException e ) { // This should not happen since we ' ve already validated the class } } return ( Class [ ] ) classes . toArray ( new Class [ classes . size ( ) ] ) ;
public class JobTracker { /** * Update the last recorded status for the given task tracker . * It assumes that the taskTrackers are locked on entry . * @ param trackerName The name of the tracker * @ param status The new status for the task tracker * @ return Was an old status found ? */ boolean updateTaskTrackerStatus ( String trackerName , TaskTrackerStatus status ) { } }
TaskTracker tt = getTaskTracker ( trackerName ) ; TaskTrackerStatus oldStatus = ( tt == null ) ? null : tt . getStatus ( ) ; // update the total cluster capacity first if ( status != null ) { // we have a fresh tasktracker status if ( ! faultyTrackers . isBlacklisted ( status . getHost ( ) ) ) { // if the task tracker host is not blacklisted - then // we update the cluster capacity with the capacity // reported by the tasktracker updateTotalTaskCapacity ( status ) ; } else { // if the tasktracker is blacklisted - then it ' s capacity // is already removed and will only be added back to the // cluster capacity when it ' s unblacklisted } } else { if ( oldStatus != null ) { // old status exists - but no new status . in this case // we are removing the tracker from the cluster . if ( ! faultyTrackers . isBlacklisted ( oldStatus . getHost ( ) ) ) { // we update the total task capacity based on the old status // this seems redundant - but this call is idempotent - so just // make it . the danger of not making it is that we may accidentally // remove something we never had updateTotalTaskCapacity ( oldStatus ) ; removeTaskTrackerCapacity ( oldStatus ) ; } else { // if the host is blacklisted - then the tracker ' s capacity // has already been removed and there ' s nothing to do } } } if ( oldStatus != null ) { totalMaps -= oldStatus . countMapTasks ( ) ; totalReduces -= oldStatus . countReduceTasks ( ) ; occupiedMapSlots -= oldStatus . countOccupiedMapSlots ( ) ; occupiedReduceSlots -= oldStatus . countOccupiedReduceSlots ( ) ; getInstrumentation ( ) . decRunningMaps ( oldStatus . countMapTasks ( ) ) ; getInstrumentation ( ) . decRunningReduces ( oldStatus . countReduceTasks ( ) ) ; getInstrumentation ( ) . decOccupiedMapSlots ( oldStatus . countOccupiedMapSlots ( ) ) ; getInstrumentation ( ) . decOccupiedReduceSlots ( oldStatus . countOccupiedReduceSlots ( ) ) ; if ( status == null ) { taskTrackers . remove ( trackerName ) ; Integer numTaskTrackersInHost = uniqueHostsMap . get ( oldStatus . getHost ( ) ) ; if ( numTaskTrackersInHost != null ) { numTaskTrackersInHost -- ; if ( numTaskTrackersInHost > 0 ) { uniqueHostsMap . put ( oldStatus . getHost ( ) , numTaskTrackersInHost ) ; } else { uniqueHostsMap . remove ( oldStatus . getHost ( ) ) ; } } } } if ( status != null ) { totalMaps += status . countMapTasks ( ) ; totalReduces += status . countReduceTasks ( ) ; occupiedMapSlots += status . countOccupiedMapSlots ( ) ; occupiedReduceSlots += status . countOccupiedReduceSlots ( ) ; getInstrumentation ( ) . addRunningMaps ( status . countMapTasks ( ) ) ; getInstrumentation ( ) . addRunningReduces ( status . countReduceTasks ( ) ) ; getInstrumentation ( ) . addOccupiedMapSlots ( status . countOccupiedMapSlots ( ) ) ; getInstrumentation ( ) . addOccupiedReduceSlots ( status . countOccupiedReduceSlots ( ) ) ; boolean alreadyPresent = false ; TaskTracker taskTracker = taskTrackers . get ( trackerName ) ; if ( taskTracker != null ) { alreadyPresent = true ; } else { taskTracker = new TaskTracker ( trackerName ) ; } taskTracker . setStatus ( status ) ; taskTrackers . put ( trackerName , taskTracker ) ; if ( LOG . isDebugEnabled ( ) ) { int runningMaps = 0 , runningReduces = 0 ; int commitPendingMaps = 0 , commitPendingReduces = 0 ; int unassignedMaps = 0 , unassignedReduces = 0 ; int miscMaps = 0 , miscReduces = 0 ; List < TaskStatus > taskReports = status . getTaskReports ( ) ; for ( Iterator < TaskStatus > it = taskReports . iterator ( ) ; it . hasNext ( ) ; ) { TaskStatus ts = ( TaskStatus ) it . next ( ) ; boolean isMap = ts . getIsMap ( ) ; TaskStatus . State state = ts . getRunState ( ) ; if ( state == TaskStatus . State . RUNNING ) { if ( isMap ) { ++ runningMaps ; } else { ++ runningReduces ; } } else if ( state == TaskStatus . State . UNASSIGNED ) { if ( isMap ) { ++ unassignedMaps ; } else { ++ unassignedReduces ; } } else if ( state == TaskStatus . State . COMMIT_PENDING ) { if ( isMap ) { ++ commitPendingMaps ; } else { ++ commitPendingReduces ; } } else { if ( isMap ) { ++ miscMaps ; } else { ++ miscReduces ; } } } LOG . debug ( trackerName + ": Status -" + " running(m) = " + runningMaps + " unassigned(m) = " + unassignedMaps + " commit_pending(m) = " + commitPendingMaps + " misc(m) = " + miscMaps + " running(r) = " + runningReduces + " unassigned(r) = " + unassignedReduces + " commit_pending(r) = " + commitPendingReduces + " misc(r) = " + miscReduces ) ; } if ( ! alreadyPresent ) { Integer numTaskTrackersInHost = uniqueHostsMap . get ( status . getHost ( ) ) ; if ( numTaskTrackersInHost == null ) { numTaskTrackersInHost = 0 ; } numTaskTrackersInHost ++ ; uniqueHostsMap . put ( status . getHost ( ) , numTaskTrackersInHost ) ; } } getInstrumentation ( ) . setMapSlots ( totalMapTaskCapacity ) ; getInstrumentation ( ) . setReduceSlots ( totalReduceTaskCapacity ) ; return oldStatus != null ;
public class EscapedFunctions2 { /** * curtime to current _ time translation * @ param buf The buffer to append into * @ param parsedArgs arguments * @ throws SQLException if something wrong happens */ public static void sqlcurtime ( StringBuilder buf , List < ? extends CharSequence > parsedArgs ) throws SQLException { } }
zeroArgumentFunctionCall ( buf , "current_time" , "curtime" , parsedArgs ) ;
public class MessageBox { public void setMessageStyleType ( MessageStyleType messageStyleType ) { } }
if ( messageStyleType == null ) { icon . getElement ( ) . getStyle ( ) . setDisplay ( Display . NONE ) ; } else { icon . getElement ( ) . getStyle ( ) . setDisplay ( Display . BLOCK ) ; icon . setStyleName ( resource . css ( ) . messageBoxIcon ( ) ) ; switch ( messageStyleType ) { case HELP : icon . addStyleName ( resource . css ( ) . messageBoxIconHelp ( ) ) ; break ; case WARN : icon . addStyleName ( resource . css ( ) . messageBoxIconWarn ( ) ) ; break ; case ERROR : icon . addStyleName ( resource . css ( ) . messageBoxIconError ( ) ) ; break ; default : icon . addStyleName ( resource . css ( ) . messageBoxIconInfo ( ) ) ; } }
public class GeoServiceItemComparator { /** * { @ inheritDoc } */ @ Override public int compare ( final GeoServiceItem o1 , final GeoServiceItem o2 ) { } }
return o1 . getModernPlaceName ( ) . compareTo ( o2 . getModernPlaceName ( ) ) ;
public class ResourceLocalIdentifierImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setResLID ( Integer newResLID ) { } }
Integer oldResLID = resLID ; resLID = newResLID ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . RESOURCE_LOCAL_IDENTIFIER__RES_LID , oldResLID , resLID ) ) ;
public class GVRPicker { /** * Propagate onTouchStart events to listeners * @ param hit collision object */ protected void propagateOnTouch ( GVRPickedObject hit ) { } }
if ( mEventOptions . contains ( EventOptions . SEND_TOUCH_EVENTS ) ) { GVREventManager eventManager = getGVRContext ( ) . getEventManager ( ) ; GVRSceneObject hitObject = hit . getHitObject ( ) ; if ( mEventOptions . contains ( EventOptions . SEND_TO_LISTENERS ) ) { eventManager . sendEvent ( this , ITouchEvents . class , "onTouchStart" , hitObject , hit ) ; } if ( mEventOptions . contains ( EventOptions . SEND_TO_HIT_OBJECT ) ) { eventManager . sendEvent ( hitObject , ITouchEvents . class , "onTouchStart" , hitObject , hit ) ; } if ( mEventOptions . contains ( EventOptions . SEND_TO_SCENE ) && ( mScene != null ) ) { eventManager . sendEvent ( mScene , ITouchEvents . class , "onTouchStart" , hitObject , hit ) ; } }
public class SegmentServiceImpl { /** * Frees a segment to be reused . Called by the segment - gc service . */ public void freeSegment ( SegmentKelp segment ) throws IOException { } }
// System . out . println ( " FREE : " + segment ) ; SegmentMeta segmentMeta = findSegmentMeta ( segment . length ( ) ) ; segmentMeta . remove ( segment ) ; segment . close ( ) ; segmentMeta . addFree ( segment . extent ( ) ) ; // System . out . println ( " FREE : " + segmentMeta . getFreeCount ( ) + " " + segment . getLength ( ) ) ;
public class InjectInjectionBinding { /** * Returns the object to be injected . * This is a different ( new ) instance every time the method is called . * @ throws Exception * if a problem occurs while creating the instance to be * injected . */ @ SuppressWarnings ( "unchecked" ) @ Override public Object getInjectionObjectInstance ( Object targetObject , InjectionTargetContext targetContext ) throws Exception { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getInjectionObjectInstance" , new Object [ ] { Util . identity ( targetObject ) , Util . identity ( targetContext ) } ) ; } WeldCreationalContext < Object > cc = null ; if ( targetContext == null ) { if ( ! ( targetObject instanceof Class < ? > ) ) { // Null target context is only valid when we ' re doing limited injection on an application main class // where we ' re injecting into the static fields of the class and there is no instance . throw new CDIException ( Tr . formatMessage ( tc , "no.injection.target.context.CWOWB1006E" , targetObject ) ) ; } } else { cc = targetContext . getInjectionTargetContextData ( WeldCreationalContext . class ) ; } WeldManager beanManager = ( WeldManager ) cdiRuntime . getCurrentBeanManager ( ) ; if ( cc == null ) { // create a dependent scope if ( beanManager != null ) { cc = beanManager . createCreationalContext ( null ) ; } } if ( beanManager != null ) { methodInvocationContext = beanManager . createCreationalContext ( null ) ; } Object retObj = InjectInjectionObjectFactory . getObjectInstance ( this , targetObject , cc , methodInvocationContext , cdiRuntime ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getInjectionObjectInstance" , Util . identity ( retObj ) ) ; } return retObj ;
public class TrivialSwap { /** * Swap two elements of array at the specified positions * @ param < E > the type of elements in this list . * @ param array array that will have two of its values swapped . * @ param index1 one of the indexes of the array . * @ param index2 other index of the array . */ public static < E > void swap ( E [ ] array , int index1 , int index2 ) { } }
TrivialSwap . swap ( array , index1 , array , index2 ) ;
public class DefaultGroovyMethods { /** * Sorts the Iterable using the given Comparator . If the Iterable is a List and mutate * is true , it is sorted in place and returned . Otherwise , the elements are first placed * into a new list which is then sorted and returned - leaving the original Iterable unchanged . * < pre class = " groovyTestCase " > * assert [ " hi " , " hey " , " hello " ] = = [ " hello " , " hi " , " hey " ] . sort ( { a , b - > a . length ( ) < = > b . length ( ) } as Comparator ) * < / pre > * < pre class = " groovyTestCase " > * def orig = [ " hello " , " hi " , " Hey " ] * def sorted = orig . sort ( false , String . CASE _ INSENSITIVE _ ORDER ) * assert orig = = [ " hello " , " hi " , " Hey " ] * assert sorted = = [ " hello " , " Hey " , " hi " ] * < / pre > * @ param self the Iterable to be sorted * @ param mutate false will always cause a new list to be created , true will mutate lists in place * @ param comparator a Comparator used for the comparison * @ return a sorted List * @ since 2.2.0 */ public static < T > List < T > sort ( Iterable < T > self , boolean mutate , Comparator < T > comparator ) { } }
List < T > list = mutate ? asList ( self ) : toList ( self ) ; Collections . sort ( list , comparator ) ; return list ;
public class ChatController { /** * Checks services for missing events in stored conversations . * @ param client Foundation client . * @ param conversationComparison Describes differences in local and remote conversation list . * @ return Observable returning unchanged argument to further processing . */ private Observable < ConversationComparison > lookForMissingEvents ( final RxComapiClient client , ConversationComparison conversationComparison ) { } }
if ( ! conversationComparison . isSuccessful || conversationComparison . conversationsToUpdate . isEmpty ( ) ) { return Observable . fromCallable ( ( ) -> conversationComparison ) ; } return synchroniseEvents ( client , conversationComparison . conversationsToUpdate , new ArrayList < > ( ) ) . map ( result -> { if ( conversationComparison . isSuccessful && ! result ) { conversationComparison . addSuccess ( false ) ; } return conversationComparison ; } ) ;
public class IndexSerializer { public boolean supports ( final MixedIndexType index , final ParameterIndexField field ) { } }
IndexInformation indexinfo = mixedIndexes . get ( index . getBackingIndexName ( ) ) ; Preconditions . checkArgument ( indexinfo != null , "Index is unknown or not configured: %s" , index . getBackingIndexName ( ) ) ; return indexinfo . supports ( getKeyInformation ( field ) ) ;
public class ComponentNameSpaceConfiguration { /** * F46994.3 */ private String getNameSpaceID ( Context javaColonContext ) { } }
String nsID = null ; String context = javaColonContext != null ? javaColonContext . toString ( ) : null ; if ( context != null ) { nsID = "UNKNOWN" ; int idx = context . indexOf ( "_nameSpaceID=" ) ; if ( idx != - 1 ) { nsID = context . substring ( idx + 13 ) ; idx = nsID . indexOf ( ',' ) ; if ( idx != - 1 ) { nsID = nsID . substring ( 0 , idx ) ; } } } return nsID ;
public class VisOdomMonoPlaneInfinity { /** * Estimates only rotation using points at infinity . A robust estimation algorithm is used which finds an angle * which maximizes the inlier set , like RANSAC does . Unlike RANSAC this will produce an optimal result . */ private void estimateFar ( ) { } }
// do nothing if there are objects at infinity farInlierCount = 0 ; if ( farAngles . size == 0 ) return ; farAnglesCopy . reset ( ) ; farAnglesCopy . addAll ( farAngles ) ; // find angle which maximizes inlier set farAngle = maximizeCountInSpread ( farAnglesCopy . data , farAngles . size , 2 * thresholdFarAngleError ) ; // mark and count inliers for ( int i = 0 ; i < tracksFar . size ( ) ; i ++ ) { PointTrack t = tracksFar . get ( i ) ; VoTrack p = t . getCookie ( ) ; if ( UtilAngle . dist ( farAngles . get ( i ) , farAngle ) <= thresholdFarAngleError ) { p . lastInlier = tick ; farInlierCount ++ ; } }
public class CalendarCLA { /** * { @ inheritDoc } */ @ Override public Calendar [ ] getValueAsCalendarArray ( ) throws ParseException { } }
final Calendar [ ] result = new Calendar [ size ( ) ] ; for ( int r = 0 ; r < size ( ) ; r ++ ) result [ r ] = getValue ( r ) ; return result ;
public class FileSystemResourceReader { /** * ( non - Javadoc ) * @ see * net . jawr . web . resource . handler . reader . ResourceBrowser # isDirectory ( java . * lang . String ) */ @ Override public boolean isDirectory ( String dirPath ) { } }
String path = dirPath . replace ( '/' , File . separatorChar ) ; return new File ( baseDir , path ) . isDirectory ( ) ;
public class BitmapLruPool { /** * Removes buffers from the pool until it is under its size limit . */ private synchronized void trim ( ) { } }
while ( currentSize > sizeLimit ) { Bitmap bitmap = bitmapsByLastUse . remove ( 0 ) ; bitmapsBySize . remove ( bitmap ) ; currentSize -= getBitmapSize ( bitmap ) ; }
public class ButtonFactory { /** * Creates a web view button . * @ param title * the button label . * @ param url * the URL to whom redirect when clicked . * @ param ratioType * the web view ratio type . * @ return the button */ public static Button createUrlButton ( String title , String url , WebViewHeightRatioType ratioType ) { } }
return new WebUrlButton ( title , url , ratioType ) ;
public class AFPChainXMLParser { /** * Takes an XML representation of the alignment and flips the positions of name1 and name2 * @ param xml String representing the alignment * @ return XML representation of the flipped alignment */ public static String flipAlignment ( String xml ) throws IOException , StructureException { } }
AFPChain [ ] afps = parseMultiXML ( xml ) ; if ( afps . length < 1 ) return null ; if ( afps . length == 1 ) { AFPChain newChain = AFPChainFlipper . flipChain ( afps [ 0 ] ) ; if ( newChain . getAlgorithmName ( ) == null ) { newChain . setAlgorithmName ( DEFAULT_ALGORITHM_NAME ) ; } return AFPChainXMLConverter . toXML ( newChain ) ; } throw new StructureException ( "not Implemented yet!" ) ;
public class User { /** * parse the user to an Actor ( Object ) JSON map * @ return Actor ( Object ) JSON map representing this user < br > * ( Activitystrea . ms ) */ public Map < String , Object > toActorJSON ( ) { } }
final HashMap < String , Object > actor = new LinkedHashMap < String , Object > ( ) ; actor . put ( "objectType" , "person" ) ; actor . put ( "id" , this . id ) ; actor . put ( "displayName" , this . displayName ) ; return actor ;
public class RegularPactTask { /** * Initialization method . Runs in the execution graph setup phase in the JobManager * and as a setup method on the TaskManager . */ @ Override public void registerInputOutput ( ) { } }
if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( formatLogString ( "Start registering input and output." ) ) ; } // get the classloader first . the classloader might have been set before by mock environments during testing if ( this . userCodeClassLoader == null ) { try { this . userCodeClassLoader = LibraryCacheManager . getClassLoader ( getEnvironment ( ) . getJobID ( ) ) ; } catch ( IOException ioe ) { throw new RuntimeException ( "The ClassLoader for the user code could not be instantiated from the library cache." , ioe ) ; } } // obtain task configuration ( including stub parameters ) Configuration taskConf = getTaskConfiguration ( ) ; taskConf . setClassLoader ( this . userCodeClassLoader ) ; this . config = new TaskConfig ( taskConf ) ; // now get the operator class which drives the operation final Class < ? extends PactDriver < S , OT > > driverClass = this . config . getDriver ( ) ; this . driver = InstantiationUtil . instantiate ( driverClass , PactDriver . class ) ; // initialize the readers . this is necessary for nephele to create the input gates // however , this does not trigger any local processing . try { initInputReaders ( ) ; initBroadcastInputReaders ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "Initializing the input streams failed" + e . getMessage ( ) == null ? "." : ": " + e . getMessage ( ) , e ) ; } // initialize the writers . this is necessary for nephele to create the output gates . // because in the presence of chained tasks , the tasks writers depend on the last task in the chain , // we need to initialize the chained tasks as well . the chained tasks are only set up , but no work // ( such as setting up a sorter , etc . ) starts try { initOutputs ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "Initializing the output handlers failed" + e . getMessage ( ) == null ? "." : ": " + e . getMessage ( ) , e ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( formatLogString ( "Finished registering input and output." ) ) ; }
public class NettyServerHandler { /** * Handler for commands sent from the stream . */ @ Override public void write ( ChannelHandlerContext ctx , Object msg , ChannelPromise promise ) throws Exception { } }
if ( msg instanceof SendGrpcFrameCommand ) { sendGrpcFrame ( ctx , ( SendGrpcFrameCommand ) msg , promise ) ; } else if ( msg instanceof SendResponseHeadersCommand ) { sendResponseHeaders ( ctx , ( SendResponseHeadersCommand ) msg , promise ) ; } else if ( msg instanceof CancelServerStreamCommand ) { cancelStream ( ctx , ( CancelServerStreamCommand ) msg , promise ) ; } else if ( msg instanceof ForcefulCloseCommand ) { forcefulClose ( ctx , ( ForcefulCloseCommand ) msg , promise ) ; } else { AssertionError e = new AssertionError ( "Write called for unexpected type: " + msg . getClass ( ) . getName ( ) ) ; ReferenceCountUtil . release ( msg ) ; promise . setFailure ( e ) ; throw e ; }
public class UserProfileManager { /** * Get UserProfile for the subject on the thread . * @ return the user profile for the social media authenticated user . */ public static UserProfile getUserProfile ( ) { } }
UserProfile userProfile = null ; Subject subject = getSubject ( ) ; Iterator < UserProfile > userProfilesIterator = subject . getPrivateCredentials ( UserProfile . class ) . iterator ( ) ; if ( userProfilesIterator . hasNext ( ) ) { userProfile = userProfilesIterator . next ( ) ; } return userProfile ;
public class PortletContextLoader { /** * Return the { @ link org . springframework . context . ApplicationContextInitializer } implementation classes to use * if any have been specified by { @ link # CONTEXT _ INITIALIZER _ CLASSES _ PARAM } . * @ param portletContext current portlet context * @ see # CONTEXT _ INITIALIZER _ CLASSES _ PARAM * @ return a { @ link java . util . List } object . */ @ SuppressWarnings ( "unchecked" ) protected List < Class < ApplicationContextInitializer < ConfigurableApplicationContext > > > determineContextInitializerClasses ( PortletContext portletContext ) { } }
String classNames = portletContext . getInitParameter ( CONTEXT_INITIALIZER_CLASSES_PARAM ) ; List < Class < ApplicationContextInitializer < ConfigurableApplicationContext > > > classes = new ArrayList < Class < ApplicationContextInitializer < ConfigurableApplicationContext > > > ( ) ; if ( classNames != null ) { for ( String className : StringUtils . tokenizeToStringArray ( classNames , "," ) ) { try { Class < ? > clazz = ClassUtils . forName ( className , ClassUtils . getDefaultClassLoader ( ) ) ; Assert . isAssignable ( ApplicationContextInitializer . class , clazz , "class [" + className + "] must implement ApplicationContextInitializer" ) ; classes . add ( ( Class < ApplicationContextInitializer < ConfigurableApplicationContext > > ) clazz ) ; } catch ( ClassNotFoundException ex ) { throw new ApplicationContextException ( "Failed to load context initializer class [" + className + "]" , ex ) ; } } } return classes ;
public class GraphIterator { /** * Replies the next segments . * @ param avoid _ visited _ segments is < code > true < / code > to avoid to reply already visited segments , otherwise < code > false < / code > * @ param element is the element from which the next segments must be replied . * @ return the list of the following segments * @ see # next ( ) */ @ SuppressWarnings ( "checkstyle:nestedifdepth" ) protected final List < GraphIterationElement < ST , PT > > getNextSegments ( boolean avoid_visited_segments , GraphIterationElement < ST , PT > element ) { } }
assert this . allowManyReplies || this . visited != null ; if ( element != null ) { final ST segment = element . getSegment ( ) ; final PT point = element . getPoint ( ) ; if ( ( segment != null ) && ( point != null ) ) { final PT pts = segment . getOtherSidePoint ( point ) ; if ( pts != null ) { final double distanceToReach = element . getDistanceToReachSegment ( ) + segment . getLength ( ) ; GraphIterationElement < ST , PT > candidate ; final double restToConsume = element . distanceToConsume - segment . getLength ( ) ; final List < GraphIterationElement < ST , PT > > list = new ArrayList < > ( ) ; for ( final ST theSegment : pts . getConnectedSegmentsStartingFrom ( segment ) ) { if ( ! theSegment . equals ( segment ) ) { candidate = newIterationElement ( segment , theSegment , pts , distanceToReach , restToConsume ) ; if ( ( this . allowManyReplies ) || ( ! avoid_visited_segments ) || ( ! this . visited . contains ( candidate ) ) ) { list . add ( candidate ) ; } } } return list ; } } } throw new NoSuchElementException ( ) ;
public class AmazonRoute53Client { /** * Updates the comment for a specified hosted zone . * @ param updateHostedZoneCommentRequest * A request to update the comment for a hosted zone . * @ return Result of the UpdateHostedZoneComment operation returned by the service . * @ throws NoSuchHostedZoneException * No hosted zone exists with the ID that you specified . * @ throws InvalidInputException * The input is not valid . * @ sample AmazonRoute53 . UpdateHostedZoneComment * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / route53-2013-04-01 / UpdateHostedZoneComment " * target = " _ top " > AWS API Documentation < / a > */ @ Override public UpdateHostedZoneCommentResult updateHostedZoneComment ( UpdateHostedZoneCommentRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeUpdateHostedZoneComment ( request ) ;
public class Edge { /** * Return a string representation of the edge . */ public String formatAsString ( boolean reverse ) { } }
BasicBlock source = getSource ( ) ; BasicBlock target = getTarget ( ) ; StringBuilder buf = new StringBuilder ( ) ; buf . append ( reverse ? "REVERSE_EDGE(" : "EDGE(" ) ; buf . append ( getLabel ( ) ) ; buf . append ( ") type " ) ; buf . append ( edgeTypeToString ( type ) ) ; buf . append ( " from block " ) ; buf . append ( reverse ? target . getLabel ( ) : source . getLabel ( ) ) ; buf . append ( " to block " ) ; buf . append ( reverse ? source . getLabel ( ) : target . getLabel ( ) ) ; InstructionHandle sourceInstruction = source . getLastInstruction ( ) ; InstructionHandle targetInstruction = target . getFirstInstruction ( ) ; String exInfo = " -> " ; if ( targetInstruction == null && target . isExceptionThrower ( ) ) { targetInstruction = target . getExceptionThrower ( ) ; exInfo = " => " ; } if ( sourceInstruction != null && targetInstruction != null ) { buf . append ( " [bytecode " ) ; buf . append ( sourceInstruction . getPosition ( ) ) ; buf . append ( exInfo ) ; buf . append ( targetInstruction . getPosition ( ) ) ; buf . append ( ']' ) ; } else if ( source . isExceptionThrower ( ) ) { if ( type == FALL_THROUGH_EDGE ) { buf . append ( " [successful check]" ) ; } else { buf . append ( " [failed check for " ) ; buf . append ( source . getExceptionThrower ( ) . getPosition ( ) ) ; if ( targetInstruction != null ) { buf . append ( " to " ) ; buf . append ( targetInstruction . getPosition ( ) ) ; } buf . append ( ']' ) ; } } return buf . toString ( ) ;
public class CircuitBreakerRetry { /** * Resets the circuit state to { @ link CircuitState # CLOSED } . * @ return The current state */ private CircuitState halfOpenCircuit ( ) { } }
if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Half Opening Circuit Breaker [{}]" , method ) ; } lastError = null ; this . childState = ( MutableRetryState ) retryStateBuilder . build ( ) ; return state . getAndSet ( CircuitState . HALF_OPEN ) ;
public class IfcRelCoversSpacesImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcCovering > getRelatedCoverings ( ) { } }
return ( EList < IfcCovering > ) eGet ( Ifc4Package . Literals . IFC_REL_COVERS_SPACES__RELATED_COVERINGS , true ) ;
public class DynamicReportBuilder { /** * For variable registration only ( can bee later referenced in custom * expression ) * @ param name * @ param col * @ param op * @ return */ public DynamicReportBuilder addGlobalVariable ( String name , AbstractColumn col , DJCalculation op ) { } }
globalVariablesGroup . addVariable ( new DJGroupVariableDef ( name , col , op ) ) ; return this ;
public class EMFGeneratorFragment { /** * Adopted from GenModel # findGenPackageHelper */ private GenPackage findGenPackageByNsURI ( GenModel genModel , String nsURI ) { } }
List < GenPackage > allGenPackages = genModel . getAllGenUsedAndStaticGenPackagesWithClassifiers ( ) ; for ( GenPackage genPackage : allGenPackages ) { EPackage ecorePackage = genPackage . getEcorePackage ( ) ; if ( ecorePackage == null || ecorePackage . eIsProxy ( ) ) { throw new RuntimeException ( "Unresolved proxy: " + ecorePackage + " in " + genModel . eResource ( ) . getURI ( ) ) ; } if ( nsURI . equals ( ecorePackage . getNsURI ( ) ) ) { return genPackage ; } } throw new RuntimeException ( "No GenPackage for NsURI " + nsURI + " found in " + genModel . eResource ( ) . getURI ( ) ) ;
public class EntityListenersIntrospector { /** * Introspects the given listener class and finds all methods that should receive callback event * notifications . * @ param listenerClass * the listener class */ private void processExternalListener ( Class < ? > listenerClass ) { } }
ExternalListenerMetadata listenerMetadata = ExternalListenerIntrospector . introspect ( listenerClass ) ; Map < CallbackType , Method > callbacks = listenerMetadata . getCallbacks ( ) ; if ( callbacks != null ) { for ( Map . Entry < CallbackType , Method > entry : callbacks . entrySet ( ) ) { validateExternalCallback ( entry . getValue ( ) , entry . getKey ( ) ) ; } }
public class Account { /** * Implements the Comparable & lt ; Account & gt ; interface , this is based first on if the * account is a folder or not . This is so that during sorting , all folders are * first in the list . Finally , it is based on the name . * @ param o The other account to compare to . * @ return this . name . compareTo ( otherAccount . name ) ; */ public int compareTo ( Account o ) { } }
if ( this . isFolder ( ) && ! o . isFolder ( ) ) return - 1 ; else if ( ! this . isFolder ( ) && o . isFolder ( ) ) return 1 ; // First ignore case , if they equate , use case . int result = name . compareToIgnoreCase ( o . name ) ; if ( result == 0 ) return name . compareTo ( o . name ) ; else return result ;
public class HostSocketListener { /** * @ see org . browsermob . proxy . jetty . http . SocketListener # customizeRequest ( java . net . Socket , org . browsermob . proxy . jetty . http . HttpRequest ) */ protected void customizeRequest ( Socket socket , HttpRequest request ) { } }
request . setState ( HttpMessage . __MSG_EDITABLE ) ; if ( _host == null ) request . removeField ( HttpFields . __Host ) ; else request . setField ( HttpFields . __Host , _host ) ; request . setState ( HttpMessage . __MSG_RECEIVED ) ; super . customizeRequest ( socket , request ) ;
public class GBSTree { /** * Add to current or successor . * < ol > * < li > There is no right child * < li > There may or may not be a left child . * < li > INSERT _ KEY > MEDIAN of current node . * < li > INSERT _ KEY < MEDIAN of successor ( if there is one ) * < / ol > * < p > In the example below , if the current node is GHI , then the insert * key is greater than H and less than K . If the current node is * MNO , then the insert key is greater than N and less than Q . If * the current node is STU , the insert key is greater than T and * there is no successor . < / p > * < pre > * * - - - - - J . K . L - - - - - * * * - - - - - D . E . F - - - - - * * - - - - - P . Q . R - - - - - * * A . B . C G . H . I M . N . O S . T . U * < / pre > * < p > We tried to move right and fell off the end . If the key value is * less than the low key of the successor or if there is no * successor , the insert point is in the right half of the current * node . Otherwise , the insert point is in the left half of the * successor node . < / p > * @ param p Current node from which we tried to move left * @ param l Last node from which we actually moved left ( logical successor ) * @ param new1 Key being inserted * @ param ip Scratch NodeInsertPoint to avoid allocating a new one * @ param point Returned insert points */ private void rightAdd ( GBSNode p , GBSNode l , Object new1 , NodeInsertPoint ip , InsertNodes point ) { } }
if ( l == null ) /* There is no upper successor */ rightAddNoSuccessor ( p , new1 , ip , point ) ; else /* There is an upper successor */ rightAddWithSuccessor ( p , l , new1 , ip , point ) ;
public class QrCodeDecoderImage { /** * Detects QR Codes inside image using position pattern graph * @ param pps position pattern graph * @ param gray Gray input image */ public void process ( FastQueue < PositionPatternNode > pps , T gray ) { } }
gridReader . setImage ( gray ) ; storageQR . reset ( ) ; successes . clear ( ) ; failures . clear ( ) ; for ( int i = 0 ; i < pps . size ; i ++ ) { PositionPatternNode ppn = pps . get ( i ) ; for ( int j = 3 , k = 0 ; k < 4 ; j = k , k ++ ) { if ( ppn . edges [ j ] != null && ppn . edges [ k ] != null ) { QrCode qr = storageQR . grow ( ) ; qr . reset ( ) ; setPositionPatterns ( ppn , j , k , qr ) ; computeBoundingBox ( qr ) ; // Decode the entire marker now if ( decode ( gray , qr ) ) { successes . add ( qr ) ; } else { failures . add ( qr ) ; } } } }
public class LocationAttributes { /** * Returns the location of an element that has been processed by this pipe * ( DOM flavor ) . If the location is to be kept into an object built from * this element , consider using { @ link # getLocation ( Element ) } and the * { @ link Locatable } interface . * @ param elem * the element that holds the location information * @ return a location string as defined by { @ link Location } . */ public static String getLocationString ( Element elem ) { } }
Attr srcAttr = elem . getAttributeNodeNS ( URI , SRC_ATTR ) ; if ( srcAttr == null ) { return LocationUtils . UNKNOWN_STRING ; } return srcAttr . getValue ( ) + ":" + elem . getAttributeNS ( URI , LINE_ATTR ) + ":" + elem . getAttributeNS ( URI , COL_ATTR ) ;
public class VariantUtils { /** * Returns all variant keys from the map of variant set * @ param variants * the map of variant set * @ param fixedVariants * the fixed variant map * @ return all variant keys */ public static List < String > getAllVariantKeysFromFixedVariants ( Map < String , VariantSet > variants , Map < String , String > fixedVariants ) { } }
Map < String , VariantSet > tempVariants = new HashMap < > ( variants ) ; if ( fixedVariants != null ) { for ( Entry < String , String > entry : fixedVariants . entrySet ( ) ) { VariantSet variantSet = tempVariants . get ( entry . getKey ( ) ) ; if ( variantSet != null ) { String variantValue = variantSet . getDefaultVariant ( ) ; if ( variantSet . contains ( entry . getValue ( ) ) ) { variantValue = entry . getValue ( ) ; } VariantSet newVariantSet = new VariantSet ( variantSet . getType ( ) , variantValue , Arrays . asList ( variantValue ) ) ; tempVariants . put ( variantSet . getType ( ) , newVariantSet ) ; } } } return getAllVariantKeys ( tempVariants ) ;
public class ServiceClient { /** * Not exposed directly - the Query object passed as parameter actually contains results . . . */ @ Override public List < JobInstance > getJobs ( Query query ) { } }
return JqmClientFactory . getClient ( ) . getJobs ( query ) ;
public class ARFFParser { /** * Try to parse the bytes as ARFF format */ static ParseSetup guessSetup ( ByteVec bv , byte [ ] bits , byte sep , boolean singleQuotes , String [ ] columnNames , String [ ] [ ] naStrings , byte [ ] nonDataLineMarkers ) { } }
if ( columnNames != null ) throw new UnsupportedOperationException ( "ARFFParser doesn't accept columnNames." ) ; if ( nonDataLineMarkers == null ) nonDataLineMarkers = NON_DATA_LINE_MARKERS_DEFAULT ; // Parse all lines starting with @ until EOF or @ DATA boolean haveData = false ; String [ ] [ ] data = new String [ 0 ] [ ] ; String [ ] labels ; String [ ] [ ] domains ; String [ ] headerlines = new String [ 0 ] ; byte [ ] ctypes ; // header section ArrayList < String > header = new ArrayList < > ( ) ; int offset = 0 ; int chunk_idx = 0 ; // relies on the assumption that bits param have been extracted from first chunk : cf . ParseSetup # map boolean readHeader = true ; while ( readHeader ) { offset = readArffHeader ( 0 , header , bits , singleQuotes ) ; if ( isValidHeader ( header ) ) { String lastHeader = header . get ( header . size ( ) - 1 ) ; if ( INCOMPLETE_HEADER . equals ( lastHeader ) || SKIP_NEXT_HEADER . equals ( lastHeader ) ) { bits = bv . chunkForChunkIdx ( ++ chunk_idx ) . getBytes ( ) ; continue ; } } else if ( chunk_idx > 0 ) { // first chunk parsed correctly , but not the next = > formatting issue throw new H2OUnsupportedDataFileException ( "Arff parsing: Invalid header. If compressed file, please try without compression" , "First chunk was parsed correctly, but a following one failed, common with archives as only first chunk in decompressed" ) ; } readHeader = false ; } if ( offset < bits . length && ! CsvParser . isEOL ( bits [ offset ] ) ) haveData = true ; // more than just the header if ( header . size ( ) == 0 ) throw new ParseDataset . H2OParseException ( "No data!" ) ; headerlines = header . toArray ( headerlines ) ; // process header int ncols = headerlines . length ; labels = new String [ ncols ] ; domains = new String [ ncols ] [ ] ; ctypes = new byte [ ncols ] ; processArffHeader ( ncols , headerlines , labels , domains , ctypes ) ; // data section ( for preview ) if ( haveData ) { final int preview_max_length = 10 ; ArrayList < String > datablock = new ArrayList < > ( ) ; // Careful ! the last data line could be incomplete too ( cf . readArffHeader ) while ( offset < bits . length && datablock . size ( ) < preview_max_length ) { int lineStart = offset ; while ( offset < bits . length && ! CsvParser . isEOL ( bits [ offset ] ) ) ++ offset ; int lineEnd = offset ; ++ offset ; // For Windoze , skip a trailing LF after CR if ( ( offset < bits . length ) && ( bits [ offset ] == CsvParser . CHAR_LF ) ) ++ offset ; if ( ArrayUtils . contains ( nonDataLineMarkers , bits [ lineStart ] ) ) continue ; if ( lineEnd > lineStart ) { String str = new String ( bits , lineStart , lineEnd - lineStart ) . trim ( ) ; if ( ! str . isEmpty ( ) ) datablock . add ( str ) ; } } if ( datablock . size ( ) == 0 ) throw new ParseDataset . H2OParseException ( "Unexpected line." ) ; // process data section String [ ] datalines = datablock . toArray ( new String [ datablock . size ( ) ] ) ; data = new String [ datalines . length ] [ ] ; // First guess the field separator by counting occurrences in first few lines if ( datalines . length == 1 ) { if ( sep == GUESS_SEP ) { // could be a bit more robust than just counting commas ? if ( datalines [ 0 ] . split ( "," ) . length > 2 ) sep = ',' ; else if ( datalines [ 0 ] . split ( " " ) . length > 2 ) sep = ' ' ; else throw new ParseDataset . H2OParseException ( "Failed to detect separator." ) ; } data [ 0 ] = determineTokens ( datalines [ 0 ] , sep , singleQuotes ) ; ncols = ( ncols > 0 ) ? ncols : data [ 0 ] . length ; labels = null ; } else { // 2 or more lines if ( sep == GUESS_SEP ) { // first guess the separator // FIXME if last line is incomplete , this logic fails sep = guessSeparator ( datalines [ 0 ] , datalines [ 1 ] , singleQuotes ) ; if ( sep == GUESS_SEP && datalines . length > 2 ) { sep = guessSeparator ( datalines [ 1 ] , datalines [ 2 ] , singleQuotes ) ; if ( sep == GUESS_SEP ) sep = guessSeparator ( datalines [ 0 ] , datalines [ 2 ] , singleQuotes ) ; } if ( sep == GUESS_SEP ) sep = ( byte ) ' ' ; // Bail out , go for space } for ( int i = 0 ; i < datalines . length ; ++ i ) { data [ i ] = determineTokens ( datalines [ i ] , sep , singleQuotes ) ; } } } naStrings = addDefaultNAs ( naStrings , ncols ) ; // Return the final setup return new ParseSetup ( ARFF_INFO , sep , singleQuotes , ParseSetup . NO_HEADER , ncols , labels , ctypes , domains , naStrings , data , nonDataLineMarkers ) ;
public class CorneredButton { /** * disable之后延时自动enable */ private void delayEnableMyself ( ) { } }
if ( ! autoDisable ) { return ; } setEnabled ( false ) ; postDelayed ( new Runnable ( ) { @ Override public void run ( ) { setEnabled ( true ) ; } } , disableDuration ) ;
public class LineGridStrategy { /** * CSOFF : ParameterNumber */ private SimpleFeature createFeature ( final SimpleFeatureBuilder featureBuilder , final GeometryFactory geometryFactory , final GridParam layerData , final AxisDirection direction , final int numDimensions , final double spacing , final double x , final double y , final int i , final int ordinate ) { } }
// CSON : ParameterNumber featureBuilder . reset ( ) ; final int numPoints = layerData . pointsInLine + 1 ; // add 1 for the last point final LinearCoordinateSequence coordinateSequence = new LinearCoordinateSequence ( ) . setDimension ( numDimensions ) . setOrigin ( x , y ) . setVariableAxis ( ordinate ) . setNumPoints ( numPoints ) . setSpacing ( spacing ) . setOrdinate0AxisDirection ( direction ) ; LineString geom = geometryFactory . createLineString ( coordinateSequence ) ; featureBuilder . set ( Grid . ATT_GEOM , geom ) ; return featureBuilder . buildFeature ( "grid." + ( ordinate == 1 ? 'x' : 'y' ) + "." + i ) ;
public class SplashScreen { /** * Close this window . */ public void close ( ) { } }
JWindow w ; synchronized ( this ) { if ( ! synch . isUnblocked ( ) ) synch . unblock ( ) ; if ( win == null ) return ; w = win ; win = null ; } if ( event != null ) event . fire ( ) ; w . setVisible ( false ) ; w . removeAll ( ) ; w . dispose ( ) ; RepaintManager . setCurrentManager ( null ) ; logoContainer = null ; titleContainer = null ; bottom = null ; progressText = null ; progressSubText = null ; progressBar = null ; poweredBy = null ; logo = null ; title = null ; text = null ; subText = null ; event = null ;
public class SwaggerBuilder { /** * Returns the description of a parameter . * @ param parameter * @ return the parameter description */ protected String getDescription ( Parameter parameter ) { } }
if ( parameter . isAnnotationPresent ( Desc . class ) ) { Desc annotation = parameter . getAnnotation ( Desc . class ) ; return translate ( annotation . key ( ) , annotation . value ( ) ) ; } return null ;
public class SQLTypeAdapterUtils { /** * Gets the adapter . * @ param < E > the element type * @ param clazz the clazz * @ return the adapter */ public static < E extends SqlTypeAdapter < ? , ? > > E getAdapter ( Class < E > clazz ) { } }
@ SuppressWarnings ( "unchecked" ) E adapter = ( E ) cache . get ( clazz ) ; if ( adapter == null ) { try { lock . lock ( ) ; adapter = clazz . newInstance ( ) ; cache . put ( clazz , adapter ) ; } catch ( Throwable e ) { throw ( new KriptonRuntimeException ( e ) ) ; } finally { lock . unlock ( ) ; } } return adapter ;
public class TemplateParserContext { /** * Add a local variable coming from a Variable destructuring to the current context . * @ param propertyType The type of the property on the destructured variable * @ param propertyName The name of the property on the destructured variable * @ param destructuredVariable The local variable that is getting destructured * @ return { @ link DestructuredPropertyInfo } for the added variable */ public DestructuredPropertyInfo addDestructuredProperty ( String propertyType , String propertyName , LocalVariableInfo destructuredVariable ) { } }
return contextLayers . getFirst ( ) . addDestructuredProperty ( propertyType , propertyName , destructuredVariable ) ;
public class Context { /** * Determines the strategy to escape Soy msg tags . * < p > Importantly , this determines the context that the message should be considered in , how the * print nodes will be escaped , and how the entire message will be escaped . We need different * strategies in different contexts because messages in general aren ' t trusted , but we also need * to be able to include markup interspersed in an HTML message ; for example , an anchor that Soy * factored out of the message . * < p > Note that it ' d be very nice to be able to simply escape the strings that came out of the * translation database , and distribute the escaping entirely over the print nodes . However , the * translation machinery , especially in Javascript , doesn ' t offer a way to escape just the bits * that come from the translation database without also re - escaping the substitutions . * @ param node The node , for error messages * @ return relevant strategy , or absent in case there ' s no valid strategy and it is an error to * have a message in this context */ Optional < MsgEscapingStrategy > getMsgEscapingStrategy ( SoyNode node ) { } }
switch ( state ) { case HTML_PCDATA : // In normal HTML PCDATA context , it makes sense to escape all of the print nodes , but not // escape the entire message . This allows Soy to support putting anchors and other small // bits of HTML in messages . return Optional . of ( new MsgEscapingStrategy ( this , ImmutableList . of ( ) ) ) ; case CSS_DQ_STRING : case CSS_SQ_STRING : case JS_DQ_STRING : case JS_SQ_STRING : case TEXT : case URI : if ( state == HtmlContext . URI && uriPart != UriPart . QUERY ) { // NOTE : Only support the query portion of URIs . return Optional . absent ( ) ; } // In other contexts like JS and CSS strings , it makes sense to treat the message ' s // placeholders as plain text , but escape the entire result of message evaluation . return Optional . of ( new MsgEscapingStrategy ( new Context ( HtmlContext . TEXT ) , getEscapingModes ( node , ImmutableList . of ( ) ) ) ) ; case HTML_RCDATA : case HTML_NORMAL_ATTR_VALUE : case HTML_COMMENT : // The weirdest case is HTML attributes . Ideally , we ' d like to treat these as a text string // and escape when done . However , many messages have HTML entities such as & raquo ; in them . // A good way around this is to escape the print nodes in the message , but normalize // ( escape except for ampersands ) the final message . // Also , content inside < title > , < textarea > , and HTML comments have a similar requirement , // where any entities in the messages are probably intended to be preserved . return Optional . of ( new MsgEscapingStrategy ( this , ImmutableList . of ( EscapingMode . NORMALIZE_HTML ) ) ) ; default : // Other contexts , primarily source code contexts , don ' t have a meaningful way to support // natural language text . return Optional . absent ( ) ; }
public class AWSCognitoIdentityProviderClient { /** * Creates the user pool client . * @ param createUserPoolClientRequest * Represents the request to create a user pool client . * @ return Result of the CreateUserPoolClient operation returned by the service . * @ throws InvalidParameterException * This exception is thrown when the Amazon Cognito service encounters an invalid parameter . * @ throws ResourceNotFoundException * This exception is thrown when the Amazon Cognito service cannot find the requested resource . * @ throws TooManyRequestsException * This exception is thrown when the user has made too many requests for a given operation . * @ throws LimitExceededException * This exception is thrown when a user exceeds the limit for a requested AWS resource . * @ throws NotAuthorizedException * This exception is thrown when a user is not authorized . * @ throws ScopeDoesNotExistException * This exception is thrown when the specified scope does not exist . * @ throws InvalidOAuthFlowException * This exception is thrown when the specified OAuth flow is invalid . * @ throws InternalErrorException * This exception is thrown when Amazon Cognito encounters an internal error . * @ sample AWSCognitoIdentityProvider . CreateUserPoolClient * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - idp - 2016-04-18 / CreateUserPoolClient " * target = " _ top " > AWS API Documentation < / a > */ @ Override public CreateUserPoolClientResult createUserPoolClient ( CreateUserPoolClientRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeCreateUserPoolClient ( request ) ;
public class CommerceShippingFixedOptionPersistenceImpl { /** * Returns a range of all the commerce shipping fixed options where commerceShippingMethodId = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceShippingFixedOptionModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order . * @ param commerceShippingMethodId the commerce shipping method ID * @ param start the lower bound of the range of commerce shipping fixed options * @ param end the upper bound of the range of commerce shipping fixed options ( not inclusive ) * @ return the range of matching commerce shipping fixed options */ @ Override public List < CommerceShippingFixedOption > findByCommerceShippingMethodId ( long commerceShippingMethodId , int start , int end ) { } }
return findByCommerceShippingMethodId ( commerceShippingMethodId , start , end , null ) ;
public class CommerceTaxFixedRateAddressRelPersistenceImpl { /** * Removes all the commerce tax fixed rate address rels where commerceTaxMethodId = & # 63 ; from the database . * @ param commerceTaxMethodId the commerce tax method ID */ @ Override public void removeByCommerceTaxMethodId ( long commerceTaxMethodId ) { } }
for ( CommerceTaxFixedRateAddressRel commerceTaxFixedRateAddressRel : findByCommerceTaxMethodId ( commerceTaxMethodId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceTaxFixedRateAddressRel ) ; }
public class OutputUtil { /** * Appends the formatted list of function arguments to a string builder . The individual * arguments are separated by spaces with the exception of commas . * @ param sb the string builder to be modified * @ param list the list of function arguments * @ return Modified < code > sb < / code > to allow chaining */ public static StringBuilder appendFunctionArgs ( StringBuilder sb , List < Term < ? > > list ) { } }
Term < ? > prev = null , pprev = null ; for ( Term < ? > elem : list ) { boolean sep = true ; if ( elem instanceof TermOperator && ( ( TermOperator ) elem ) . getValue ( ) == ',' ) sep = false ; // no spaces before commas if ( ( prev != null && prev instanceof TermOperator && ( ( TermOperator ) prev ) . getValue ( ) == '-' ) && ( pprev == null || pprev instanceof TermOperator ) ) // nothing or an operator before - sep = false ; // no spaces after unary minus if ( prev != null && sep ) sb . append ( SPACE_DELIM ) ; pprev = prev ; prev = elem ; sb . append ( elem . toString ( ) ) ; } return sb ;
public class CharsTrieBuilder { /** * { @ inheritDoc } * @ deprecated This API is ICU internal only . * @ hide draft / provisional / internal are hidden on Android */ @ Deprecated @ Override protected int writeValueAndType ( boolean hasValue , int value , int node ) { } }
if ( ! hasValue ) { return write ( node ) ; } int length ; if ( value < 0 || value > CharsTrie . kMaxTwoUnitNodeValue ) { intUnits [ 0 ] = ( char ) ( CharsTrie . kThreeUnitNodeValueLead ) ; intUnits [ 1 ] = ( char ) ( value >> 16 ) ; intUnits [ 2 ] = ( char ) value ; length = 3 ; } else if ( value <= CharsTrie . kMaxOneUnitNodeValue ) { intUnits [ 0 ] = ( char ) ( ( value + 1 ) << 6 ) ; length = 1 ; } else { intUnits [ 0 ] = ( char ) ( CharsTrie . kMinTwoUnitNodeValueLead + ( ( value >> 10 ) & 0x7fc0 ) ) ; intUnits [ 1 ] = ( char ) value ; length = 2 ; } intUnits [ 0 ] |= ( char ) node ; return write ( intUnits , length ) ;
public class Globs { /** * TBD */ private static char next ( String glob , int i ) { } }
if ( i < glob . length ( ) ) { return glob . charAt ( i ) ; } return EOL ;
public class Project { /** * An array of < code > ProjectArtifacts < / code > objects . * @ param secondaryArtifacts * An array of < code > ProjectArtifacts < / code > objects . */ public void setSecondaryArtifacts ( java . util . Collection < ProjectArtifacts > secondaryArtifacts ) { } }
if ( secondaryArtifacts == null ) { this . secondaryArtifacts = null ; return ; } this . secondaryArtifacts = new java . util . ArrayList < ProjectArtifacts > ( secondaryArtifacts ) ;
public class TreeNode { /** * Deletes a node from the tree . The caller of this method needs to check , if the * node is actually empty , because this method only performs the deletion . * @ param root The node that needs to be deleted . * @ param < T > The type of the start and end points of the intervals . * @ return The new root of the subtree rooted at the node to be deleted . It may * be { @ code null } , if the deleted node was the last in the subtree . */ private static < T extends Comparable < ? super T > > TreeNode < T > deleteNode ( TreeNode < T > root ) { } }
if ( root . left == null && root . right == null ) return null ; if ( root . left == null ) { // If the left child is empty , then the right subtree can consist of at most // one node , otherwise it would have been unbalanced . So , just return // the right child . return root . right ; } else { TreeNode < T > node = root . left ; Stack < TreeNode < T > > stack = new Stack < > ( ) ; while ( node . right != null ) { stack . push ( node ) ; node = node . right ; } if ( ! stack . isEmpty ( ) ) { stack . peek ( ) . right = node . left ; node . left = root . left ; } node . right = root . right ; TreeNode < T > newRoot = node ; while ( ! stack . isEmpty ( ) ) { node = stack . pop ( ) ; if ( ! stack . isEmpty ( ) ) stack . peek ( ) . right = newRoot . assimilateOverlappingIntervals ( node ) ; else newRoot . left = newRoot . assimilateOverlappingIntervals ( node ) ; } return newRoot . balanceOut ( ) ; }
public class ShutdownManager { /** * Adds a constraint that a certain shutdowner must be run before another . */ public void addConstraint ( Shutdowner lhs , Constraint constraint , Shutdowner rhs ) { } }
switch ( constraint ) { case RUNS_BEFORE : _cycle . addShutdownConstraint ( lhs , Lifecycle . Constraint . RUNS_BEFORE , rhs ) ; break ; case RUNS_AFTER : _cycle . addShutdownConstraint ( lhs , Lifecycle . Constraint . RUNS_AFTER , rhs ) ; break ; }
public class TemplateEngine { /** * Retrieves the lines of code where an exception occurred * @ param errorLine The line number of the exception * @ param sourcePath The path to the source code file * @ return A list of source code with the exception and surrounding lines * @ throws IOException If an IO exception occurs */ @ SuppressFBWarnings ( justification = "SourcePath should intentionally come from user file path" , value = "PATH_TRAVERSAL_IN" ) private List < Source > getSources ( int errorLine , String sourcePath ) throws IOException { } }
Objects . requireNonNull ( sourcePath , Required . SOURCE_PATH . toString ( ) ) ; StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( System . getProperty ( "user.dir" ) ) . append ( File . separator ) . append ( "src" ) . append ( File . separator ) . append ( "main" ) . append ( File . separator ) . append ( "java" ) ; List < Source > sources = new ArrayList < > ( ) ; Path templateFile = Paths . get ( buffer . toString ( ) ) . resolve ( sourcePath ) ; if ( Files . exists ( templateFile ) ) { List < String > lines = Files . readAllLines ( templateFile ) ; int index = 0 ; for ( String line : lines ) { if ( ( index + MAX_LINES > errorLine ) && ( index - MIN_LINES < errorLine ) ) { sources . add ( new Source ( ( index + 1 ) == errorLine , index + 1 , line ) ) ; } index ++ ; } } return sources ;
public class Tesseract1 { /** * Performs OCR operation . * @ param inputFile an image file * @ param rect the bounding rectangle defines the region of the image to be * recognized . A rectangle of zero dimension or < code > null < / code > indicates * the whole image . * @ return the recognized text * @ throws TesseractException */ @ Override public String doOCR ( File inputFile , Rectangle rect ) throws TesseractException { } }
try { File imageFile = ImageIOHelper . getImageFile ( inputFile ) ; String imageFileFormat = ImageIOHelper . getImageFileFormat ( imageFile ) ; Iterator < ImageReader > readers = ImageIO . getImageReadersByFormatName ( imageFileFormat ) ; if ( ! readers . hasNext ( ) ) { throw new RuntimeException ( ImageIOHelper . JAI_IMAGE_READER_MESSAGE ) ; } ImageReader reader = readers . next ( ) ; StringBuilder result = new StringBuilder ( ) ; try ( ImageInputStream iis = ImageIO . createImageInputStream ( imageFile ) ; ) { reader . setInput ( iis ) ; int imageTotal = reader . getNumImages ( true ) ; init ( ) ; setTessVariables ( ) ; for ( int i = 0 ; i < imageTotal ; i ++ ) { IIOImage oimage = reader . readAll ( i , reader . getDefaultReadParam ( ) ) ; result . append ( doOCR ( oimage , inputFile . getPath ( ) , rect , i + 1 ) ) ; } if ( renderedFormat == RenderedFormat . HOCR ) { result . insert ( 0 , htmlBeginTag ) . append ( htmlEndTag ) ; } } finally { // delete temporary TIFF image for PDF if ( imageFile != null && imageFile . exists ( ) && imageFile != inputFile && imageFile . getName ( ) . startsWith ( "multipage" ) && imageFile . getName ( ) . endsWith ( ImageIOHelper . TIFF_EXT ) ) { imageFile . delete ( ) ; } reader . dispose ( ) ; dispose ( ) ; } return result . toString ( ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) , e ) ; throw new TesseractException ( e ) ; }
public class DebugCommand { /** * コマンド実行結果のテストステップインデックスを取得します 。 * @ param idx * テストステップインデックス * @ param testScript * テストスクリプト * @ return コマンド実行結果のテストステップインデックス */ int execute ( final int idx , TestScript testScript , ApplicationContext appCtx ) { } }
int ret = idx ; switch ( key ) { case START : ret = idx + 1 ; break ; case BACK : ret = idx - 1 ; break ; case CURRENT : ret = idx ; break ; case FORWARD : ret = idx + 1 ; break ; case EXEC_STEP_NO : ret = testScript . getIndexByScriptNo ( body ) ; break ; case SET_STEP_NO : ret = testScript . getIndexByScriptNo ( body ) - 1 ; break ; case LOC : LocatorChecker check = appCtx . getBean ( LocatorChecker . class ) ; Locator locator = Locator . build ( body ) ; if ( locator . isNa ( ) ) { LOG . info ( "format.valid" ) ; } else { check . check ( locator ) ; } break ; case SHOW_PARAM : showParam ( appCtx ) ; break ; case INPUT_PARAM : inputParam ( appCtx ) ; break ; case EXPORT : try { TestScriptGenerateTool exporter = appCtx . getBean ( TestScriptGenerateTool . class ) ; exporter . generateFromPage ( ) ; } catch ( Exception e ) { LOG . error ( "export.error" , e ) ; } break ; case OPEN_SRCIPT : try { Desktop . getDesktop ( ) . open ( testScript . getScriptFile ( ) ) ; } catch ( IOException e ) { LOG . error ( "unexpected.error" , e ) ; } break ; case EXIT : ret = testScript . getTestStepList ( ) . size ( ) ; break ; default : break ; } return ret ;
public class ZooKeeperUtils { /** * Creates an instance of { @ link ZooKeeperStateHandleStore } . * @ param client ZK client * @ param path Path to use for the client namespace * @ param stateStorage RetrievableStateStorageHelper that persist the actual state and whose * returned state handle is then written to ZooKeeper * @ param < T > Type of state * @ return { @ link ZooKeeperStateHandleStore } instance * @ throws Exception ZK errors */ public static < T extends Serializable > ZooKeeperStateHandleStore < T > createZooKeeperStateHandleStore ( final CuratorFramework client , final String path , final RetrievableStateStorageHelper < T > stateStorage ) throws Exception { } }
return new ZooKeeperStateHandleStore < > ( useNamespaceAndEnsurePath ( client , path ) , stateStorage ) ;
public class ReflectUtils { /** * 得到类所在地址 , 可以是文件 , 也可以是jar包 * @ param cls the cls * @ return the code base */ public static String getCodeBase ( Class < ? > cls ) { } }
if ( cls == null ) { return null ; } ProtectionDomain domain = cls . getProtectionDomain ( ) ; if ( domain == null ) { return null ; } CodeSource source = domain . getCodeSource ( ) ; if ( source == null ) { return null ; } URL location = source . getLocation ( ) ; if ( location == null ) { return null ; } return location . getFile ( ) ;
public class ArrayUtil { /** * 获取子数组 * @ param array 数组 * @ param start 开始位置 ( 包括 ) * @ param end 结束位置 ( 不包括 ) * @ return 新的数组 * @ since 4.0.6 */ public static Object [ ] sub ( Object array , int start , int end ) { } }
return sub ( array , start , end , 1 ) ;
public class WorkbenchEntrySet { /** * Shifts left entries with the specified hash code , starting at the specified position , and * empties the resulting free entry . * @ param pos a starting position . * @ return the position cleared by the shifting process . */ protected final int shiftKeys ( int pos ) { } }
// Shift entries with the same hash . int last , slot ; for ( ; ; ) { pos = ( ( last = pos ) + 1 ) & mask ; while ( workbenchEntry [ pos ] != null ) { slot = hashCode ( workbenchEntry [ pos ] . ipAddress ) & mask ; if ( last <= pos ? last >= slot || slot > pos : last >= slot && slot > pos ) break ; pos = ( pos + 1 ) & mask ; } if ( workbenchEntry [ pos ] == null ) break ; workbenchEntry [ last ] = workbenchEntry [ pos ] ; } workbenchEntry [ last ] = null ; return last ;
public class FormValidator { /** * Validates if relative path entered in text field points to an existing directory . */ public FormInputValidator directory ( VisValidatableTextField field , String errorMsg ) { } }
DirectoryValidator validator = new DirectoryValidator ( errorMsg ) ; field . addValidator ( validator ) ; add ( field ) ; return validator ;
public class LineIterator { /** * { @ link java . util . Iterator # next ( ) } implementation . * @ return Next line of the source stream . * @ throws NoSuchElementException in the case of a end of file or a { @ link java . io . IOException } * by the underlying { @ link java . io . InputStream InputStream } . In the latter case the exception can * be retrieved via { @ link # getIOException ( ) } . */ @ Override public String next ( ) throws NoSuchElementException { } }
String ret ; if ( previousException != null ) throw new NoSuchElementException ( "Previous IOException reading from stream" ) ; if ( line == null ) { try { if ( ( line = in . readLine ( ) ) == null ) throw new NoSuchElementException ( "No more lines available" ) ; } catch ( IOException e ) { previousException = e ; throw new NoSuchElementException ( "IOException reading next line." ) ; } } ret = line ; line = null ; return ret ;
public class SystemUtil { /** * Creates a temporary directory in the given path . * You can specify certain files to get a random unique name . * @ param _ path where to place the temp folder * @ param _ prefix prefix of the folder * @ param _ length length of random chars * @ param _ timestamp add timestamp ( yyyyMMdd _ HHmmss - SSS ) to directory name * @ param _ deleteOnExit mark directory for deletion on jvm termination * @ return file */ public static File createTempDirectory ( String _path , String _prefix , int _length , boolean _timestamp , boolean _deleteOnExit ) { } }
SimpleDateFormat formatter = new SimpleDateFormat ( "yyyyMMdd_HHmmss-SSS" ) ; String randomStr = StringUtil . randomString ( _length ) ; StringBuilder fileName = new StringBuilder ( ) ; if ( _prefix != null ) { fileName . append ( _prefix ) ; } fileName . append ( randomStr ) ; if ( _timestamp ) { fileName . append ( "_" ) . append ( formatter . format ( new Date ( ) ) ) ; } File result = createTempDirectory ( _path , fileName . toString ( ) , _deleteOnExit ) ; while ( result == null ) { result = createTempDirectory ( _path , _prefix , _length , _timestamp , _deleteOnExit ) ; } return result ;
public class WapitiCRFModel { /** * 加载特征模板 * @ param br * @ return * @ throws IOException */ private Map < String , Integer > loadConfig ( BufferedReader br ) throws IOException { } }
Map < String , Integer > featureIndex = new HashMap < String , Integer > ( ) ; String temp = br . readLine ( ) ; // # rdr # 8/0/0 int featureNum = ObjConver . getIntValue ( StringUtil . matcherFirst ( "\\d+" , temp ) ) ; // 找到特征个数 List < int [ ] > list = new ArrayList < int [ ] > ( ) ; for ( int i = 0 ; i < featureNum ; i ++ ) { temp = br . readLine ( ) ; List < String > matcherAll = StringUtil . matcherAll ( "\\[.*?\\]" , temp ) ; if ( matcherAll . size ( ) == 0 ) { continue ; } int [ ] is = new int [ matcherAll . size ( ) ] ; for ( int j = 0 ; j < is . length ; j ++ ) { is [ j ] = ObjConver . getIntValue ( StringUtil . matcherFirst ( "[-\\d]+" , matcherAll . get ( j ) ) ) ; } featureIndex . put ( temp . split ( ":" ) [ 1 ] , list . size ( ) ) ; list . add ( is ) ; } int [ ] [ ] template = new int [ list . size ( ) ] [ 0 ] ; // 构建特征模板 for ( int i = 0 ; i < template . length ; i ++ ) { template [ i ] = list . get ( i ) ; } config = new Config ( template ) ; return featureIndex ;
public class CPOptionValuePersistenceImpl { /** * Returns the cp option values before and after the current cp option value in the ordered set where groupId = & # 63 ; . * @ param CPOptionValueId the primary key of the current cp option value * @ param groupId the group ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the previous , current , and next cp option value * @ throws NoSuchCPOptionValueException if a cp option value with the primary key could not be found */ @ Override public CPOptionValue [ ] findByGroupId_PrevAndNext ( long CPOptionValueId , long groupId , OrderByComparator < CPOptionValue > orderByComparator ) throws NoSuchCPOptionValueException { } }
CPOptionValue cpOptionValue = findByPrimaryKey ( CPOptionValueId ) ; Session session = null ; try { session = openSession ( ) ; CPOptionValue [ ] array = new CPOptionValueImpl [ 3 ] ; array [ 0 ] = getByGroupId_PrevAndNext ( session , cpOptionValue , groupId , orderByComparator , true ) ; array [ 1 ] = cpOptionValue ; array [ 2 ] = getByGroupId_PrevAndNext ( session , cpOptionValue , groupId , orderByComparator , false ) ; return array ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; }
public class Wavelet { /** * Applies the wavelet filter to a data vector a [ 0 , n - 1 ] . */ void forward ( double [ ] a , int n ) { } }
if ( n < ncof ) { return ; } if ( n > workspace . length ) { workspace = new double [ n ] ; } else { Arrays . fill ( workspace , 0 , n , 0.0 ) ; } int nmod = ncof * n ; int n1 = n - 1 ; int nh = n >> 1 ; for ( int ii = 0 , i = 0 ; i < n ; i += 2 , ii ++ ) { int ni = i + 1 + nmod + ioff ; int nj = i + 1 + nmod + joff ; for ( int k = 0 ; k < ncof ; k ++ ) { int jf = n1 & ( ni + k + 1 ) ; int jr = n1 & ( nj + k + 1 ) ; workspace [ ii ] += cc [ k ] * a [ jf ] ; workspace [ ii + nh ] += cr [ k ] * a [ jr ] ; } } System . arraycopy ( workspace , 0 , a , 0 , n ) ;
public class ProjectsBase { /** * Removes the specified list of users from following the project , this will not affect project membership status . * Returns the updated project record . * @ param project The project to remove followers from . * @ return Request object */ public ItemRequest < Project > removeFollowers ( String project ) { } }
String path = String . format ( "/projects/%s/removeFollowers" , project ) ; return new ItemRequest < Project > ( this , Project . class , path , "POST" ) ;
public class VicinitySampler { /** * Choose any possible quadruple of the set of atoms * in ac and establish all of the possible bonding schemes according to * Faulon ' s equations . */ public static List < IAtomContainer > sample ( IAtomContainer ac ) { } }
LOGGER . debug ( "RandomGenerator->mutate() Start" ) ; List < IAtomContainer > structures = new ArrayList < IAtomContainer > ( ) ; int nrOfAtoms = ac . getAtomCount ( ) ; double a11 = 0 , a12 = 0 , a22 = 0 , a21 = 0 ; double b11 = 0 , lowerborder = 0 , upperborder = 0 ; double b12 = 0 ; double b21 = 0 ; double b22 = 0 ; double [ ] cmax = new double [ 4 ] ; double [ ] cmin = new double [ 4 ] ; IAtomContainer newAc = null ; IAtom ax1 = null , ax2 = null , ay1 = null , ay2 = null ; IBond b1 = null , b2 = null , b3 = null , b4 = null ; // int [ ] choices = new int [ 3 ] ; /* We need at least two non - zero bonds in order to be successful */ int nonZeroBondsCounter = 0 ; for ( int x1 = 0 ; x1 < nrOfAtoms ; x1 ++ ) { for ( int x2 = x1 + 1 ; x2 < nrOfAtoms ; x2 ++ ) { for ( int y1 = x2 + 1 ; y1 < nrOfAtoms ; y1 ++ ) { for ( int y2 = y1 + 1 ; y2 < nrOfAtoms ; y2 ++ ) { nonZeroBondsCounter = 0 ; ax1 = ac . getAtom ( x1 ) ; ay1 = ac . getAtom ( y1 ) ; ax2 = ac . getAtom ( x2 ) ; ay2 = ac . getAtom ( y2 ) ; /* Get four bonds for these four atoms */ b1 = ac . getBond ( ax1 , ay1 ) ; if ( b1 != null ) { a11 = BondManipulator . destroyBondOrder ( b1 . getOrder ( ) ) ; nonZeroBondsCounter ++ ; } else { a11 = 0 ; } b2 = ac . getBond ( ax1 , ay2 ) ; if ( b2 != null ) { a12 = BondManipulator . destroyBondOrder ( b2 . getOrder ( ) ) ; nonZeroBondsCounter ++ ; } else { a12 = 0 ; } b3 = ac . getBond ( ax2 , ay1 ) ; if ( b3 != null ) { a21 = BondManipulator . destroyBondOrder ( b3 . getOrder ( ) ) ; nonZeroBondsCounter ++ ; } else { a21 = 0 ; } b4 = ac . getBond ( ax2 , ay2 ) ; if ( b4 != null ) { a22 = BondManipulator . destroyBondOrder ( b4 . getOrder ( ) ) ; nonZeroBondsCounter ++ ; } else { a22 = 0 ; } if ( nonZeroBondsCounter > 1 ) { /* * Compute the range for b11 ( see Faulons formulae * for details ) */ cmax [ 0 ] = 0 ; cmax [ 1 ] = a11 - a22 ; cmax [ 2 ] = a11 + a12 - 3 ; cmax [ 3 ] = a11 + a21 - 3 ; cmin [ 0 ] = 3 ; cmin [ 1 ] = a11 + a12 ; cmin [ 2 ] = a11 + a21 ; cmin [ 3 ] = a11 - a22 + 3 ; lowerborder = MathTools . max ( cmax ) ; upperborder = MathTools . min ( cmin ) ; for ( b11 = lowerborder ; b11 <= upperborder ; b11 ++ ) { if ( b11 != a11 ) { b12 = a11 + a12 - b11 ; b21 = a11 + a21 - b11 ; b22 = a22 - a11 + b11 ; LOGGER . debug ( "Trying atom combination : " + x1 + ":" + x2 + ":" + y1 + ":" + y2 ) ; try { newAc = ( IAtomContainer ) ac . clone ( ) ; change ( newAc , x1 , y1 , x2 , y2 , b11 , b12 , b21 , b22 ) ; if ( ConnectivityChecker . isConnected ( newAc ) ) { structures . add ( newAc ) ; } else { LOGGER . debug ( "not connected" ) ; } } catch ( CloneNotSupportedException e ) { LOGGER . error ( "Cloning exception: " + e . getMessage ( ) ) ; LOGGER . debug ( e ) ; } } } } } } } } return structures ;
public class TagsBenchmarksUtil { /** * Gets the { @ link TagContextBinarySerializer } for the specified ' implementation ' . */ @ VisibleForTesting public static TagContextBinarySerializer getTagContextBinarySerializer ( String implementation ) { } }
if ( implementation . equals ( "impl" ) ) { // We can return the global tracer here because if impl is linked the global tracer will be // the impl one . // TODO ( bdrutu ) : Make everything not be a singleton ( disruptor , etc . ) and use a new // TraceComponentImpl similar to TraceComponentImplLite . return tagsComponentImplBase . getTagPropagationComponent ( ) . getBinarySerializer ( ) ; } else if ( implementation . equals ( "impl-lite" ) ) { return tagsComponentImplLite . getTagPropagationComponent ( ) . getBinarySerializer ( ) ; } else { throw new RuntimeException ( "Invalid binary serializer implementation specified." ) ; }
public class ValueMatcherBuilder { /** * 处理间隔形式的表达式 < br > * 处理的形式包括 : * < ul > * < li > < strong > a < / strong > 或 < strong > * < / strong > < / li > * < li > < strong > a & # 47 ; b < / strong > 或 < strong > * & # 47 ; b < / strong > < / li > * < li > < strong > a - b / 2 < / strong > < / li > * < / ul > * @ param value 表达式值 * @ param parser 针对这个时间字段的解析器 * @ return List */ private static List < Integer > parseStep ( String value , ValueParser parser ) { } }
final List < String > parts = StrUtil . split ( value , StrUtil . C_SLASH ) ; int size = parts . size ( ) ; List < Integer > results ; if ( size == 1 ) { // 普通形式 results = parseRange ( value , - 1 , parser ) ; } else if ( size == 2 ) { // 间隔形式 final int step = parser . parse ( parts . get ( 1 ) ) ; if ( step < 1 ) { throw new CronException ( "Non positive divisor for field: [{}]" , value ) ; } results = parseRange ( parts . get ( 0 ) , step , parser ) ; } else { throw new CronException ( "Invalid syntax of field: [{}]" , value ) ; } return results ;
public class JobManagerRunner { /** * Marks this runner ' s job as not running . Other JobManager will not recover the job * after this call . * < p > This method never throws an exception . */ private void unregisterJobFromHighAvailability ( ) { } }
try { runningJobsRegistry . setJobFinished ( jobGraph . getJobID ( ) ) ; } catch ( Throwable t ) { log . error ( "Could not un-register from high-availability services job {} ({})." + "Other JobManager's may attempt to recover it and re-execute it." , jobGraph . getName ( ) , jobGraph . getJobID ( ) , t ) ; }
public class GroupService { /** * Pause groups of servers * @ param groupFilter search servers criteria by group filter * @ return OperationFuture wrapper for Server list */ public OperationFuture < List < Server > > pause ( GroupFilter groupFilter ) { } }
return serverService ( ) . pause ( getServerSearchCriteria ( groupFilter ) ) ;
public class CPFriendlyURLEntryUtil { /** * Returns the last cp friendly url entry in the ordered set where classNameId = & # 63 ; and classPK = & # 63 ; . * @ param classNameId the class name ID * @ param classPK the class pk * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching cp friendly url entry , or < code > null < / code > if a matching cp friendly url entry could not be found */ public static CPFriendlyURLEntry fetchByC_C_Last ( long classNameId , long classPK , OrderByComparator < CPFriendlyURLEntry > orderByComparator ) { } }
return getPersistence ( ) . fetchByC_C_Last ( classNameId , classPK , orderByComparator ) ;
public class MediaServicesInner { /** * Regenerates a primary or secondary key for a Media Service . * @ param resourceGroupName Name of the resource group within the Azure subscription . * @ param mediaServiceName Name of the Media Service . * @ param keyType The keyType indicating which key you want to regenerate , Primary or Secondary . Possible values include : ' Primary ' , ' Secondary ' * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ApiErrorException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the RegenerateKeyOutputInner object if successful . */ public RegenerateKeyOutputInner regenerateKey ( String resourceGroupName , String mediaServiceName , KeyType keyType ) { } }
return regenerateKeyWithServiceResponseAsync ( resourceGroupName , mediaServiceName , keyType ) . toBlocking ( ) . single ( ) . body ( ) ;
public class ObjectWrapper { /** * Sets the value of the specified indexed property in the wrapped object . * @ param propertyName the name of the indexed property whose value is to be updated , cannot be { @ code null } * @ param index the index position of the property value to be set * @ param value the indexed value to set , can be { @ code null } * @ throws ReflectionException if a reflection error occurs * @ throws IllegalArgumentException if the propertyName parameter is { @ code null } * @ throws IllegalArgumentException if the indexed object in the wrapped object is not a { @ link List } or { @ code array } type * @ throws IndexOutOfBoundsException if the indexed object in the wrapped object is out of bounds with the given index and autogrowing is disabled * @ throws NullPointerException if the indexed object in the wrapped object is { @ code null } * @ throws NullPointerException if the indexed object in the wrapped object is out of bounds with the given index , but autogrowing ( if enabled ) is unable to fill the blank positions with { @ code null } * @ throws NullPointerException if the wrapped object does not have a property with the given name */ public void setIndexedValue ( String propertyName , int index , Object value ) { } }
setIndexedValue ( object , getPropertyOrThrow ( bean , propertyName ) , index , value , this ) ;
public class Context { /** * Get the indexes of a bitset . * @ param bits parameter * @ return list of set bits */ public static List < Long > indexes ( final MutableBitSet bits ) { } }
List < Long > indexes = new ArrayList < > ( ( int ) bits . cardinality ( ) ) ; for ( long i = bits . nextSetBit ( 0 ) ; i >= 0 ; i = bits . nextSetBit ( i + 1 ) ) { indexes . add ( i ) ; } return indexes ;
public class Engine { /** * Get template . * @ param name - template name * @ return template instance * @ throws IOException - If an I / O error occurs * @ throws ParseException - If the template cannot be parsed * @ see # getEngine ( ) */ public Template getTemplate ( String name , Object args ) throws IOException , ParseException { } }
if ( args instanceof String ) return getTemplate ( name , ( String ) args ) ; if ( args instanceof Locale ) return getTemplate ( name , ( Locale ) args ) ; return getTemplate ( name , null , null , args ) ;
public class Parser { /** * Match a bracketed token given the start bracket and the end bracket * The result includes the brackets . * @ param start * @ param end * @ param textProvider * @ return true if match */ public boolean getBracketedToken ( char start , char end , TextProvider textProvider ) { } }
clearLastToken ( textProvider ) ; clearLeadingSpaces ( textProvider ) ; mark ( textProvider ) ; if ( m_debug ) debug ( "testing " + start + " " + end , textProvider ) ; StringBuilder sb = new StringBuilder ( ) ; char c = getNextChar ( textProvider ) ; if ( c != start ) { reset ( textProvider ) ; return false ; } int brackets = 0 ; while ( true ) { if ( c == start ) brackets ++ ; if ( c == end ) brackets -- ; sb . append ( c ) ; if ( brackets < 1 ) break ; c = getNextChar ( textProvider ) ; if ( c == 0 ) { reset ( textProvider ) ; return false ; } } unmark ( textProvider ) ; String s = sb . toString ( ) . trim ( ) ; if ( s . length ( ) == 0 ) return false ; textProvider . setLastToken ( s ) ; debug ( textProvider ) ; return true ;
public class AbstractConditionalEventDefinitionBuilder { /** * Sets the condition of the conditional event definition . * @ param conditionText the condition which should be evaluate to true or false * @ return the builder object */ public B condition ( String conditionText ) { } }
Condition condition = createInstance ( Condition . class ) ; condition . setTextContent ( conditionText ) ; element . setCondition ( condition ) ; return myself ;