Parameter Description Generation

Human Evaluation

Thank you for participating. Each question in this survey contains the following components: Code, Parameter Name, Reference (ground truth), and three model outputs.

Reference (Ground Truth): The parameter description written by the developer (or extracted from the original documentation), provided as a reference.

Output 1 / Output 2 / Output 3: Parameter descriptions generated by three different models. To reduce bias, the order of these outputs is randomized.

Please evaluate each output based on the following three criteria and give a score from 1 (very poor) to 5 (excellent) for each criterion:

Correctness: Does the description accurately reflect the meaning and role of the parameter in the given code?

Completeness: Does the description capture all important aspects of the parameter without missing key information?

Readability: Is the description clear, concise, and easy to understand?

There are 60 questions in this questionnaire.
1.

Basic information collection

name:______
age:______
Affiliated institution (e.g., XXX university, XXX company, etc.):______

Programming experience (years):___

Programming languages you are at (e.g., Java, C++, Python etc.):______

English level (e.g., CET4, CET6, IELTS, TOEFL etc.):______
2. @Override protected Iterator<URL> getConfigurationUrls(String fileName) throws IOException {
URL url=null;
if (baseDir != null) {
url=findInFileSystem(fileName);
if (url == null) {
return super.getConfigurationUrls(fileName);
}
}
if (url != null) {
List<URL> list=new ArrayList<>();
list.add(url);
return list.iterator();
}
else {
return super.getConfigurationUrls(fileName);
}
}

Parameters to be described: fileName
Reference: The file name to retrieve
output_1: name of the configuration file to locate.
output_2: the name of the file
output_3: the name of the file
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
3. protected void putProperty(Map propertyMap,InternalContextAdapter contextAdapter,Node node) throws ParseErrorException, MethodInvocationException {
String param=node.value(contextAdapter).toString();
int idx=param.indexOf('=');
if (idx != -1) {
String property=param.substring(0,idx);
String value=param.substring(idx + 1);
propertyMap.put(property,value);
}
else {
throw new ParseErrorException("#" + this.getName() + " arguments must include an assignment operator! For example #tag( Component \"template=mytemplate\" ). #tag( TextField \"mytemplate\" ) is illegal!");
}
}

Parameters to be described: contextAdapter
Reference: the context adapter
output_1: the context for evaluating node values.
output_2: the name of the file
output_3: the node to be added to the map
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
4. public static String interpreterCall(boolean isTagFile,String expression,Class expectedType,String fnmapvar,boolean XmlEscape){
String jspCtxt=null;
if (isTagFile) jspCtxt="this.getJspContext()";
else jspCtxt="_jspx_page_context";
String targetType=expectedType.getName();
String primitiveConverterMethod=null;
if (expectedType.isPrimitive()) {
if (expectedType.equals(Boolean.TYPE)) {
targetType=Boolean.class.getName();
primitiveConverterMethod="booleanValue";
}
else if (expectedType.equals(Byte.TYPE)) {
targetType=Byte.class.getName();
primitiveConverterMethod="byteValue";
}
else if (expectedType.equals(Character.TYPE)) {
targetType=Character.class.getName();
primitiveConverterMethod="charValue";
}
else if (expectedType.equals(Short.TYPE)) {
targetType=Short.class.getName();
primitiveConverterMethod="shortValue";
}
else if (expectedType.equals(Integer.TYPE)) {
targetType=Integer.class.getName();
primitiveConverterMethod="intValue";
}
else if (expectedType.equals(Long.TYPE)) {
targetType=Long.class.getName();
primitiveConverterMethod="longValue";
}
else if (expectedType.equals(Float.TYPE)) {
targetType=Float.class.getName();
primitiveConverterMethod="floatValue";
}
else if (expectedType.equals(Double.TYPE)) {
targetType=Double.class.getName();
primitiveConverterMethod="doubleValue";
}
}
if (primitiveConverterMethod != null) {
XmlEscape=false;
}
targetType=toJavaSourceType(targetType);
StringBuilder call=new StringBuilder("(" + targetType + ") "+ "org.apache.struts2.jasper.runtime.PageContextImpl.proprietaryEvaluate"+ "("+ Generator.quote(expression)+ ", "+ targetType+ ".class, "+ "(PageContext)"+ jspCtxt+ ", "+ fnmapvar+ ", "+ XmlEscape+ ")");
if (primitiveConverterMethod != null) {
call.insert(0,"(");
call.append(")." + primitiveConverterMethod + "()");
}
return call.toString();
}

Parameters to be described: XmlEscape
Reference: True if the result should do XML escaping
output_1: whether to escape XML characters in the expression result.
output_2: the name of the class
output_3: the expected type of the expression
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
5. public static AnnotatedType getFieldType(Field field,AnnotatedType declaringType){
AnnotatedType exactDeclaringType=GenericTypeReflector.getExactSuperType(capture(declaringType),field.getDeclaringClass());
if (isMissingTypeParameters(exactDeclaringType.getType())) {
return field.getAnnotatedType();
}
return GenericTypeReflector.getFieldType(field,declaringType);
}

Parameters to be described: declaringType
Reference: The declaring annotated type against which to resolve the field type
output_1: the annotated type of the class declaring the field.
output_2: the class of the class
output_3: The field to get the type for
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
6. protected List<Method> findAnnotatedMethods(List<Class<?>> locations,Class<? extends Annotation> annotationClass){
List<Method> result=new ArrayList<Method>();
for ( Class<?> location : locations) {
List<Method> intermediateResult=new ArrayList<Method>();
Class<?> currentClass=location;
while (currentClass != null) {
for ( Method method : sorted(currentClass.getDeclaredMethods())) {
Annotation foundAnnotation=method.getAnnotation(annotationClass);
if (foundAnnotation != null && !isMethodShadowedBy(method,intermediateResult)) {
intermediateResult.add(method);
}
}
currentClass=currentClass.getSuperclass();
}
result.addAll(intermediateResult);
}
return result;
}

Parameters to be described: locations
Reference: denote where to search for methods
output_1: classes to search for annotated methods.
output_2: the locations to search
output_3: the annotation to search for
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
7. @Override public RecordId setHead(@NotNull Function<RecordId,RecordId> newHead,@NotNull Option... options) throws InterruptedException {
checkBound();
TimeOutOption timeout=getTimeout(options);
if (rwLock.writeLock().tryLock(timeout.time,timeout.unit)) {
try {
RecordId after=newHead.apply(getHead());
if (after != null) {
head.set(after);
return after;
}
else {
return null;
}
}
finally {
rwLock.writeLock().unlock();
}
}
else {
return null;
}
}

