signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AbstractLegacyAwareInputRow { /** * Subclasses should call this method within their * readObject ( ObjectInputStream ) invocations * @ param stream * @ throws IOException * @ throws ClassNotFoundException */ protected void doReadObject ( final ObjectInputStream stream ) throws IOException , ClassNotFoundException { } }
final GetField readFields = stream . readFields ( ) ; for ( final String fieldName : getFieldNamesInAdditionToId ( ) ) { final Object value = readFields . get ( fieldName , null ) ; setField ( fieldName , value ) ; } // fix issue of deserializing _ rowNumber in it ' s previous int form final long rowNumber ; final ObjectStreamField legacyRowNumberField = readFields . getObjectStreamClass ( ) . getField ( getFieldNameForOldId ( ) ) ; if ( legacyRowNumberField != null ) { rowNumber = readFields . get ( getFieldNameForOldId ( ) , - 1 ) ; } else { rowNumber = readFields . get ( getFieldNameForNewId ( ) , - 1L ) ; } setField ( getFieldNameForNewId ( ) , rowNumber ) ;
public class StatusMessageEscaper { /** * Escape the provided unicode { @ link String } into ascii . */ public static String escape ( String value ) { } }
for ( int i = 0 ; i < value . length ( ) ; i ++ ) { if ( isEscapingChar ( value . charAt ( i ) ) ) { return doEscape ( value . getBytes ( StandardCharsets . UTF_8 ) , i ) ; } } return value ;
public class TileSetRuleSet { /** * The ruleset can be provided to a { @ link ValidatedSetNextRule } to ensure that the tileset * was fully parsed before doing something with it . */ public boolean isValid ( Object target ) { } }
TileSet set = ( TileSet ) target ; boolean valid = true ; // check for the ' name ' attribute if ( StringUtil . isBlank ( set . getName ( ) ) ) { log . warning ( "Tile set definition missing 'name' attribute " + "[set=" + set + "]." ) ; valid = false ; } // check for an < imagePath > element if ( StringUtil . isBlank ( set . getImagePath ( ) ) ) { log . warning ( "Tile set definition missing <imagePath> element " + "[set=" + set + "]." ) ; valid = false ; } return valid ;
public class WindowedStream { /** * Sets the time by which elements are allowed to be late . Elements that * arrive behind the watermark by more than the specified time will be dropped . * By default , the allowed lateness is { @ code 0L } . * < p > Setting an allowed lateness is only valid for event - time windows . */ @ PublicEvolving public WindowedStream < T , K , W > allowedLateness ( Time lateness ) { } }
final long millis = lateness . toMilliseconds ( ) ; checkArgument ( millis >= 0 , "The allowed lateness cannot be negative." ) ; this . allowedLateness = millis ; return this ;
public class ClassHelper { /** * Get the name of the object ' s class without the package . * @ param aObject * The object to get the information from . May be < code > null < / code > . * @ return The local name of the passed object ' s class . */ @ Nullable public static String getClassLocalName ( @ Nullable final Object aObject ) { } }
return aObject == null ? null : getClassLocalName ( aObject . getClass ( ) ) ;
public class EmailIntentBuilder { /** * Add an email address to be used in the " cc " field . * @ param cc * the email addresses to add * @ return This { @ code EmailIntentBuilder } for method chaining */ @ NonNull public EmailIntentBuilder cc ( @ NonNull Collection < String > cc ) { } }
checkNotNull ( cc ) ; for ( String email : cc ) { checkEmail ( email ) ; } this . cc . addAll ( cc ) ; return this ;
public class ApiOvhEmailexchange { /** * Get this object properties * REST : GET / email / exchange / { organizationName } / service / { exchangeService } / publicFolder / { path } * @ param organizationName [ required ] The internal name of your exchange organization * @ param exchangeService [ required ] The internal name of your exchange service * @ param path [ required ] Path for public folder */ public OvhPublicFolder organizationName_service_exchangeService_publicFolder_path_GET ( String organizationName , String exchangeService , String path ) throws IOException { } }
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}" ; StringBuilder sb = path ( qPath , organizationName , exchangeService , path ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhPublicFolder . class ) ;
public class DelegatingClassResolver { /** * < p > intialize . < / p > * @ throws java . lang . IllegalStateException if any . */ public final void intialize ( ) throws IllegalStateException { } }
synchronized ( this ) { if ( tracker != null ) { throw new IllegalStateException ( "DelegatingClassResolver [" + this + "] had been initialized." ) ; } tracker = new ClassResolverTracker ( context , applicationName ) ; tracker . open ( ) ; }
public class RecurringData { /** * Moves a calendar to the nth named day of the month . * @ param calendar current date * @ param dayNumber nth day */ private void setCalendarToOrdinalRelativeDay ( Calendar calendar , int dayNumber ) { } }
int currentDayOfWeek = calendar . get ( Calendar . DAY_OF_WEEK ) ; int requiredDayOfWeek = getDayOfWeek ( ) . getValue ( ) ; int dayOfWeekOffset = 0 ; if ( requiredDayOfWeek > currentDayOfWeek ) { dayOfWeekOffset = requiredDayOfWeek - currentDayOfWeek ; } else { if ( requiredDayOfWeek < currentDayOfWeek ) { dayOfWeekOffset = 7 - ( currentDayOfWeek - requiredDayOfWeek ) ; } } if ( dayOfWeekOffset != 0 ) { calendar . add ( Calendar . DAY_OF_YEAR , dayOfWeekOffset ) ; } if ( dayNumber > 1 ) { calendar . add ( Calendar . DAY_OF_YEAR , ( 7 * ( dayNumber - 1 ) ) ) ; }
public class CmsUgcSession { /** * Stores the upload resource and deletes previously uploaded resources for the same form field . < p > * @ param fieldName the field name * @ param upload the uploaded resource */ private void updateUploadResource ( String fieldName , CmsResource upload ) { } }
CmsResource prevUploadResource = m_uploadResourcesByField . get ( fieldName ) ; if ( prevUploadResource != null ) { try { m_cms . deleteResource ( m_cms . getSitePath ( prevUploadResource ) , CmsResource . DELETE_PRESERVE_SIBLINGS ) ; } catch ( Exception e ) { LOG . error ( "Couldn't delete previous upload resource: " + e . getLocalizedMessage ( ) , e ) ; } } m_uploadResourcesByField . put ( fieldName , upload ) ;
public class IsModifiedVisitor { /** * Visits all Auditable , Visitable objects in an object graph hierarchy in search of any modified objects . * @ param visitable the Visitable object visited by this Visitor . * @ see org . cp . elements . lang . Auditable # isModified ( ) */ @ Override public void visit ( final Visitable visitable ) { } }
if ( visitable instanceof Auditable ) { modified |= ( ( Auditable ) visitable ) . isModified ( ) ; }
public class ListProvisioningArtifactsResult { /** * Information about the provisioning artifacts . * @ param provisioningArtifactDetails * Information about the provisioning artifacts . */ public void setProvisioningArtifactDetails ( java . util . Collection < ProvisioningArtifactDetail > provisioningArtifactDetails ) { } }
if ( provisioningArtifactDetails == null ) { this . provisioningArtifactDetails = null ; return ; } this . provisioningArtifactDetails = new java . util . ArrayList < ProvisioningArtifactDetail > ( provisioningArtifactDetails ) ;
public class FileHistory { /** * Read specified history file to history buffer */ private void readFile ( ) { } }
if ( historyFile . exists ( ) ) { try ( BufferedReader reader = new BufferedReader ( new FileReader ( historyFile ) ) ) { String line ; while ( ( line = reader . readLine ( ) ) != null ) push ( Parser . toCodePoints ( line ) ) ; } catch ( FileNotFoundException ignored ) { // AESH - 205 } catch ( IOException e ) { if ( logging ) LOGGER . log ( Level . WARNING , "Failed to read from history file, " , e ) ; } }
public class SecureUriMapperImpl { /** * { @ inheritDoc } */ public String getPassKey ( String uri ) { } }
Iterator iter = uriMappings . keySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { String passKey = ( String ) iter . next ( ) ; if ( antPathMather . match ( ( String ) uriMappings . get ( passKey ) , uri ) ) { return passKey ; } } return null ;
public class DateTimeField { /** * init . * @ param record The parent record . * @ param strName The field name . * @ param iDataLength The maximum string length ( pass - 1 for default ) . * @ param strDesc The string description ( usually pass null , to use the resource file desc ) . * @ param strDefault The default value ( if object , this value is the default value , if string , the string is the default ) . */ public void init ( Record record , String strName , int iDataLength , String strDesc , Object strDefault ) { } }
if ( m_calendar == null ) m_calendar = Calendar . getInstance ( ) ; super . init ( record , strName , iDataLength , strDesc , strDefault ) ; if ( iDataLength == DBConstants . DEFAULT_FIELD_LENGTH ) m_iMaxLength = DATETIME_DEFAULT_LENGTH ; m_classData = java . util . Date . class ;
public class HttpRequest { /** * 获取请求URL最后的一个 / 后面的部分的double值 < br > * 例如请求URL / pipes / record / query / 2 < br > * 获取type参数 : double type = request . getRequstURILastPath ( 0.0 ) ; / / type = 2.0 * @ param defvalue 默认double值 * @ return double值 */ public double getRequstURILastPath ( double defvalue ) { } }
String val = getRequstURILastPath ( ) ; try { return val . isEmpty ( ) ? defvalue : Double . parseDouble ( val ) ; } catch ( NumberFormatException e ) { return defvalue ; }
public class LocalQPConsumerKey { /** * Return this key ' s parent if it is a member of a keyGroup */ public JSConsumerKey getParent ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getParent" ) ; JSConsumerKey key = this ; if ( keyGroup != null ) key = keyGroup ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getParent" , key ) ; return key ;
public class JobInitializer { /** * Get the average waiting msecs per hard admission job entrance . * @ return Average waiting msecs per hard admission job entrance */ synchronized float getAverageWaitMsecsPerHardAdmissionJob ( ) { } }
float averageWaitMsecsPerHardAdmissionJob = - 1f ; if ( ! hardAdmissionMillisQueue . isEmpty ( ) ) { long totalWait = 0 ; for ( Long waitMillis : hardAdmissionMillisQueue ) { totalWait += waitMillis ; } averageWaitMsecsPerHardAdmissionJob = ( ( float ) totalWait ) / hardAdmissionMillisQueue . size ( ) ; } return averageWaitMsecsPerHardAdmissionJob ;
public class CmsMultiListDialog { /** * Returns the html code for the default action content . < p > * @ return html code */ protected String defaultActionHtmlContent ( ) { } }
StringBuffer result = new StringBuffer ( 2048 ) ; result . append ( "<table id='twolists' cellpadding='0' cellspacing='0' align='center' width='100%'>\n" ) ; Iterator < A_CmsListDialog > i = m_wps . iterator ( ) ; while ( i . hasNext ( ) ) { A_CmsListDialog wp = i . next ( ) ; result . append ( "\t<tr>\n" ) ; result . append ( "\t\t<td valign='top'>\n" ) ; result . append ( "\t\t\t" ) . append ( wp . defaultActionHtmlContent ( ) ) . append ( "\n" ) ; result . append ( "\t\t</td>\n" ) ; result . append ( "\t</tr>\n" ) ; result . append ( "\t<tr><td height='20'/></tr>\n" ) ; } result . append ( "</table>\n" ) ; return result . toString ( ) ;
public class Edge { /** * Compare with other edge . */ @ Override public int compareTo ( Edge other ) { } }
int cmp = super . compareTo ( other ) ; if ( cmp != 0 ) { return cmp ; } return type - other . type ;
public class DateTimeExpression { /** * Get the minimum value of this expression ( aggregation ) * @ return min ( this ) */ public DateTimeExpression < T > min ( ) { } }
if ( min == null ) { min = Expressions . dateTimeOperation ( getType ( ) , Ops . AggOps . MIN_AGG , mixin ) ; } return min ;
public class CompositeType { /** * The encodedLength ( in octets ) of the list of EncodedDataTypes * @ return encodedLength of the compositeType */ public int encodedLength ( ) { } }
int length = 0 ; for ( final Type t : containedTypeByNameMap . values ( ) ) { if ( t . isVariableLength ( ) ) { return Token . VARIABLE_LENGTH ; } if ( t . offsetAttribute ( ) != - 1 ) { length = t . offsetAttribute ( ) ; } if ( t . presence ( ) != Presence . CONSTANT ) { length += t . encodedLength ( ) ; } } return length ;
public class PersistenceUnitDefaultsImpl { /** * If not already created , a new < code > entity - listeners < / code > element with the given value will be created . * Otherwise , the existing < code > entity - listeners < / code > element will be returned . * @ return a new or existing instance of < code > EntityListeners < PersistenceUnitDefaults < T > > < / code > */ public EntityListeners < PersistenceUnitDefaults < T > > getOrCreateEntityListeners ( ) { } }
Node node = childNode . getOrCreate ( "entity-listeners" ) ; EntityListeners < PersistenceUnitDefaults < T > > entityListeners = new EntityListenersImpl < PersistenceUnitDefaults < T > > ( this , "entity-listeners" , childNode , node ) ; return entityListeners ;
public class PortletEntityRegistryImpl { /** * Delete a portlet entity , removes it from the request , session and persistent stores */ protected void deletePortletEntity ( HttpServletRequest request , IPortletEntity portletEntity , boolean cacheOnly ) { } }
final IPortletEntityId portletEntityId = portletEntity . getPortletEntityId ( ) ; // Remove from request cache final PortletEntityCache < IPortletEntity > portletEntityMap = this . getPortletEntityMap ( request ) ; portletEntityMap . removeEntity ( portletEntityId ) ; // Remove from session cache final PortletEntityCache < PortletEntityData > portletEntityDataMap = this . getPortletEntityDataMap ( request ) ; portletEntityDataMap . removeEntity ( portletEntityId ) ; if ( ! cacheOnly && portletEntity instanceof PersistentPortletEntityWrapper ) { final IPortletEntity persistentEntity = ( ( PersistentPortletEntityWrapper ) portletEntity ) . getPersistentEntity ( ) ; try { this . portletEntityDao . deletePortletEntity ( persistentEntity ) ; } catch ( HibernateOptimisticLockingFailureException e ) { this . logger . warn ( "This persistent portlet has already been deleted: " + persistentEntity + ", trying to find and delete by layout node and user." ) ; final IPortletEntity existingPersistentEntity = this . portletEntityDao . getPortletEntity ( persistentEntity . getLayoutNodeId ( ) , persistentEntity . getUserId ( ) ) ; if ( existingPersistentEntity != null ) { this . portletEntityDao . deletePortletEntity ( existingPersistentEntity ) ; } } }
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcAreaMeasure ( ) { } }
if ( ifcAreaMeasureEClass == null ) { ifcAreaMeasureEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 783 ) ; } return ifcAreaMeasureEClass ;
public class MinMax { /** * Return the maximum of two values , according the given comparator . * { @ code null } values are allowed . * @ param comp the comparator used for determining the max value * @ param a the first value to compare * @ param b the second value to compare * @ param < T > the type of the compared objects * @ return the maximum value , or { @ code null } if both values are { @ code null } . * If only one value is { @ code null } , the non { @ code null } values is * returned . */ public static < T > T max ( final Comparator < ? super T > comp , final T a , final T b ) { } }
return a != null ? b != null ? comp . compare ( a , b ) >= 0 ? a : b : a : b ;
public class AdapterUtil { /** * Translates a SQLException from the database . Exception mapping code is * now consolidated into AdapterUtil . mapException . * @ param SQLException se - the SQLException from the database * @ param mapper the managed connection or managed connection factory capable of * mapping the exception . If this value is NULL , then exception mapping is * not performed . If stale statement handling or connection error handling * is required then the managed connection must be supplied . * @ return SQLException - the mapped SQLException */ public static SQLException mapSQLException ( SQLException se , Object mapper ) { } }
return ( SQLException ) mapException ( se , null , mapper , true ) ;
public class Node { /** * 生成一个服务注册json对象 */ @ Override public NodeStatus getFullStatus ( ) { } }
NodeStatus nodeStatus = getSimpleStatus ( ) ; LocalUnitsManager . searchUnitMap ( searchUnitMap -> nodeStatus . setUnits ( searchUnitMap . keySet ( ) ) ) ; nodeStatus . setPort ( RPC_PORT ) ; nodeStatus . setHost ( EnvUtil . getLocalIp ( ) ) ; return nodeStatus ;
public class AbstractSyncAsyncMessageBus { /** * this method queues a message delivery request */ protected IMessagePublication addAsynchronousPublication ( MessagePublication publication , long timeout , TimeUnit unit ) { } }
try { return pendingMessages . offer ( publication , timeout , unit ) ? publication . markScheduled ( ) : publication ; } catch ( InterruptedException e ) { handlePublicationError ( new InternalPublicationError ( e , "Error while adding an asynchronous message publication" , publication ) ) ; return publication ; }
public class ContentSpecProcessor { /** * Checks to see if a ContentSpec topic matches a Content Spec Entity topic . * @ param infoTopic The ContentSpec topic object . * @ param infoNode The Content Spec Entity topic . * @ param parentNode * @ return True if the topic is determined to match otherwise false . */ protected boolean doesInfoTopicMatch ( final InfoTopic infoTopic , final CSInfoNodeWrapper infoNode , final CSNodeWrapper parentNode ) { } }
if ( infoNode == null && infoTopic != null ) return false ; // If the unique id is not from the parser , in which case it will start with a number than use the unique id to compare if ( infoTopic . getUniqueId ( ) != null && infoTopic . getUniqueId ( ) . matches ( "^\\d.*" ) ) { return infoTopic . getUniqueId ( ) . equals ( Integer . toString ( parentNode . getId ( ) ) ) ; } else { // Since a content spec doesn ' t contain the database ids for the nodes use what is available to see if the topics match return infoTopic . getDBId ( ) . equals ( infoNode . getTopicId ( ) ) ; }
public class EpicsApi { /** * Updates an existing epic . * < pre > < code > GitLab Endpoint : PUT / groups / : id / epics / : epic _ iid < / code > < / pre > * @ param groupIdOrPath the group ID , path of the group , or a Group instance holding the group ID or path * @ param epicIid the IID of the epic to update * @ param title the title of the epic ( optional ) * @ param labels comma separated list of labels ( optional ) * @ param description the description of the epic ( optional ) * @ param startDate the start date of the epic ( optional ) * @ param endDate the end date of the epic ( optional ) * @ return an Epic instance containing info on the newly created epic * @ throws GitLabApiException if any exception occurs */ public Epic updateEpic ( Object groupIdOrPath , Integer epicIid , String title , String labels , String description , Date startDate , Date endDate ) throws GitLabApiException { } }
Form formData = new GitLabApiForm ( ) . withParam ( "title" , title , true ) . withParam ( "labels" , labels ) . withParam ( "description" , description ) . withParam ( "start_date" , startDate ) . withParam ( "end_date" , endDate ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "epics" , epicIid ) ; return ( response . readEntity ( Epic . class ) ) ;
public class MappingTrackArchiver { /** * look into a jar file and check for pom . properties . The first pom . properties found are returned . */ private Artifact getArtifactFromJar ( File jar ) { } }
// Lets figure the real mvn source of file . String type = extractFileType ( jar ) ; if ( type != null ) { try { ArrayList < Properties > options = new ArrayList < Properties > ( ) ; try ( ZipInputStream in = new ZipInputStream ( new FileInputStream ( jar ) ) ) { ZipEntry entry ; while ( ( entry = in . getNextEntry ( ) ) != null ) { if ( entry . getName ( ) . startsWith ( "META-INF/maven/" ) && entry . getName ( ) . endsWith ( "pom.properties" ) ) { byte [ ] buf = new byte [ 1024 ] ; int len ; ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; // change ouptut stream as required while ( ( len = in . read ( buf ) ) > 0 ) { out . write ( buf , 0 , len ) ; } Properties properties = new Properties ( ) ; properties . load ( new ByteArrayInputStream ( out . toByteArray ( ) ) ) ; options . add ( properties ) ; } } } if ( options . size ( ) == 1 ) { return getArtifactFromPomProperties ( type , options . get ( 0 ) ) ; } else { log . warn ( "Found %d pom.properties in %s" , options . size ( ) , jar ) ; } } catch ( IOException e ) { log . warn ( "IO Exception while examining %s for maven coordinates: %s. Ignoring for watching ..." , jar , e . getMessage ( ) ) ; } } return null ;
public class MetadataListMarshaller { /** * { @ inheritDoc } */ @ Override protected void marshallAttributes ( XMLObject xmlObject , Element domElement ) throws MarshallingException { } }
MetadataList mdl = ( MetadataList ) xmlObject ; if ( mdl . getTerritory ( ) != null ) { domElement . setAttributeNS ( null , MetadataList . TERRITORY_ATTR_NAME , mdl . getTerritory ( ) ) ; } this . marshallUnknownAttributes ( mdl , domElement ) ;
public class MultiUserChatLightManager { /** * Returns true if Multi - User Chat Light feature is supported by the server . * @ param mucLightService * @ return true if Multi - User Chat Light feature is supported by the server . * @ throws NotConnectedException * @ throws XMPPErrorException * @ throws NoResponseException * @ throws InterruptedException */ public boolean isFeatureSupported ( DomainBareJid mucLightService ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } }
return ServiceDiscoveryManager . getInstanceFor ( connection ( ) ) . discoverInfo ( mucLightService ) . containsFeature ( MultiUserChatLight . NAMESPACE ) ;
public class RDateIteratorImpl { /** * monotonically . */ private static < C extends Comparable < C > > boolean increasing ( C [ ] els ) { } }
for ( int i = els . length ; -- i >= 1 ; ) { if ( els [ i - 1 ] . compareTo ( els [ i ] ) > 0 ) { return false ; } } return true ;
public class MACAddressSection { /** * If this section is part of a shorter 48 bit MAC or EUI - 48 address see { @ link # isExtended ( ) } , * then the required sections are inserted ( FF - FF for MAC , FF - FE for EUI - 48 ) to extend it to EUI - 64. * However , if the section does not encompass the parts of the address where * the new sections should be placed , then the section is unchanged . * If the section is already part of an EUI - 64 address , then it is checked * to see if it has the segments that identify it as extended to EUI - 64 ( FF - FF for MAC , FF - FE for EUI - 48 ) , * and if not , { @ link IncompatibleAddressException } is thrown . * @ param asMAC * @ return */ public MACAddressSection toEUI64 ( boolean asMAC ) { } }
int originalSegmentCount = getSegmentCount ( ) ; if ( ! isExtended ( ) ) { MACAddressCreator creator = getAddressCreator ( addressSegmentIndex , true ) ; if ( addressSegmentIndex + originalSegmentCount < 3 || addressSegmentIndex > 3 ) { return this ; } // we are in a situation where we are including segments at index 3 and 4 in an address , which are the ff : fe or ff : ff segments MACAddressSegment segs [ ] = creator . createSegmentArray ( originalSegmentCount + 2 ) ; int frontCount ; if ( addressSegmentIndex < 3 ) { frontCount = 3 - addressSegmentIndex ; getSegments ( 0 , frontCount , segs , 0 ) ; } else { frontCount = 0 ; } MACAddressSegment ffSegment = creator . createSegment ( 0xff ) ; segs [ frontCount ] = ffSegment ; segs [ frontCount + 1 ] = asMAC ? ffSegment : creator . createSegment ( 0xfe ) ; Integer prefLength = getPrefixLength ( ) ; if ( originalSegmentCount > frontCount ) { getSegments ( frontCount , originalSegmentCount , segs , frontCount + 2 ) ; // If the prefLength is exactly at the end of the initial segments before ff : fe or ff : ff , we could put it either before or after the ff : fe or ff : ff // Since the ff : fe or ff : ff is not part of any OUI , we put it before // This is also consistent with what we do with IP address inserts , where inserting at 3rd segment of 1.2.4/16 results in 1.2.3.4/16 if ( prefLength != null && prefLength > frontCount << 3 ) { prefLength += MACAddress . BITS_PER_SEGMENT << 1 ; // 2 segments } } MACAddressSection result = creator . createSectionInternal ( segs , addressSegmentIndex , true ) ; result . assignPrefixLength ( prefLength ) ; return result ; } int endIndex = addressSegmentIndex + originalSegmentCount ; if ( addressSegmentIndex <= 3 ) { if ( endIndex > 4 ) { int index3 = 3 - addressSegmentIndex ; MACAddressSegment seg3 = getSegment ( index3 ) ; MACAddressSegment seg4 = getSegment ( index3 + 1 ) ; if ( ! seg4 . matches ( asMAC ? 0xff : 0xfe ) || ! seg3 . matches ( 0xff ) ) { throw new IncompatibleAddressException ( this , "ipaddress.mac.error.not.eui.convertible" ) ; } } else if ( endIndex == 4 ) { MACAddressSegment seg3 = getSegment ( 3 - addressSegmentIndex ) ; if ( ! seg3 . matches ( 0xff ) ) { throw new IncompatibleAddressException ( this , "ipaddress.mac.error.not.eui.convertible" ) ; } } } else if ( addressSegmentIndex == 4 ) { if ( endIndex > 4 ) { MACAddressSegment seg4 = getSegment ( 4 - addressSegmentIndex ) ; if ( ! seg4 . matches ( asMAC ? 0xff : 0xfe ) ) { throw new IncompatibleAddressException ( this , "ipaddress.mac.error.not.eui.convertible" ) ; } } } return this ;
public class RecentCaseCommunicationsMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RecentCaseCommunications recentCaseCommunications , ProtocolMarshaller protocolMarshaller ) { } }
if ( recentCaseCommunications == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( recentCaseCommunications . getCommunications ( ) , COMMUNICATIONS_BINDING ) ; protocolMarshaller . marshall ( recentCaseCommunications . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SDBaseOps { /** * Minimum array reduction operation , optionally along specified dimensions . out = min ( in ) * @ param name Output variable name * @ param x Input variable * @ param dimensions Dimensions to reduce over . If dimensions are not specified , full array reduction is performed * @ return Reduced array of rank ( input rank - num dimensions ) */ public SDVariable min ( String name , SDVariable x , int ... dimensions ) { } }
return min ( name , x , false , dimensions ) ;
public class LogMonitor { /** * Attempts to start a new troubleshooting session . First the SDK will check if there is * an existing session stored in the persistent storage and then check if the clipboard * contains a valid access token . * This call is async and returns immediately . */ public static void startSession ( final Context context , final String appKey , final String appSignature ) { } }
dispatchOnConversationQueue ( new DispatchTask ( ) { @ Override protected void execute ( ) { try { startSessionGuarded ( context , appKey , appSignature ) ; } catch ( Exception e ) { ApptentiveLog . e ( TROUBLESHOOT , e , "Unable to start Apptentive Log Monitor" ) ; logException ( e ) ; } } } ) ;
public class DockerRule { /** * Run , record and remove after test container with jenkins . * @ param forceRefresh enforce data container and data image refresh */ public String runFreshJenkinsContainer ( DockerImagePullStrategy pullStrategy , boolean forceRefresh ) throws IOException , SettingsBuildingException , InterruptedException { } }
LOG . debug ( "Entering run fresh jenkins container." ) ; pullImage ( pullStrategy , JENKINS_DEFAULT . getDockerImageName ( ) ) ; // labels attached to container allows cleanup container if it wasn ' t removed final Map < String , String > labels = new HashMap < > ( ) ; labels . put ( "test.displayName" , description . getDisplayName ( ) ) ; LOG . debug ( "Removing existed container before" ) ; try { final List < Container > containers = getDockerCli ( ) . listContainersCmd ( ) . withShowAll ( true ) . exec ( ) ; for ( Container c : containers ) { if ( c . getLabels ( ) . equals ( labels ) ) { // equals ? container labels vs image labels ? LOG . debug ( "Removing {}, for labels: '{}'" , c , labels ) ; getDockerCli ( ) . removeContainerCmd ( c . getId ( ) ) . withForce ( true ) . exec ( ) ; break ; } } } catch ( NotFoundException ex ) { LOG . debug ( "Container wasn't found, that's ok" ) ; } LOG . debug ( "Recreating data container without data-image doesn't make sense, so reuse boolean." ) ; String dataContainerId = getDataContainerId ( forceRefresh ) ; final String id = getDockerCli ( ) . createContainerCmd ( JENKINS_DEFAULT . getDockerImageName ( ) ) . withEnv ( CONTAINER_JAVA_OPTS ) . withExposedPorts ( new ExposedPort ( JENKINS_DEFAULT . tcpPort ) ) . withPortSpecs ( String . format ( "%d/tcp" , JENKINS_DEFAULT . tcpPort ) ) . withHostConfig ( HostConfig . newHostConfig ( ) . withPortBindings ( PortBinding . parse ( "0.0.0.0:48000:48000" ) ) . withVolumesFrom ( new VolumesFrom ( dataContainerId ) ) . withPublishAllPorts ( true ) ) . withLabels ( labels ) // . withPortBindings ( PortBinding . parse ( " 0.0.0.0:48000:48000 " ) , PortBinding . parse ( " 0.0.0.0:50000:50000 " ) ) . exec ( ) . getId ( ) ; provisioned . add ( id ) ; LOG . debug ( "Starting container" ) ; getDockerCli ( ) . startContainerCmd ( id ) . exec ( ) ; return id ;
public class Node { /** * Recursive component of findTopLevelElements . * @ see # findTopLevelElements */ private static < E extends Element > List < E > findTopLevelElementsRecurse ( Class < E > elementType , Node node , List < E > matches ) { } }
for ( Element elem : node . getChildElements ( ) ) { if ( elementType . isInstance ( elem ) ) { // Found match if ( matches == null ) matches = new ArrayList < > ( ) ; matches . add ( elementType . cast ( elem ) ) ; } else { // Look further down the tree matches = findTopLevelElementsRecurse ( elementType , elem , matches ) ; } } return matches ;
public class Router { /** * todo : write a regexp one day */ private static String [ ] split ( String value , String delimeter ) { } }
StringTokenizer st = new StringTokenizer ( value , delimeter ) ; String [ ] res = new String [ st . countTokens ( ) ] ; for ( int i = 0 ; st . hasMoreTokens ( ) ; i ++ ) { res [ i ] = st . nextToken ( ) ; } return res ;
public class RedissonObjectBuilder { /** * WARNING : rEntity has to be the class of @ This object . */ private Codec getFieldCodec ( Class < ? > rEntity , Class < ? extends RObject > rObjectClass , String fieldName ) throws Exception { } }
Field field = ClassUtils . getDeclaredField ( rEntity , fieldName ) ; if ( field . isAnnotationPresent ( RObjectField . class ) ) { RObjectField anno = field . getAnnotation ( RObjectField . class ) ; return codecProvider . getCodec ( anno , rEntity , rObjectClass , fieldName , config ) ; } else { REntity anno = ClassUtils . getAnnotation ( rEntity , REntity . class ) ; return codecProvider . getCodec ( anno , ( Class < ? > ) rEntity , config ) ; }
public class RubyIO { /** * Returns a { @ link RubyEnumerator } of lines in given file . * @ param path * of a File * @ return { @ link RubyEnumerator } */ public static RubyEnumerator < String > foreach ( String path ) { } }
return Ruby . Enumerator . of ( new EachLineIterable ( new File ( path ) ) ) ;
public class ConceptAlchemyEntity { /** * Set the detected concept tag . * @ param concept detected concept tag */ public void setConcept ( String concept ) { } }
if ( concept != null ) { concept = concept . trim ( ) ; } this . concept = concept ;
public class RouteBuilder { /** * Allows to wire a route to a controller . * @ param type class of controller to which a route is mapped * @ return instance of { @ link RouteBuilder } . */ public < T extends AppController > RouteBuilder to ( Class < T > type ) { } }
boolean hasControllerSegment = false ; for ( Segment segment : segments ) { hasControllerSegment = segment . controller ; } if ( type != null && hasControllerSegment ) { throw new IllegalArgumentException ( "Cannot combine {controller} segment and .to(\"...\") method. Failed route: " + routeConfig ) ; } this . type = type ; return this ;
public class BufferUtil { /** * Checks if two arrays intersect * @ param set1 first array * @ param length1 length of first array * @ param set2 second array * @ param length2 length of second array * @ return true if they intersect */ public static boolean unsignedIntersects ( ShortBuffer set1 , int length1 , ShortBuffer set2 , int length2 ) { } }
if ( ( 0 == length1 ) || ( 0 == length2 ) ) { return false ; } int k1 = 0 ; int k2 = 0 ; // could be more efficient with galloping short s1 = set1 . get ( k1 ) ; short s2 = set2 . get ( k2 ) ; mainwhile : while ( true ) { if ( toIntUnsigned ( s2 ) < toIntUnsigned ( s1 ) ) { do { ++ k2 ; if ( k2 == length2 ) { break mainwhile ; } s2 = set2 . get ( k2 ) ; } while ( toIntUnsigned ( s2 ) < toIntUnsigned ( s1 ) ) ; } if ( toIntUnsigned ( s1 ) < toIntUnsigned ( s2 ) ) { do { ++ k1 ; if ( k1 == length1 ) { break mainwhile ; } s1 = set1 . get ( k1 ) ; } while ( toIntUnsigned ( s1 ) < toIntUnsigned ( s2 ) ) ; } else { return true ; } } return false ;
public class Trie2Writable { /** * Set a value in a range of code points [ start . . end ] . * All code points c with start < = c < = end will get the value if * overwrite is TRUE or if the old value is the initial value . * @ param start the first code point to get the value * @ param end the last code point to get the value ( inclusive ) * @ param value the value * @ param overwrite flag for whether old non - initial values are to be overwritten */ public Trie2Writable setRange ( int start , int end , int value , boolean overwrite ) { } }
/* * repeat value in [ start . . end ] * mark index values for repeat - data blocks by setting bit 31 of the index values * fill around existing values if any , if ( overwrite ) */ int block , rest , repeatBlock ; int /* UChar32 */ limit ; if ( start > 0x10ffff || start < 0 || end > 0x10ffff || end < 0 || start > end ) { throw new IllegalArgumentException ( "Invalid code point range." ) ; } if ( ! overwrite && value == initialValue ) { return this ; /* nothing to do */ } fHash = 0 ; if ( isCompacted ) { this . uncompact ( ) ; } limit = end + 1 ; if ( ( start & UTRIE2_DATA_MASK ) != 0 ) { int /* UChar32 */ nextStart ; /* set partial block at [ start . . following block boundary [ */ block = getDataBlock ( start , true ) ; nextStart = ( start + UTRIE2_DATA_BLOCK_LENGTH ) & ~ UTRIE2_DATA_MASK ; if ( nextStart <= limit ) { fillBlock ( block , start & UTRIE2_DATA_MASK , UTRIE2_DATA_BLOCK_LENGTH , value , initialValue , overwrite ) ; start = nextStart ; } else { fillBlock ( block , start & UTRIE2_DATA_MASK , limit & UTRIE2_DATA_MASK , value , initialValue , overwrite ) ; return this ; } } /* number of positions in the last , partial block */ rest = limit & UTRIE2_DATA_MASK ; /* round down limit to a block boundary */ limit &= ~ UTRIE2_DATA_MASK ; /* iterate over all - value blocks */ if ( value == initialValue ) { repeatBlock = dataNullOffset ; } else { repeatBlock = - 1 ; } while ( start < limit ) { int i2 ; boolean setRepeatBlock = false ; if ( value == initialValue && isInNullBlock ( start , true ) ) { start += UTRIE2_DATA_BLOCK_LENGTH ; /* nothing to do */ continue ; } /* get index value */ i2 = getIndex2Block ( start , true ) ; i2 += ( start >> UTRIE2_SHIFT_2 ) & UTRIE2_INDEX_2_MASK ; block = index2 [ i2 ] ; if ( isWritableBlock ( block ) ) { /* already allocated */ if ( overwrite && block >= UNEWTRIE2_DATA_0800_OFFSET ) { /* * We overwrite all values , and it ' s not a * protected ( ASCII - linear or 2 - byte UTF - 8 ) block : * replace with the repeatBlock . */ setRepeatBlock = true ; } else { /* ! overwrite , or protected block : just write the values into this block */ fillBlock ( block , 0 , UTRIE2_DATA_BLOCK_LENGTH , value , initialValue , overwrite ) ; } } else if ( data [ block ] != value && ( overwrite || block == dataNullOffset ) ) { /* * Set the repeatBlock instead of the null block or previous repeat block : * If ! isWritableBlock ( ) then all entries in the block have the same value * because it ' s the null block or a range block ( the repeatBlock from a previous * call to utrie2 _ setRange32 ( ) ) . * No other blocks are used multiple times before compacting . * The null block is the only non - writable block with the initialValue because * of the repeatBlock initialization above . ( If value = = initialValue , then * the repeatBlock will be the null data block . ) * We set our repeatBlock if the desired value differs from the block ' s value , * and if we overwrite any data or if the data is all initial values * ( which is the same as the block being the null block , see above ) . */ setRepeatBlock = true ; } if ( setRepeatBlock ) { if ( repeatBlock >= 0 ) { setIndex2Entry ( i2 , repeatBlock ) ; } else { /* create and set and fill the repeatBlock */ repeatBlock = getDataBlock ( start , true ) ; writeBlock ( repeatBlock , value ) ; } } start += UTRIE2_DATA_BLOCK_LENGTH ; } if ( rest > 0 ) { /* set partial block at [ last block boundary . . limit [ */ block = getDataBlock ( start , true ) ; fillBlock ( block , 0 , rest , value , initialValue , overwrite ) ; } return this ;
public class AtomContainerSet { /** * Sets the coefficient of a AtomContainer to a given value . * @ param container The AtomContainer for which the multiplier is set * @ param multiplier The new multiplier for the AtomContatiner * @ return true if multiplier has been set * @ see # getMultiplier ( IAtomContainer ) */ @ Override public boolean setMultiplier ( IAtomContainer container , Double multiplier ) { } }
for ( int i = 0 ; i < atomContainers . length ; i ++ ) { if ( atomContainers [ i ] == container ) { multipliers [ i ] = multiplier ; return true ; } } return false ;
public class RESTClient { /** * Customize socket options */ private void setSocketOptions ( ) throws SocketException { } }
if ( DISABLE_NAGLES ) { // Disable Nagle ' s algorithm ( significant on Windows ) . m_socket . setTcpNoDelay ( true ) ; m_logger . debug ( "Nagle's algorithm disabled." ) ; } if ( USE_CUSTOM_BUFFER_SIZE ) { // Improve default send / receive buffer sizes from default ( often 8K ) . if ( m_socket . getSendBufferSize ( ) < NET_BUFFER_SIZE ) { m_logger . debug ( "SendBufferSize increased from {} to {}" , m_socket . getSendBufferSize ( ) , NET_BUFFER_SIZE ) ; m_socket . setSendBufferSize ( NET_BUFFER_SIZE ) ; } if ( m_socket . getReceiveBufferSize ( ) < NET_BUFFER_SIZE ) { m_logger . debug ( "ReceiveBufferSize increased from {} to {}" , m_socket . getReceiveBufferSize ( ) , NET_BUFFER_SIZE ) ; m_socket . setReceiveBufferSize ( NET_BUFFER_SIZE ) ; } }
public class IntegrationAccountsInner { /** * Regenerates the integration account access key . * @ param resourceGroupName The resource group name . * @ param integrationAccountName The integration account name . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the IntegrationAccountInner object */ public Observable < ServiceResponse < IntegrationAccountInner > > regenerateAccessKeyWithServiceResponseAsync ( String resourceGroupName , String integrationAccountName ) { } }
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( integrationAccountName == null ) { throw new IllegalArgumentException ( "Parameter integrationAccountName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } final KeyType keyType = null ; RegenerateActionParameter regenerateAccessKey = new RegenerateActionParameter ( ) ; regenerateAccessKey . withKeyType ( null ) ; return service . regenerateAccessKey ( this . client . subscriptionId ( ) , resourceGroupName , integrationAccountName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , regenerateAccessKey , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < IntegrationAccountInner > > > ( ) { @ Override public Observable < ServiceResponse < IntegrationAccountInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < IntegrationAccountInner > clientResponse = regenerateAccessKeyDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class StashController { /** * Gets the configurations */ @ RequestMapping ( value = "configurations" , method = RequestMethod . GET ) public Resources < StashConfiguration > getConfigurations ( ) { } }
return Resources . of ( configurationService . getConfigurations ( ) , uri ( on ( getClass ( ) ) . getConfigurations ( ) ) ) . with ( Link . CREATE , uri ( on ( getClass ( ) ) . getConfigurationForm ( ) ) ) . with ( "_test" , uri ( on ( getClass ( ) ) . testConfiguration ( null ) ) , securityService . isGlobalFunctionGranted ( GlobalSettings . class ) ) ;
public class ModuleUiExtensions { /** * Create a new ui extension . * This method will override the configuration specified through * { @ link CMAClient . Builder # setSpaceId ( String ) } and will ignore * { @ link CMAClient . Builder # setEnvironmentId ( String ) } . * @ param spaceId the id of the space this ui extension should be created in . * @ param environmentId the id of the environment this is valid on . * @ param extension the ui extension to be added . * @ return the created ui extension . * @ throws IllegalArgumentException if spaceId is null . * @ throws IllegalArgumentException if extension is null . * @ throws IllegalArgumentException if extension ' s id is null . * @ throws IllegalArgumentException if extension ' s version is null . * @ throws IllegalArgumentException if extension ' s spaceId is null . */ public CMAUiExtension create ( String spaceId , String environmentId , CMAUiExtension extension ) { } }
assertNotNull ( extension , "extension" ) ; assertNotNull ( spaceId , "spaceId" ) ; assertNotNull ( environmentId , "environmentId" ) ; final String id = extension . getId ( ) ; final CMASystem system = extension . getSystem ( ) ; extension . setSystem ( null ) ; try { if ( id == null ) { return service . create ( spaceId , environmentId , extension ) . blockingFirst ( ) ; } else { return service . create ( spaceId , environmentId , id , extension ) . blockingFirst ( ) ; } } finally { extension . setSystem ( system ) ; }
import java . util . * ; class ComputeProductOfUniqueElements { /** * A Java function that calculates the product of unique elements in a provided array . * > > > compute _ product _ of _ unique _ elements ( [ 1 , 1 , 2 , 3 ] , 4) * > > > compute _ product _ of _ unique _ elements ( [ 1 , 2 , 3 , 1 , 1 ] , 5) * > > > compute _ product _ of _ unique _ elements ( [ 1 , 1 , 4 , 5 , 6 ] , 5) * 120 */ public static int computeProductOfUniqueElements ( List < Integer > values , int length ) { } }
Collections . sort ( values ) ; int product = 1 ; for ( int idx = 0 ; idx < length ; idx ++ ) { if ( idx == 0 || ! values . get ( idx - 1 ) . equals ( values . get ( idx ) ) ) { product *= values . get ( idx ) ; } } return product ;
public class Resulting { /** * Override this to handle a request completion in your own way . */ public void requestCompleted ( T result ) { } }
if ( _chain != null ) { _chain . requestCompleted ( result ) ; } else if ( _invChain instanceof InvocationService . ResultListener ) { ( ( InvocationService . ResultListener ) _invChain ) . requestProcessed ( result ) ; } else if ( _invChain instanceof InvocationService . ConfirmListener ) { ( ( InvocationService . ConfirmListener ) _invChain ) . requestProcessed ( ) ; }
public class AddressResolverGroup { /** * Returns the { @ link AddressResolver } associated with the specified { @ link EventExecutor } . If there ' s no associated * resolved found , this method creates and returns a new resolver instance created by * { @ link # newResolver ( EventExecutor ) } so that the new resolver is reused on another * { @ link # getResolver ( EventExecutor ) } call with the same { @ link EventExecutor } . */ public AddressResolver < T > getResolver ( final EventExecutor executor ) { } }
if ( executor == null ) { throw new NullPointerException ( "executor" ) ; } if ( executor . isShuttingDown ( ) ) { throw new IllegalStateException ( "executor not accepting a task" ) ; } AddressResolver < T > r ; synchronized ( resolvers ) { r = resolvers . get ( executor ) ; if ( r == null ) { final AddressResolver < T > newResolver ; try { newResolver = newResolver ( executor ) ; } catch ( Exception e ) { throw new IllegalStateException ( "failed to create a new resolver" , e ) ; } resolvers . put ( executor , newResolver ) ; executor . terminationFuture ( ) . addListener ( new FutureListener < Object > ( ) { @ Override public void operationComplete ( Future < Object > future ) throws Exception { synchronized ( resolvers ) { resolvers . remove ( executor ) ; } newResolver . close ( ) ; } } ) ; r = newResolver ; } } return r ;
public class SquareRegularClustersIntoGrids { /** * There are only three edges on target and two of them are known . Pick the one which isn ' t an inptu child */ static SquareNode pickNot ( SquareNode target , SquareNode child0 , SquareNode child1 ) { } }
for ( int i = 0 ; i < 4 ; i ++ ) { SquareEdge e = target . edges [ i ] ; if ( e == null ) continue ; SquareNode c = e . destination ( target ) ; if ( c != child0 && c != child1 ) return c ; } throw new RuntimeException ( "There was no odd one out some how" ) ;
public class Service { /** * A histogram that maps the spread of service durations . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setDurationHistogram ( java . util . Collection ) } or { @ link # withDurationHistogram ( java . util . Collection ) } if * you want to override the existing values . * @ param durationHistogram * A histogram that maps the spread of service durations . * @ return Returns a reference to this object so that method calls can be chained together . */ public Service withDurationHistogram ( HistogramEntry ... durationHistogram ) { } }
if ( this . durationHistogram == null ) { setDurationHistogram ( new java . util . ArrayList < HistogramEntry > ( durationHistogram . length ) ) ; } for ( HistogramEntry ele : durationHistogram ) { this . durationHistogram . add ( ele ) ; } return this ;
public class WLinkRenderer { /** * Paints the given { @ link WLink } . * @ param component the WLink to paint . * @ param renderContext the RenderContext to paint to . */ @ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { } }
WLink link = ( WLink ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; String text = link . getText ( ) ; String targetWindowName = link . getOpenNewWindow ( ) ? link . getTargetWindowName ( ) : null ; String imageUrl = link . getImageUrl ( ) ; xml . appendTagOpen ( "ui:link" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; xml . appendOptionalAttribute ( "track" , component . isTracking ( ) , "true" ) ; xml . appendOptionalAttribute ( "disabled" , link . isDisabled ( ) , "true" ) ; xml . appendOptionalAttribute ( "hidden" , component . isHidden ( ) , "true" ) ; xml . appendOptionalAttribute ( "toolTip" , link . getToolTip ( ) ) ; xml . appendOptionalAttribute ( "accessibleText" , link . getAccessibleText ( ) ) ; xml . appendUrlAttribute ( "url" , link . getUrl ( ) ) ; xml . appendOptionalAttribute ( "rel" , link . getRel ( ) ) ; xml . appendOptionalAttribute ( "accessKey" , Util . upperCase ( link . getAccessKeyAsString ( ) ) ) ; if ( imageUrl != null ) { xml . appendUrlAttribute ( "imageUrl" , imageUrl ) ; ImagePosition imagePosition = link . getImagePosition ( ) ; if ( imagePosition != null ) { switch ( imagePosition ) { case NORTH : xml . appendAttribute ( "imagePosition" , "n" ) ; break ; case EAST : xml . appendAttribute ( "imagePosition" , "e" ) ; break ; case SOUTH : xml . appendAttribute ( "imagePosition" , "s" ) ; break ; case WEST : xml . appendAttribute ( "imagePosition" , "w" ) ; break ; default : throw new SystemException ( "Unknown image position: " + imagePosition ) ; } } // we have an image . We must have a text equivalent if ( Util . empty ( text ) && Util . empty ( link . getToolTip ( ) ) && Util . empty ( link . getAccessibleText ( ) ) ) { // If the link has an umageUrl but no text equivalent get the text equivalent off of the image WImage linkImage = link . getImageHolder ( ) ; if ( null != linkImage ) { xml . appendOptionalAttribute ( "toolTip" , linkImage . getAlternativeText ( ) ) ; } } } if ( link . isRenderAsButton ( ) ) { xml . appendAttribute ( "type" , "button" ) ; } xml . appendClose ( ) ; if ( targetWindowName != null ) { xml . appendTagOpen ( "ui:windowAttributes" ) ; xml . appendAttribute ( "name" , targetWindowName ) ; WLink . WindowAttributes attributes = link . getWindowAttrs ( ) ; if ( attributes != null ) { xml . appendOptionalAttribute ( "top" , attributes . getTop ( ) >= 0 , attributes . getTop ( ) ) ; xml . appendOptionalAttribute ( "left" , attributes . getLeft ( ) >= 0 , attributes . getLeft ( ) ) ; xml . appendOptionalAttribute ( "width" , attributes . getWidth ( ) > 0 , attributes . getWidth ( ) ) ; xml . appendOptionalAttribute ( "height" , attributes . getHeight ( ) > 0 , attributes . getHeight ( ) ) ; xml . appendOptionalAttribute ( "resizable" , attributes . isResizable ( ) , "true" ) ; xml . appendOptionalAttribute ( "showMenubar" , attributes . isMenubar ( ) , "true" ) ; xml . appendOptionalAttribute ( "showToolbar" , attributes . isToolbars ( ) , "true" ) ; xml . appendOptionalAttribute ( "showLocation" , attributes . isLocation ( ) , "true" ) ; xml . appendOptionalAttribute ( "showStatus" , attributes . isStatus ( ) , "true" ) ; xml . appendOptionalAttribute ( "showScrollbars" , attributes . isScrollbars ( ) , "true" ) ; xml . appendOptionalAttribute ( "showDirectories" , attributes . isDirectories ( ) , "true" ) ; } xml . appendEnd ( ) ; } if ( text != null ) { xml . appendEscaped ( text ) ; } xml . appendEndTag ( "ui:link" ) ; // Paint the AJAX trigger if the link has an action if ( link . getAction ( ) != null ) { paintAjaxTrigger ( link , xml ) ; }
public class VariantUtils { /** * Returns the list of variant maps , which are initialized with the current * map values and each element of the list contains an element of the * variant list with the variant type as key * @ param curVariant * the current variant map * @ param variantType * the variant type * @ param variantList * the variant list * @ return the list of variant maps */ private static List < Map < String , String > > getVariants ( Map < String , String > curVariant , String variantType , Collection < String > variantList ) { } }
List < Map < String , String > > variants = new ArrayList < > ( ) ; for ( String variant : variantList ) { Map < String , String > map = new HashMap < > ( ) ; if ( curVariant != null ) { map . putAll ( curVariant ) ; } map . put ( variantType , variant ) ; variants . add ( map ) ; } return variants ;
public class ListConferenceProvidersResult { /** * The conference providers . * @ param conferenceProviders * The conference providers . */ public void setConferenceProviders ( java . util . Collection < ConferenceProvider > conferenceProviders ) { } }
if ( conferenceProviders == null ) { this . conferenceProviders = null ; return ; } this . conferenceProviders = new java . util . ArrayList < ConferenceProvider > ( conferenceProviders ) ;
public class HyphenationTree { /** * Hyphenate word and return an array of hyphenation points . * @ param w char array that contains the word * @ param offset Offset to first character in word * @ param len Length of word * @ param remainCharCount Minimum number of characters allowed * before the hyphenation point . * @ param pushCharCount Minimum number of characters allowed after * the hyphenation point . * @ return a { @ link Hyphenation Hyphenation } object representing * the hyphenated word or null if word is not hyphenated . */ public Hyphenation hyphenate ( char [ ] w , int offset , int len , int remainCharCount , int pushCharCount ) { } }
int i ; char [ ] word = new char [ len + 3 ] ; // normalize word char [ ] c = new char [ 2 ] ; int iIgnoreAtBeginning = 0 ; int iLength = len ; boolean bEndOfLetters = false ; for ( i = 1 ; i <= len ; i ++ ) { c [ 0 ] = w [ offset + i - 1 ] ; int nc = classmap . find ( c , 0 ) ; if ( nc < 0 ) { // found a non - letter character . . . if ( i == ( 1 + iIgnoreAtBeginning ) ) { // . . . before any letter character iIgnoreAtBeginning ++ ; } else { // . . . after a letter character bEndOfLetters = true ; } iLength -- ; } else { if ( ! bEndOfLetters ) { word [ i - iIgnoreAtBeginning ] = ( char ) nc ; } else { return null ; } } } len = iLength ; if ( len < ( remainCharCount + pushCharCount ) ) { // word is too short to be hyphenated return null ; } int [ ] result = new int [ len + 1 ] ; int k = 0 ; // check exception list first String sw = new String ( word , 1 , len ) ; if ( stoplist . containsKey ( sw ) ) { // assume only simple hyphens ( Hyphen . pre = " - " , Hyphen . post = Hyphen . no = null ) ArrayList hw = ( ArrayList ) stoplist . get ( sw ) ; int j = 0 ; for ( i = 0 ; i < hw . size ( ) ; i ++ ) { Object o = hw . get ( i ) ; // j = index ( sw ) = letterindex ( word ) ? // result [ k ] = corresponding index ( w ) if ( o instanceof String ) { j += ( ( String ) o ) . length ( ) ; if ( j >= remainCharCount && j < ( len - pushCharCount ) ) { result [ k ++ ] = j + iIgnoreAtBeginning ; } } } } else { // use algorithm to get hyphenation points word [ 0 ] = '.' ; // word start marker word [ len + 1 ] = '.' ; // word end marker word [ len + 2 ] = 0 ; // null terminated byte [ ] il = new byte [ len + 3 ] ; // initialized to zero for ( i = 0 ; i < len + 1 ; i ++ ) { searchPatterns ( word , i , il ) ; } // hyphenation points are located where interletter value is odd // i is letterindex ( word ) , // i + 1 is index ( word ) , // result [ k ] = corresponding index ( w ) for ( i = 0 ; i < len ; i ++ ) { if ( ( ( il [ i + 1 ] & 1 ) == 1 ) && i >= remainCharCount && i <= ( len - pushCharCount ) ) { result [ k ++ ] = i + iIgnoreAtBeginning ; } } } if ( k > 0 ) { // trim result array int [ ] res = new int [ k ] ; System . arraycopy ( result , 0 , res , 0 , k ) ; return new Hyphenation ( new String ( w , offset , len ) , res ) ; } else { return null ; }
public class ConfigQueryBuilder { /** * A query representing a logical AND of the provided restrictions . * @ param r1 Restriction one * @ param r2 Restriction two * @ return An AND restriction . */ public static Restriction and ( Restriction r1 , Restriction r2 ) { } }
return new And ( Arrays . asList ( r1 , r2 ) ) ;
public class XMLSerializer { /** * Main method . * @ param args * args [ 0 ] specifies the input - TT file / folder ; args [ 1 ] specifies * the output XML file . * @ throws Exception * Any exception . */ public static void main ( final String ... args ) throws Exception { } }
if ( args . length < 2 || args . length > 3 ) { System . out . println ( "Usage: XMLSerializer input-TT output.xml" ) ; System . exit ( 1 ) ; } System . out . print ( "Serializing '" + args [ 0 ] + "' to '" + args [ 1 ] + "' ... " ) ; final long time = System . currentTimeMillis ( ) ; Injector injector = Guice . createInjector ( new ModuleSetter ( ) . setDataFacClass ( TreeNodeFactory . class ) . setMetaFacClass ( NodeMetaPageFactory . class ) . createModule ( ) ) ; IBackendFactory storage = injector . getInstance ( IBackendFactory . class ) ; IRevisioning revision = injector . getInstance ( IRevisioning . class ) ; final File target = new File ( args [ 1 ] ) ; target . delete ( ) ; final FileOutputStream outputStream = new FileOutputStream ( target ) ; final StorageConfiguration config = new StorageConfiguration ( new File ( args [ 0 ] ) ) ; Storage . createStorage ( config ) ; final IStorage db = Storage . openStorage ( new File ( args [ 0 ] ) ) ; Properties props = new Properties ( ) ; props . setProperty ( ConstructorProps . STORAGEPATH , target . getAbsolutePath ( ) ) ; props . setProperty ( ConstructorProps . RESOURCE , "shredded" ) ; db . createResource ( new ResourceConfiguration ( props , storage , revision , new TreeNodeFactory ( ) , new NodeMetaPageFactory ( ) ) ) ; final ISession session = db . getSession ( new SessionConfiguration ( "shredded" , StandardSettings . KEY ) ) ; final XMLSerializer serializer = new XMLSerializerBuilder ( session , outputStream ) . build ( ) ; serializer . call ( ) ; session . close ( ) ; outputStream . close ( ) ; db . close ( ) ; System . out . println ( " done [" + ( System . currentTimeMillis ( ) - time ) + "ms]." ) ;
public class UrlPatternAnnotationHandlerMapping { /** * Check if the URL matches one of the configured include patterns */ protected boolean included ( String url ) { } }
for ( final Pattern urlPattern : this . includedUrls ) { final Matcher matcher = urlPattern . matcher ( url ) ; if ( matcher . matches ( ) ) { if ( this . logger . isDebugEnabled ( ) ) { this . logger . debug ( "Include pattern " + urlPattern . pattern ( ) + " matches " + url ) ; } return true ; } } return false ;
public class MtasExtendedTermSpans { /** * Gets the positions . * @ return the positions */ public int [ ] getPositions ( ) { } }
int [ ] list ; if ( assumeSinglePosition ) { list = new int [ 1 ] ; list [ 0 ] = super . startPosition ( ) ; return list ; } else { try { processEncodedPayload ( ) ; list = mtasPosition . getPositions ( ) ; if ( list != null ) { return mtasPosition . getPositions ( ) ; } } catch ( IOException e ) { log . debug ( e ) ; // do nothing } int start = super . startPosition ( ) ; int end = super . endPosition ( ) ; list = new int [ end - start ] ; for ( int i = start ; i < end ; i ++ ) list [ i - start ] = i ; return list ; }
public class GenericResource { /** * The information about supported locks . * @ return information about supported locks */ protected HierarchicalProperty supportedLock ( ) { } }
HierarchicalProperty supportedLock = new HierarchicalProperty ( new QName ( "DAV:" , "supportedlock" ) ) ; HierarchicalProperty lockEntry = new HierarchicalProperty ( new QName ( "DAV:" , "lockentry" ) ) ; supportedLock . addChild ( lockEntry ) ; HierarchicalProperty lockScope = new HierarchicalProperty ( new QName ( "DAV:" , "lockscope" ) ) ; lockScope . addChild ( new HierarchicalProperty ( new QName ( "DAV:" , "exclusive" ) ) ) ; lockEntry . addChild ( lockScope ) ; HierarchicalProperty lockType = new HierarchicalProperty ( new QName ( "DAV:" , "locktype" ) ) ; lockType . addChild ( new HierarchicalProperty ( new QName ( "DAV:" , "write" ) ) ) ; lockEntry . addChild ( lockType ) ; return supportedLock ;
public class SecurityUtils { /** * Validates the signature of the request . * @ param incoming the incoming HTTP request containing a signature * @ param secretKey the app ' s secret key * @ return true if the signature is valid */ public static boolean isValidSignature ( HttpServletRequest incoming , String secretKey ) { } }
if ( incoming == null || StringUtils . isBlank ( secretKey ) ) { return false ; } String auth = incoming . getHeader ( HttpHeaders . AUTHORIZATION ) ; String givenSig = StringUtils . substringAfter ( auth , "Signature=" ) ; String sigHeaders = StringUtils . substringBetween ( auth , "SignedHeaders=" , "," ) ; String credential = StringUtils . substringBetween ( auth , "Credential=" , "," ) ; String accessKey = StringUtils . substringBefore ( credential , "/" ) ; if ( StringUtils . isBlank ( auth ) ) { givenSig = incoming . getParameter ( "X-Amz-Signature" ) ; sigHeaders = incoming . getParameter ( "X-Amz-SignedHeaders" ) ; credential = incoming . getParameter ( "X-Amz-Credential" ) ; accessKey = StringUtils . substringBefore ( credential , "/" ) ; } Set < String > headersUsed = new HashSet < > ( Arrays . asList ( sigHeaders . split ( ";" ) ) ) ; Map < String , String > headers = new HashMap < > ( ) ; for ( Enumeration < String > e = incoming . getHeaderNames ( ) ; e . hasMoreElements ( ) ; ) { String head = e . nextElement ( ) . toLowerCase ( ) ; if ( headersUsed . contains ( head ) ) { headers . put ( head , incoming . getHeader ( head ) ) ; } } Map < String , String > params = new HashMap < > ( ) ; for ( Map . Entry < String , String [ ] > param : incoming . getParameterMap ( ) . entrySet ( ) ) { params . put ( param . getKey ( ) , param . getValue ( ) [ 0 ] ) ; } String path = incoming . getRequestURI ( ) ; String endpoint = StringUtils . removeEndIgnoreCase ( incoming . getRequestURL ( ) . toString ( ) , path ) ; String httpMethod = incoming . getMethod ( ) ; InputStream entity ; try { entity = new BufferedRequestWrapper ( incoming ) . getInputStream ( ) ; if ( entity . available ( ) <= 0 ) { entity = null ; } } catch ( IOException ex ) { logger . error ( null , ex ) ; entity = null ; } Signer signer = new Signer ( ) ; Map < String , String > sig = signer . sign ( httpMethod , endpoint , path , headers , params , entity , accessKey , secretKey ) ; String auth2 = sig . get ( HttpHeaders . AUTHORIZATION ) ; String recreatedSig = StringUtils . substringAfter ( auth2 , "Signature=" ) ; return StringUtils . equals ( givenSig , recreatedSig ) ;
public class Xsd2AvroTranslator { /** * Create an avro primitive type field using an XML schema type . * @ param xsdType the XML schema simple type * @ param level the depth in the hierarchy * @ param avroFieldName to use as the field name for this avro field * @ param minOccurs lower dimension for arrays & zero for optional fields * @ param maxOccurs dimension for arrays * @ param avroFields array of avro fields being populated * @ throws Xsd2AvroTranslatorException if something abnormal in the xsd */ private void visit ( XmlSchemaSimpleType xsdType , final int level , final String avroFieldName , long minOccurs , long maxOccurs , ArrayNode avroFields ) throws Xsd2AvroTranslatorException { } }
Object avroType = getAvroPrimitiveType ( avroFieldName , xsdType , maxOccurs > 1 , minOccurs == 0 && maxOccurs == 1 ) ; ObjectNode avroField = MAPPER . createObjectNode ( ) ; avroField . put ( "name" , avroFieldName ) ; if ( avroType != null ) { if ( avroType instanceof String ) { avroField . put ( "type" , ( String ) avroType ) ; } else if ( avroType instanceof JsonNode ) { avroField . put ( "type" , ( JsonNode ) avroType ) ; } } avroFields . add ( avroField ) ;
public class FileSystemUtils { /** * Deletes the given { @ link File } from the file system if accepted by the given { @ link FileFilter } . * If the { @ link File } is a directory , then this method recursively deletes all files and subdirectories * accepted by the { @ link FileFilter } in the given directory along with the directory itself . * If the { @ link File } is just a plain old file , then only the given file will be deleted if accepted * by the { @ link FileFilter } . * This method attempts to delete as many files as possible . * @ param path the { @ link File } to delete from the file system . * @ param fileFilter the { @ link FileFilter } used to identify the { @ link File } s to delete . * @ return a boolean value indicating whether the given { @ link File } was successfully deleted from the file system . * @ see java . io . File * @ see java . io . FileFilter * @ see # safeListFiles ( File ) * @ see # isDirectory ( File ) * @ see # delete ( File ) */ public static boolean deleteRecursive ( File path , FileFilter fileFilter ) { } }
boolean success = true ; for ( File file : safeListFiles ( path , fileFilter ) ) { success &= ( isDirectory ( file ) ? deleteRecursive ( file , fileFilter ) : delete ( file ) ) ; } return ( success && fileFilter . accept ( path ) && delete ( path ) ) ;
public class CharBuffer { /** * method to append a part of a char array * @ param c char array to get part from * @ param off start index on the char array * @ param len length of the sequenz to get from array */ public void append ( char c [ ] , int off , int len ) { } }
int restLength = buffer . length - pos ; if ( len < restLength ) { System . arraycopy ( c , off , buffer , pos , len ) ; pos += len ; } else { System . arraycopy ( c , off , buffer , pos , restLength ) ; curr . next = new Entity ( buffer ) ; curr = curr . next ; length += buffer . length ; buffer = new char [ ( buffer . length > len - restLength ) ? buffer . length : len - restLength ] ; System . arraycopy ( c , off + restLength , buffer , 0 , len - restLength ) ; pos = len - restLength ; }
public class RailwayType { /** * Gets the value of the genericApplicationPropertyOfRailway property . * This accessor method returns a reference to the live list , * not a snapshot . Therefore any modification you make to the * returned list will be present inside the JAXB object . * This is why there is not a < CODE > set < / CODE > method for the genericApplicationPropertyOfRailway property . * For example , to add a new item , do as follows : * < pre > * get _ GenericApplicationPropertyOfRailway ( ) . add ( newItem ) ; * < / pre > * Objects of the following type ( s ) are allowed in the list * { @ link JAXBElement } { @ code < } { @ link Object } { @ code > } * { @ link JAXBElement } { @ code < } { @ link Object } { @ code > } */ public List < JAXBElement < Object > > get_GenericApplicationPropertyOfRailway ( ) { } }
if ( _GenericApplicationPropertyOfRailway == null ) { _GenericApplicationPropertyOfRailway = new ArrayList < JAXBElement < Object > > ( ) ; } return this . _GenericApplicationPropertyOfRailway ;
public class PublicIPAddressesInner { /** * Gets information about all public IP addresses on a virtual machine scale set level . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the PagedList & lt ; PublicIPAddressInner & gt ; object if successful . */ public PagedList < PublicIPAddressInner > listVirtualMachineScaleSetPublicIPAddressesNext ( final String nextPageLink ) { } }
ServiceResponse < Page < PublicIPAddressInner > > response = listVirtualMachineScaleSetPublicIPAddressesNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < PublicIPAddressInner > ( response . body ( ) ) { @ Override public Page < PublicIPAddressInner > nextPage ( String nextPageLink ) { return listVirtualMachineScaleSetPublicIPAddressesNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ;
public class AsynchronousRequest { /** * For more info on Character Training API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / characters # Training " > here < / a > < br / > * Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions * @ param API API key * @ param name character name * @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) } * @ throws GuildWars2Exception invalid API key | empty character name * @ throws NullPointerException if given { @ link Callback } is empty * @ see CharacterTraining character training info */ public void getCharacterTraining ( String API , String name , Callback < CharacterTraining > callback ) throws GuildWars2Exception , NullPointerException { } }
isParamValid ( new ParamChecker ( ParamType . API , API ) , new ParamChecker ( ParamType . CHAR , name ) ) ; gw2API . getCharacterTraining ( name , API ) . enqueue ( callback ) ;
public class ComponentBindingsProviderCache { /** * Gets the ComponentBindingProvider references for the specified resource * type . * @ param resourceType * the resource type for which to retrieve the references * @ return the references for the resource type */ public List < ServiceReference > getReferences ( String resourceType ) { } }
List < ServiceReference > references = new ArrayList < ServiceReference > ( ) ; if ( containsKey ( resourceType ) ) { references . addAll ( get ( resourceType ) ) ; Collections . sort ( references , new Comparator < ServiceReference > ( ) { @ Override public int compare ( ServiceReference r0 , ServiceReference r1 ) { Integer p0 = OsgiUtil . toInteger ( r0 . getProperty ( ComponentBindingsProvider . PRIORITY ) , 0 ) ; Integer p1 = OsgiUtil . toInteger ( r1 . getProperty ( ComponentBindingsProvider . PRIORITY ) , 0 ) ; return - 1 * p0 . compareTo ( p1 ) ; } } ) ; } return references ;
public class Validator { /** * Validates a given value to be false * @ param value The value to check * @ param name The name of the field to display the error message * @ param message A custom error message instead of the default one */ @ SuppressWarnings ( "all" ) public void validateFalse ( boolean value , String name , String message ) { } }
if ( value ) { addError ( name , Optional . ofNullable ( message ) . orElse ( messages . get ( Validation . FALSE_KEY . name ( ) , name ) ) ) ; }
public class ClasspathReader { /** * ( non - Javadoc ) * @ see com . impetus . kundera . classreading . Reader # findResources ( ) */ @ Override public URL [ ] findResources ( ) { } }
URL [ ] result = null ; if ( classesToScan != null && ! classesToScan . isEmpty ( ) ) { result = findResourcesByContextLoader ( ) ; } // else // result = findResourcesByClasspath ( ) ; return result ;
public class TaskInfo { /** * Gets the error details . * @ return the error details */ public List < ErrorDetail > getErrorDetails ( ) { } }
List < ErrorDetail > result = new ArrayList < ErrorDetail > ( ) ; List < ErrorDetailType > errorDetailTypes = getContent ( ) . getErrorDetails ( ) ; if ( errorDetailTypes != null ) { for ( ErrorDetailType errorDetailType : errorDetailTypes ) { ErrorDetail errorDetail = new ErrorDetail ( errorDetailType . getCode ( ) , errorDetailType . getMessage ( ) ) ; result . add ( errorDetail ) ; } return result ; } return null ;
public class NetworkUtils { /** * Checks if the specified is available as listen port . * @ param port * the port to check * @ return true if the port is available */ public static boolean isPortAvailable ( final int port ) { } }
try ( ServerSocket tcp = new ServerSocket ( port ) ; DatagramSocket udp = new DatagramSocket ( port ) ) { return tcp . isBound ( ) && udp . isBound ( ) ; } catch ( Exception e ) { // NOSONAR return false ; }
public class PrometheusController { /** * Reports on hits , errors , and duration sum for all counters in the collector . * Bypasses the { @ link JRobin # getLastValue ( ) } methods to provide real - time counters as well as * improving performance from bypassing JRobin reads in the getLastValue ( ) method . */ private void reportOnCollector ( ) { } }
for ( final Counter counter : collector . getCounters ( ) ) { if ( ! counter . isDisplayed ( ) ) { continue ; } final List < CounterRequest > requests = counter . getRequests ( ) ; long hits = 0 ; long duration = 0 ; long errors = 0 ; for ( final CounterRequest cr : requests ) { hits += cr . getHits ( ) ; duration += cr . getDurationsSum ( ) ; errors += cr . getSystemErrors ( ) ; } final String sanitizedName = sanitizeName ( counter . getName ( ) ) ; printLong ( MetricType . COUNTER , sanitizedName + "_hits_count" , "javamelody counter" , hits ) ; if ( ! counter . isErrorCounter ( ) || counter . isJobCounter ( ) ) { // errors has no sense for the error and log counters printLong ( MetricType . COUNTER , sanitizedName + "_errors_count" , "javamelody counter" , errors ) ; } if ( duration >= 0 ) { // duration is negative and has no sense for the log counter printLong ( MetricType . COUNTER , sanitizedName + "_duration_millis" , "javamelody counter" , duration ) ; } }
public class CircuitBreakerRpcClient { /** * Creates a new decorator that binds one { @ link CircuitBreaker } per host with the specified * { @ link CircuitBreakerStrategy } . * < p > Since { @ link CircuitBreaker } is a unit of failure detection , don ' t reuse the same instance for * unrelated services . * @ param factory a function that takes a host name and creates a new { @ link CircuitBreaker } */ public static Function < Client < RpcRequest , RpcResponse > , CircuitBreakerRpcClient > newPerHostDecorator ( Function < String , CircuitBreaker > factory , CircuitBreakerStrategyWithContent < RpcResponse > strategy ) { } }
return newDecorator ( CircuitBreakerMapping . perHost ( factory ) , strategy ) ;
public class DataIO { /** * Writes UTF - 8 encoded characters to the given stream , but does not write * the length . * @ param workspace temporary buffer to store characters in */ public static final void writeUTF ( OutputStream out , String str , int offset , int strlen , char [ ] workspace ) throws IOException { } }
int worklen = workspace . length ; while ( true ) { int amt = strlen <= worklen ? strlen : worklen ; str . getChars ( offset , offset + amt , workspace , 0 ) ; writeUTF ( out , workspace , 0 , amt ) ; if ( ( strlen -= amt ) <= 0 ) { break ; } offset += amt ; }
public class GMRES { /** * Sets the restart parameter * @ param restart * GMRES iteration is restarted after this number of iterations */ public void setRestart ( int restart ) { } }
this . restart = restart ; if ( restart <= 0 ) throw new IllegalArgumentException ( "restart must be a positive integer" ) ; s = new DenseVector ( restart + 1 ) ; H = new DenseMatrix ( restart + 1 , restart ) ; rotation = new GivensRotation [ restart + 1 ] ; v = new Vector [ restart + 1 ] ; for ( int i = 0 ; i < v . length ; ++ i ) v [ i ] = r . copy ( ) . zero ( ) ;
public class XMLParser { /** * / * ( non - Javadoc ) * @ see com . abubusoft . kripton . xml . XmlPullParser # getText ( ) */ @ Override public String getText ( ) { } }
if ( type < TEXT || ( type == ENTITY_REF && unresolved ) ) { return null ; } else if ( text == null ) { return "" ; } else { return text ; }
public class ST_BoundingCircle { /** * Computes the bounding circle * @ param geometry * @ return */ public static Geometry computeBoundingCircle ( Geometry geometry ) { } }
if ( geometry == null ) { return null ; } return new MinimumBoundingCircle ( geometry ) . getCircle ( ) ;
public class P1_QueryOp { /** * 单个关联 */ private < T > void postHandleRelatedColumn ( T t , String ... relatedColumnProperties ) { } }
if ( t == null ) { return ; } List < T > list = new ArrayList < T > ( ) ; list . add ( t ) ; postHandleRelatedColumn ( list , relatedColumnProperties ) ;
public class ProjectAggregated { /** * Create the list of measures which are available in < b > all < / b > projects . */ private void calculateAvailableMeasures ( ) { } }
boolean measureAvailable = true ; measures = new ArrayList < HLAMeasure > ( ) ; for ( HLAMeasure currMeasure : HLAMeasure . values ( ) ) { measureAvailable = true ; for ( IProject currProject : getProjects ( ) ) { LOG . debug ( "Checking measure " + currMeasure . getSonarName ( ) + " for project " + currProject ) ; if ( isNoMeasureAvailable ( currMeasure , currProject ) ) { measureAvailable = false ; break ; } } if ( measureAvailable ) measures . add ( currMeasure ) ; else LOG . warn ( "Measure " + currMeasure . getSonarName ( ) + " not available in all projects. Cannot calculate!" ) ; } LOG . debug ( measures . size ( ) + " measures are available in aggregated project " + getName ( ) ) ;
public class ApplySchemaRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ApplySchemaRequest applySchemaRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( applySchemaRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( applySchemaRequest . getPublishedSchemaArn ( ) , PUBLISHEDSCHEMAARN_BINDING ) ; protocolMarshaller . marshall ( applySchemaRequest . getDirectoryArn ( ) , DIRECTORYARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SameDiff { /** * Creates a { @ link SDVariable } with the given shape and name < br > * The underlying array will be initialized using the specified weight initilization scheme < br > * This is a VARIABLE type SDVariable - i . e . , must be floating point , and is a trainable parameter . See { @ link VariableType } for more details . * @ param name the name of the variable * @ param shape the shape of the variable * @ param weightInitScheme Weight initialization scheme to use to initialize the underlying array * @ return the created variable */ public SDVariable var ( @ NonNull String name , @ NonNull LongShapeDescriptor shape , WeightInitScheme weightInitScheme ) { } }
return var ( name , weightInitScheme , shape . dataType ( ) , shape . getShape ( ) ) ;
public class AbstractLRParser { /** * This method treats all ignored tokens during a shift . The ignored tokens are * just skipped by moving the stream position variable forward . */ private final void shiftIgnoredTokens ( ) { } }
if ( streamPosition == getTokenStream ( ) . size ( ) ) { return ; } Token token = getTokenStream ( ) . get ( streamPosition ) ; while ( token . getVisibility ( ) == Visibility . IGNORED ) { streamPosition ++ ; if ( streamPosition == getTokenStream ( ) . size ( ) ) { break ; } token = getTokenStream ( ) . get ( streamPosition ) ; }
public class EmailApi { /** * reply email * Reply to inbound email interaction specified in the id path parameter * @ param id id of interaction to reply ( required ) * @ param replyData Request parameters . ( optional ) * @ return ApiSuccessResponse * @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */ public ApiSuccessResponse replyEmail ( String id , ReplyData replyData ) throws ApiException { } }
ApiResponse < ApiSuccessResponse > resp = replyEmailWithHttpInfo ( id , replyData ) ; return resp . getData ( ) ;
public class MessageBirdClient { /** * Retrieves a listing of all legs . * @ param callId Voice call ID * @ param page page to fetch ( can be null - will return first page ) , number of first page is 1 * @ param pageSize page size * @ return VoiceCallLegResponse * @ throws UnsupportedEncodingException no UTF8 supported url * @ throws UnauthorizedException if client is unauthorized * @ throws GeneralException general exception */ public VoiceCallLegResponse viewCallLegsByCallId ( String callId , Integer page , Integer pageSize ) throws UnsupportedEncodingException , UnauthorizedException , GeneralException { } }
if ( callId == null ) { throw new IllegalArgumentException ( "Voice call ID must be specified." ) ; } String url = String . format ( "%s%s/%s%s" , VOICE_CALLS_BASE_URL , VOICECALLSPATH , urlEncode ( callId ) , VOICELEGS_SUFFIX_PATH ) ; return messageBirdService . requestList ( url , new PagedPaging ( page , pageSize ) , VoiceCallLegResponse . class ) ;
public class LolChat { /** * Get all your friends who are offline . * @ return A list of all your offline Friends */ public List < Friend > getOfflineFriends ( ) { } }
return getFriends ( new Filter < Friend > ( ) { public boolean accept ( Friend friend ) { return ! friend . isOnline ( ) ; } } ) ;
public class CheapIntMap { /** * Removes the mapping associated with the specified key . The previous * value of the mapping will be returned . */ public Object remove ( int key ) { } }
int size = _keys . length , start = key % size ; for ( int ii = 0 ; ii < size ; ii ++ ) { int idx = ( ii + start ) % size ; if ( _keys [ idx ] == key ) { Object value = _values [ idx ] ; _keys [ idx ] = - 1 ; _values [ idx ] = null ; return value ; } } return null ;
public class ProgramGene { /** * Create a new program gene with the given operation . * @ param op the operation of the new program gene * @ return a new program gene with the given operation * @ throws NullPointerException if the given { @ code op } is { @ code null } * @ throws IllegalArgumentException if the arity of the given operation is * different from the arity of current operation . This restriction * ensures that only valid program genes are created by this method . */ @ Override public ProgramGene < A > newInstance ( final Op < A > op ) { } }
if ( getValue ( ) . arity ( ) != op . arity ( ) ) { throw new IllegalArgumentException ( format ( "New operation must have same arity: %s[%d] != %s[%d]" , getValue ( ) . name ( ) , getValue ( ) . arity ( ) , op . name ( ) , op . arity ( ) ) ) ; } return new ProgramGene < > ( op , childOffset ( ) , _operations , _terminals ) ;
public class DataSiftPush { /** * Create a push subscription to be consumed via { @ link # pull ( PushSubscription , int , String ) } using a live stream * @ param stream the stream which will be consumed via pull * @ param name a name for the subscription * @ param initialStatus the initial status of the subscription * @ param start an option timestamp of when to start the subscription * @ param end an optional timestamp of when to stop * @ return this */ public FutureData < PushSubscription > createPull ( PullJsonType jsonMeta , Stream stream , String name , Status initialStatus , long start , long end ) { } }
return createPull ( jsonMeta , null , stream , name , initialStatus , start , end ) ;
public class BufferedISPNCache { /** * Put object in cache . * @ param key * cache key * @ param value * cache value * @ return * always returns null */ public Object put ( CacheKey key , Object value ) { } }
return put ( key , value , false ) ;
public class ParameterUtil { /** * Get values for a default source * @ param con connection * @ param qp parameter * @ return a list of default values * @ throws Exception if select failes */ public static ArrayList < Serializable > getDefaultSourceValues ( Connection con , QueryParameter qp ) throws Exception { } }
ArrayList < Serializable > result = new ArrayList < Serializable > ( ) ; List < IdName > list = getSelectValues ( con , qp . getDefaultSource ( ) , false , QueryParameter . NO_ORDER ) ; if ( QueryParameter . SINGLE_SELECTION . equals ( qp . getSelection ( ) ) ) { for ( IdName in : list ) { result . add ( in . getId ( ) ) ; } } else { for ( IdName in : list ) { result . add ( in ) ; } } return result ;
public class Country { /** * AF AFG 004 Afghanistan */ protected static Country parse ( String line ) throws IOException { } }
try { int pos = line . indexOf ( ' ' ) ; if ( pos < 0 ) throw new IOException ( "Invalid format, could not parse 2 char code" ) ; String code2 = line . substring ( 0 , pos ) ; int pos2 = line . indexOf ( ' ' , pos + 1 ) ; if ( pos2 < 0 ) throw new IOException ( "Invalid format, could not parse 3 char code" ) ; String code3 = line . substring ( pos + 1 , pos2 ) ; int pos3 = line . indexOf ( ' ' , pos2 + 1 ) ; if ( pos3 < 0 ) throw new IOException ( "Invalid format, could not parse 3 char digit code" ) ; String num3 = line . substring ( pos2 + 1 , pos3 ) ; // rest of line is the long name String longName = line . substring ( pos3 + 1 ) . trim ( ) ; // was there a name ? if ( longName == null || longName . equals ( "" ) ) { throw new IOException ( "Country name was null or empty" ) ; } // parse long name into its short name ( strip anything after the last comma ) String name = longName ; int pos4 = longName . lastIndexOf ( ',' ) ; if ( pos4 > 0 ) { // strip out the final part such as " , Republic of " from something like " Nigeria , Republic Of " name = longName . substring ( 0 , pos4 ) ; } // create the new country return new Country ( code2 , name , longName ) ; } catch ( Exception e ) { throw new IOException ( "Failed while parsing country for line: " + line , e ) ; }
public class Vector3d { /** * Rotate this vector the specified radians around the given rotation axis . * @ param angle * the angle in radians * @ param x * the x component of the rotation axis * @ param y * the y component of the rotation axis * @ param z * the z component of the rotation axis * @ return a vector holding the result */ public Vector3d rotateAxis ( double angle , double x , double y , double z ) { } }
return rotateAxis ( angle , x , y , z , thisOrNew ( ) ) ;