Page 241 - 《软件学报》2021年第7期
P. 241

牛长安  等:基于指针生成网络的代码注释自动生成模型                                                      2159


                                        Table 4    Examples of generated comment by models
                                                  表 4   模型生成的注释例子
                   序号                                          例子
                          protected void forwardReply(AbstractMRListener client, AbstractMRReply r){
                             ((Dcc4PcListener)client).reply((Dcc4PcReply)r);
                          }

                    1
                          Human-written: forward a dcc pcreply to all registered dcc pcinterface listeners.
                          Hybrid-DeepCom: forward a UNK to all registered easydccinterface listeners.
                          CodePtr-PGN: forward a UNK to all registered ecosinterface listeners.
                          CodePtr: forward a dcc4pcreply to all registered nceinterface listeners.
                          public void addBloatControl(BloatControlFunction bloat_control){
                             this.bloatControl.add(bloat_control);
                          }

                    2
                          Human-written: set new bloat control function
                          Hybrid-DeepCom: add a control control to the list of control control list.
                          CodePtr-PGN: add a control to this control.
                          CodePtr: adds a bloatcontrolfunction control control to the control list.
                          public RootPaneNoFrameState(){
                             super();
                          }

                    3
                          Human-written: creates a new rootpanenoframestate object.
                          Hybrid-DeepCom: creates a new UNK
                          CodePtr-PGN: creates a new UNK object.
                          CodePtr: creates a new rootpanenoframestate object.
                          public Boolean isWhiteLabelWallet(){
                             return whiteLabelWallet;
                          }

                    4
                          Human-written: gets the value of the whitelabelwallet property.
                          Hybrid-DeepCom: gets the value of the UNK property.
                          CodePtr-PGN: gets the value of the UNK property.
                          CodePtr: gets the value of the whitelabelwallet property.
                          public CombinatorialNameGenerator build(final boolean usesMiddles) throws IllegalStateException{
                             checkState(usesMiddles);
                             return new CombinatorialNameGenerator(this, usesMiddles);
                          }
                    5
                          Human-written: uses the builder to construct a new combinatorialnamegenerator.
                          Hybrid-DeepCom: creates a new UNK with the specified options for this instance of this builder.
                          CodePtr-PGN: builds the name using the provided builder using the provided builder.
                          CodePtr: builds the combinatorialnamegenerator with the specified builder builder.
                          private static boolean CallNonvirtualBooleanMethodV(JNIEnvironment env,
                                                             int objJREF,
                                                             int classJREF,
                                                             int methodID,
                                                             Address argAddress) throws Exception{
                             if (traceJNI)
                               VM.sysWrite(STR);
                             RuntimeEntrypoints.checkJNICountDownToGC();
                             try{
                               Object obj=env.getJNIRef(objJREF);
                               Object returnObj=JNIHelpers.invokeWithVarArg(obj, methodID, argAddress, TypeReference.Boolean, True);
                               return Reflection.unwrapBoolean(returnObj);
                    6        }
                             catch (Throwable unexpected){
                               if (traceJNI)
                                 unexpected.printStackTrace(System.err);
                               env.recordException(unexpected);
                               return False;
                             }
                          }

                          Human-written: callnonvirtualbooleanmethodv invoke a virtual method that returns a boolean value
                          Hybrid-DeepCom: UNK invoke a virtual method that returns a boolean value
                          CodePtr-PGN: UNK invoke a virtual method that returns a boolean value
                          CodePtr: callnonvirtualbooleanmethodv invoke a virtual method that returns a boolean value
   236   237   238   239   240   241   242   243   244   245   246