Parameters to be described: newHead
Reference: function mapping an record id to the record id to whichthe current head id should be set. If it returns {@code null} the head remains unchanged and {@code setHead}returns {@code false}.
output_1: function to determine the new head record ID.
output_2: the {@link return to use
output_3: the {@link Function} to apply to the head of the record
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
8. @RequestMapping(value="",method=RequestMethod.POST,params="name") @ResponseStatus(HttpStatus.CREATED) public long launch(@RequestParam("name") String taskName,@RequestParam(required=false) String properties,@RequestParam(required=false) String arguments){
SchemaVersionTarget schemaVersionTarget=aggregateExecutionSupport.findSchemaVersionTarget(taskName,taskDefinitionReader);
if (!schemaVersionTarget.equals(SchemaVersionTarget.defaultTarget())) {
Link link=linkTo(methodOn(TaskExecutionController.class).launchBoot3(taskName,properties,arguments)).withRel("launch");
throw new ApiNotSupportedException(String.format("Task: %s cannot be launched for %s. Use %s",taskName,SchemaVersionTarget.defaultTarget().getName(),link.getHref()));
}
Map<String,String> propertiesToUse=DeploymentPropertiesUtils.parse(properties);
List<String> argumentsToUse=DeploymentPropertiesUtils.parseArgumentList(arguments," ");
LaunchResponse launchResponse=this.taskExecutionService.executeTask(taskName,propertiesToUse,argumentsToUse);
return launchResponse.getExecutionId();
}

Parameters to be described: arguments
Reference: the runtime commandline arguments
output_1: optional task command line arguments.
output_2: the arguments to pass
output_3: name of the task
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
9. protected boolean lookAhead(int distance,TokenKind desiredTokenKind){
if ((position + distance) >= tokenStream.size()) {
return false;
}
Token t=tokenStream.get(position + distance);
return t.kind == desiredTokenKind;
}

Parameters to be described: distance
Reference: number of token positions past the current position
output_1: how many tokens ahead to check.
output_2: the distance to check
output_3: the kind of the token
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
10. boolean dropSession(final String clientId,boolean removeSessionState){
LOG.debug("Disconnecting client: {}",clientId);
if (clientId == null) {
return false;
}
final Session client=pool.get(clientId);
if (client == null) {
LOG.debug("Client {} not found, nothing disconnected",clientId);
return false;
}
client.closeImmediately();
if (removeSessionState) {
purgeSessionState(client);
}
LOG.debug("Client {} successfully disconnected from broker",clientId);
return true;
}

Parameters to be described: removeSessionState
Reference: boolean flag to request the removal of session state from broker.
output_1: whether to delete the session state after disconnection.
output_2: the name of the string
output_3: the id of the client to drop
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
11. private @Nullable String readResponseTopic(final @NotNull ClientConnectionContext clientConnectionContext,final @NotNull ByteBuf buf,@Nullable String responseTopic){
if (responseTopic != null) {
connackByMoreThanOnce(clientConnectionContext,"response topic");
return null;
}
responseTopic=MqttBinaryData.decodeString(buf,validateUTF8);
if (responseTopic == null) {
mqttConnacker.connackError(clientConnectionContext.getChannel(),"A client (IP: {}) sent a CONNECT with a malformed UTF-8 string for response topic. This is not allowed.","Sent a CONNECT with a malformed UTF-8 string for response topic",Mqtt5ConnAckReasonCode.MALFORMED_PACKET,ReasonStrings.CONNACK_MALFORMED_RESPONSE_TOPIC);
return null;
}
if (topicInvalid(clientConnectionContext,responseTopic,"will response topic")) {
return null;
}
return responseTopic;
}

Parameters to be described: buf
Reference: the encoded ByteBuf of the message
output_1: buffer containing the raw response topic data.
output_2: the buffer to read
output_3: the {@link ByteBuf} containing the message
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
12. private double getStandardDeviation(Map<Long,Pair<Long,Long>> storageCapacities){
double[] freeCapacities=storageCapacities.values().stream().mapToDouble(x -> ((double)x.first() / x.second())).toArray();
double mean=calculateStorageMean(freeCapacities);
return (calculateStorageStandardDeviation(freeCapacities,mean) / mean);
}

Parameters to be described: storageCapacities
Reference: Map comprising the metrics(free and total capacities) of the images stores considered
output_1: mapping of storage identifiers to pairs of used and total capacities.
output_2: the number of the /
output_3: storage capacities to calculate standard deviation for
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
13. private TemplateInfo createManagedTemplateVolume(TemplateInfo srcTemplateInfo,PrimaryDataStore destPrimaryDataStore){
TemplateInfo templateOnPrimary=(TemplateInfo)destPrimaryDataStore.create(srcTemplateInfo,srcTemplateInfo.getDeployAsIsConfiguration());
VMTemplateStoragePoolVO templatePoolRef=_tmpltPoolDao.findByPoolTemplate(destPrimaryDataStore.getId(),templateOnPrimary.getId(),srcTemplateInfo.getDeployAsIsConfiguration());
if (templatePoolRef == null) {
throw new CloudRuntimeException("Failed to find template " + srcTemplateInfo.getUniqueName() + " in storage pool "+ destPrimaryDataStore.getId());
}
else if (templatePoolRef.getState() == ObjectInDataStoreStateMachine.State.Ready) {
return templateOnPrimary;
}
int storagePoolMaxWaitSeconds=NumbersUtil.parseInt(configDao.getValue(Config.StoragePoolMaxWaitSeconds.key()),3600);
long templatePoolRefId=templatePoolRef.getId();
templatePoolRef=_tmpltPoolDao.acquireInLockTable(templatePoolRefId,storagePoolMaxWaitSeconds);
if (templatePoolRef == null) {
throw new CloudRuntimeException("Unable to acquire lock on VMTemplateStoragePool: " + templatePoolRefId);
}
try {
templateOnPrimary.processEvent(Event.CreateOnlyRequested);
CreateAsyncCompleteCallback callback=new CreateAsyncCompleteCallback();
destPrimaryDataStore.getDriver().createAsync(destPrimaryDataStore,templateOnPrimary,callback);
if (callback.result == null || callback.result.isFailed()) {
String errMesg;
if (callback.result == null) {
errMesg="Unknown/unable to determine result";
}
else {
errMesg=callback.result.getResult();
}
templateOnPrimary.processEvent(Event.OperationFailed);
throw new CloudRuntimeException("Unable to create template " + templateOnPrimary.getId() + " on primary storage "+ destPrimaryDataStore.getId()+ ":"+ errMesg);
}
templateOnPrimary.processEvent(Event.OperationSuccessed);
}
catch ( Throwable e) {
s_logger.debug("Failed to create template volume on storage",e);
templateOnPrimary.processEvent(Event.OperationFailed);
throw new CloudRuntimeException(e.getMessage());
}
finally {
_tmpltPoolDao.releaseFromLockTable(templatePoolRefId);
}
return templateOnPrimary;
}

Parameters to be described: destPrimaryDataStore
Reference: Managed storage on which we need to create the volume
output_1: the target primary data store for the template volume.
output_2: the template to create the template
output_3: template info for the source
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
14. protected File swiftWriteMetadataFile(String metaFileName,String uniqueName,String filename,long size,long virtualSize) throws IOException {
File metaFile=new File(metaFileName);
FileWriter writer=new FileWriter(metaFile);
BufferedWriter bufferWriter=new BufferedWriter(writer);
bufferWriter.write("uniquename=" + uniqueName);
bufferWriter.write("\n");
bufferWriter.write("filename=" + filename);
bufferWriter.write("\n");
bufferWriter.write("size=" + size);
bufferWriter.write("\n");
bufferWriter.write("virtualsize=" + virtualSize);
bufferWriter.close();
writer.close();
return metaFile;
}

Parameters to be described: virtualSize
Reference: :attribute: virtual size of the template
output_1: the logical or apparent size.
output_2: the directory to the directory
output_3: #NAME?
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
15. public Builder addSanDnsnames(java.lang.String value){
if (value == null) {
throw new NullPointerException();
}
ensureSanDnsnamesIsMutable();
sanDnsnames_.add(value);
bitField0_|=0x00000080;
onChanged();
return this;
}

Parameters to be described: value
Reference: The sanDnsnames to add.
output_1: a DNS name to add to the SAN list.
output_2: the bytes of the value to add.
output_3: The sanDnsnames to add.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
16. public Builder setDeny(int index,java.lang.String value){
if (value == null) {
throw new NullPointerException();
}
ensureDenyIsMutable();
deny_.set(index,value);
bitField0_|=0x00000004;
onChanged();
return this;
}

Parameters to be described: value
Reference: The deny to set.
output_1: the string to assign at the specified index.
output_2: the outputintname to set.
output_3: The index to set the value at.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
17. public Builder setIncludedPermissions(int index,java.lang.String value){
if (value == null) {
throw new NullPointerException();
}
ensureIncludedPermissionsIsMutable();
includedPermissions_.set(index,value);
bitField0_|=0x00000008;
onChanged();
return this;
}

Parameters to be described: value
Reference: The includedPermissions to set.
output_1: the permission string to set at the specified index.
output_2: the outputintname to set.
output_3: The index to set the value at.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
18. public Builder setServingConfigIds(int index,java.lang.String value){
if (value == null) {
throw new NullPointerException();
}
ensureServingConfigIdsIsMutable();
servingConfigIds_.set(index,value);
bitField0_|=0x00000001;
onChanged();
return this;
}

Parameters to be described: index
Reference: The index to set the value at.
output_1: position at which to set the serving configuration ID.
output_2: the index to set the value at.
output_3: The index to set the value at.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
19. public Builder setIntentDisplayNames(int index,java.lang.String value){
if (value == null) {
throw new NullPointerException();
}
ensureIntentDisplayNamesIsMutable();
intentDisplayNames_.set(index,value);
bitField0_|=0x00000001;
onChanged();
return this;
}

Parameters to be described: value
Reference: The intentDisplayNames to set.
output_1: the display name to set at the specified index.
output_2: the outputintname to set.
output_3: The intentDisplayNames to set.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
20. public Builder addCardLabels(com.google.recaptchaenterprise.v1.FraudSignals.CardSignals.CardLabel value){
if (value == null) {
throw new NullPointerException();
}
ensureCardLabelsIsMutable();
cardLabels_.add(value.getNumber());
onChanged();
return this;
}

Parameters to be described: value
Reference: The cardLabels to add.
output_1: the card label to add.
output_2: the bytes of the value to add.
output_3: The cardLabels to add.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
21. public Builder addAllApplicableCountries(java.lang.Iterable<java.lang.String> values){
ensureApplicableCountriesIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(values,applicableCountries_);
bitField0_|=0x00000100;
onChanged();
return this;
}

Parameters to be described: values
Reference: The applicableCountries to add.
output_1: a collection of country codes to add.
output_2: the enum to add.
output_3: The applicableCountries to add.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
22. @java.lang.Deprecated public Builder addAllAllowedMachineTypes(java.lang.Iterable<java.lang.String> values){
ensureAllowedMachineTypesIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(values,allowedMachineTypes_);
bitField0_|=0x00000001;
onChanged();
return this;
}

Parameters to be described: values
Reference: The allowedMachineTypes to add.
output_1: the machine types to add.
output_2: the values to add.
output_3: The allowedMachineTypes to add.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
23. public Builder setHealthChecks(int index,java.lang.String value){
if (value == null) {
throw new NullPointerException();
}
ensureHealthChecksIsMutable();
healthChecks_.set(index,value);
bitField0_|=0x00000010;
onChanged();
return this;
}

Parameters to be described: value
Reference: The healthChecks to set.
output_1: the health check string to set.
output_2: the outputintname to set.
output_3: The healthChecks to set.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
24. public Builder setTunnels(int index,java.lang.String value){
if (value == null) {
throw new NullPointerException();
}
ensureTunnelsIsMutable();
tunnels_.set(index,value);
bitField0_|=0x00001000;
onChanged();
return this;
}

Parameters to be described: value
Reference: The tunnels to set.
output_1: the tunnel string to set.
output_2: the outputintname to set.
output_3: The index to set the value at.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
25. public Builder addDeviceIds(java.lang.String value){
if (value == null) {
throw new NullPointerException();
}
ensureDeviceIdsIsMutable();
deviceIds_.add(value);
bitField0_|=0x00000004;
onChanged();
return this;
}

Parameters to be described: value
Reference: The deviceIds to add.
output_1: the device ID to add.
output_2: the bytes of the value to add.
output_3: The deviceIds to add.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
26. public final String dumpImageFile(final File file) throws ImagingException, IOException {
if (!canAcceptExtension(file)) {
return null;
}
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest(getName() + ": " + file.getName());
}
return dumpImageFile(ByteSource.file(file));
}

Parameters to be described: file
Reference: A valid file reference.
output_1: the image file to be processed.
output_2: the file to search
output_3: the file to dump
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
27. @Override public BasicKeyChain toEncrypted(KeyCrypter keyCrypter,AesKey aesKey){
lock.lock();
try {
Objects.requireNonNull(keyCrypter);
checkState(this.keyCrypter == null,() -> "key chain is already encrypted");
BasicKeyChain encrypted=new BasicKeyChain(keyCrypter);
for ( ECKey key : hashToKeys.values()) {
ECKey encryptedKey=key.encrypt(keyCrypter,aesKey);
if (!ECKey.encryptionIsReversible(key,encryptedKey,keyCrypter,aesKey)) throw new KeyCrypterException("The key " + key.toString() + " cannot be successfully decrypted after encryption so aborting wallet encryption.");
encrypted.importKeyLocked(encryptedKey);
}
for ( ListenerRegistration<KeyChainEventListener> listener : listeners) {
encrypted.addEventListener(listener);
}
return encrypted;
}
finally {
lock.unlock();
}
}

Parameters to be described: aesKey
Reference: AES key to use (normally created using KeyCrypter#deriveKey and cached as it is time consumingto create from a password)
output_1: the AES key used for encryption.
output_2: the key of the encryption
output_3: the key crypter to use for encryption
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
28. public MonetaryFormat repeatOptionalDecimals(int decimals,int repetitions){
checkArgument(repetitions >= 0,() -> "repetitions cannot be negative: " + repetitions);
List<Integer> decimalGroups=new ArrayList<>(repetitions);
for (int i=0; i < repetitions; i++) decimalGroups.add(decimals);
return new MonetaryFormat(negativeSign,positiveSign,zeroDigit,decimalMark,minDecimals,decimalGroups,shift,roundingMode,codes,codeSeparator,codePrefixed);
}

Parameters to be described: repetitions
Reference: number of repetitions
output_1: number of times to repeat the optional decimal groups.
output_2: the number of columns to be added
output_3: The number of digits to repeat.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
29. public static void writeInt16LE(int val,OutputStream stream) throws IOException {
byte[] buf=new byte[2];
writeInt16LE(val,ByteBuffer.wrap(buf));
stream.write(buf);
}

Parameters to be described: val
Reference: value to be written
output_1: the 16-bit integer to write.
output_2: the byte to write
output_3: the stream to write to
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
30. static InetSocketAddress parse(final String value,final String uriParamName,final boolean isReResolution,final NameResolver nameResolver){
if (Strings.isEmpty(value)) {
throw new NullPointerException("input string must not be null or empty");
}
final String nameAndPort=nameResolver.lookup(value,uriParamName,isReResolution);
InetSocketAddress address=tryParseIpV4(nameAndPort,uriParamName,isReResolution,nameResolver);
if (null == address) {
address=tryParseIpV6(nameAndPort,uriParamName,isReResolution,nameResolver);
}
if (null == address) {
throw new IllegalArgumentException("invalid format: " + value);
}
return address;
}

Parameters to be described: uriParamName
Reference: for the parse.
output_1: the name of the URI parameter for error messages.
output_2: the name of the address=tryparseipv6(nameandport,uriparamname,isreresolution,nameresolver);
output_3: the name resolver to use
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
31. public void onResponseSetup(final ResponseSetupFlyweight msg,final UnsafeBuffer unsafeBuffer,final int length,final InetSocketAddress srcAddress,final DriverConductorProxy conductorProxy){
final long key=compoundKey(msg.sessionId(),msg.streamId());
final NetworkPublication publication=publicationBySessionAndStreamId.get(key);
if (null != publication) {
final long responseCorrelationId=publication.responseCorrelationId();
if (Aeron.NULL_VALUE != responseCorrelationId) {
conductorProxy.responseSetup(responseCorrelationId,msg.responseSessionId());
}
}
}

Parameters to be described: msg
Reference: of the Response Setup frame.
output_1: the response setup message received.
output_2: the message to send
output_3: the {@link DriverConductorProxy} to use for this connection
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
32. public static int findNumberOfAddressesByRegistrationId(final CountersReader countersReader,final long registrationId){
int result=0;
for (int i=0, size=countersReader.maxCounterId(); i < size; i++) {
final int counterState=countersReader.getCounterState(i);
if (counterState == RECORD_ALLOCATED && countersReader.getCounterTypeId(i) == LOCAL_SOCKET_ADDRESS_STATUS_TYPE_ID && countersReader.getCounterRegistrationId(i) == registrationId) {
result++;
}
else if (RECORD_UNUSED == counterState) {
break;
}
}
return result;
}

Parameters to be described: registrationId
Reference: for the subscription.
output_1: the identifier to match registration records.
output_2: the current number of the record_allocated
output_3: the counter id
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
33. public static BitFieldGet create(BitFieldType type,Offset offset){
Assert.notNull(type,"BitFieldType must not be null");
Assert.notNull(offset,"Offset must not be null");
BitFieldGet instance=new BitFieldGet();
instance.type=type;
instance.offset=offset;
return instance;
}

Parameters to be described: type
Reference: must not be {@literal null}.
output_1: the bit field's data type.
output_2: must not be {@literal null}.
output_3: the offset of the bit field
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
34. public CellIterator getTreeCellIterator(Shape shape,int detailLevel){
if (detailLevel > maxLevels) {
throw new IllegalArgumentException("detailLevel > maxLevels");
}
return new TreeCellIterator(shape,detailLevel,getWorldCell());
}

Parameters to be described: detailLevel
Reference: the maximum detail level to get cells for
output_1: the granularity level of detail.
output_2: the maximum number of the last
output_3: the shape of the tree
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
35. public static String[] getExecutorCommand(Config config,Config runtime,String shardId,Map<ExecutorPort,String> ports){
List<String> commands=new ArrayList<>();
commands.add(Context.executorBinary(config));
String[] commandArgs=executorCommandArgs(config,runtime,ports,shardId);
commands.addAll(Arrays.asList(commandArgs));
return commands.toArray(new String[0]);
}

Parameters to be described: shardId
Reference: the executor/container index
output_1: identifier for the process shard.
output_2: raft shard id
output_3: the runtime configuration
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
36. @VisibleForTesting protected void configureContainerPorts(boolean remoteDebugEnabled,int numberOfInstances,final V1Container container){
List<V1ContainerPort> ports=new ArrayList<>(getExecutorPorts());
if (remoteDebugEnabled) {
ports.addAll(getDebuggingPorts(numberOfInstances));
}
KubernetesUtils.CommonUtils<V1ContainerPort> utils=new KubernetesUtils.CommonUtils<>();
container.setPorts(utils.mergeListsDedupe(getExecutorPorts(),container.getPorts(),Comparator.comparing(V1ContainerPort::getContainerPort),"Pod Template Ports"));
}

Parameters to be described: remoteDebugEnabled
Reference: Flag used to indicate if debugging ports need to be added.
output_1: whether remote debugging is enabled.
output_2: the {@link protected to use
output_3: The number of instances to configure
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
37. V1PersistentVolumeClaim createPersistentVolumeClaim(String claimName,Map<String,String> labels,Map<KubernetesConstants.VolumeConfigKeys,String> configs){
V1PersistentVolumeClaim claim=new V1PersistentVolumeClaimBuilder().withNewMetadata().withName(claimName).withLabels(labels).endMetadata().withNewSpec().withStorageClassName("").endSpec().build();
for ( Map.Entry<KubernetesConstants.VolumeConfigKeys,String> option : configs.entrySet()) {
String optionValue=option.getValue();
switch (option.getKey()) {
case storageClassName:
claim.getSpec().setStorageClassName(optionValue);
break;
case sizeLimit:
claim.getSpec().setResources(new V1ResourceRequirements().putRequestsItem("storage",new Quantity(optionValue)));
break;
case accessModes:
claim.getSpec().setAccessModes(Arrays.asList(optionValue.split(",")));
break;
case volumeMode:
claim.getSpec().setVolumeMode(optionValue);
break;
default :
break;
}
}
return claim;
}

Parameters to be described: claimName
Reference: Name to be assigned to <code>Persistent Volume Claims Template</code>.
output_1: the name of the volume claim.
output_2: the {@link v1persistentvolumeclaim to use
output_3: The labels of the volume.
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
38. public static void stopProxy(VersionedProtocol proxy){
if (proxy != null) {
((Invoker)Proxy.getInvocationHandler(proxy)).close();
}
}

Parameters to be described: proxy
Reference: the proxy to be stopped
output_1: the protocol instance to stop.
output_2: the proxy to check
output_3: the proxy to stop
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
39. private static <T>void assertEventuallyEquals(T expected,Callable<T> eval,int checkIntervalMillis,long timeoutMillis) throws Exception {
T result=null;
try {
result=TestUtils.awaitEvaluateExpr(expected,eval,checkIntervalMillis,timeoutMillis);
}
catch ( TimeoutException e) {
throw e;
}
assertEquals(expected,result);
}

Parameters to be described: timeoutMillis
Reference: The timeout in milliseconds after which an assertion error should be thrown.
output_1: maximum time to wait for the expected value.
output_2: the maximum timeout in milliseconds
output_3: the expected value
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
40. public boolean removeAttributes(final boolean includeSubtree,final String... attributeNames){
boolean result=false;
for ( final String name : attributeNames) {
result|=this.attributes.remove(name) != null;
}
if (includeSubtree) {
for ( final Topic c : this.children) {
result|=c.removeAttributes(includeSubtree,attributeNames);
}
}
return result;
}

Parameters to be described: includeSubtree
Reference: if true then remove all attributes from subtree
output_1: whether to remove attributes from child elements recursively.
output_2: the includesubtree to check
output_3: the attribute names to remove
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
41. public void doTestPrelimSorting(final Client client,final boolean extraAgg,final boolean extraSubFacet) throws Exception {
client.deleteByQuery("*:*",null);
List<SolrClient> clients=client.getClientProvider().all();
final SolrClient shardA=clients.get(0);
final SolrClient shardB=clients.get(clients.size() - 1);
final int numShardsWithData=(shardA == shardB) ? 1 : 2;
int id=0;
for (int i=1; i <= 20; i++) {
for (int j=1; j <= i; j++) {
shardA.add(new SolrInputDocument("id","" + (++id),"foo_s","foo_" + i,"bar_i","1"));
shardB.add(new SolrInputDocument("id","" + (++id),"foo_s","foo_" + i,"bar_i","1"));
}
}
assertEquals(420,id);
client.commit();
DebugAgg.Acc.collectDocs.set(0);
DebugAgg.Acc.collectDocSets.set(0);
final boolean indexSortDebugAggFudge=(1 < numShardsWithData) && (FacetField.FacetMethod.DEFAULT_METHOD.equals(FacetField.FacetMethod.STREAM) || FacetField.FacetMethod.DEFAULT_METHOD.equals(FacetField.FacetMethod.ENUM));
final String common="refine:true, type:field, field:'foo_s', facet: { " + "x: 'debug(wrap,sum(bar_i))' " + (extraAgg ? ", y:'min(bar_i)'" : "") + (extraSubFacet ? ", z:{type:query, q:'bar_i:0'}" : "")+ "}";
final String yz=(extraAgg ? "y:1, " : "") + (extraSubFacet ? "z:{count:0}, " : "");
client.testJQ(params("q","*:*","rows","0","json.facet","{ foo_a:{ " + common + ", limit:5, overrequest:0, "+ " prelim_sort:'count desc', sort:'x asc' }"+ " foo_b:{ "+ common+ ", limit:5, overrequest:0, "+ " prelim_sort:'count asc', sort:'x desc' } }"),"facets=={ 'count':420, " + " 'foo_a':{ 'buckets':[" + " { val:foo_16, count:32, " + yz + "x:32.0},"+ " { val:foo_17, count:34, "+ yz+ "x:34.0},"+ " { val:foo_18, count:36, "+ yz+ "x:36.0},"+ " { val:foo_19, count:38, "+ yz+ "x:38.0},"+ " { val:foo_20, count:40, "+ yz+ "x:40.0},"+ "] },"+ " 'foo_b':{ 'buckets':["+ " { val:foo_5, count:10, "+ yz+ "x:10.0},"+ " { val:foo_4, count:8, "+ yz+ "x:8.0},"+ " { val:foo_3, count:6, "+ yz+ "x:6.0},"+ " { val:foo_2, count:4, "+ yz+ "x:4.0},"+ " { val:foo_1, count:2, "+ yz+ "x:2.0},"+ "] },"+ "}");
assertEqualsAndReset(0,DebugAgg.Acc.collectDocs);
assertEqualsAndReset(numShardsWithData * 2 * 5,DebugAgg.Acc.collectDocSets);
{
final String aout="allBuckets:{ count:420, " + (extraAgg ? "y:1, " : "") + "x:420.0 }";
client.testJQ(params("q","*:*","rows","0","json.facet","{ foo_a:{ " + common + ", allBuckets:true, limit:5, overrequest:0, "+ " prelim_sort:'count desc', sort:'x asc' }"+ " foo_b:{ "+ common+ ", allBuckets:true, limit:5, overrequest:0, "+ " prelim_sort:'count asc', sort:'x desc' } }"),"facets=={ 'count':420, " + " 'foo_a':{ " + aout + " 'buckets':["+ " { val:foo_16, count:32, "+ yz+ "x:32.0},"+ " { val:foo_17, count:34, "+ yz+ "x:34.0},"+ " { val:foo_18, count:36, "+ yz+ "x:36.0},"+ " { val:foo_19, count:38, "+ yz+ "x:38.0},"+ " { val:foo_20, count:40, "+ yz+ "x:40.0},"+ "] },"+ " 'foo_b':{ "+ aout+ " 'buckets':["+ " { val:foo_5, count:10, "+ yz+ "x:10.0},"+ " { val:foo_4, count:8, "+ yz+ "x:8.0},"+ " { val:foo_3, count:6, "+ yz+ "x:6.0},"+ " { val:foo_2, count:4, "+ yz+ "x:4.0},"+ " { val:foo_1, count:2, "+ yz+ "x:2.0},"+ "] },"+ "}");
assertEqualsAndReset(2 * 420,DebugAgg.Acc.collectDocs);
assertEqualsAndReset(numShardsWithData * 2 * 5,DebugAgg.Acc.collectDocSets);
}
client.testJQ(params("q","*:*","rows","0","json.facet","{ foo_a:{ " + common + ", offset:2, limit:3, overrequest:0, "+ " prelim_sort:'count desc', sort:'x asc' }"+ " foo_b:{ "+ common+ ", offset:2, limit:3, overrequest:0, "+ " prelim_sort:'count asc', sort:'x desc' } }"),"facets=={ 'count':420, " + " 'foo_a':{ 'buckets':[" + " { val:foo_18, count:36, " + yz + "x:36.0},"+ " { val:foo_19, count:38, "+ yz+ "x:38.0},"+ " { val:foo_20, count:40, "+ yz+ "x:40.0},"+ "] },"+ " 'foo_b':{ 'buckets':["+ " { val:foo_3, count:6, "+ yz+ "x:6.0},"+ " { val:foo_2, count:4, "+ yz+ "x:4.0},"+ " { val:foo_1, count:2, "+ yz+ "x:2.0},"+ "] },"+ "}");
assertEqualsAndReset(0,DebugAgg.Acc.collectDocs);
assertEqualsAndReset(numShardsWithData * 2 * 5,DebugAgg.Acc.collectDocSets);
client.testJQ(params("q","*:*","rows","0","json.facet","{ foo_a:{ " + common + ", limit:5, overrequest:5, "+ " prelim_sort:'count desc', sort:'x asc' }"+ " foo_b:{ "+ common+ ", limit:5, overrequest:5, "+ " prelim_sort:'count asc', sort:'x desc' } }"),"facets=={ 'count':420, " + " 'foo_a':{ 'buckets':[" + " { val:foo_11, count:22, " + yz + "x:22.0},"+ " { val:foo_12, count:24, "+ yz+ "x:24.0},"+ " { val:foo_13, count:26, "+ yz+ "x:26.0},"+ " { val:foo_14, count:28, "+ yz+ "x:28.0},"+ " { val:foo_15, count:30, "+ yz+ "x:30.0},"+ "] },"+ " 'foo_b':{ 'buckets':["+ " { val:foo_10, count:20, "+ yz+ "x:20.0},"+ " { val:foo_9, count:18, "+ yz+ "x:18.0},"+ " { val:foo_8, count:16, "+ yz+ "x:16.0},"+ " { val:foo_7, count:14, "+ yz+ "x:14.0},"+ " { val:foo_6, count:12, "+ yz+ "x:12.0},"+ "] },"+ "}");
assertEqualsAndReset(0,DebugAgg.Acc.collectDocs);
assertEqualsAndReset(numShardsWithData * 2 * 10,DebugAgg.Acc.collectDocSets);
{
final StringBuilder expected=new StringBuilder("facets=={ 'count':420, 'foo_a':{ 'buckets':[\n");
for (int i=20; 0 < i; i--) {
final int x=i * 2;
expected.append("{ val:foo_" + i + ", count:"+ x+ ", "+ yz+ "x:"+ x+ ".0},\n");
}
expected.append("] } }");
for ( int limit : Arrays.asList(-1,100000)) {
for ( String sortOpts : Arrays.asList("sort:'x desc'","prelim_sort:'count asc', sort:'x desc'","prelim_sort:'index asc', sort:'x desc'")) {
final String snippet="limit: " + limit + ", "+ sortOpts;
client.testJQ(params("q","*:*","rows","0","json.facet","{ foo_a:{ " + common + ", "+ snippet+ "}}"),expected.toString());
if (((0 < limit || extraSubFacet) && snippet.contains("prelim_sort")) && !(indexSortDebugAggFudge && snippet.contains("index asc"))) {
assertEqualsAndReset(snippet,numShardsWithData * 20,DebugAgg.Acc.collectDocSets);
assertEqualsAndReset(snippet,0,DebugAgg.Acc.collectDocs);
}
else {
assertEqualsAndReset(snippet,0,DebugAgg.Acc.collectDocSets);
assertEqualsAndReset(snippet,420,DebugAgg.Acc.collectDocs);
}
}
}
}
for ( String numSort : Arrays.asList("count","x")) {
client.testJQ(params("q","*:*","rows","0","json.facet","{ foo_a:{ " + common + ", limit:10, overrequest:0, "+ " prelim_sort:'"+ numSort+ " asc', sort:'index desc' }"+ " foo_b:{ "+ common+ ", limit:10, overrequest:0, "+ " prelim_sort:'index asc', sort:'"+ numSort+ " desc' } }"),"facets=={ 'count':420, " + " 'foo_a':{ 'buckets':[" + " { val:foo_9, count:18, " + yz + "x:18.0},"+ " { val:foo_8, count:16, "+ yz+ "x:16.0},"+ " { val:foo_7, count:14, "+ yz+ "x:14.0},"+ " { val:foo_6, count:12, "+ yz+ "x:12.0},"+ " { val:foo_5, count:10, "+ yz+ "x:10.0},"+ " { val:foo_4, count:8, "+ yz+ "x:8.0},"+ " { val:foo_3, count:6, "+ yz+ "x:6.0},"+ " { val:foo_2, count:4, "+ yz+ "x:4.0},"+ " { val:foo_10, count:20, "+ yz+ "x:20.0},"+ " { val:foo_1, count:2, "+ yz+ "x:2.0},"+ "] },"+ " 'foo_b':{ 'buckets':["+ " { val:foo_18, count:36, "+ yz+ "x:36.0},"+ " { val:foo_17, count:34, "+ yz+ "x:34.0},"+ " { val:foo_16, count:32, "+ yz+ "x:32.0},"+ " { val:foo_15, count:30, "+ yz+ "x:30.0},"+ " { val:foo_14, count:28, "+ yz+ "x:28.0},"+ " { val:foo_13, count:26, "+ yz+ "x:26.0},"+ " { val:foo_12, count:24, "+ yz+ "x:24.0},"+ " { val:foo_11, count:22, "+ yz+ "x:22.0},"+ " { val:foo_10, count:20, "+ yz+ "x:20.0},"+ " { val:foo_1, count:2, "+ yz+ "x:2.0},"+ "] },"+ "}");
}
assertEqualsAndReset((indexSortDebugAggFudge ? 1 : 3) * numShardsWithData * 10,DebugAgg.Acc.collectDocSets);
assertEqualsAndReset(420 + (indexSortDebugAggFudge ? 2 * numShardsWithData * (1 + 10 + 11+ 12+ 13+ 14+ 15+ 16+ 17+ 18+ 19) : 0),DebugAgg.Acc.collectDocs);
client.testJQ(params("q","*:*","rows","0","json.facet","{ bar:{ type:query, query:'foo_s:[foo_10 TO foo_19]', facet: {" + " foo:{ " + common + ", limit:5, overrequest:0, "+ " prelim_sort:'count desc', sort:'x asc' } } } }"),"facets=={ 'count':420, " + " 'bar':{ 'count':290, " + " 'foo':{ 'buckets':["+ " { val:foo_15, count:30, " + yz + "x:30.0},"+ " { val:foo_16, count:32, "+ yz+ "x:32.0},"+ " { val:foo_17, count:34, "+ yz+ "x:34.0},"+ " { val:foo_18, count:36, "+ yz+ "x:36.0},"+ " { val:foo_19, count:38, "+ yz+ "x:38.0},"+ " ] },"+ " },"+ "}");
assertEqualsAndReset(0,DebugAgg.Acc.collectDocs);
assertEqualsAndReset(numShardsWithData * 5,DebugAgg.Acc.collectDocSets);
{
final List<String> sorts=new ArrayList<String>(Arrays.asList("index asc","count asc"));
if (extraAgg) {
sorts.add("y asc");
}
for ( String s : sorts) {
client.testJQ(params("q","*:*","rows","0","json.facet","{ foo:{ " + common + ", limit:5, overrequest:0, "+ " prelim_sort:'count desc', sort:'"+ s+ "' } }"),"facets=={ 'count':420, " + " 'foo':{ 'buckets':[" + " { val:foo_16, count:32, " + yz + "x:32.0},"+ " { val:foo_17, count:34, "+ yz+ "x:34.0},"+ " { val:foo_18, count:36, "+ yz+ "x:36.0},"+ " { val:foo_19, count:38, "+ yz+ "x:38.0},"+ " { val:foo_20, count:40, "+ yz+ "x:40.0},"+ "] } }");
assertEqualsAndReset(0,DebugAgg.Acc.collectDocs);
assertEqualsAndReset(numShardsWithData * 5,DebugAgg.Acc.collectDocSets);
}
}
}

Parameters to be described: extraAgg
Reference: if an extra aggregation function should be included, this hits slightly diffcode paths
output_1: whether to include an additional aggregation in the test.
output_2: the extraagg to use
output_3: the client to sort
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
42. protected Predicate<BytesRef> newBytesRefFilter(String field,SolrParams params){
final String contains=params.getFieldParam(field,FacetParams.FACET_CONTAINS);
Predicate<BytesRef> finalFilter=null;
if (contains != null) {
final boolean containsIgnoreCase=params.getFieldBool(field,FacetParams.FACET_CONTAINS_IGNORE_CASE,false);
finalFilter=new SubstringBytesRefFilter(contains,containsIgnoreCase);
}
final String regex=params.getFieldParam(field,FacetParams.FACET_MATCHES);
if (regex != null) {
final RegexBytesRefFilter regexBytesRefFilter=new RegexBytesRefFilter(regex);
finalFilter=(finalFilter == null) ? regexBytesRefFilter : finalFilter.and(regexBytesRefFilter);
}
final Predicate<BytesRef> excludeFilter=newExcludeBytesRefFilter(field,params);
if (excludeFilter != null) {
finalFilter=(finalFilter == null) ? excludeFilter : finalFilter.and(excludeFilter);
}
return finalFilter;
}

Parameters to be described: params
Reference: the request parameter object
output_1: the Solr parameters containing filter criteria.
output_2: the parameters to use
output_3: the field name
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
43. public void validate(List<String> sigs,FileStore.FileEntry entry,boolean isFirstAttempt) throws SolrException, IOException {
if (!isFirstAttempt) {
fileStore.refresh(KEYS_DIR);
}
Map<String,byte[]> keys=fileStore.getKeys();
if (keys == null || keys.isEmpty()) {
if (isFirstAttempt) {
validate(sigs,entry,false);
return;
}
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,"Filestore does not have any public keys");
}
CryptoKeys cryptoKeys=null;
try {
cryptoKeys=new CryptoKeys(keys);
}
catch ( Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,"Error parsing public keys in ZooKeeper");
}
for ( String sig : sigs) {
Supplier<String> errMsg=() -> "Signature does not match any public key : " + sig + "sha256 "+ entry.getMetaData().sha512;
if (entry.getBuffer() != null) {
if (cryptoKeys.verify(sig,entry.getBuffer()) == null) {
if (isFirstAttempt) {
validate(sigs,entry,false);
return;
}
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,errMsg.get());
}
}
else {
InputStream inputStream=entry.getInputStream();
if (cryptoKeys.verify(sig,inputStream) == null) {
if (isFirstAttempt) {
validate(sigs,entry,false);
return;
}
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,errMsg.get());
}
}
}
}

Parameters to be described: sigs
Reference: the signatures. atleast one should succeed
output_1: list of signatures to validate.
output_2: the list of the public
output_3: the list of signatures to validate
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
44. public Builder withProxyConfiguration(String host,int port,boolean isSocks4,boolean isSecure){
this.proxyHost=host;
this.proxyPort=port;
this.proxyIsSocks4=isSocks4;
this.proxyIsSecure=isSecure;
return this;
}

Parameters to be described: host
Reference: The proxy host
output_1: the proxy server address.
output_2: the host to connect
output_3: the port of the proxy
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
45. public static void shutdownExecutorService(ExecutorService executorService,Optional<Logger> logger,long timeout,TimeUnit unit){
Preconditions.checkNotNull(unit);
executorService.shutdown();
if (logger.isPresent()) {
logger.get().info("Attempting to shutdown ExecutorService: " + executorService);
}
try {
long halfTimeoutNanos=TimeUnit.NANOSECONDS.convert(timeout,unit) / 2;
if (!executorService.awaitTermination(halfTimeoutNanos,TimeUnit.NANOSECONDS)) {
executorService.shutdownNow();
if (logger.isPresent()) {
logger.get().info("Shutdown un-successful, attempting shutdownNow of ExecutorService: " + executorService);
}
if (!executorService.awaitTermination(halfTimeoutNanos,TimeUnit.NANOSECONDS) && logger.isPresent()) {
logger.get().error("Could not shutdown all threads in ExecutorService: " + executorService);
}
}
else if (logger.isPresent()) {
logger.get().info("Successfully shutdown ExecutorService: " + executorService);
}
}
catch ( InterruptedException ie) {
Thread.currentThread().interrupt();
executorService.shutdownNow();
if (logger.isPresent()) {
logger.get().info("Attempting to shutdownNow ExecutorService: " + executorService);
}
}
}

Parameters to be described: unit
Reference: the time unit of the timeout argument
output_1: time unit for the timeout duration.
output_2: the time unit
output_3: the executor service to shutdown
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
46. public static Path serializeAsPath(GenericRecord record,boolean includeFieldNames,boolean replacePathSeparators){
if (record == null) {
return new Path("");
}
List<String> tokens=Lists.newArrayList();
for ( Schema.Field field : record.getSchema().getFields()) {
String sanitizedName=HadoopUtils.sanitizePath(field.name(),"_");
String sanitizedValue=HadoopUtils.sanitizePath(record.get(field.name()).toString(),"_");
if (replacePathSeparators) {
sanitizedName=sanitizedName.replaceAll(Path.SEPARATOR,"_");
sanitizedValue=sanitizedValue.replaceAll(Path.SEPARATOR,"_");
}
if (includeFieldNames) {
tokens.add(String.format("%s=%s",sanitizedName,sanitizedValue));
}
else if (!Strings.isNullOrEmpty(sanitizedValue)) {
tokens.add(sanitizedValue);
}
}
return new Path(Joiner.on(Path.SEPARATOR).join(tokens));
}

Parameters to be described: replacePathSeparators
Reference: If true, path separators ('/') in each token will be replaced with '_'.
output_1: whether to replace path separator characters in field names and values.
output_2: whether to use the file
output_3: Whether to replace the path separators
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
47. @Override protected ArrayList<String> isPathContaining(DatasetDescriptor inputDatasetDescriptorConfig){
ArrayList<String> errors=new ArrayList<>();
String otherPath=inputDatasetDescriptorConfig.getPath();
DatasetDescriptorErrorUtils.populateErrorForDatasetDescriptorKey(errors,inputDatasetDescriptorConfig.getIsInputDataset(),DatasetDescriptorConfigKeys.PATH_KEY,this.getPath(),otherPath,false);
return errors;
}

Parameters to be described: inputDatasetDescriptorConfig
Reference: whose path should be in the format of a HTTP path
output_1: the dataset descriptor to check for path containment.
output_2: the map of the arraylist<string>
output_3: the dataset descriptor configuration
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
48. public boolean deleteDataNode(DataNode node){
try {
rwLock.writeLock().lock();
if (!dataNodeMap.containsKey(node.getId())) {
return false;
}
dataNodeMap.remove(node.getId());
for ( FlowEdge edge : nodesToEdges.get(node)) {
flowEdgeMap.remove(edge.getId());
}
nodesToEdges.remove(node);
return true;
}
finally {
rwLock.writeLock().unlock();
}
}

Parameters to be described: node
Reference: to be deleted.
output_1: the data node to delete.
output_2: the node to check
output_3: the data node to delete
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
49. public void printRecord(final Appendable out,final Object... values) throws IOException {
for (int i=0; i < values.length; i++) {
print(values[i],out,i == 0);
}
println(out);
}

Parameters to be described: values
Reference: values to output.
output_1: objects to be printed.
output_2: the values to write
output_3: the record values to print
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
50. public void schedule(String jobName,String poolName,String serviceName,Map<String,? extends Object> context,long startTime,int frequency,int interval,int count,long endTime,int maxRetry) throws JobManagerException {
String dataId=null;
try {
GenericValue runtimeData=delegator.makeValue("RuntimeData");
runtimeData.set("runtimeInfo",XmlSerializer.serialize(context));
runtimeData=delegator.createSetNextSeqId(runtimeData);
dataId=runtimeData.getString("runtimeDataId");
}
catch ( GenericEntityException|SerializeException|IOException e) {
throw new JobManagerException(e.getMessage(),e);
}
schedule(jobName,poolName,serviceName,dataId,startTime,frequency,interval,count,endTime,maxRetry);
}

Parameters to be described: maxRetry
Reference: The max number of retries on failure (-1 for no max)
output_1: maximum number of retry attempts allowed.
output_2: the maximum time of time to wait
output_3: The name of the service to run the service on
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
51. public double[] getSibsonCoordinates(List<IQuadEdge> polygon,double x,double y){
int nEdge=polygon.size();
if (nEdge < 3) {
return new double[0];
}
Vertex a, b, c;
Circumcircle c0=new Circumcircle();
Circumcircle c1=new Circumcircle();
Circumcircle c2=new Circumcircle();
Circumcircle c3=new Circumcircle();
IQuadEdge e0, e1, n, n1;
double x0, y0, x1, y1, wThiessen, wXY, wDelta;
double wSum=0;
double[] weights=new double[nEdge];
for (int i0=0; i0 < nEdge; i0++) {
int i1=(i0 + 1) % nEdge;
e0=polygon.get(i0);
e1=polygon.get(i1);
a=e0.getA();
b=e1.getA();
c=e1.getB();
double ax=a.getX() - x;
double ay=a.getY() - y;
double bx=b.getX() - x;
double by=b.getY() - y;
double cx=c.getX() - x;
double cy=c.getY() - y;
x0=(ax + bx) / 2;
y0=(ay + by) / 2;
x1=(bx + cx) / 2;
y1=(by + cy) / 2;
if (i0 == 0) {
geoOp.circumcircle(ax,ay,bx,by,0,0,c0);
Vertex nb=e0.getForward().getB();
geoOp.circumcircle(ax,ay,bx,by,nb.getX() - x,nb.getY() - y,c3);
}
else {
c0.copy(c1);
}
geoOp.circumcircle(bx,by,cx,cy,0,0,c1);
wXY=(x0 * c0.getY() - c0.getX() * y0) + (c0.getX() * c1.getY() - c1.getX() * c0.getY()) + (c1.getX() * y1 - x1 * c1.getY());
n=e0.getForward();
wThiessen=x0 * c3.getY() - c3.getX() * y0;
while (!(n.equals(e1))) {
n1=n.getDual();
n=n1.getForward();
c2.copy(c3);
a=n1.getA();
b=n.getA();
c=n.getB();
ax=a.getX() - x;
ay=a.getY() - y;
bx=b.getX() - x;
by=b.getY() - y;
cx=c.getX() - x;
cy=c.getY() - y;
geoOp.circumcircle(ax,ay,bx,by,cx,cy,c3);
wThiessen+=c2.getX() * c3.getY() - c3.getX() * c2.getY();
}
wThiessen+=c3.getX() * y1 - x1 * c3.getY();
wDelta=wXY - wThiessen;
wSum+=wDelta;
weights[i1]=wDelta;
}
for (int i=0; i < weights.length; i++) {
weights[i]/=wSum;
}
double xSum=0;
double ySum=0;
int k=0;
for ( IQuadEdge s : polygon) {
Vertex v=s.getA();
xSum+=weights[k] * (v.getX() - x);
ySum+=weights[k] * (v.getY() - y);
k++;
}
barycentricCoordinateDeviation=Math.sqrt(xSum * xSum + ySum * ySum);
return weights;
}

Parameters to be described: x
Reference: the x coordinate of the reference point
output_1: x-coordinate of the reference point.
output_2: the x coordinate of the touch
output_3: the x coordinate of the start point
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
52. private static SiteCatalog loadInstance(String catalogImplementor,PegasusBag bag,Properties properties){
if (properties == null) {
throw new SiteFactoryException("Invalid NULL properties passed");
}
SiteCatalog catalog=null;
try {
if (catalogImplementor == null) {
throw new RuntimeException("You need to specify the " + SiteCatalog.c_prefix + " property");
}
catalogImplementor=(catalogImplementor.indexOf('.') == -1) ? DEFAULT_PACKAGE_NAME + "." + catalogImplementor : catalogImplementor;
DynamicLoader dl=new DynamicLoader(catalogImplementor);
catalog=(SiteCatalog)dl.instantiate(new Object[0]);
if (catalog == null) {
throw new RuntimeException("Unable to load " + catalogImplementor);
}
catalog.initialize(bag);
if (!catalog.connect(properties)) throw new RuntimeException("Unable to connect to site catalog implementation");
}
catch ( Exception e) {
throw new SiteFactoryException("Unable to instantiate Site Catalog ",catalogImplementor,e);
}
return catalog;
}

Parameters to be described: properties
Reference: the connection properties.
output_1: configuration settings for connecting to the site catalog.
output_2: the properties to connect
output_3: The bag to use for loading the catalog
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
53. public void addToForwardOptions(String argument){
String[] arr=argument.split("=");
NameValue nv=new NameValue();
nv.setKey(arr[0]);
if (arr.length == 2) {
nv.setValue(arr[1]);
}
this.mForwardOptions.add(nv);
}

Parameters to be described: argument
Reference: the argument to be passed.
output_1: a key-value pair string separated by '='.
output_2: the argument to be used
output_3: the argument to add to forward options
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
54. public AbstractJob uses(String file,File.LINK link,File.TRANSFER transfer,boolean register){
File f=new File(file,link);
f.setRegister(register);
f.setTransfer(transfer);
if (!mUses.contains(f)) {
mUses.add(f);
}
else {
mLogger.log("Job " + Separator.combine(mNamespace,mName,mVersion) + "already contains a file "+ Separator.combine(f.mNamespace,f.mName,f.mVersion)+ ". Ignoring",LogManager.WARNING_MESSAGE_LEVEL);
}
return this;
}

Parameters to be described: register
Reference: whether to register the file or not
output_1: whether to register the file.
output_2: the register to use
output_3: the file to use
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
55. protected boolean entryNotInTC(String namespace,String name,String version,String executableBasename,String site){
List l=null;
try {
l=mTCHandle.lookupNoProfiles(namespace,name,version,site,TCType.INSTALLED);
}
catch ( Exception e) {
mLogger.log("Unable to retrieve entry from TC " + e.getMessage(),LogManager.ERROR_MESSAGE_LEVEL);
}
return (l == null || l.isEmpty()) ? ((this.defaultTCEntry(name,executableBasename,site)) == null) : false;
}

Parameters to be described: site
Reference: the site at which existence check is required.
output_1: the target site or location identifier.
output_2: the site to be used.
output_3: the name of the entry
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
56. public boolean requestLFN(String filename) throws java.sql.SQLException {
ArrayList al=new ArrayList(1);
al.add(filename);
return requestLFN(al);
}

Parameters to be described: filename
Reference: is the name of the requested LFN.
output_1: the name of the requested LFN.
output_2: the filename to check
output_3: filename to be used
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
57. public long saveAnnotationDeclare(String fqdi,String formalname,Tuple annotation,boolean overwrite) throws SQLException, IllegalArgumentException {
String[] names=Separator.split(fqdi);
Long did=getSpecificDefinitionId(names[0],names[1],names[2],Definition.TRANSFORMATION);
if (did == null) throw new SQLException("Unknown TR " + fqdi);
Transformation tr=(Transformation)loadDefinition(did.longValue());
boolean found=false;
for (Iterator i=tr.iterateDeclare(); i.hasNext(); ) {
String arg=((Declare)i.next()).getName();
if (arg.equals(formalname)) {
found=true;
break;
}
}
if (!found) throw new SQLException("Invalid argument " + formalname + " for TR "+ fqdi);
long id=getAnnotationIdDeclare(did.longValue(),formalname,annotation.getKey());
if (id == -1) {
id=m_dbdriver.sequence1("anno_id_seq");
Logging.instance().log("xaction",1,"START save anno_targ");
PreparedStatement ps=m_dbdriver.getPreparedStatement("stmt.save.anno_targ");
int i=1;
longOrNull(ps,i++,id);
if (m_dbdriver.preferString()) ps.setString(i++,did.toString());
else ps.setLong(i++,did.longValue());
ps.setString(i++,makeNotNull(formalname));
ps.setString(i++,makeNotNull(annotation.getKey()));
Logging.instance().log("chunk",2,"INSERT INTO anno_targ");
try {
int rc=ps.executeUpdate();
if (id == -1) id=m_dbdriver.sequence2(ps,"anno_id_seq",1);
}
catch ( SQLException e) {
Logging.instance().log("app",0,"While inserting into anno_targ: " + e.toString().trim());
m_dbdriver.cancelPreparedStatement("stmt.save.anno_targ");
throw e;
}
Logging.instance().log("xaction",1,"FINAL save anno_targ: ID=" + id);
}
else {
}
if (overwrite) deleteAnnotationValue(id,annotation);
return (saveAnnotationValue(id,annotation) ? id : -1);
}

Parameters to be described: fqdi
Reference: is the FQDI to annotate
output_1: fully qualified definition identifier.
output_2: the id of the argument
output_3: the formalname of the annotation
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
58. private void checkLinkage(Map use,Use u,Transformation tr){
if (use.containsKey(u.getName())) {
int linkage=((Integer)use.get(u.getName())).intValue();
int newlink=u.getLink();
int result=this.m_state[newlink + 1][linkage + 1];
if (result == -2) {
throw new IncompatibleLinkageException("Transformation " + tr.shortID() + "uses variable "+ u.getName()+ " with incompatibles linkages");
}
else if (result > -1) {
use.put(u.getName(),new Integer(result));
}
}
else {
use.put(u.getName(),new Integer(u.getLink()));
}
}

Parameters to be described: use
Reference: is a table of previously used variables and their linkage
output_1: a map tracking variable linkage states.
output_2: the use to add
output_3: the use to check
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
59. private <T2>void put(Map<Object,Collection<T2>> map,Object key,T2 value){
Collection<T2> col=map.get(key);
if (col == null) {
col=Lists.newArrayList();
map.put(key,col);
}
col.add(value);
}

Parameters to be described: map
Reference: the map from which get or create the collection
output_1: the map to add the value to.
output_2: the map to add
output_3: the map to add the value to
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
60. static <T>String iterableToString(Iterable<T> objects,int limit){
StringBuilder builder=new StringBuilder().append("[");
String sep="";
int head=(limit <= 0) ? Integer.MAX_VALUE : (limit + 1) / 2;
int tail=(limit <= 0) ? 0 : limit - head;
Iterator<T> iter=objects.iterator();
while (iter.hasNext() && --head >= 0) {
builder.append(sep).append(iter.next());
sep=", ";
}
LinkedList<T> tailMembers=new LinkedList<T>();
int seen=0;
while (iter.hasNext()) {
tailMembers.add(iter.next());
if (++seen > tail) {
tailMembers.removeFirst();
}
}
if (seen > tail) {
builder.append(", ...");
}
for ( T o : tailMembers) {
builder.append(sep).append(o);
sep=", ";
}
return builder.append("]").toString();
}

Parameters to be described: limit
Reference: the maximum number of objects from iterable to be usedto build a string
output_1: maximum number of elements to include in the output.
output_2: the maximum number of the maximum
output_3: the iterable to convert
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
61. @javax.annotation.Nullable public List<String> findSuffixChildren(String key,int limit){
if (key == null || limit == 0) {
return null;
}
RadixNode<T> currentNode=root;
String remainingText=key.trim();
List<String> result=new LinkedList<String>();
do {
boolean flag=false;
for ( RadixNode<T> child : currentNode.getChildren()) {
LOG.debug("Checking for child key: {} against remainingText: {}",child.getKey(),remainingText);
if (child.getKey().charAt(0) == remainingText.charAt(0)) {
LOG.debug("Child key: {} found to have overlap with the remainingText: {}",child.getKey(),remainingText);
flag=true;
if (!remainingText.startsWith(child.getKey())) {
return null;
}
if (StringUtils.equals(child.getKey(),remainingText)) {
int counter=0;
for ( RadixNode<T> suffixChild : child.getChildren()) {
if (limit < 0 || counter < limit) {
result.add(suffixChild.getKey());
}
}
return Collections.unmodifiableList(result);
}
remainingText=remainingText.substring(child.getKey().length());
currentNode=child;
break;
}
}
if (!flag) {
return null;
}
}
while (true);
}

Parameters to be described: key
Reference: - Input string for which all Suffix Children should be returned
output_1: the prefix string to find child keys for.
output_2: the key of the child
output_3: the key to search for
  • 1
  • 2
  • 3
  • 4
  • 5
output_1_Correctness
output_1_Completeness
output_1_Readability
output_2_Correctness
output_2_Completeness
output_2_Readability
output_3_Correctness
output_3_Completeness
output_3_Readability
更多问卷 复制此问卷