diff --git a/funcom_test/10001320.txt b/funcom_test/10001320.txt new file mode 100644 index 0000000000000000000000000000000000000000..394db997664ab5e4932c408a22938d74abc5e1e1 --- /dev/null +++ b/funcom_test/10001320.txt @@ -0,0 +1,11 @@ +TDAT: private void parse(Connection con, ByteBuffer buf) { + int sz = buf.getShort() & 0xFFFF; + sz -= 2; + ByteBuffer b = (ByteBuffer)buf.slice().limit(sz); + b.order(ByteOrder.LITTLE_ENDIAN); + buf.position(buf.position()+sz); // read message fully + con.decript(b); + con.addReceivedMsg(b); + } + COM: parse received packet push a message into inbound queue + diff --git a/funcom_test/10001325.txt b/funcom_test/10001325.txt new file mode 100644 index 0000000000000000000000000000000000000000..692a17d9c2837a49a7f735446cc795ad6457f954 --- /dev/null +++ b/funcom_test/10001325.txt @@ -0,0 +1,13 @@ +TDAT: private void closeClient(Connection c) { + if (c.readBuffer != null) { + releaseBuffer(c.readBuffer); + c.readBuffer = null; + } + if (c.writeBuffer != null) { + releaseBuffer(c.writeBuffer); + c.writeBuffer = null; + } + try { c.close(); } catch (Exception dummy) {} + } + COM: a helper method to close client if connection was + diff --git a/funcom_test/10214587.txt b/funcom_test/10214587.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3828992e53a5c8815579cad83cac96008de7432 --- /dev/null +++ b/funcom_test/10214587.txt @@ -0,0 +1,10 @@ +TDAT: protected Document toDocument(String value) throws Exception { + org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser(); + parser.setFeature("http://xml.org/sax/features/namespaces", true); + StringReader reader = new StringReader(value); + parser.parse(new InputSource(reader)); + reader.close(); + return parser.getDocument(); + } + COM: convert xml string value to dom + diff --git a/funcom_test/10215017.txt b/funcom_test/10215017.txt new file mode 100644 index 0000000000000000000000000000000000000000..1a922f0c2f58e7faa20f31ccdc0284e4c02394f0 --- /dev/null +++ b/funcom_test/10215017.txt @@ -0,0 +1,15 @@ +TDAT: private void updateUIFromDOMModel() { + + // 1. Get DOM Document from DOM Model. + Document document = model.getDocument(); + + // 3. Update SWT Table with DOM list of shapes (rectangle, ellipse) + if (shapesTableViewer.getInput() == null) + // Input is not initialized, set it + shapesTableViewer.setInput(document); + else + // refresh SWT Table + shapesTableViewer.refresh(); + } + COM: update the ui from dom model + diff --git a/funcom_test/10215277.txt b/funcom_test/10215277.txt new file mode 100644 index 0000000000000000000000000000000000000000..c330941afdf65934def3154dd3e0818efef02b36 --- /dev/null +++ b/funcom_test/10215277.txt @@ -0,0 +1,17 @@ +TDAT: protected void addControllerErrorListener() { + ITkuiController controller = tkuiDocument.getController(); + if (controller != null + && this.getContainer() instanceof ITkuiWizardContainer) { + final ITkuiWizardContainer tkuiContainer = (ITkuiWizardContainer) this + .getContainer(); + final ITkuiWizardPage page = this; + controller + .addControllerErrorListener(new ITkuiControllerErrorListener() { + public void errorThrowed(Exception e) { + tkuiContainer.addControllerError(page, e); + } + }); + } + } + COM: add controller error listner to display icon with error when controller + diff --git a/funcom_test/10216042.txt b/funcom_test/10216042.txt new file mode 100644 index 0000000000000000000000000000000000000000..81fe73f6a36e4c312a870839ab220f750867d6bd --- /dev/null +++ b/funcom_test/10216042.txt @@ -0,0 +1,28 @@ +TDAT: public void editElement(Object element, int column) { + if (cellEditor != null) { + applyEditorValue(); + } + + IStructuredSelection structuredSelection; + if (element instanceof TreePath) { + structuredSelection = new TreeSelection((TreePath) element, viewer + .getComparer()); + } else { + structuredSelection = new StructuredSelection(element); + } + setSelection(structuredSelection, true); + Item[] selection = getSelection(); + if (selection.length != 1) { + return; + } + + treeItem = selection[0]; + + // Make sure selection is visible + showSelection(); + columnNumber = column; + activateCellEditor(); + + } + COM: start editing the given element + diff --git a/funcom_test/10216064.txt b/funcom_test/10216064.txt new file mode 100644 index 0000000000000000000000000000000000000000..1951881463c10875686c4c7908a2a5ba81197a7b --- /dev/null +++ b/funcom_test/10216064.txt @@ -0,0 +1,12 @@ +TDAT: private void saveEditorValue(CellEditor cellEditor, Item treeItem) { + if (cellModifier != null) { + String property = null; + if (columnProperties != null + && columnNumber < columnProperties.length) { + property = columnProperties[columnNumber]; + } + cellModifier.modify(treeItem, property, cellEditor.getValue(), columnNumber); + } + } + COM: saves the value of the currently active cell editor by delegating to the + diff --git a/funcom_test/10216942.txt b/funcom_test/10216942.txt new file mode 100644 index 0000000000000000000000000000000000000000..098303979854ce343b0c4f0b13a4f2d8a0ed31f5 --- /dev/null +++ b/funcom_test/10216942.txt @@ -0,0 +1,14 @@ +TDAT: public IMenuitem insertItemAt(int index, String label) { + IMenuitem menuitem = (IMenuitem) this.getOwnerDocument() + .createElementNS(XulConstants.XUL_NAMESPACE_URI, + XulConstants.MENUITEM_ELEMENT); + menuitem.setAttribute("label", label); + NodeList nodes = menupopup.getElementsByTagNameNS( + XulConstants.XUL_NAMESPACE_URI, XulConstants.MENUITEM_ELEMENT); + IMenuitem item = (IMenuitem) nodes.item(index); + menupopup.insertBefore(menuitem, item); + ((MenupopupImpl) menupopup).addComboItem(index, menuitem); + return menuitem; + } + COM: creates a new menuitem element and inserts it at a specific position in + diff --git a/funcom_test/10217229.txt b/funcom_test/10217229.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fc869ae72941bad8d15f3024b0caa4e24e5763b --- /dev/null +++ b/funcom_test/10217229.txt @@ -0,0 +1,14 @@ +TDAT: public void setSharedVariables(Map variables) throws TemplateModelException { + if (variables != null) { + for (Iterator iter = variables.entrySet().iterator(); iter + .hasNext();) { + Map.Entry entry = (Map.Entry) iter.next(); + String key = (String) entry.getKey(); + Object value = entry.getValue(); + super.setSharedVariable(key, value); + } + + } + } + COM: set shared variables + diff --git a/funcom_test/10217245.txt b/funcom_test/10217245.txt new file mode 100644 index 0000000000000000000000000000000000000000..d6a86ee554fa6251f7873c069274ea9167151183 --- /dev/null +++ b/funcom_test/10217245.txt @@ -0,0 +1,15 @@ +TDAT: public ITemplateEngine getTemplateEngine(String type) throws Exception { + // Get template engine defined into the Spring config + ITemplateEngine templateEngine = (ITemplateEngine) applicationContext + .getBean(type); + // Test if template engine have configuration ID + String configurationId = templateEngine.getConfigurationId(); + if (!StringUtils.isEmpty(configurationId)) { + // Template engine works with Configuration, get it + ITemplateConfiguration configuration = getTemplateConfiguration(configurationId); + templateEngine.setConfiguration(configuration); + } + return templateEngine; + } + COM: return template engine of type code type code + diff --git a/funcom_test/10217907.txt b/funcom_test/10217907.txt new file mode 100644 index 0000000000000000000000000000000000000000..499b97e0fe549dfc8479ac705393991f8c9183b7 --- /dev/null +++ b/funcom_test/10217907.txt @@ -0,0 +1,18 @@ +TDAT: private Composite createComposite(Composite parent, int numColumns) { + Composite composite = new Composite(parent, SWT.NULL); + + // GridLayout + GridLayout layout = new GridLayout(); + layout.numColumns = numColumns; + layout.makeColumnsEqualWidth = false; + layout.marginHeight = 0; + layout.marginWidth = 0; + composite.setLayout(layout); + + // GridData + GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); + composite.setLayoutData(data); + return composite; + } + COM: creates composite control and sets the default layout data + diff --git a/funcom_test/10218506.txt b/funcom_test/10218506.txt new file mode 100644 index 0000000000000000000000000000000000000000..8dd010216ac3b7b755370be1165a836e2e47032a --- /dev/null +++ b/funcom_test/10218506.txt @@ -0,0 +1,19 @@ +TDAT: private EditPart getPartForElement(Object modelElement) { + if (modelElement instanceof Docflow) { + return new DocflowPart(); + } + if (modelElement instanceof State) { + return new StatePart(); + } + if (modelElement instanceof Transition) { + return new TransitionPart(); + } + if (modelElement instanceof Connection) { + return new ConnectionPart(); + } + throw new RuntimeException("Can't create part for model element: " + + ((modelElement != null) ? modelElement.getClass().getName() + : "null")); + } + COM: maps an object to an edit part + diff --git a/funcom_test/10218943.txt b/funcom_test/10218943.txt new file mode 100644 index 0000000000000000000000000000000000000000..746a1aa3d8f7afe027533b429646826db59e7360 --- /dev/null +++ b/funcom_test/10218943.txt @@ -0,0 +1,11 @@ +TDAT: public void saveColumnSettings() { + int columnCount = getTable().getColumnCount(); + for (int i = 0; i < columnCount; i++) { + getDialogSettings() + .put( + getQualifier() + ".columnWidth" + i, getTable().getColumn(i).getWidth()); //$NON-NLS-1$ + } + getDialogSettings().put(getQualifier() + ".sortColumn", fSortColumn); //$NON-NLS-1$ + } + COM: persist table settings into the give dialog store prefixed with the + diff --git a/funcom_test/10219363.txt b/funcom_test/10219363.txt new file mode 100644 index 0000000000000000000000000000000000000000..a54fba87c59cbc7db911e6930e9b2c920142d450 --- /dev/null +++ b/funcom_test/10219363.txt @@ -0,0 +1,14 @@ +TDAT: private SearchPatternData getPatternData() { + SearchPatternData match = findInPrevious(xpathCombo.getText()); + if (match != null) { + fPreviousSearchPatterns.remove(match); + } + match = new SearchPatternData(getXPath(), getXPathProcessorId(), + fFileTypeEditor.getFileTypes(), getContainer() + .getSelectedScope(), getContainer() + .getSelectedWorkingSets()); + fPreviousSearchPatterns.add(0, match); + return match; + } + COM: return search pattern data and update previous searches + diff --git a/funcom_test/10219398.txt b/funcom_test/10219398.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5984895ab698bdf03529fb83b0a8f5a1eb55faf --- /dev/null +++ b/funcom_test/10219398.txt @@ -0,0 +1,14 @@ +TDAT: public void reset() throws XFormsException { + if (logger.isDebugEnabled()) { + logger.debug(this + " perform reset"); + } + // recreate instance document + this.instanceDocument = createInstanceDocument(); + // notify to another elements (UI or DOM) whcih are bounded + // with this instance that the instanceDocument to observe + // has changed. + rootNodeObservable.setRootNode(this.instanceDocument); + + } + COM: performs element reset + diff --git a/funcom_test/10221933.txt b/funcom_test/10221933.txt new file mode 100644 index 0000000000000000000000000000000000000000..df3fbe2fc6f77af675e28ce406904aab2b87a394 --- /dev/null +++ b/funcom_test/10221933.txt @@ -0,0 +1,10 @@ +TDAT: public void setDecorationBounds(int x, int y, int w, int h) { + if (this.bounds == null) { + this.bounds = new Rectangle(x, y, w, h); + } else { + this.bounds.setBounds(x, y, w, h); + } + synch(); + } + COM: change the current decorated bounds + diff --git a/funcom_test/10221965.txt b/funcom_test/10221965.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf212874bd9655ab34cc9e50336cda89975d77b7 --- /dev/null +++ b/funcom_test/10221965.txt @@ -0,0 +1,23 @@ +TDAT: protected void fillTextareaWithStyleSheetContent(InputStream stream) { + try { + StringWriter writer = new StringWriter(); + InputStreamReader streamReader = new InputStreamReader(stream); + BufferedReader buffer = new BufferedReader(streamReader); + String line = ""; + boolean b = false; + while (null != (line = buffer.readLine())) { + if (b) + writer.write("\n"); + writer.write(line); + b = true; + } + buffer.close(); + streamReader.close(); + String content = writer.toString(); + setStyleSheetContent(content); + } catch (Exception e) { + handleExceptions(e); + } + } + COM: fill the text area which store the style sheet content with the + diff --git a/funcom_test/10222579.txt b/funcom_test/10222579.txt new file mode 100644 index 0000000000000000000000000000000000000000..b4f76384b56bbe9e9fb60e0dba09883f871b3308 --- /dev/null +++ b/funcom_test/10222579.txt @@ -0,0 +1,10 @@ +TDAT: public boolean equals(Object obj) { + if (obj == null || (obj.getClass() != getClass())) { + return false; + } + CSSConditionalSelectorImpl s = (CSSConditionalSelectorImpl)obj; + return (s.simpleSelector.equals(simpleSelector) && + s.condition.equals(condition)); + } + COM: indicates whether some other object is equal to this one + diff --git a/funcom_test/10222898.txt b/funcom_test/10222898.txt new file mode 100644 index 0000000000000000000000000000000000000000..5786366ee586fc468f0a8ec1aaea24b4ca145f75 --- /dev/null +++ b/funcom_test/10222898.txt @@ -0,0 +1,15 @@ +TDAT: public CSSStyleDeclaration getComputedStyle(Element elt, String pseudoElt) { + // Loop for CSS StyleSheet list parsed + StyleSheetList styleSheetList = documentCSS.getStyleSheets(); + int l = styleSheetList.getLength(); + for (int i = 0; i < l; i++) { + CSSStyleSheet styleSheet = (CSSStyleSheet) styleSheetList.item(i); + CSSStyleDeclaration styleDeclaration = getComputedStyle(styleSheet, + elt, pseudoElt); + if (styleDeclaration != null) + return styleDeclaration; + } + return null; + } + COM: b dom b implements + diff --git a/funcom_test/10223338.txt b/funcom_test/10223338.txt new file mode 100644 index 0000000000000000000000000000000000000000..069f78e992d85e883a8a567597609d13f50d7e33 --- /dev/null +++ b/funcom_test/10223338.txt @@ -0,0 +1,13 @@ +TDAT: protected String getHandlerClassName(String property) { + String handlerClassName = "CSSProperty"; + String[] s = StringUtils.split(property, "-"); + for (int i = 0; i < s.length; i++) { + String p = s[i]; + p = p.substring(0, 1).toUpperCase() + p.substring(1, p.length()); + handlerClassName += p; + } + handlerClassName += "Handler"; + return handlerClassName; + } + COM: return the handler class name corresponding to the property label given + diff --git a/funcom_test/10227347.txt b/funcom_test/10227347.txt new file mode 100644 index 0000000000000000000000000000000000000000..8856b6cb7747ef8ab1c31367dcabd61779e0ecd3 --- /dev/null +++ b/funcom_test/10227347.txt @@ -0,0 +1,14 @@ +TDAT: public Command getCommand(Request request) { + if (request instanceof ReconnectRequest) { + Object view = ((ReconnectRequest) request).getConnectionEditPart() + .getModel(); + if (view instanceof View) { + Integer id = new Integer(ModelVisualIDRegistry + .getVisualID((View) view)); + request.getExtendedData().put(VISUAL_ID_KEY, id); + } + } + return super.getCommand(request); + } + COM: extended request data key to hold editpart visual id + diff --git a/funcom_test/10228059.txt b/funcom_test/10228059.txt new file mode 100644 index 0000000000000000000000000000000000000000..4997936f4e4246fc8c83d70d9b0c9c997a0dde52 --- /dev/null +++ b/funcom_test/10228059.txt @@ -0,0 +1,17 @@ +TDAT: protected void addReturnValuePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Operation_returnValue_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Operation_returnValue_feature", "_UI_Operation_type"), + ModelPackage.Literals.OPERATION__RETURN_VALUE, + false, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + COM: this adds a property descriptor for the return value feature + diff --git a/funcom_test/10228096.txt b/funcom_test/10228096.txt new file mode 100644 index 0000000000000000000000000000000000000000..3364cdee37b7a26d5b5388b7d646aab796a72bbf --- /dev/null +++ b/funcom_test/10228096.txt @@ -0,0 +1,17 @@ +TDAT: protected void addIsInPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Parameter_isIn_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Parameter_isIn_feature", "_UI_Parameter_type"), + ModelPackage.Literals.PARAMETER__IS_IN, + false, + false, + false, + ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, + null, + null)); + } + COM: this adds a property descriptor for the is in feature + diff --git a/funcom_test/10228099.txt b/funcom_test/10228099.txt new file mode 100644 index 0000000000000000000000000000000000000000..278619aecf2619475339938fae2656ff395f030d --- /dev/null +++ b/funcom_test/10228099.txt @@ -0,0 +1,17 @@ +TDAT: protected void addIsOutPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Parameter_isOut_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Parameter_isOut_feature", "_UI_Parameter_type"), + ModelPackage.Literals.PARAMETER__IS_OUT, + false, + false, + false, + ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, + null, + null)); + } + COM: this adds a property descriptor for the is out feature + diff --git a/funcom_test/10228107.txt b/funcom_test/10228107.txt new file mode 100644 index 0000000000000000000000000000000000000000..563c518b42b61f01463948b434ae5c2334c99514 --- /dev/null +++ b/funcom_test/10228107.txt @@ -0,0 +1,17 @@ +TDAT: protected void addReferencedInstancesPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_Instance_referencedInstances_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_Instance_referencedInstances_feature", "_UI_Instance_type"), + ModelPackage.Literals.INSTANCE__REFERENCED_INSTANCES, + true, + false, + true, + null, + null, + null)); + } + COM: this adds a property descriptor for the referenced instances feature + diff --git a/funcom_test/10228580.txt b/funcom_test/10228580.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b721c1c2d8dbf00cbc41cb28affc81ffa74be4f --- /dev/null +++ b/funcom_test/10228580.txt @@ -0,0 +1,12 @@ +TDAT: public boolean equal(InputStream xml1, InputStream xml2) throws SAXException, IOException { + DOMParser parser1 = new DOMParser(); + DOMParser parser2 = new DOMParser(); + parser1.parse(new InputSource(xml1)); + parser2.parse(new InputSource(xml2)); + Document doc1 = parser1.getDocument(); + Document doc2 = parser2.getDocument(); + + return compareNodes(doc1.getDocumentElement(), doc2.getDocumentElement()); + } + COM: performs the comparison of 2 xml files + diff --git a/funcom_test/10237254.txt b/funcom_test/10237254.txt new file mode 100644 index 0000000000000000000000000000000000000000..eaa051fed93cd2a20518048288b91412ade80406 --- /dev/null +++ b/funcom_test/10237254.txt @@ -0,0 +1,11 @@ +TDAT: public void eventPerfomed(FelperEvent event) { + if (event instanceof FelperMessageReceiveEvent) { + FelperMessageReceiveEvent newFelperMessageReceiveEvent = (FelperMessageReceiveEvent) event; + + if(logger.isDebugEnabled()) + logger.debug("Receive Event: " + newFelperMessageReceiveEvent + " with Message " + + newFelperMessageReceiveEvent.getMessage()); + } + } + COM: receive event and process it + diff --git a/funcom_test/10237266.txt b/funcom_test/10237266.txt new file mode 100644 index 0000000000000000000000000000000000000000..a716aced01842e53c72e7fa92884d82a9fbd4667 --- /dev/null +++ b/funcom_test/10237266.txt @@ -0,0 +1,11 @@ +TDAT: public void removeUser(User removableUser) throws FelperUserAddRemoveOperationException{ + if (this.users.remove(removableUser)) { + if(logger.isDebugEnabled()) + logger.debug("User is Removed: " + removableUser); + } else { + logger.warn("Can`t remove user: " + removableUser); + throw new FelperUserAddRemoveOperationException("Can`t remove user: " + removableUser); + } + } + COM: remove user and resize users array + diff --git a/funcom_test/10237358.txt b/funcom_test/10237358.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e810d059445d15429653e09c7f2d16443cd418b --- /dev/null +++ b/funcom_test/10237358.txt @@ -0,0 +1,11 @@ +TDAT: public void sendMessageToPeer(UserConnection userConnection, Message message) throws FelperNotSentMessageException { + + SendMessageThread sendMessageThread = new SendMessageThread(userConnection, message); + sendMessageThread.start(); + + if (sendMessageThread.isInterrupted()) + throw new FelperNotSentMessageException(); + + } + COM: send message to peer + diff --git a/funcom_test/10262852.txt b/funcom_test/10262852.txt new file mode 100644 index 0000000000000000000000000000000000000000..de3391d9515659ee0cf30f887cef82da37c5b129 --- /dev/null +++ b/funcom_test/10262852.txt @@ -0,0 +1,17 @@ +TDAT: private boolean vectorsToNearestCentroid() { + boolean converged = true; + for (int i = 0; i < vectors.size(); ++i) { + // Find centroid closest to current vector. + int nearest = vectors.get(i).nearest(centroids); + + // If there was a change then there is no convergence. + if (nearest != nearestCentroid[i]) { + converged = false; + } + nearestCentroid[i] = nearest; + } + updateNearestNeighbours(); + return converged; + } + COM: assign vectors to nearest centroid + diff --git a/funcom_test/10262853.txt b/funcom_test/10262853.txt new file mode 100644 index 0000000000000000000000000000000000000000..e01a98aa4bdb4bc2371db85350982ef1bf94163c --- /dev/null +++ b/funcom_test/10262853.txt @@ -0,0 +1,11 @@ +TDAT: private void updateNearestNeighbours() { + for (List nn : nearestNeighbours) { + nn.clear(); + } + for (int i = 0; i < nearestCentroid.length; ++i) { + int nearest = nearestCentroid[i]; + nearestNeighbours.get(nearest).add(vectors.get(i)); + } + } + COM: pre nearest centroid has been updated with nearest indexes + diff --git a/funcom_test/10262887.txt b/funcom_test/10262887.txt new file mode 100644 index 0000000000000000000000000000000000000000..277fb42c0c1d3acb4d68adc193768739239fdb6d --- /dev/null +++ b/funcom_test/10262887.txt @@ -0,0 +1,15 @@ +TDAT: public double sumSquaredError(V parentEntry) { + double distance = 0.0; + if (isLeaf()) { + for (V key : keys) { + distance += key.distanceSquared(parentEntry); + } + } else { + for (int i = 0; i < count(); ++i) { + distance += children.get(i).sumSquaredError(keys.get(i)); + } + } + return distance; + } + COM: calculate sum of squared error between vecotrs in leaves and their + diff --git a/funcom_test/10262922.txt b/funcom_test/10262922.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ac88d40a2461ce5d4afc007e26f102830a82f78 --- /dev/null +++ b/funcom_test/10262922.txt @@ -0,0 +1,10 @@ +TDAT: private void updateMean(V parentEntry) { + assert (!isLeaf()); + int[] weights = new int[count()]; + for (int iChild = 0; iChild < count(); ++iChild) { + weights[iChild] = children.get(iChild).totalCount; + } + parentEntry.updateMean(keys, weights); + } + COM: update the means entries based on child entries 1 level down the tree + diff --git a/funcom_test/10263089.txt b/funcom_test/10263089.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e50e14aa57137fc04fc72d16e26132678143dab --- /dev/null +++ b/funcom_test/10263089.txt @@ -0,0 +1,18 @@ +TDAT: private boolean vectorsToNearestCentroid() { + boolean converged = true; + + for (int i = 0; i < data.size(); ++i) { + // Find centroid closest to current vector. + int nearest = data.get(i).nearest(centroids); + + // If there was a change then there is no convergence. + if (nearest != nearestCentroid[i]) { + converged = false; + } + nearestCentroid[i] = nearest; + } + + return converged; + } + COM: pre set data + diff --git a/funcom_test/10263190.txt b/funcom_test/10263190.txt new file mode 100644 index 0000000000000000000000000000000000000000..8622e357659f0c6b7a91c7ad5e8d60dbeaa3cd57 --- /dev/null +++ b/funcom_test/10263190.txt @@ -0,0 +1,13 @@ +TDAT: private void remove(int index) { + assert(!isLeaf()); + totalCount -= children[index].totalCount; + for (int i = index + 1; i < count; ++i) { + entries[i - 1] = entries[i]; + children[i - 1] = children[i]; + } + entries[count - 1] = null; + children[count - 1] = null; + --count; + } + COM: remove a entry child pair + diff --git a/funcom_test/10263895.txt b/funcom_test/10263895.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ac3ffb05c65153d1aa399ef05ae7ee97201cd7e --- /dev/null +++ b/funcom_test/10263895.txt @@ -0,0 +1,12 @@ +TDAT: private float distortion(Vector[] currCentroids) { + // currently inefficient + // cost could be calculated when determining nearest centroids + float cost = 0.0f; + int[] nearestCentroids = vectorsToNearestCentroid(currCentroids); + for (int i = 0; i < vectorCount; ++i) { + cost += vectors[i].distance(currCentroids[nearestCentroids[i]]); + } + return cost; + } + COM: sum of distances to nearest centroid + diff --git a/funcom_test/10347019.txt b/funcom_test/10347019.txt new file mode 100644 index 0000000000000000000000000000000000000000..67c6a5bdcc0973d6916ed7f23fe1150ff025bc67 --- /dev/null +++ b/funcom_test/10347019.txt @@ -0,0 +1,18 @@ +TDAT: protected void insertContent(Element element, Component component, Method method) { + + ResourceManager resourceManager = this.usiXMLInterfaceRenderer.resourceRetriever; + String resourceContent = resourceManager.getStringResourceContent(element); + + try { + method.invoke(component, resourceContent); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + + } + COM: inserts static content in a specific ui element + diff --git a/funcom_test/1046747.txt b/funcom_test/1046747.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea7ba315c9e0cb843f6eabd51c848deb9176e988 --- /dev/null +++ b/funcom_test/1046747.txt @@ -0,0 +1,15 @@ +TDAT: protected TilesContainer createTilesContainer() throws TilesException { + ServletContextAdapter adaptedContext = new ServletContextAdapter( + new DelegatingServletConfig()); + TilesApplicationContext preliminaryContext = new ServletTilesApplicationContext( + adaptedContext); + AbstractTilesApplicationContextFactory contextFactory = AbstractTilesApplicationContextFactory + .createFactory(preliminaryContext); + this.tilesContext = contextFactory + .createApplicationContext(adaptedContext); + AbstractTilesContainerFactory factory = AbstractTilesContainerFactory + .getTilesContainerFactory(this.tilesContext); + return factory.createContainer(this.tilesContext); + } + COM: create a tiles container for this web application + diff --git a/funcom_test/1046774.txt b/funcom_test/1046774.txt new file mode 100644 index 0000000000000000000000000000000000000000..1974d9a0f72cea26847eb96a9b61ecfffbb0e9d7 --- /dev/null +++ b/funcom_test/1046774.txt @@ -0,0 +1,18 @@ +TDAT: public void testDeleteBlobDataType() { + // 1. insert init data + insertBlobDataType(); + + // 2. select a blobDataType data + BlobDataType blobDataType = (BlobDataType) session.get( + BlobDataType.class, new Integer(4491)); + + // 3. remove data + session.delete(blobDataType); + + // 4. check if deletion is successful + blobDataType = (BlobDataType) session.get(BlobDataType.class, + new Integer(4491)); + assertNull(blobDataType); + } + COM: flow 3 positive case blob type entity + diff --git a/funcom_test/1046788.txt b/funcom_test/1046788.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5dd61fdc9b59d87ddcb9f602f6f7cd06402fb0c --- /dev/null +++ b/funcom_test/1046788.txt @@ -0,0 +1,13 @@ +TDAT: public void testAddCountryWithSequenceGenerator() throws Exception { + CountryWithSequence country1 = new CountryWithSequence(); + country1.setCountryId("KR"); + country1.setCountryName("Korea"); + + Integer countryCode = (Integer) session.save(country1); + assertEquals("fail to generate a new countryCode.", 0, countryCode + .intValue()); + assertNotNull("fail to add a new country with sequence generator.", + countryCode); + } + COM: flow 2 positive case hibernate sequence generator + diff --git a/funcom_test/1046802.txt b/funcom_test/1046802.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e8fb0ba703041a142da63ea68342b4de1571bb6 --- /dev/null +++ b/funcom_test/1046802.txt @@ -0,0 +1,13 @@ +TDAT: public void testAddCountryWithUUIDGenerator() throws Exception { + CountryWithUUID country1 = new CountryWithUUID(); + country1.setCountryId("KR"); + country1.setCountryName("대한민국"); + + String countryCode = (String) session.save(country1); + assertTrue("fail to generate a new countryCode.", countryCode + .indexOf("#") != -1); + assertNotNull("fail to add a new country with UUID generator.", + countryCode); + } + COM: flow 6 positive case hibernate uuid generator country + diff --git a/funcom_test/1046818.txt b/funcom_test/1046818.txt new file mode 100644 index 0000000000000000000000000000000000000000..5a63936ce2ac25836bae20bddc36923a6c9cf937 --- /dev/null +++ b/funcom_test/1046818.txt @@ -0,0 +1,18 @@ +TDAT: public void testDeleteClobDataType() { + // 1. insert init data + insertClobDataType(); + + // 2. select a clobDataType data + ClobDataType clobDataType = (ClobDataType) session.get( + ClobDataType.class, new Integer(4491)); + + // 3. remove data + session.delete(clobDataType); + + // 4. check if deletion is successful + clobDataType = (ClobDataType) session.get(ClobDataType.class, + new Integer(4491)); + assertNull(clobDataType); + } + COM: flow 3 positive case clob type entity + diff --git a/funcom_test/10576200.txt b/funcom_test/10576200.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfbf4b48943021c529c72c5156ec628d252f3ea5 --- /dev/null +++ b/funcom_test/10576200.txt @@ -0,0 +1,13 @@ +TDAT: protected void cleanup(ChannelHandlerContext ctx) { + // Make sure we dispose everything on exit on session close + SMTPSession smtpSession = (SMTPSession) ctx.getAttachment(); + + if (smtpSession != null) { + LifecycleUtil.dispose(smtpSession.getState().get(SMTPConstants.MAIL)); + LifecycleUtil.dispose(smtpSession.getState().get(SMTPConstants.DATA_MIMEMESSAGE_STREAMSOURCE)); + } + + super.cleanup(ctx); + } + COM: cleanup temporary files + diff --git a/funcom_test/10576314.txt b/funcom_test/10576314.txt new file mode 100644 index 0000000000000000000000000000000000000000..d036e2ac89046ba11e6aa983909c1807e2503023 --- /dev/null +++ b/funcom_test/10576314.txt @@ -0,0 +1,14 @@ +TDAT: static protected String hostFromUriStr(String uriStr) { + debugOut("hostFromUriStr(\"" + uriStr + "\")"); + String host = null; + URI uri; + try { + uri = new URI(uriStr); + host = uri.getHost(); + } catch (URISyntaxException e) { + debugOut(e.getMessage()); + } + return host; + } + COM: extracts and returns the host portion of uri string + diff --git a/funcom_test/10576712.txt b/funcom_test/10576712.txt new file mode 100644 index 0000000000000000000000000000000000000000..1da2fb7c057e4eeda91b60a7f55eaa9d7b7f8a2f --- /dev/null +++ b/funcom_test/10576712.txt @@ -0,0 +1,11 @@ +TDAT: public void testInetAddress() throws UnknownHostException { + + // Test name alone (can be IPv4 or IPv6 depending on the OS plaform + // configuration). + address = InetAddress.getByName("localhost"); + assertEquals(true, address instanceof InetAddress); + assertEquals(true, address.toString().contains("localhost")); + + } + COM: preliminary test method to validate the inet address behaviour v4 and v6 + diff --git a/funcom_test/10576766.txt b/funcom_test/10576766.txt new file mode 100644 index 0000000000000000000000000000000000000000..9c833f31a66af8e538884e43a00b650dd630e2c6 --- /dev/null +++ b/funcom_test/10576766.txt @@ -0,0 +1,20 @@ +TDAT: public void testHasCorrectArguments() { + CmdType cmd; + boolean result; + + cmd = CmdType.ADDDOMAIN; + + // Test bogus number + result = cmd.hasCorrectArguments(-1); + assertEquals(false, result); + + // Test actual number + result = cmd.hasCorrectArguments(cmd.getArguments()); + assertEquals(true, result); + + // Test known bad number + result = cmd.hasCorrectArguments(cmd.getArguments() - 1); + assertEquals(false, result); + } + COM: test the has correct arguments method + diff --git a/funcom_test/10576888.txt b/funcom_test/10576888.txt new file mode 100644 index 0000000000000000000000000000000000000000..496068e2da65a8fdeef0d3e2e140cd43d0951bd6 --- /dev/null +++ b/funcom_test/10576888.txt @@ -0,0 +1,10 @@ +TDAT: private Date getLastUpdated(Node node) throws RepositoryException { + try { + node = node.getNode("jcr:content"); + } catch (PathNotFoundException e) { + node = node.getProperty("jcr:content").getNode(); + } + return node.getProperty("jcr:lastModified").getDate().getTime(); + } + COM: reads the update timestamp from the + diff --git a/funcom_test/10576918.txt b/funcom_test/10576918.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a8581972dcbb374927ebb7e46cb03fb7be0e107 --- /dev/null +++ b/funcom_test/10576918.txt @@ -0,0 +1,16 @@ +TDAT: public String getRealName(String name, boolean ignoreCase) throws UsersRepositoryException { + if (ignoreCase) { + Iterator it = list(); + while (it.hasNext()) { + String temp = it.next(); + if (name.equalsIgnoreCase(temp)) { + return temp; + } + } + return null; + } else { + return objectRepository.containsKey(name) ? name : null; + } + } + COM: return the real name given the ignore case boolean parameter + diff --git a/funcom_test/10577072.txt b/funcom_test/10577072.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c6cb8797eb5066f1100ad8f9c52d02905d96562 --- /dev/null +++ b/funcom_test/10577072.txt @@ -0,0 +1,15 @@ +TDAT: protected void rejectRemoteRecipient(MailAddress recipient) throws MessagingException { + // Update the flags of the received message + if (!isLeaveRemoteRecipient()) + setMessageDeleted(); + + if (isMarkRemoteRecipientSeen()) + setMessageSeen(); + + StringBuilder messageBuffer = new StringBuilder("Rejected mail intended for remote recipient: "); + messageBuffer.append(recipient); + messageBuffer.append('.'); + logStatusInfo(messageBuffer.toString()); + } + COM: method reject remote recipient + diff --git a/funcom_test/10577109.txt b/funcom_test/10577109.txt new file mode 100644 index 0000000000000000000000000000000000000000..523772df049c40f0b4848bc240180da527d7ee02 --- /dev/null +++ b/funcom_test/10577109.txt @@ -0,0 +1,15 @@ +TDAT: protected void rejectUserUndefined(MailAddress recipient) throws MessagingException { + // Update the flags of the received message + if (!isLeaveUserUndefined()) + setMessageDeleted(); + + if (isMarkUserUndefinedSeen()) + setMessageSeen(); + + StringBuilder messageBuffer = new StringBuilder("Rejected mail intended for undefined user: "); + messageBuffer.append(recipient); + messageBuffer.append('.'); + logStatusInfo(messageBuffer.toString()); + } + COM: method reject user undefined + diff --git a/funcom_test/10577222.txt b/funcom_test/10577222.txt new file mode 100644 index 0000000000000000000000000000000000000000..722a11e956134eda89587f7d16e4a5fdffabf3ce --- /dev/null +++ b/funcom_test/10577222.txt @@ -0,0 +1,9 @@ +TDAT: protected void handleBouncing(Mail mail) throws MessagingException { + mail.setState(Mail.ERROR); + setMessageDeleted(); + + mail.setErrorMessage("This mail from FetchMail task " + getFetchTaskName() + " seems to be bouncing!"); + logStatusError("Message is bouncing! Deleted from message store and moved to the Error repository."); + } + COM: method handle bouncing sets the mail state to error and delete from the + diff --git a/funcom_test/10577360.txt b/funcom_test/10577360.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b0e54114fde6030a6938dbaded7d79e30593981 --- /dev/null +++ b/funcom_test/10577360.txt @@ -0,0 +1,18 @@ +TDAT: public boolean lock(final Object key) { + Object theLock; + + synchronized (this) { + theLock = locks.get(key); + + if (null == theLock) { + locks.put(key, getCallerId()); + return true; + } else if (getCallerId() == theLock) { + return true; + } else { + return false; + } + } + } + COM: lock on a given object + diff --git a/funcom_test/10577422.txt b/funcom_test/10577422.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4999ed9d795b8f5d6b3f64dcf78a3fa44297ae9 --- /dev/null +++ b/funcom_test/10577422.txt @@ -0,0 +1,15 @@ +TDAT: protected void setDestination(final String destination) throws ConfigurationException { + + if (!destination.startsWith(FileSystem.FILE_PROTOCOL)) { + throw new ConfigurationException("cannot handle destination " + destination); + } + + try { + m_baseDirectory = fileSystem.getFile(destination); + } catch (FileNotFoundException e) { + throw new ConfigurationException("Unable to acces destination " + destination, e); + } + + } + COM: set the destination for the repository + diff --git a/funcom_test/10577428.txt b/funcom_test/10577428.txt new file mode 100644 index 0000000000000000000000000000000000000000..940c898ce9272c19bb77b638dea4802892223de8 --- /dev/null +++ b/funcom_test/10577428.txt @@ -0,0 +1,10 @@ +TDAT: protected InputStream getInputStream(final String key) throws IOException { + // This was changed to SharedFileInputStream but reverted to + // fix JAMES-559. Usign SharedFileInputStream should be a good + // performance improvement, but more checks have to be done + // on the repository side to avoid concurrency in reading and + // writing the same file. + return new FileInputStream(encode(key)); + } + COM: return the input stream which belongs to the given key + diff --git a/funcom_test/10577511.txt b/funcom_test/10577511.txt new file mode 100644 index 0000000000000000000000000000000000000000..a36b1aad5be51a8f6975935b34f7d0e673a89006 --- /dev/null +++ b/funcom_test/10577511.txt @@ -0,0 +1,10 @@ +TDAT: protected void setMessageSeen() throws MessagingException { + // If the Seen flag is not handled by the folder + // allow a handler to do whatever it deems necessary + if (!getMessageIn().getFolder().getPermanentFlags().contains(Flags.Flag.SEEN)) + handleMarkSeenNotPermanent(); + else + getMessageIn().setFlag(Flags.Flag.SEEN, true); + } + COM: set the seen flag + diff --git a/funcom_test/10577532.txt b/funcom_test/10577532.txt new file mode 100644 index 0000000000000000000000000000000000000000..60b477ef65b202e77b19fc78f0ba2f0f35f849aa --- /dev/null +++ b/funcom_test/10577532.txt @@ -0,0 +1,8 @@ +TDAT: public void testAddRemoveContainsDifferentDomain() throws DomainListException { + domainList.addDomain(DOMAIN_1); + domainList.removeDomain(DOMAIN_2); + assertEquals(1, domainList.getDomains().length); + assertEquals(true, domainList.containsDomain(DOMAIN_1)); + } + COM: add a domain and remove another domain and check first domain is still + diff --git a/funcom_test/10577617.txt b/funcom_test/10577617.txt new file mode 100644 index 0000000000000000000000000000000000000000..85b15d36bbb546606bc2d6635e17fa085267f6cb --- /dev/null +++ b/funcom_test/10577617.txt @@ -0,0 +1,14 @@ +TDAT: public InputStream read(int size, boolean extraCRLF) throws DecodingException { + + // Unset the next char. + nextSeen = false; + nextChar = 0; + FixedLengthInputStream fin = new FixedLengthInputStream(this.in, size); + if (extraCRLF) { + return new EolInputStream(this, fin); + } else { + return fin; + } + } + COM: reads and consumes a number of characters from the underlying reader + diff --git a/funcom_test/10577622.txt b/funcom_test/10577622.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c3f4641e167e16bfcc2a8fd97b367f6fc747304 --- /dev/null +++ b/funcom_test/10577622.txt @@ -0,0 +1,17 @@ +TDAT: public char nextChar() throws DecodingException { + if (!nextSeen) { + int next = -1; + + if (buffer.readable()) { + next = buffer.readByte(); + read++; + } else { + throw new NotEnoughDataException(); + } + nextSeen = true; + nextChar = (char) next; + } + return nextChar; + } + COM: return the next char to read + diff --git a/funcom_test/10577759.txt b/funcom_test/10577759.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee1265dea277a107c95c94a47c31c75596a44899 --- /dev/null +++ b/funcom_test/10577759.txt @@ -0,0 +1,12 @@ +TDAT: public Response onCommand(POP3Session session, Request request) { + POP3Response response = null; + if (session.getHandlerState() == POP3Session.TRANSACTION) { + stat(session); + response = new POP3Response(POP3Response.OK_RESPONSE); + } else { + response = new POP3Response(POP3Response.ERR_RESPONSE); + } + return response; + } + COM: handler method called upon receipt of a rset command + diff --git a/funcom_test/10577824.txt b/funcom_test/10577824.txt new file mode 100644 index 0000000000000000000000000000000000000000..3537d7d3927dfc710c3875c1c4142b3c283220ac --- /dev/null +++ b/funcom_test/10577824.txt @@ -0,0 +1,12 @@ +TDAT: private ReadOnlyLDAPUser buildUser(String userDN) throws NamingException { + ReadOnlyLDAPUser result; + + Attributes userAttributes = ldapConnection.getLdapContext().getAttributes(userDN); + Attribute userName = userAttributes.get(userIdAttribute); + + result = new ReadOnlyLDAPUser(userName.get().toString(), userDN, ldapHost); + + return result; + } + COM: given a user dn this method retrieves the user attributes from the ldap + diff --git a/funcom_test/10577846.txt b/funcom_test/10577846.txt new file mode 100644 index 0000000000000000000000000000000000000000..f144cc4ce1662e977e3314e7098038bc828b49c1 --- /dev/null +++ b/funcom_test/10577846.txt @@ -0,0 +1,12 @@ +TDAT: private void registerMBeans() throws MalformedObjectNameException, JMException { + + String baseObjectName = "org.apache.james:type=component,component=mailetcontainer,name=processor,"; + + String[] processorNames = mList.getProcessorStates(); + for (int i = 0; i < processorNames.length; i++) { + String processorName = processorNames[i]; + registerProcessorMBean(baseObjectName, processorName); + } + } + COM: register all jmx mbeans + diff --git a/funcom_test/10577848.txt b/funcom_test/10577848.txt new file mode 100644 index 0000000000000000000000000000000000000000..04b196b70c525f3c41c5f4e9715bfa60eeebf3f7 --- /dev/null +++ b/funcom_test/10577848.txt @@ -0,0 +1,10 @@ +TDAT: private void registerProcessorMBean(String baseObjectName, String processorName) throws MalformedObjectNameException, JMException { + String processorMBeanName = baseObjectName + "processor=" + processorName; + + MailProcessorManagement processorDetail = new MailProcessorManagement(processorName); + registerMBean(processorMBeanName, processorDetail); + mMap.put(mList.getProcessor(processorName), processorDetail); + + } + COM: register a jmx mbean for a + diff --git a/funcom_test/10577856.txt b/funcom_test/10577856.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad33437b014be5784f64c36ef8308fb7b4e588c7 --- /dev/null +++ b/funcom_test/10577856.txt @@ -0,0 +1,21 @@ +TDAT: public void update(long processTime, boolean success) { + long fastest = fastestProcessing.get(); + + if (fastest > processTime || fastest == -1) { + fastestProcessing.set(processTime); + } + + if (slowestProcessing.get() < processTime) { + slowestProcessing.set(processTime); + } + if (success) { + successCount.incrementAndGet(); + } else { + errorCount.incrementAndGet(); + } + + lastProcessing.set(processTime); + + } + COM: update the stats + diff --git a/funcom_test/10578060.txt b/funcom_test/10578060.txt new file mode 100644 index 0000000000000000000000000000000000000000..650adc910d15dd480d52ff4140dab867657b7f74 --- /dev/null +++ b/funcom_test/10578060.txt @@ -0,0 +1,5 @@ +TDAT: public boolean tableExists(DatabaseMetaData dbMetaData, String tableName) throws SQLException { + return (tableExistsCaseSensitive(dbMetaData, tableName) || tableExistsCaseSensitive(dbMetaData, tableName.toUpperCase(Locale.US)) || tableExistsCaseSensitive(dbMetaData, tableName.toLowerCase(Locale.US))); + } + COM: checks database metadata to see if a table exists + diff --git a/funcom_test/10578061.txt b/funcom_test/10578061.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b9872566e31a57c1c8caf951b798d5777162fd5 --- /dev/null +++ b/funcom_test/10578061.txt @@ -0,0 +1,7 @@ +TDAT: public void updateHamTokens(Connection conn) throws java.sql.SQLException { + updateTokens(conn, getHamTokenCounts(), sqlQueries.getSqlString("insertHamToken", true), sqlQueries.getSqlString("updateHamToken", true)); + + setMessageCount(conn, sqlQueries.getSqlString("updateHamMessageCounts", true), getHamMessageCount()); + } + COM: updates the database with new ham token frequencies + diff --git a/funcom_test/10578063.txt b/funcom_test/10578063.txt new file mode 100644 index 0000000000000000000000000000000000000000..513f84761efa6a154688a5e68786b0931c33be94 --- /dev/null +++ b/funcom_test/10578063.txt @@ -0,0 +1,7 @@ +TDAT: public void updateSpamTokens(Connection conn) throws java.sql.SQLException { + updateTokens(conn, getSpamTokenCounts(), sqlQueries.getSqlString("insertSpamToken", true), sqlQueries.getSqlString("updateSpamToken", true)); + + setMessageCount(conn, sqlQueries.getSqlString("updateSpamMessageCounts", true), getSpamMessageCount()); + } + COM: updates the database with new spam token frequencies + diff --git a/funcom_test/10578066.txt b/funcom_test/10578066.txt new file mode 100644 index 0000000000000000000000000000000000000000..08446464b20b5837598726a8f59ab455eaf76c31 --- /dev/null +++ b/funcom_test/10578066.txt @@ -0,0 +1,7 @@ +TDAT: public void resetData(Connection conn) throws SQLException { + deleteData(conn, sqlQueries.getSqlString("deleteHamTokens", true)); + deleteData(conn, sqlQueries.getSqlString("deleteSpamTokens", true)); + deleteData(conn, sqlQueries.getSqlString("deleteMessageCounts", true)); + } + COM: reset all trained data + diff --git a/funcom_test/10578067.txt b/funcom_test/10578067.txt new file mode 100644 index 0000000000000000000000000000000000000000..feffe436b0a5587ef448b500326d0628da759053 --- /dev/null +++ b/funcom_test/10578067.txt @@ -0,0 +1,11 @@ +TDAT: public boolean columnExistsCaseSensitive(DatabaseMetaData dbMetaData, String tableName, String columnName) throws SQLException { + ResultSet rsTables = dbMetaData.getColumns(null, null, tableName, columnName); + try { + boolean found = rsTables.next(); + return found; + } finally { + closeJDBCResultSet(rsTables); + } + } + COM: checks database metadata to see if a column exists in a table + diff --git a/funcom_test/10578077.txt b/funcom_test/10578077.txt new file mode 100644 index 0000000000000000000000000000000000000000..03a17b7107cd01e327031c28e672ae8e74176428 --- /dev/null +++ b/funcom_test/10578077.txt @@ -0,0 +1,15 @@ +TDAT: public void initSqlQueries(Connection conn, File sqlFile) throws Exception { + try { + if (conn.getAutoCommit()) { + conn.setAutoCommit(false); + } + + sqlQueries.init(sqlFile, JDBCBayesianAnalyzer.class.getName(), conn, getSqlParameters()); + + checkTables(conn); + } finally { + theJDBCUtil.closeJDBCConnection(conn); + } + } + COM: initializes the sql query environment from the sql resources file + diff --git a/funcom_test/10578158.txt b/funcom_test/10578158.txt new file mode 100644 index 0000000000000000000000000000000000000000..2cb46e481a049386a8e7c4a4e583c2741fbe881a --- /dev/null +++ b/funcom_test/10578158.txt @@ -0,0 +1,13 @@ +TDAT: public long getMessageSize() throws MessagingException { + if (source != null && !isModified()) { + try { + return source.getMessageSize(); + } catch (IOException ioe) { + throw new MessagingException("Error retrieving message size", ioe); + } + } else { + return MimeMessageUtil.calculateMessageSize(this); + } + } + COM: returns size of message ie headers and content + diff --git a/funcom_test/10578274.txt b/funcom_test/10578274.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e03d497aaf1046e7a6f54e6863d87e3f9b8dee2 --- /dev/null +++ b/funcom_test/10578274.txt @@ -0,0 +1,21 @@ +TDAT: public void testMessageCloningViaCoW3() throws Exception { + MimeMessage mmorig = getSimpleMessage(); + + MimeMessage mm = new MimeMessageCopyOnWriteProxy(mmorig); + + LifecycleUtil.dispose(mmorig); + mmorig = null; + System.gc(); + Thread.sleep(200); + + try { + mm.writeTo(System.out); + } catch (Exception e) { + e.printStackTrace(); + fail("Exception while writing the message to output"); + } + + LifecycleUtil.dispose(mm); + } + COM: this test throw a null pointer exception when the original message was + diff --git a/funcom_test/10578279.txt b/funcom_test/10578279.txt new file mode 100644 index 0000000000000000000000000000000000000000..1446a2a74432ff61f53eb846e164e5c6c097c869 --- /dev/null +++ b/funcom_test/10578279.txt @@ -0,0 +1,13 @@ +TDAT: private void writeObject(java.io.ObjectOutputStream out) throws IOException { + out.writeObject(sender); + out.writeObject(recipients); + out.writeObject(state); + out.writeObject(errorMessage); + out.writeObject(name); + out.writeObject(remoteHost); + out.writeObject(remoteAddr); + out.writeObject(lastUpdated); + out.writeObject(attributes); + } + COM: write the mail impl to an code object output stream code + diff --git a/funcom_test/10578360.txt b/funcom_test/10578360.txt new file mode 100644 index 0000000000000000000000000000000000000000..621272b863e21c00296488094a60e8850db0a5af --- /dev/null +++ b/funcom_test/10578360.txt @@ -0,0 +1,15 @@ +TDAT: private void closeOutputStreams(OutputStream headerStream, OutputStream bodyStream) throws IOException { + try { + // If the header stream is not the same as the body stream, + // close the header stream here. + if ((headerStream != null) && (headerStream != bodyStream)) { + headerStream.close(); + } + } finally { + if (bodyStream != null) { + bodyStream.close(); + } + } + } + COM: closes output streams used to update message + diff --git a/funcom_test/10578424.txt b/funcom_test/10578424.txt new file mode 100644 index 0000000000000000000000000000000000000000..1640c0823305dd0d66f2a8f1db6d114f0cd5ea2e --- /dev/null +++ b/funcom_test/10578424.txt @@ -0,0 +1,12 @@ +TDAT: private int getNumberOfParameters(String sqlstring) { + // it is alas a java 1.4 feature to be able to call + // getParameterMetaData which could provide us with the parameterCount + char[] chars = sqlstring.toCharArray(); + int count = 0; + for (int i = 0; i < chars.length; i++) { + count += chars[i] == '?' ? 1 : 0; + } + return count; + } + COM: this method calculates number of parameters in a prepared statement sql + diff --git a/funcom_test/10578470.txt b/funcom_test/10578470.txt new file mode 100644 index 0000000000000000000000000000000000000000..2386688ef6c9c3a96a89eb33cd96d794881fb5a7 --- /dev/null +++ b/funcom_test/10578470.txt @@ -0,0 +1,7 @@ +TDAT: protected MailetException loadFailed(String name, String type, Exception e) { + final StringBuilder builder = new StringBuilder(128).append("Could not load ").append(type).append(" (").append(name).append(")"); + final MailetException mailetException = new MailetException(builder.toString(), e); + return mailetException; + } + COM: constructs an appropriate exception with an appropriate message + diff --git a/funcom_test/10578526.txt b/funcom_test/10578526.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1b86a8e45fec8d7bdb6e8281116905a4197bfcb --- /dev/null +++ b/funcom_test/10578526.txt @@ -0,0 +1,12 @@ +TDAT: public void afterPropertiesSet() throws Exception { + if (configurationMappings != null) { + Iterator it = configurationMappings.keySet().iterator(); + while (it.hasNext()) { + String key = it.next(); + String value = configurationMappings.get(key); + registerConfiguration(key, getConfiguration(value)); + } + } + } + COM: responsible to register additional configurations for the injected + diff --git a/funcom_test/10578609.txt b/funcom_test/10578609.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec20bca2ebb53dd9c1274b48f72193d46b1e190a --- /dev/null +++ b/funcom_test/10578609.txt @@ -0,0 +1,10 @@ +TDAT: protected void populateMailMimeMessage(Message message, Mail mail) throws MessagingException, JMSException { + if (message instanceof ObjectMessage) { + mail.setMessage(new MimeMessageCopyOnWriteProxy(new MimeMessageObjectMessageSource((ObjectMessage) message))); + } else { + throw new MailQueueException("Not supported JMS Message received " + message); + } + + } + COM: populat the given + diff --git a/funcom_test/10578654.txt b/funcom_test/10578654.txt new file mode 100644 index 0000000000000000000000000000000000000000..f46e5746667bffc308de7baf976026131efdcfb9 --- /dev/null +++ b/funcom_test/10578654.txt @@ -0,0 +1,15 @@ +TDAT: protected String getPrimaryName(String originalUsername) { + String username; + try { + username = originalUsername; + JamesUser user = (JamesUser) localusers.getUserByName(username); + if (user.getAliasing()) { + username = user.getAlias(); + } + } catch (Exception e) { + username = originalUsername; + } + return username; + } + COM: gets the main name of a local customer handling alias + diff --git a/funcom_test/10578705.txt b/funcom_test/10578705.txt new file mode 100644 index 0000000000000000000000000000000000000000..51e4c1fcbd352f12b6d38b8061af6e9203da3478 --- /dev/null +++ b/funcom_test/10578705.txt @@ -0,0 +1,17 @@ +TDAT: public void init() throws MessagingException { + repositoryPath = getInitParameter("repositoryPath"); + try { + passThrough = Boolean.valueOf(getInitParameter("passThrough")); + } catch (Exception e) { + // Ignore exception, default to false + } + + try { + repository = mailStore.select(repositoryPath); + } catch (Exception e) { + throw new MessagingException("Failed to retrieve MailRepository for url " + repositoryPath, e); + } + + } + COM: initialize the mailet loading configuration information + diff --git a/funcom_test/10578707.txt b/funcom_test/10578707.txt new file mode 100644 index 0000000000000000000000000000000000000000..57948ed518021378056ff7dbbf88adefe2e49436 --- /dev/null +++ b/funcom_test/10578707.txt @@ -0,0 +1,10 @@ +TDAT: public void service(Mail mail) throws javax.mail.MessagingException { + StringBuffer logBuffer = new StringBuffer(160).append("Storing mail ").append(mail.getName()).append(" in ").append(repositoryPath); + log(logBuffer.toString()); + repository.store(mail); + if (!passThrough) { + mail.setState(Mail.GHOST); + } + } + COM: store a mail in a particular repository + diff --git a/funcom_test/10578741.txt b/funcom_test/10578741.txt new file mode 100644 index 0000000000000000000000000000000000000000..db22f2e82a7d246c02889b972b1e39b10d70d87b --- /dev/null +++ b/funcom_test/10578741.txt @@ -0,0 +1,15 @@ +TDAT: protected String getUsername(MailAddress m) { + try { + if (usersRepos.supportVirtualHosting()) { + return m.toString(); + } else { + return super.getUsername(m); + } + } catch (UsersRepositoryException e) { + log("Unable to access UsersRepository", e); + return super.getUsername(m); + + } + } + COM: return the username to use for sieve processing for the given + diff --git a/funcom_test/10578805.txt b/funcom_test/10578805.txt new file mode 100644 index 0000000000000000000000000000000000000000..7012f2d99c961ddf3b5a3983a15f5791a1ddefb3 --- /dev/null +++ b/funcom_test/10578805.txt @@ -0,0 +1,5 @@ +TDAT: private String getSeparator(String targetString) { + return (targetString.indexOf(',') > -1 ? "," : (targetString.indexOf(';') > -1 ? ";" : (targetString.indexOf("regex:") > -1 ? "" : ":"))); + } + COM: returns the character used to delineate multiple addresses + diff --git a/funcom_test/10579053.txt b/funcom_test/10579053.txt new file mode 100644 index 0000000000000000000000000000000000000000..70cf7e39ce250a37ab8256041a86fea80f33e8d7 --- /dev/null +++ b/funcom_test/10579053.txt @@ -0,0 +1,13 @@ +TDAT: protected Collection getRecipients(Mail originalMail) throws MessagingException { + Collection recipients = (isStatic()) ? this.recipients : getRecipients(); + if (recipients != null) { + if (recipients.size() == 1 && (recipients.contains(SpecialAddress.UNALTERED) || recipients.contains(SpecialAddress.RECIPIENTS))) { + recipients = null; + } else { + recipients = replaceMailAddresses(originalMail, recipients); + } + } + return recipients; + } + COM: gets the code recipients code property built dynamically using the + diff --git a/funcom_test/10579057.txt b/funcom_test/10579057.txt new file mode 100644 index 0000000000000000000000000000000000000000..94bb46100e9d91fa51815aec62cb54b1e5414e93 --- /dev/null +++ b/funcom_test/10579057.txt @@ -0,0 +1,10 @@ +TDAT: protected void setRecipients(Mail newMail, Collection recipients, Mail originalMail) throws MessagingException { + if (recipients != null) { + newMail.setRecipients(recipients); + if (isDebug) { + log("recipients set to: " + arrayToString(recipients.toArray())); + } + } + } + COM: sets the recipients of i new mail i to i recipients i + diff --git a/funcom_test/10579062.txt b/funcom_test/10579062.txt new file mode 100644 index 0000000000000000000000000000000000000000..212d6474fae081688360c9717483317dc7552f3b --- /dev/null +++ b/funcom_test/10579062.txt @@ -0,0 +1,14 @@ +TDAT: protected ActiveMQSession getAMQSession(Session session) throws JMSException { + ActiveMQSession amqSession; + + if (session instanceof SessionProxy) { + // handle Springs CachingConnectionFactory + amqSession = (ActiveMQSession) ((SessionProxy) session).getTargetSession(); + } else { + // just cast as we have no other idea + amqSession = (ActiveMQSession) session; + } + return amqSession; + } + COM: cast the given + diff --git a/funcom_test/10579064.txt b/funcom_test/10579064.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d8fde130d8d4552ca5b82c9e59003a1e5a9f6a2 --- /dev/null +++ b/funcom_test/10579064.txt @@ -0,0 +1,10 @@ +TDAT: protected void setTo(Mail newMail, InternetAddress[] to, Mail originalMail) throws MessagingException { + if (to != null) { + newMail.getMessage().setRecipients(Message.RecipientType.TO, to); + if (isDebug) { + log("apparentlyTo set to: " + arrayToString(to)); + } + } + } + COM: sets the to header of i new mail i to i to i + diff --git a/funcom_test/10579092.txt b/funcom_test/10579092.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2e933493f68750527478b6f5e17ae493ff0d185 --- /dev/null +++ b/funcom_test/10579092.txt @@ -0,0 +1,13 @@ +TDAT: protected MailAddress getReplyTo(Mail originalMail) throws MessagingException { + MailAddress replyTo = (isStatic()) ? this.replyTo : getReplyTo(); + if (replyTo != null) { + if (replyTo == SpecialAddress.UNALTERED) { + replyTo = null; + } else if (replyTo == SpecialAddress.SENDER) { + replyTo = originalMail.getSender(); + } + } + return replyTo; + } + COM: gets the code reply to code property built dynamically using the + diff --git a/funcom_test/10579340.txt b/funcom_test/10579340.txt new file mode 100644 index 0000000000000000000000000000000000000000..438b0ac6da247d565a4338214cdd6784f900e2a5 --- /dev/null +++ b/funcom_test/10579340.txt @@ -0,0 +1,10 @@ +TDAT: protected String getMessageHeaders(MimeMessage message) throws MessagingException { + Enumeration heads = message.getAllHeaderLines(); + StringBuffer headBuffer = new StringBuffer(1024); + while (heads.hasMoreElements()) { + headBuffer.append(heads.nextElement().toString()).append("\r\n"); + } + return headBuffer.toString(); + } + COM: utility method for obtaining a string representation of a messages + diff --git a/funcom_test/10579412.txt b/funcom_test/10579412.txt new file mode 100644 index 0000000000000000000000000000000000000000..076089d85f32bfeaa5b2394c607004e4617c30cb --- /dev/null +++ b/funcom_test/10579412.txt @@ -0,0 +1,11 @@ +TDAT: private void setMessageId(Mail newMail, Mail originalMail) throws MessagingException { + String messageId = originalMail.getMessage().getMessageID(); + if (messageId != null) { + newMail.getMessage().setHeader(RFC2822Headers.MESSAGE_ID, messageId); + if (isDebug) { + log("MESSAGE_ID restored to: " + messageId); + } + } + } + COM: sets the message id of original mail into new mail + diff --git a/funcom_test/10855978.txt b/funcom_test/10855978.txt new file mode 100644 index 0000000000000000000000000000000000000000..20cfc6fbd8ce1303eebc96ff45bafc236e24641e --- /dev/null +++ b/funcom_test/10855978.txt @@ -0,0 +1,11 @@ +TDAT: public void testValidateVersion() throws Exception { + CookieSpec cookiespec = new RFC2965Spec(); + // version attribute is REQUIRED + Header header = new Header("Set-Cookie2", "name=value"); + try { + cookieParse(cookiespec, "www.domain.com", 8000, "/", false, header); + fail("MalformedCookieException should have been thrown"); + } catch (MalformedCookieException e) {} + } + COM: test cookie tt version tt validation + diff --git a/funcom_test/10856115.txt b/funcom_test/10856115.txt new file mode 100644 index 0000000000000000000000000000000000000000..bfe65ebeaa94c72955129e548b349096590bb3ce --- /dev/null +++ b/funcom_test/10856115.txt @@ -0,0 +1,10 @@ +TDAT: public void testSecondDomainLevelCookie() throws Exception { + Cookie cookie = new Cookie(".sourceforge.net", "name", null, "/", null, false); + cookie.setDomainAttributeSpecified(true); + cookie.setPathAttributeSpecified(true); + + CookieSpec cookiespec = new CookieSpecBase(); + cookiespec.validate("sourceforge.net", 80, "/", false, cookie); + } + COM: tests if invalid second domain level cookie gets accepted in the + diff --git a/funcom_test/10856252.txt b/funcom_test/10856252.txt new file mode 100644 index 0000000000000000000000000000000000000000..7ea6a946a555d13e770f8ea6d8cae5e58440bc14 --- /dev/null +++ b/funcom_test/10856252.txt @@ -0,0 +1,10 @@ +TDAT: private File createTempTestFile() throws IOException { + File file = File.createTempFile("FilePartTest", ".txt"); + PrintWriter out = new PrintWriter(new FileWriter(file)); + out.println(PART_DATA); + out.flush(); + out.close(); + return file; + } + COM: writes part data out to a temporary file and returns the file it + diff --git a/funcom_test/10856281.txt b/funcom_test/10856281.txt new file mode 100644 index 0000000000000000000000000000000000000000..83ec949cfcd7b3a02dac86464c9d8c90842b9271 --- /dev/null +++ b/funcom_test/10856281.txt @@ -0,0 +1,9 @@ +TDAT: public void testRemoveParameterReturnValue() throws Exception { + PostMethod method = new PostMethod("/"); + + method.addParameter("param", "whatever"); + assertTrue("Return value of the method is expected to be true", method.removeParameter("param")); + assertFalse("Return value of the method is expected to be false", method.removeParameter("param")); + } + COM: test the return value of the post method remove parameter + diff --git a/funcom_test/10856285.txt b/funcom_test/10856285.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a0a1f182dcf0dadb1a664378ff15b2be8477570 --- /dev/null +++ b/funcom_test/10856285.txt @@ -0,0 +1,13 @@ +TDAT: public void testGetCause() { + + Exception aCause = new IOException("the cause"); + + try { + throw new HttpException("http exception", aCause); + } + catch (HttpException e) { + assertEquals("Retrieve cause from caught exception", e.getCause(), aCause); + } + } + COM: make sure that you can retrieve the cause from an http exception + diff --git a/funcom_test/10856530.txt b/funcom_test/10856530.txt new file mode 100644 index 0000000000000000000000000000000000000000..2b2c5325427aa6e380f12b427dd66a452b3581b2 --- /dev/null +++ b/funcom_test/10856530.txt @@ -0,0 +1,12 @@ +TDAT: public void testSimpleGet() throws Exception { + this.server.setHttpService(new FeedbackService()); + GetMethod get = new GetMethod("/"); + try { + this.client.executeMethod(get); + assertEquals(HttpStatus.SC_OK, get.getStatusCode()); + } finally { + get.releaseConnection(); + } + } + COM: tests get via non authenticating proxy + diff --git a/funcom_test/10856746.txt b/funcom_test/10856746.txt new file mode 100644 index 0000000000000000000000000000000000000000..43d629b42b401559af8031c574768ae65f778f50 --- /dev/null +++ b/funcom_test/10856746.txt @@ -0,0 +1,10 @@ +TDAT: public int hashCode() { + int hash = LangUtils.HASH_SEED; + hash = LangUtils.hashCode(hash, this.defaultPort); + hash = LangUtils.hashCode(hash, this.scheme.toLowerCase(Locale.ENGLISH)); + hash = LangUtils.hashCode(hash, this.secure); + hash = LangUtils.hashCode(hash, this.socketFactory); + return hash; + } + COM: return a hash code for this object + diff --git a/funcom_test/10856923.txt b/funcom_test/10856923.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc42693ee96f3531548aae79066339f1c174a67c --- /dev/null +++ b/funcom_test/10856923.txt @@ -0,0 +1,22 @@ +TDAT: public int read() throws IOException { + + if (closed) { + throw new IOException("Attempted read from closed stream."); + } + if (eof) { + return -1; + } + if (pos >= chunkSize) { + nextChunk(); + if (eof) { + return -1; + } + } + int b = in.read(); + if (b != -1) { + pos++; + } + return b; + } + COM: p returns all the data in a chunked stream in coalesced form + diff --git a/funcom_test/1086025.txt b/funcom_test/1086025.txt new file mode 100644 index 0000000000000000000000000000000000000000..1dff5a958afc63ddda8f196c335410fc59d58ca2 --- /dev/null +++ b/funcom_test/1086025.txt @@ -0,0 +1,11 @@ +TDAT: private void setServer( Server svr ) { + this.server = svr; + // Create a human player object and an action to lauch it + if( theHumanPlayer == null ) theHumanPlayer = new HumanPlayer(); + killServerAction.setEnabled( true ); + openAction.setEnabled(false); + closeAction.setEnabled(false); + enableServerActions(false); + } + COM: set the server from which we are receiving moves + diff --git a/funcom_test/1086054.txt b/funcom_test/1086054.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a88f4902e77f0f54d7a45fa50ea406a30c2035e --- /dev/null +++ b/funcom_test/1086054.txt @@ -0,0 +1,11 @@ +TDAT: public void moveEntered(Move m) { + if( !userMoveNeeded ) { + System.err.println( "Unexpected user move received from BoardPanel"); + return; + } + userMoveNeeded = false; userMoveRequested = false; + this.theHumanPlayer.moveEntered( m ); + statusLabel.setText( "User move sent to server." ); + } + COM: callback from the board panel + diff --git a/funcom_test/1086087.txt b/funcom_test/1086087.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbd972103520092a0d631a6c354d3ef79c441baf --- /dev/null +++ b/funcom_test/1086087.txt @@ -0,0 +1,17 @@ +TDAT: public Move chooseMove(Board theboard) { + int myColor = this.getColor(); + + // Cast the arguments to the objects we want to work with + BTBoard board = (BTBoard) theboard; + + // Find all my pieces + //TODO:This can be easily optimized to be saved on the board + + + BTMove nextMove = new BTMove(UNASSIGNED_MOVE, -1, -1); + gen_move(board, myColor, myColor, 0, nextMove); + + return nextMove; + } + COM: implement a very stupid way of picking moves + diff --git a/funcom_test/1086099.txt b/funcom_test/1086099.txt new file mode 100644 index 0000000000000000000000000000000000000000..0242341b4cea367332cb9809805aa2df4b45d145 --- /dev/null +++ b/funcom_test/1086099.txt @@ -0,0 +1,16 @@ +TDAT: public void createChildren() { + //go over all possible moves (!) in a specific order + //and for each move generate a board, create a node around it and + //add it to the list of children of this node + Vector moves = this.getBoard().GenerateMoves(); + + for (BTMove move : moves) { + EnhancedBTBoard board = new EnhancedBTBoard(this.getBoard()); + board.move(move); + MyNode node = new MyNode(board); + node.setMove(move); + this.add(node); + } + } + COM: generate all possible moves for this node + diff --git a/funcom_test/1086124.txt b/funcom_test/1086124.txt new file mode 100644 index 0000000000000000000000000000000000000000..1abf8f64e6fdfeca31a0ff866470c0dc4763c717 --- /dev/null +++ b/funcom_test/1086124.txt @@ -0,0 +1,8 @@ +TDAT: public void randomizeWeights() { + for (int layer = 1; layer < structure.length; layer++) + for (int unit = 0; unit < structure[layer]; unit++) + for (int wt = 0; wt < structure[layer - 1] + 1; wt++) + weights[layer][unit][wt] = Math.random() * 0.02 - 0.01; + } + COM: assign random weights everywhere + diff --git a/funcom_test/1086158.txt b/funcom_test/1086158.txt new file mode 100644 index 0000000000000000000000000000000000000000..c54797a6cf9d7ff04ab367f47e872944b5803985 --- /dev/null +++ b/funcom_test/1086158.txt @@ -0,0 +1,19 @@ +TDAT: private MyNode UCTSelect(MyNode root) { + MyNode node, choice = null; + double maxUCB = Double.NEGATIVE_INFINITY, minUCB = Double.POSITIVE_INFINITY; + + for (int i = 0; i < root.getChildCount(); i++) { + node = (MyNode) root.getChildAt(i); + if (node.firstVisit()) + return node; + + double currentUCB = node.getUCBValue(); + if (currentUCB > maxUCB) { + choice = node; + maxUCB = currentUCB; + } + } + return choice; + } + COM: selects the node with the best return + diff --git a/funcom_test/1086160.txt b/funcom_test/1086160.txt new file mode 100644 index 0000000000000000000000000000000000000000..ff8f4a45353c818bcff363cadf2b4d8a59e3118c --- /dev/null +++ b/funcom_test/1086160.txt @@ -0,0 +1,24 @@ +TDAT: private int RandomSimulation(MyNode node) { + EnhancedBTBoard board = new EnhancedBTBoard(node.getBoard()); + + int winner = board.getWinner(); + + while (board.getWinner() == EnhancedBTBoard.NOBODY) { + // generate moves + + board.move(netPlayer.chooseMove(board)); + + winner = board.getWinner(); + + if (winner != EnhancedBTBoard.NOBODY) { + break; + } + } + + if (winner == myColor) + return 1; + else + return 0; + } + COM: generate a random simulation + diff --git a/funcom_test/10891981.txt b/funcom_test/10891981.txt new file mode 100644 index 0000000000000000000000000000000000000000..420c01caf962a0965305ef3af11b8803116876b9 --- /dev/null +++ b/funcom_test/10891981.txt @@ -0,0 +1,10 @@ +TDAT: public void setProperties(Map properties) { + this.properties = properties; + final String useEquals = "useEquals"; + InterceptorProperty p = properties.get(useEquals); + if (p!=null) { + setUseEquals(Boolean.parseBoolean(p.getValue())); + } + } + COM: called during the creation of an interceptor + diff --git a/funcom_test/10892009.txt b/funcom_test/10892009.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ef4faad9353b708c424d9698b0cb323493a056e --- /dev/null +++ b/funcom_test/10892009.txt @@ -0,0 +1,11 @@ +TDAT: public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { + try { + this.oname = createObjectName(name); + if (oname!=null) registerJmx(); + }catch (MalformedObjectNameException x) { + log.error("Unable to create object name for JDBC pool.",x); + } + return name; + } + COM: if the connection pool mbean exists it will be registered during this operation + diff --git a/funcom_test/10892019.txt b/funcom_test/10892019.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbac552b4307708d06ce3282d4067de7c8287772 --- /dev/null +++ b/funcom_test/10892019.txt @@ -0,0 +1,9 @@ +TDAT: protected boolean shouldAbandon() { + if (poolProperties.getAbandonWhenPercentageFull()==0) return true; + float used = busy.size(); + float max = poolProperties.getMaxActive(); + float perc = poolProperties.getAbandonWhenPercentageFull(); + return (used/max*100f)>=perc; + } + COM: determines if a connection should be abandoned based on + diff --git a/funcom_test/10892076.txt b/funcom_test/10892076.txt new file mode 100644 index 0000000000000000000000000000000000000000..51734f93f0f8690655712dfb6d96eb2940aeda29 --- /dev/null +++ b/funcom_test/10892076.txt @@ -0,0 +1,9 @@ +TDAT: protected void createMBean() { + try { + jmxPool = new org.apache.tomcat.jdbc.pool.jmx.ConnectionPool(this); + } catch (Exception x) { + log.warn("Unable to start JMX integration for connection pool. Instance["+getName()+"] can't be monitored.",x); + } + } + COM: create mbean object that can be registered + diff --git a/funcom_test/10892115.txt b/funcom_test/10892115.txt new file mode 100644 index 0000000000000000000000000000000000000000..36a0c656b3a90628742a418ec290f0d4732064ac --- /dev/null +++ b/funcom_test/10892115.txt @@ -0,0 +1,12 @@ +TDAT: public void run() { + try { + Connection con = get(); //complete this future + con.close(); //return to the pool + }catch (ExecutionException ex) { + //we can ignore this + }catch (Exception x) { + ConnectionPool.log.error("Unable to cancel ConnectionFuture.",x); + } + } + COM: run method to be executed when cancelled by an executor + diff --git a/funcom_test/10892455.txt b/funcom_test/10892455.txt new file mode 100644 index 0000000000000000000000000000000000000000..95e886f39a9774ea64511d644f9a19aa75bfa3d4 --- /dev/null +++ b/funcom_test/10892455.txt @@ -0,0 +1,9 @@ +TDAT: public void resetStats() { + ConcurrentHashMap queries = perPoolStats.get(poolName); + if (queries!=null) { + Iterator it = queries.keySet().iterator(); + while (it.hasNext()) it.remove(); + } + } + COM: jmx operation remove all stats for this connection pool + diff --git a/funcom_test/10892817.txt b/funcom_test/10892817.txt new file mode 100644 index 0000000000000000000000000000000000000000..91087bec945017940f30f018a3a67041e3b6ccb7 --- /dev/null +++ b/funcom_test/10892817.txt @@ -0,0 +1,12 @@ +TDAT: protected int getTimeout() { + String timeoutS = servletConfig.getInitParameter("timeout"); + int timeout = 120*1000; //2 min + try { + timeout = Integer.parseInt(timeoutS); + }catch (NumberFormatException nfe) { + //ignore, we have a default value + } + return timeout; + } + COM: returns the preconfigured connection timeout + diff --git a/funcom_test/10892933.txt b/funcom_test/10892933.txt new file mode 100644 index 0000000000000000000000000000000000000000..36b74e31937eb1661a4ed9240d265866d8c9982d --- /dev/null +++ b/funcom_test/10892933.txt @@ -0,0 +1,9 @@ +TDAT: public HttpError validate() { + if(clientId==null|| (!this.getTomcatBayeux().hasClient(clientId))) + return new HttpError(400,"Client Id not valid.", null); + if (subscription==null||subscription.length()==0) + return new HttpError(400,"Subscription missing.",null); + return null;//no error + } + COM: check client request for validity + diff --git a/funcom_test/10892966.txt b/funcom_test/10892966.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1acad9988101ef152161d4200e639dd672b2b75 --- /dev/null +++ b/funcom_test/10892966.txt @@ -0,0 +1,21 @@ +TDAT: public void recordCookie(HttpCookie cookie) { + if (!checkIfCookieOK(cookie)) { + return; + } + synchronized (cookieJar) { + + String domain = cookie.getDomain().toLowerCase(); + + Vector cookieList = (Vector)cookieJar.get(domain); + if (cookieList == null) { + cookieList = new Vector(); + } + + addOrReplaceCookie(cookieList, cookie); + cookieJar.put(domain, cookieList); + + } + + } + COM: record the cookie in the in memory container of cookies + diff --git a/funcom_test/10893093.txt b/funcom_test/10893093.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d570919d125223a8bea5a9b2ae10cabae78f452 --- /dev/null +++ b/funcom_test/10893093.txt @@ -0,0 +1,10 @@ +TDAT: public void setExpectHeaders(String s) { + this.expectHeaders = new HashMap(); + StringTokenizer tok = new StringTokenizer(s, "|"); + while (tok.hasMoreElements()) { + String header = (String) tok.nextElement(); + setHeaderDetails(header, expectHeaders, false); + } + } + COM: code set expect headers code configures gtest to look for the header + diff --git a/funcom_test/10893117.txt b/funcom_test/10893117.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f5e2539077299cdb019b6a0eb2bee124f1ee9f0 --- /dev/null +++ b/funcom_test/10893117.txt @@ -0,0 +1,10 @@ +TDAT: public void setRequestHeaders(String s) { + requestHeaders = new HashMap(); + StringTokenizer tok = new StringTokenizer(s, "|"); + while (tok.hasMoreElements()) { + String header = (String) tok.nextElement(); + setHeaderDetails(header, requestHeaders, true); + } + } + COM: code set request headers code configures the request headers gtest + diff --git a/funcom_test/10893420.txt b/funcom_test/10893420.txt new file mode 100644 index 0000000000000000000000000000000000000000..757ba26b15a64a530ff7442127e76e44c0064602 --- /dev/null +++ b/funcom_test/10893420.txt @@ -0,0 +1,20 @@ +TDAT: public StandardServer getServer() { + + if (server != null) { + return server; + } + + initBaseDir(); + + System.setProperty("catalina.useNaming", "false"); + + server = new StandardServer(); + server.setPort( -1 ); + + service = new StandardService(); + service.setName("Tomcat"); + server.addService( service ); + return server; + } + COM: get the server object + diff --git a/funcom_test/10893655.txt b/funcom_test/10893655.txt new file mode 100644 index 0000000000000000000000000000000000000000..c32ec47101c86f14495fb76c9dab5290959a6802 --- /dev/null +++ b/funcom_test/10893655.txt @@ -0,0 +1,11 @@ +TDAT: public ByteBuffer getByteBuffer() { + if (byteBuffer == null || byteBuffer.array() != buff) { + byteBuffer = ByteBuffer.wrap(buff, start, end - start); + } else { + byteBuffer.position(start); + byteBuffer.limit(end); + } + return byteBuffer; + } + COM: return a byte buffer + diff --git a/funcom_test/10893671.txt b/funcom_test/10893671.txt new file mode 100644 index 0000000000000000000000000000000000000000..ad29c5dee12b2dd19b178ec901ac617f181bca69 --- /dev/null +++ b/funcom_test/10893671.txt @@ -0,0 +1,16 @@ +TDAT: public boolean startsWith(String s) { + char[] c = value; + int len = s.length(); + if (c == null || len > end - start) { + return false; + } + int off = start; + for (int i = 0; i < len; i++) { + if (c[off++] != s.charAt(i)) { + return false; + } + } + return true; + } + COM: returns true if the message bytes starts with the specified string + diff --git a/funcom_test/10893712.txt b/funcom_test/10893712.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d6f18c9ba42041745ad34c9aff264b4d86d57b5 --- /dev/null +++ b/funcom_test/10893712.txt @@ -0,0 +1,14 @@ +TDAT: public int read() throws IOException { + if (isClosedAndEmpty()) { + return -1; + } + BBucket bucket = peekFirst(); + if (bucket == null) { + return -2; + } + int res = bucket.array()[bucket.position()]; + bucket.position(bucket.position() + 1); + return res & 0xFF; + } + COM: non blocking read + diff --git a/funcom_test/10893856.txt b/funcom_test/10893856.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d54e12d5d83dce709295dcb67274bf88f9d30fd --- /dev/null +++ b/funcom_test/10893856.txt @@ -0,0 +1,15 @@ +TDAT: public IOChannel setHead(IOChannel head) throws IOException { + this.head = head; + head.setSink(this); + + // TODO: do we want to migrate them automatically ? + head.setDataReceivedCallback(dataReceivedCallback); + head.setDataFlushedCallback(dataFlushedCallback); + // app.setClosedCallback(closedCallback); + + dataReceivedCallback = null; + dataFlushedCallback = null; + return this; + } + COM: called to add an filter after the current channel for + diff --git a/funcom_test/10893924.txt b/funcom_test/10893924.txt new file mode 100644 index 0000000000000000000000000000000000000000..17761db6de46c279e4b447c6cd6a16bc6d0e8bb1 --- /dev/null +++ b/funcom_test/10893924.txt @@ -0,0 +1,10 @@ +TDAT: public boolean isOpen() { + if (ch == null) { + return false; + } + return ch.isOpen() && ch.channel != null && + ch.channel.isOpen() && !getIn().isAppendClosed() && + !getOut().isAppendClosed(); + } + COM: both in and out open + diff --git a/funcom_test/10893929.txt b/funcom_test/10893929.txt new file mode 100644 index 0000000000000000000000000000000000000000..96a5835103e85d4de0510c0cc30cd2a911feef1a --- /dev/null +++ b/funcom_test/10893929.txt @@ -0,0 +1,17 @@ +TDAT: public int readToSpace(BBuffer res) { + int resStart = start; + while (true) { + if (start >= end) { + break; + } + if (buff[start] == SP + || buff[start] == HT) { + break; + } + start++; + } + res.setBytes(buff, resStart, start - resStart); + return res.remaining(); + } + COM: consume all up to the first space or t which will be the + diff --git a/funcom_test/10894097.txt b/funcom_test/10894097.txt new file mode 100644 index 0000000000000000000000000000000000000000..58dd212827bcbba03e0a1bc8d8400e806bfcebef --- /dev/null +++ b/funcom_test/10894097.txt @@ -0,0 +1,14 @@ +TDAT: protected HttpChannel create() throws IOException { + HttpChannel res = new HttpChannel(); + newHttpChannel.incrementAndGet(); + res.setConnector(this); + if (httpEvents != null) { + httpEvents.onCreate(res, this); + } + if (debugHttp) { + res.debug = debugHttp; + } + return res; + } + COM: override to create customized client server connections + diff --git a/funcom_test/10894173.txt b/funcom_test/10894173.txt new file mode 100644 index 0000000000000000000000000000000000000000..c45d9486e24498a8b543c7a40d56fb5f6070f67b --- /dev/null +++ b/funcom_test/10894173.txt @@ -0,0 +1,16 @@ +TDAT: public boolean hasBody() { + if (httpCh.getRequest().method().equals("HEAD")) { + return false; + } + if (status >= 100 && status < 200) { + return false; + } + // what about (status == 205) ? + if ((status == 204) + || (status == 304)) { + return false; + } + return true; + } + COM: all responses to the head request method must not include a + diff --git a/funcom_test/10894293.txt b/funcom_test/10894293.txt new file mode 100644 index 0000000000000000000000000000000000000000..882c4771346798200d51117c154a05e119d7add2 --- /dev/null +++ b/funcom_test/10894293.txt @@ -0,0 +1,16 @@ +TDAT: private void maybeRelease() throws IOException { + synchronized (this) { + if (release && sendReceiveDone) { + if (debug) { + trace("RELEASE"); + } + if (getConnector() != null) { + getConnector().returnToPool(this); + } else { + log.severe("Attempt to release with no pool"); + } + } + } + } + COM: called when all done + diff --git a/funcom_test/10894341.txt b/funcom_test/10894341.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1eef3d79374c852912163d9edf1119c6facd6fb --- /dev/null +++ b/funcom_test/10894341.txt @@ -0,0 +1,18 @@ +TDAT: public void abort(HttpChannel http, String t) throws IOException { + if (switchedProtocol != null) { + switchedProtocol.abort(http, t); + return; + } + keepAlive = false; + if (net != null ) { + if (net.isOpen()) { + net.close(); + net.startSending(); + } + } + if (http != null) { + http.abort(t); + } + } + COM: disconnect abruptly client closed frame errors etc + diff --git a/funcom_test/10894400.txt b/funcom_test/10894400.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cab234c639e87895117795b122567461a50bcc5 --- /dev/null +++ b/funcom_test/10894400.txt @@ -0,0 +1,14 @@ +TDAT: private void coyoteService(final HttpRequest httpReq, final HttpResponse httpRes) { + // TODO: reuse, per req + RequestData rc = new RequestData(); + rc.init(httpReq, httpRes); + + try { + adapter.service(rc.req, rc.res); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + COM: main lite service method will wrap to coyote request + diff --git a/funcom_test/10894538.txt b/funcom_test/10894538.txt new file mode 100644 index 0000000000000000000000000000000000000000..a34ad6b9abd8623c20a939e74c8cd0eefec12eee --- /dev/null +++ b/funcom_test/10894538.txt @@ -0,0 +1,13 @@ +TDAT: public void handleQueryParameters() { + if( queryMB.length() == 0) { + return; + } + + decodedQuery.recycle(); + decodedQuery.append(getMsgBytes().query()); + // TODO: option 'useBodyEncodingForUri' - versus UTF or ASCII + String queryStringEncoding = getEncoding(); + processParameters( decodedQuery, queryStringEncoding ); + } + COM: process the query string into parameters + diff --git a/funcom_test/10895951.txt b/funcom_test/10895951.txt new file mode 100644 index 0000000000000000000000000000000000000000..bdacb9f7f8b027ae27f94999933cae8aa4b612a6 --- /dev/null +++ b/funcom_test/10895951.txt @@ -0,0 +1,15 @@ +TDAT: public FunctionInfo getFunction(String name) { + + if (functions == null || functions.length == 0) { + return null; + } + + for (int i = 0; i < functions.length; i++) { + if (functions[i].getName().equals(name)) { + return functions[i]; + } + } + return null; + } + COM: get the function info for a given function name looking through all the + diff --git a/funcom_test/10897840.txt b/funcom_test/10897840.txt new file mode 100644 index 0000000000000000000000000000000000000000..d15013ff2f755ddb24c5418332f6a321005dedfe --- /dev/null +++ b/funcom_test/10897840.txt @@ -0,0 +1,18 @@ +TDAT: public void stop() { + + if (log.isDebugEnabled()) + log.debug(sm.getString("hostConfig.stop")); + + if (oname != null) { + try { + Registry.getRegistry(null, null).unregisterComponent(oname); + } catch (Exception e) { + log.error(sm.getString("hostConfig.jmx.unregister", oname), e); + } + } + oname = null; + configBase = null; + + } + COM: process a stop event for this host + diff --git a/funcom_test/10899292.txt b/funcom_test/10899292.txt new file mode 100644 index 0000000000000000000000000000000000000000..1e219c84c62699eebd0dda61d8c674a92fff8400 --- /dev/null +++ b/funcom_test/10899292.txt @@ -0,0 +1,12 @@ +TDAT: public void setSessionAttributeFilter(String sessionAttributeFilter) { + if (sessionAttributeFilter == null + || sessionAttributeFilter.trim().equals("")) { + this.sessionAttributeFilter = null; + sessionAttributePattern = null; + } else { + this.sessionAttributeFilter = sessionAttributeFilter; + sessionAttributePattern = Pattern.compile(sessionAttributeFilter); + } + } + COM: set the pattern used for including session attributes to replication + diff --git a/funcom_test/10903479.txt b/funcom_test/10903479.txt new file mode 100644 index 0000000000000000000000000000000000000000..fb52553f8db18a25a4b9fb44ffae47e54f6281f6 --- /dev/null +++ b/funcom_test/10903479.txt @@ -0,0 +1,21 @@ +TDAT: public boolean events() { + boolean result = false; + + Runnable r = null; + while ( (r = events.poll()) != null ) { + result = true; + try { + r.run(); + if ( r instanceof PollerEvent ) { + ((PollerEvent)r).reset(); + eventCache.offer((PollerEvent)r); + } + } catch ( Throwable x ) { + log.error("",x); + } + } + + return result; + } + COM: processes events in the event queue of the poller + diff --git a/funcom_test/1106630.txt b/funcom_test/1106630.txt new file mode 100644 index 0000000000000000000000000000000000000000..cbbff02fecda11b16a442713c0f3fd13b1d6fb6e --- /dev/null +++ b/funcom_test/1106630.txt @@ -0,0 +1,21 @@ +TDAT: public Point_List getForegroundPoint(PImage Image)throws WrongSizeException,LearningStateException{ + + Point_List Points; + if (!end_learn || learn_state) + throw new LearningStateException(); + + if(Image.width!=width || Image.height!=height) + throw new WrongSizeException(); + + Points=new Point_List(); + for(int x=0;x returns the pixels identified as belonging to the foreground + diff --git a/funcom_test/1118165.txt b/funcom_test/1118165.txt new file mode 100644 index 0000000000000000000000000000000000000000..f72a76e1da10a53c8ab366bfdca1ff9959c8bad6 --- /dev/null +++ b/funcom_test/1118165.txt @@ -0,0 +1,14 @@ +TDAT: public void modifyRoleInCache(Role role, String orgRolename) { + Set users = role.getUsers(); + for (Iterator iter = users.iterator(); iter.hasNext();) { + User user = (User) iter.next(); + userDetailsInCache(user); + } + + for (Iterator iter = role.getRescs().iterator(); iter.hasNext();) { + Resource resource = (Resource) iter.next(); + resourceDetailsInCache(resource); + } + } + COM: role user cache resource cache + diff --git a/funcom_test/11297970.txt b/funcom_test/11297970.txt new file mode 100644 index 0000000000000000000000000000000000000000..0221ce9b3f9962fa5280fcad09688de490de328f --- /dev/null +++ b/funcom_test/11297970.txt @@ -0,0 +1,10 @@ +TDAT: private String serialiseChildSequence() { + StringBuffer buffer = new StringBuffer(); + for(Iterator it = childSequence.iterator(); it.hasNext();) { + Integer child = (Integer)it.next(); + buffer.append("/" + child.toString()); + } + return buffer.toString(); + } + COM: serialises the child sequence and returns it as a string + diff --git a/funcom_test/11297996.txt b/funcom_test/11297996.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d006ea806cda7449220ca4f682128ce592eaa5f --- /dev/null +++ b/funcom_test/11297996.txt @@ -0,0 +1,14 @@ +TDAT: public String toString() { + if (shorthandPointer.equals(emptyNCName)) { + StringBuffer buffer = new StringBuffer(); + Iterator parts = pointerParts.iterator(); + while (parts.hasNext()) { + buffer.append(parts.next()); + } + return buffer.toString(); + } else { + return shorthandPointer.toString(); + } + } + COM: returns a string serialisation of this xpointer + diff --git a/funcom_test/11298083.txt b/funcom_test/11298083.txt new file mode 100644 index 0000000000000000000000000000000000000000..18321f871725cf6c1e6512f7a603790518d3ef1c --- /dev/null +++ b/funcom_test/11298083.txt @@ -0,0 +1,6 @@ +TDAT: public String toString() { + String operationString = (operation.getPrefix() != null && !operation.getPrefix().equals(emptyString) ? operation.getPrefix() + ":" + operation.getLocalPart() : operation.getLocalPart()); + return "wsdl.bindingOperation(" + binding + "/" + operationString + ")"; + } + COM: returns a string of the serialised binding operation pointer part + diff --git a/funcom_test/11298105.txt b/funcom_test/11298105.txt new file mode 100644 index 0000000000000000000000000000000000000000..5d267696d587d16869184d713fbbfa3d2697169b --- /dev/null +++ b/funcom_test/11298105.txt @@ -0,0 +1,7 @@ +TDAT: public QName prefixQNameNamespace(QName qname) { + //Get prefix for the fault QName in the XPointer. + NCName prefix = getXmlNamespacePrefix(qname); + return new QName(qname.getNamespaceURI(), qname.getLocalPart(), prefix.toString()); + } + COM: returns a qname prefixed from the map of local namespaces and prefixes + diff --git a/funcom_test/11298468.txt b/funcom_test/11298468.txt new file mode 100644 index 0000000000000000000000000000000000000000..309eeaf753313064815840c2e2f19e25f1b89922 --- /dev/null +++ b/funcom_test/11298468.txt @@ -0,0 +1,16 @@ +TDAT: public void testGetHttpAuthenticationRealm() { + + //test "abc" parsed from WSDL + Endpoint endpoint = fEndpoints[0]; + HTTPEndpointExtensions httpEndpointExts = + (HTTPEndpointExtensions) endpoint + .getComponentExtensionContext( + HTTPConstants.NS_URI_HTTP); + + String actual = httpEndpointExts.getHttpAuthenticationRealm(); + assertEquals("Unexpected value for http authentication realm.", + "abc", + actual); + } + COM: testcases for the http authentication realm property returned by the + diff --git a/funcom_test/11298735.txt b/funcom_test/11298735.txt new file mode 100644 index 0000000000000000000000000000000000000000..68f4b65ec635fd868b943638abea7c85ce4ce0b3 --- /dev/null +++ b/funcom_test/11298735.txt @@ -0,0 +1,21 @@ +TDAT: public void testNoInterfaces() { + DescriptionElement descEl = factory.newDescription(); + Description descComp = descEl.toComponent(); + + try { + descEl.setTargetNamespace(new URI("http://testnamespace")); + } catch(URISyntaxException e) { + // Do nothing. + } + + try { + assertion.validate(descComp, wodenContext); + } catch(WSDLException e) { + fail("Assertion Interface1010 threw WSDLException."); + } + if(handler.errorMessageHasBeenReported()) { + fail("Assertion Interface1010 failed incorrectly with no interfaces specified."); + } + } + COM: test that the assertion passes for an empty list of interfaces + diff --git a/funcom_test/11298866.txt b/funcom_test/11298866.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a9b8afd73ba1e151952545a742d528267f2b1d9 --- /dev/null +++ b/funcom_test/11298866.txt @@ -0,0 +1,14 @@ +TDAT: private boolean containsInterface(Interface interfac, Interface[] extendedInterfaces) { + boolean foundInterface = false; + + int numExtInterfaces = extendedInterfaces.length; + for(int i = 0; i < numExtInterfaces && !foundInterface; i++) { + if(interfac.isEquivalentTo(extendedInterfaces[i])) + foundInterface = true; + else if(containsInterface(interfac, extendedInterfaces[i].getExtendedInterfaces())) + foundInterface = true; + } + return foundInterface; + } + COM: check whether the specified interface is in the list of extended interfaces + diff --git a/funcom_test/11299440.txt b/funcom_test/11299440.txt new file mode 100644 index 0000000000000000000000000000000000000000..2fa14675a6941f9765e05a3f3eea7e1920ffb569 --- /dev/null +++ b/funcom_test/11299440.txt @@ -0,0 +1,13 @@ +TDAT: public void xmlDeclaration(String encoding) { + + if (out == null) + return; + + if (encoding == null) { + out.println(""); + } else { + out.println(""); + } + } + COM: writes the xml declaration + diff --git a/funcom_test/11299443.txt b/funcom_test/11299443.txt new file mode 100644 index 0000000000000000000000000000000000000000..acf6f7fddd369a497c9de47ff4a097a5008dee6a --- /dev/null +++ b/funcom_test/11299443.txt @@ -0,0 +1,16 @@ +TDAT: public void beginElement(String tag, String attributes) { + + if (out == null) + return; + + indent(); + if (attributes.length() == 0) { + out.println("<" + tag + ">"); + + } else { + out.println("<" + tag + " " + attributes + ">"); + } + tags.push(tag); + } + COM: writes the begin tag for an element with attributes + diff --git a/funcom_test/11299894.txt b/funcom_test/11299894.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c661f95ac5ecfb4fed9b945a7500fc1cbc411e9 --- /dev/null +++ b/funcom_test/11299894.txt @@ -0,0 +1,16 @@ +TDAT: public void setURIResolver(URIResolver resolver) { + + if(resolver == null) { + String msg = fWsdlContext.errorReporter.getFormattedMessage( + "WSDL026", new Object[] {"resolver"}); + throw new NullPointerException(msg); + } + + fWsdlContext = new WSDLContext( + fWsdlContext.wsdlFactory, + fWsdlContext.errorReporter, + fWsdlContext.extensionRegistry, + resolver); + } + COM: provides the capability of setting a custom uri resolver + diff --git a/funcom_test/1150413.txt b/funcom_test/1150413.txt new file mode 100644 index 0000000000000000000000000000000000000000..16c66c036a8899321c2b13c697e4f5901e3306bb --- /dev/null +++ b/funcom_test/1150413.txt @@ -0,0 +1,10 @@ +TDAT: public void skipPast(String to) { + this.myIndex = this.mySource.indexOf(to, this.myIndex); + if (this.myIndex < 0) { + this.myIndex = this.mySource.length(); + } else { + this.myIndex += to.length(); + } + } + COM: skip characters until past the requested string + diff --git a/funcom_test/1150448.txt b/funcom_test/1150448.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b22893a494bc9ac640621fee65a3191e552215c --- /dev/null +++ b/funcom_test/1150448.txt @@ -0,0 +1,14 @@ +TDAT: public String join(String separator) throws JSONException { + int len = length(); + StringBuffer sb = new StringBuffer(); + + for (int i = 0; i < len; i += 1) { + if (i > 0) { + sb.append(separator); + } + sb.append(JSONObject.valueToString(this.myArrayList.elementAt(i))); + } + return sb.toString(); + } + COM: make a string from the contents of this jsonarray + diff --git a/funcom_test/11758866.txt b/funcom_test/11758866.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0e9e5417da144771dcfe5b734bd39b8af0c32c6 --- /dev/null +++ b/funcom_test/11758866.txt @@ -0,0 +1,18 @@ +TDAT: public GlobalState getGlobalState() { + if (MainConfiguration.getSingleton().staticGlobalState) { + return GlobalStateServer.getStaticallySharedGlobalState(); + } else { + // check if you are server first + GlobalStateServer server = (GlobalStateServer) getPeerletOfType(GlobalStateServer.class); + if (server != null) { + return server.getGlobalState(); + } + GlobalStateClient client = (GlobalStateClient) getPeerletOfType(GlobalStateClient.class); + if (client != null) { + return client.getGlobalState(); + } + return null; + } + } + COM: a convenience method returns an instance of the code global state code + diff --git a/funcom_test/11758890.txt b/funcom_test/11758890.txt new file mode 100644 index 0000000000000000000000000000000000000000..fe5ef054f18317abbc544e79a80f7d1c22b6e606 --- /dev/null +++ b/funcom_test/11758890.txt @@ -0,0 +1,22 @@ +TDAT: public void incomingConnectionCompleted(Connection connection) { + + assert incomingConnections.contains(connection); + incomingConnections.remove(connection); + + Message message = connection.getMessage(); + + if (logger.isDebugEnabled()) { + StringBuffer sb = new StringBuffer(); + sb.append("Peer "); + sb.append(getNetworkAddress()); + sb.append(" received a "); + sb.append(message.getClass().getSimpleName()); + sb.append(" from "); + sb.append(message.getSourceAddress()); + logger.debug(sb.toString()); + } + + fireMessageReceived(message.getSourceAddress(), message); + } + COM: called by the network model when the complete message + diff --git a/funcom_test/11758920.txt b/funcom_test/11758920.txt new file mode 100644 index 0000000000000000000000000000000000000000..79f2208fa09c9d1547577fa2ad68e40629e5bd8a --- /dev/null +++ b/funcom_test/11758920.txt @@ -0,0 +1,25 @@ +TDAT: public void addBWRel(BWRel r) { + + assert tmpToFix.isEmpty(); + assert toFix.isEmpty(); + assert newRates.isEmpty(); + + /* + * calls defreeze on the server and the client of the connection + * which adds them to toFix set and their neighbors to tmpToFix + */ + r.getClient().add(r); + r.getServer().add(r); + + /* + * call management function in order to reallocate + * bandwidth across all network nodes + */ + reallocate(); + + assert tmpToFix.isEmpty(); + assert toFix.isEmpty(); + + } + COM: adds a new bandwidth relation to the network + diff --git a/funcom_test/11758923.txt b/funcom_test/11758923.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce579861c442b5ad2e392a835225b6809c42ccd5 --- /dev/null +++ b/funcom_test/11758923.txt @@ -0,0 +1,23 @@ +TDAT: public void removeBWRel(BWRel r) { + + assert tmpToFix.isEmpty(); + assert toFix.isEmpty(); + assert newRates.isEmpty(); + + /* + * calls defreeze on the server and the client of the connection + * which adds tmpToFix set with distance 1 (this triggers the correct + * behavior as distance-1-neighbors can increase the bandwidth of their + * connections) + */ + r.getServer().del(r); + r.getClient().del(r); + + reallocate(); + + assert tmpToFix.isEmpty(); + assert toFix.isEmpty(); + + } + COM: removes the bandwidth relation code r code from the network + diff --git a/funcom_test/11758940.txt b/funcom_test/11758940.txt new file mode 100644 index 0000000000000000000000000000000000000000..1de78473d2a43bc9d0d04e277582f657bce6bbbd --- /dev/null +++ b/funcom_test/11758940.txt @@ -0,0 +1,13 @@ +TDAT: public void freeze(double newRate, BWNode lbNode) { + frozen = true; + BWNode rbNode = getOtherNode(lbNode); + + rbNode.removeCon(this); // do not adjust the rate while the relation is in rbCons + + rate = newRate; + OriginalImpl.newRates.put(connection, Bandwidth.inBitPerMillisecond(newRate)); + + rbNode.addRBCon(this); + } + COM: freezes this connection i + diff --git a/funcom_test/11758969.txt b/funcom_test/11758969.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ea8001f313abebed2ee79dfd2ccec3deb33a661 --- /dev/null +++ b/funcom_test/11758969.txt @@ -0,0 +1,18 @@ +TDAT: private void addToTmpToFix(Iterator rels, int dist, BWNode exclude) { + while (rels.hasNext()) { + BWRel r = rels.next(); + r.defreeze(); + BWNode other = r.getOtherNode(this); + + if (!other.equals(exclude)) { + other.setDistance(dist); + getTmpToFixSet().add(other); + } + + if (other.isReached()) { + other.calculateBWProCapite(); + } + } + } + COM: iterates over the bwrels code rels code originating at this node and + diff --git a/funcom_test/11759001.txt b/funcom_test/11759001.txt new file mode 100644 index 0000000000000000000000000000000000000000..a77f43d697ec0401e5106a9eaff6283d71041ae9 --- /dev/null +++ b/funcom_test/11759001.txt @@ -0,0 +1,21 @@ +TDAT: public void defreeze(BWNode altro) { + + assert (distance >= 0) : "defreeze() invoked for a node with invalid distance"; + + if (distance == 0) { + initialDefreeze(altro); + } else if (distance == 1) { + defreeze1HOP(); + } else if (distance == 2) { + defreeze2HOP(); + } else if (distance == 3) { + defreeze3HOP(); + } + + setBWProCapite(calculateBWProCapite()); + getToFixSet().add(this); + getTmpToFixSet().remove(this); + reached = true; + } + COM: this function is called when a new connection is established or an old + diff --git a/funcom_test/11759212.txt b/funcom_test/11759212.txt new file mode 100644 index 0000000000000000000000000000000000000000..49720837b67970bfac90e769d9a06e5ab97f51a3 --- /dev/null +++ b/funcom_test/11759212.txt @@ -0,0 +1,10 @@ +TDAT: public void mergeIn(Scenario newScenario, int peerIndexNumberFilter, double timeFilter) { + for (ScenarioEvent scenarioEvent : newScenario.scenarioEvents) { + if (scenarioEvent.getExecutionTime() > timeFilter + && scenarioEvent.indexNumberMatches(peerIndexNumberFilter)) { + this.scenarioEvents.add(scenarioEvent); + } + } + } + COM: merges in the events from the code new scenario code into this + diff --git a/funcom_test/11759225.txt b/funcom_test/11759225.txt new file mode 100644 index 0000000000000000000000000000000000000000..a173234c7c5bbd15c6921d3ae9cb419f9e012f99 --- /dev/null +++ b/funcom_test/11759225.txt @@ -0,0 +1,21 @@ +TDAT: public void executeMethodOnPeer(Peer peer) { + try { + methodToCall.setAccessible(true); + if (clazz == Peer.class) { + methodToCall.invoke(peer); + } else { + Object target = peer.getPeerletOfType(clazz); + if (target == null) { + logger.error(getGeneralFailureString(peer) + ": peerlet of type " + clazz.getCanonicalName() + + " not found"); + return; + } else { + methodToCall.invoke(target); + } + } + } catch (Exception e) { + logger.error(getGeneralFailureString(peer), e); + } + } + COM: executes the code method code of the event on the code peer code + diff --git a/funcom_test/11759898.txt b/funcom_test/11759898.txt new file mode 100644 index 0000000000000000000000000000000000000000..baba98a4a3dcef1a58a4cea9a319b502e56e8fbe --- /dev/null +++ b/funcom_test/11759898.txt @@ -0,0 +1,12 @@ +TDAT: public void markStart(Object tag) { + synchronized (pair2startTimeMap) { + pair2startTimeMap.put(tag, clock.getCurrentTime()); + // FIXME it probably makes more sense to run the garbage collection + // periodically instead of allocating the timer every time + Timer removalTimer = clock.createNewTimer(); + removalTimer.addTimerListener(new GarbageCollectionTimerListener(tag)); + removalTimer.schedule(Time.inMilliseconds(maxWait)); + } + } + COM: marks the start of the interval + diff --git a/funcom_test/11759899.txt b/funcom_test/11759899.txt new file mode 100644 index 0000000000000000000000000000000000000000..da642f6ae21cc6e6b5ea8cc1e3c54e685aa8d461 --- /dev/null +++ b/funcom_test/11759899.txt @@ -0,0 +1,23 @@ +TDAT: public void loadFromFile(String filename) throws ConfigurationException { + InputStream propertiesStream = null; + try { + propertiesStream = new FileInputStream(filename); + Properties properties = new Properties(); + properties.load(propertiesStream); + loadFromProperties(properties); + } catch (ConfigurationException e) { + throw e; + } catch (Exception e) { + throw new ConfigurationException(e); + } finally { + if (propertiesStream != null) { + try { + propertiesStream.close(); + } catch (IOException e) { + throw new ConfigurationException(e); + } + } + } + } + COM: loads the configuration from a file in the java properties format + diff --git a/funcom_test/11759954.txt b/funcom_test/11759954.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a43ec2fa1618cb1c57bbe7785f6d227e3be6d64 --- /dev/null +++ b/funcom_test/11759954.txt @@ -0,0 +1,10 @@ +TDAT: public void initPeers(int startIndex, int numPeers, PeerFactory peerFactory) { + for (int peerIndex = startIndex; peerIndex < startIndex + numPeers; peerIndex++) { + Peer peer = peerFactory.createPeer(peerIndex, this); + peer.init(networkInterfaceFactory, createClock(), getAddressToBindTo(peerIndex)); + peers.setSize(startIndex + numPeers); + peers.setElementAt(peer, peerIndex); + } + } + COM: creates and initializes the peers + diff --git a/funcom_test/11761439.txt b/funcom_test/11761439.txt new file mode 100644 index 0000000000000000000000000000000000000000..59a72c53307b0316770e6205e0b22ec68b46f7da --- /dev/null +++ b/funcom_test/11761439.txt @@ -0,0 +1,13 @@ +TDAT: public void setBootstrapPeers(Collection bootstrapPeers){ + synchronized(this.view){ + for(Finger peer:bootstrapPeers){ + FingerDescriptor descriptor=new FingerDescriptor(peer.clone()); + this.ageManager.initAge(descriptor); + this.getView().add(descriptor); + } + //gurantees there are no more than c nodes in the view at the beginning + this.select(new ArrayList()); + } + } + COM: initializes the view with the initial bootstrap neighbors + diff --git a/funcom_test/11761448.txt b/funcom_test/11761448.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3a41115d70b25a9c91c46955f5e79a3ec4afd87 --- /dev/null +++ b/funcom_test/11761448.txt @@ -0,0 +1,12 @@ +TDAT: public FingerDescriptor selectPeer(){ + switch(policy){ + case RAND: + return this.getView().get((int)(Math.random()*this.getView().size())); + case OLD: + return this.ageManager.getOldestDescriptor(this.view); + default: + return null; //no defined policy + } + } + COM: selects a peer from the view to gossip with + diff --git a/funcom_test/11761458.txt b/funcom_test/11761458.txt new file mode 100644 index 0000000000000000000000000000000000000000..b7f0a1b430bc5b36ed56a16ccc8987fcd5ba4e61 --- /dev/null +++ b/funcom_test/11761458.txt @@ -0,0 +1,14 @@ +TDAT: public FingerDescriptor getOldestDescriptor(List neighbors){ + if(neighbors.size()>0){ + FingerDescriptor oldest=neighbors.get(0);//(int)(Math.random()*neighbors.size()) + for(FingerDescriptor neighbor:neighbors){ + if(isOlder(neighbor, oldest)){ + oldest=neighbor; + } + } + return oldest; + } + return null; + } + COM: finds the oldest finger descriptor from a list of them + diff --git a/funcom_test/11761477.txt b/funcom_test/11761477.txt new file mode 100644 index 0000000000000000000000000000000000000000..859d43108008bb07760a63082f121ab193235993 --- /dev/null +++ b/funcom_test/11761477.txt @@ -0,0 +1,9 @@ +TDAT: public FingerDescriptor clone(){ + FingerDescriptor fingerDescriptor=new FingerDescriptor(this.getFinger().clone()); + HashMap descriptors=new HashMap(); + descriptors.putAll(this.getDescriptors()); + fingerDescriptor.setDescriptors(descriptors); + return fingerDescriptor; + } + COM: clones the descriptor by copying the finger and the descriptor types + diff --git a/funcom_test/11761494.txt b/funcom_test/11761494.txt new file mode 100644 index 0000000000000000000000000000000000000000..6969136d1739b0fad1623de0ad3a058cdc90de61 --- /dev/null +++ b/funcom_test/11761494.txt @@ -0,0 +1,13 @@ +TDAT: private void bootstrap(){ + Timer bootstrapTimer= getPeer().getClock().createNewTimer(); + bootstrapTimer.addTimerListener(new TimerListener(){ + public void timerExpired(Timer timer){ + viewManager.setBootstrapPeers(getNeighborManager().getNeighbors()); + scheduleMeasurements(); + runActiveState(); + } + }); + bootstrapTimer.schedule(B); + } + COM: bootstraps and runs the system + diff --git a/funcom_test/11761563.txt b/funcom_test/11761563.txt new file mode 100644 index 0000000000000000000000000000000000000000..c30f9905cc8d784e5ffd3aec91eaa392d848af5a --- /dev/null +++ b/funcom_test/11761563.txt @@ -0,0 +1,15 @@ +TDAT: public void getGCBlocks() { + if (logger.isDebugEnabled()) { + logger.debug("G2G lookup triggered"); + } + grandChildren = new Vector(); + alreadyRequestedGrandchildren = new Vector(); + for (Finger peer : getInterestedPeers()) { + // send request for children to interested peer + getPeer().sendMessage(peer.getNetworkAddress(), new G2GChildrenRequestMessage()); + } + + triggerG2gTimer.schedule(triggerG2gInterval); + } + COM: starts search for list of blocks that grandchildren of this peer + diff --git a/funcom_test/11761627.txt b/funcom_test/11761627.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b23a663d4bdffd18597feae8dc06a03d2a7cd56 --- /dev/null +++ b/funcom_test/11761627.txt @@ -0,0 +1,10 @@ +TDAT: public void allocateChunk(VideoChunk chunk, Data sizeInChunk) throws AllocationException { + if (sizeInChunk.isGreaterThan(unallocatedChunksize)) { + throw new AllocationException(chunk, this); + } + allocatedChunksizes.put(chunk, sizeInChunk); + unallocatedBlocksizes.put(chunk, sizeInChunk); + unallocatedChunksize = unallocatedChunksize.subtract(sizeInChunk); + } + COM: allocates a chunk to this frames + diff --git a/funcom_test/11761705.txt b/funcom_test/11761705.txt new file mode 100644 index 0000000000000000000000000000000000000000..11e56ccc736c0535aec3eeeccd80cfffbcb183a7 --- /dev/null +++ b/funcom_test/11761705.txt @@ -0,0 +1,26 @@ +TDAT: protected void createPeerlets() { + + createNeighborManagementPeerlets(); + + // state + StorageWrapper storageWrapper = createStorageWrapper(); + + setPeerState(createPeerState(storageWrapper)); + + // interested-management + addPeerlet(new InterestedClient(getPeerState())); + + RemoteChunksPeerlet rcp = new RemoteChunksPeerlet(getNeighborManager()); + addPeerlet(rcp); + addPeerlet(new BTInterestedServer(rcp, getPeerState())); + + // choke/unchoke + addPeerlet(new ChokePeerlet(getPeerState())); + + // Up/download + addPeerlet(new DownloadPeerlet(getPeerState())); + addPeerlet(new UploadPeerlet(getPeerState())); + + } + COM: peerlet creation function + diff --git a/funcom_test/11761754.txt b/funcom_test/11761754.txt new file mode 100644 index 0000000000000000000000000000000000000000..af9c074c650ed2f7718a41d1a2524a6dc954759e --- /dev/null +++ b/funcom_test/11761754.txt @@ -0,0 +1,19 @@ +TDAT: public void startBlockTransmission(PieceMessage message) { + Bandwidth currentBW = up.getRateLimit(); + Bandwidth newFairshare = currentBW.divideBy(transmissions.size()+1); + Time now = up.getPeer().getClock().getTime(); + + // Update old transmissions + for(Transmission t : transmissions) { + t.updateTransmission(lastUpdate, now, fairshare, newFairshare); + } + + // Create new transmission + transmissions.add(new Transmission(this, message, now, newFairshare)); + + // Update stored Bandwidth and Time + lastUpdate = now; + fairshare = newFairshare; + } + COM: this function is called when a new block transmission is started by the + diff --git a/funcom_test/11761778.txt b/funcom_test/11761778.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb77aa7fa54cbabd839f6f061577fce7647a0421 --- /dev/null +++ b/funcom_test/11761778.txt @@ -0,0 +1,14 @@ +TDAT: public void updateRate(Data amount, Time now) { + Time oldTime = last.subtract(rateSince); + Data oldData = Converter.getData(rate, oldTime); + Data allData = oldData.add(amount); + Time allTime = now.subtract(rateSince).add(Time.inMilliseconds(0.001)); + + rate = Converter.getBandwidth(allData, allTime); + last = now; + if (rateSince.isLowerThan(now.subtract(maxRatePeriod))) { + rateSince = now.subtract(maxRatePeriod); + } + } + COM: updates the traffic rate with code amount code at time + diff --git a/funcom_test/11761872.txt b/funcom_test/11761872.txt new file mode 100644 index 0000000000000000000000000000000000000000..6b628b1e1462e44ff5846d4936fe0c5a92139a1e --- /dev/null +++ b/funcom_test/11761872.txt @@ -0,0 +1,16 @@ +TDAT: private void handleCancelMessage(CancelMessage message) { + FileSharingNeighborManager nm = state.getNeighborManager(); + Finger remotePeer = nm.getNeighborByNetworkAddress( + message.getSourceAddress()); + + if (remotePeer != null) { + ConnectionState cs = nm.getConnectionState(remotePeer); + if (cs != null) { + BlockDescriptor block = new BlockDescriptor( + message.getChunkIndex(), message.getBlockIndex()); + cs.removeRequest(block); + } + } + } + COM: cancels the request of a block of the peer which sent this messages + diff --git a/funcom_test/11761882.txt b/funcom_test/11761882.txt new file mode 100644 index 0000000000000000000000000000000000000000..0f38930ac2ff3dac4a0989a268c24880c4ab6116 --- /dev/null +++ b/funcom_test/11761882.txt @@ -0,0 +1,15 @@ +TDAT: protected void handleChokeMessage(ChokeMessage message, Finger remotePeer) { + ConnectionState cs = state.getNeighborManager().getConnectionState( + remotePeer); + if (cs != null) { + cs.setPeerChoking(true); + + // clear requested blocks from this peer + StorageWrapper sw = state.getStorageWrapper(); + for (BlockDescriptor block : sw.getRequestedBlocks(remotePeer)) { + sw.setBlockRequestCanceled(block, remotePeer); + } + } + } + COM: sets the code remote peer code s status to choking and cancel all + diff --git a/funcom_test/11761886.txt b/funcom_test/11761886.txt new file mode 100644 index 0000000000000000000000000000000000000000..28de96e5068e9fbd5a6b9dfa93a12530265c22c3 --- /dev/null +++ b/funcom_test/11761886.txt @@ -0,0 +1,18 @@ +TDAT: protected void handlePieceMessage(PieceMessage message, Finger remotePeer) { + AbstractBlock block = message.getBlock(); + state.getStorageWrapper().setBlockDownloaded(block, remotePeer, + getPeer().getClock().getTime()); + + blockReceived(block, remotePeer); + + cancelRemainingRequests(block); + + ConnectionState cs = state.getNeighborManager().getConnectionState( + remotePeer); + if (cs != null && !cs.isPeerChoking()) { + // send new request + requestBlock(remotePeer); + } + } + COM: notifies the storage wrapper that a new block is downloaded sends a new + diff --git a/funcom_test/11761909.txt b/funcom_test/11761909.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7a14599e45baedbfb1dd483303020995b807d83 --- /dev/null +++ b/funcom_test/11761909.txt @@ -0,0 +1,15 @@ +TDAT: protected void sendTrackerMessage(TrackerRequestMessage.EVENT event, int number) { + + double completed = ((FileSharingPeer) + getPeer()).getStorageWrapper().getCompletedFraction(); + + Message m = new TrackerRequestMessage(getPeer().getIdentifier(), + event, completed, number); + getPeer().sendMessage(trackerAddress, m); + + // reschedule timer + sendAliveTimer.cancel(); + sendAliveTimer.schedule(aliveInterval); + } + COM: sends a code tracker request message code to the tracker + diff --git a/funcom_test/11761989.txt b/funcom_test/11761989.txt new file mode 100644 index 0000000000000000000000000000000000000000..e4ffd83cf7fc3a27c520bc0763105bcfa5232ffb --- /dev/null +++ b/funcom_test/11761989.txt @@ -0,0 +1,15 @@ +TDAT: private void handleHandshakeMessage(HandshakeMessage message) { + NetworkAddress remoteAddress = message.getSourceAddress(); + Message response = null; + if (neighborManager.incomingConnectionAllowed()) { + response = new AcceptHandshakeMessage(getPeer().getIdentifier()); + Finger pendingNeighbor = new Finger( + message.getSourceAddress(), message.getPeerId()); + addPendingNeighbor(pendingNeighbor); + } else { + response = new RejectHandshakeMessage(getPeer().getIdentifier()); + } + getPeer().sendMessage(remoteAddress, response); + } + COM: the remote peer wants to initiate a connection by sending this message + diff --git a/funcom_test/1189466.txt b/funcom_test/1189466.txt new file mode 100644 index 0000000000000000000000000000000000000000..0158872d6be97ac696c7f50085703e7f5ab2fc8f --- /dev/null +++ b/funcom_test/1189466.txt @@ -0,0 +1,8 @@ +TDAT: public int blocksAccessed() { + // create a dummy TableInfo object to calculate record length + TableInfo ti = new TableInfo("", srcplan.schema()); + double rpb = (double) (BLOCK_SIZE / ti.recordLength()); + return (int) Math.ceil(srcplan.recordsOutput() / rpb); + } + COM: returns the estimated number of blocks in the + diff --git a/funcom_test/1189496.txt b/funcom_test/1189496.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a2f6c9d16b48414befbf4bea5c6a2b6f07a6ef3 --- /dev/null +++ b/funcom_test/1189496.txt @@ -0,0 +1,17 @@ +TDAT: public boolean next() { + if (!moregroups) + return false; + for (AggregationFn fn : aggfns) + fn.processFirst(s); + groupval = new GroupValue(s, groupfields); + while(moregroups = s.next()) { + GroupValue gv = new GroupValue(s, groupfields); + if (!groupval.equals(gv)) + break; + for (AggregationFn fn : aggfns) + fn.processNext(s); + } + return true; + } + COM: moves to the next group + diff --git a/funcom_test/1189507.txt b/funcom_test/1189507.txt new file mode 100644 index 0000000000000000000000000000000000000000..643baa97d9e86d226ddd795475657b97f45e18a6 --- /dev/null +++ b/funcom_test/1189507.txt @@ -0,0 +1,12 @@ +TDAT: private FileChannel getFile(String filename) throws IOException { + FileChannel fc = openFiles.get(filename); + if (fc == null) { + File dbTable = new File(dbDirectory, filename); + RandomAccessFile f = new RandomAccessFile(dbTable, "rws"); + fc = f.getChannel(); + openFiles.put(filename, fc); + } + return fc; + } + COM: returns the file channel for the specified filename + diff --git a/funcom_test/1189516.txt b/funcom_test/1189516.txt new file mode 100644 index 0000000000000000000000000000000000000000..249aa1e3c7fdf908baf34df260e043ee52e1a211 --- /dev/null +++ b/funcom_test/1189516.txt @@ -0,0 +1,12 @@ +TDAT: public Plan makeJoinPlan(Plan current) { + Schema currsch = current.schema(); + Predicate joinpred = mypred.joinPred(myschema, currsch); + if (joinpred == null) + return null; + Plan p = makeIndexJoin(current, currsch); + if (p == null) + p = makeProductJoin(current, currsch); + return p; + } + COM: constructs a join plan of the specified plan + diff --git a/funcom_test/1189597.txt b/funcom_test/1189597.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c7c4689278b66514778d8a4e2fc539efaa3b7b2 --- /dev/null +++ b/funcom_test/1189597.txt @@ -0,0 +1,14 @@ +TDAT: public Constant equatesWithConstant(String fldname) { + if (lhs.isFieldName() && + lhs.asFieldName().equals(fldname) && + rhs.isConstant()) + return rhs.asConstant(); + else if (rhs.isFieldName() && + rhs.asFieldName().equals(fldname) && + lhs.isConstant()) + return lhs.asConstant(); + else + return null; + } + COM: determines if this term is of the form f c + diff --git a/funcom_test/1189603.txt b/funcom_test/1189603.txt new file mode 100644 index 0000000000000000000000000000000000000000..17076be27457da81138e7a21ca6b7d7391887157 --- /dev/null +++ b/funcom_test/1189603.txt @@ -0,0 +1,14 @@ +TDAT: public String equatesWithField(String fldname) { + if (lhs.isFieldName() && + lhs.asFieldName().equals(fldname) && + rhs.isFieldName()) + return rhs.asFieldName(); + else if (rhs.isFieldName() && + rhs.asFieldName().equals(fldname) && + lhs.isFieldName()) + return lhs.asFieldName(); + else + return null; + } + COM: determines if this term is of the form f1 f2 + diff --git a/funcom_test/1189712.txt b/funcom_test/1189712.txt new file mode 100644 index 0000000000000000000000000000000000000000..03317559101ae0ee3a74084d2674c286eb4d6d02 --- /dev/null +++ b/funcom_test/1189712.txt @@ -0,0 +1,10 @@ +TDAT: public int setInt(Buffer buff, int offset, int newval) { + int oldval = buff.getInt(offset); + Block blk = buff.block(); + if (isTempBlock(blk)) + return -1; + else + return new SetIntRecord(txnum, blk, offset, oldval).writeToLog(); + } + COM: writes a setint record to the log and returns its lsn + diff --git a/funcom_test/1189718.txt b/funcom_test/1189718.txt new file mode 100644 index 0000000000000000000000000000000000000000..78daff90015c182b41341b27aafcf8c62a24871d --- /dev/null +++ b/funcom_test/1189718.txt @@ -0,0 +1,10 @@ +TDAT: public int setString(Buffer buff, int offset, String newval) { + String oldval = buff.getString(offset); + Block blk = buff.block(); + if (isTempBlock(blk)) + return -1; + else + return new SetStringRecord(txnum, blk, offset, oldval).writeToLog(); + } + COM: writes a setstring record to the log and returns its lsn + diff --git a/funcom_test/1189726.txt b/funcom_test/1189726.txt new file mode 100644 index 0000000000000000000000000000000000000000..d95a48a7309248b0376b6d1858ba41012f6b0cb8 --- /dev/null +++ b/funcom_test/1189726.txt @@ -0,0 +1,13 @@ +TDAT: private void doRollback() { + Iterator iter = new LogRecordIterator(); + while (iter.hasNext()) { + LogRecord rec = iter.next(); + if (rec.txNumber() == txnum) { + if (rec.op() == START) + return; + rec.undo(txnum); + } + } + } + COM: rolls back the transaction + diff --git a/funcom_test/1189730.txt b/funcom_test/1189730.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2f89b364ef4d01cbbc557b35016e1cab3852f5d --- /dev/null +++ b/funcom_test/1189730.txt @@ -0,0 +1,8 @@ +TDAT: public void setInt(Block blk, int offset, int val) { + concurMgr.xLock(blk); + Buffer buff = myBuffers.getBuffer(blk); + int lsn = recoveryMgr.setInt(buff, offset, val); + buff.setInt(offset, val, txnum, lsn); + } + COM: stores an integer at the specified offset + diff --git a/funcom_test/1189741.txt b/funcom_test/1189741.txt new file mode 100644 index 0000000000000000000000000000000000000000..7d6a6427998a7a128b44b2bd2dac5ffd3b765d25 --- /dev/null +++ b/funcom_test/1189741.txt @@ -0,0 +1,8 @@ +TDAT: public void setString(Block blk, int offset, String val) { + concurMgr.xLock(blk); + Buffer buff = myBuffers.getBuffer(blk); + int lsn = recoveryMgr.setString(buff, offset, val); + buff.setString(offset, val, txnum, lsn); + } + COM: stores a string at the specified offset + diff --git a/funcom_test/1189764.txt b/funcom_test/1189764.txt new file mode 100644 index 0000000000000000000000000000000000000000..92deba2a928c0af6350fab1d7f294690abd358d5 --- /dev/null +++ b/funcom_test/1189764.txt @@ -0,0 +1,11 @@ +TDAT: public int search(Constant searchkey) { + Block childblk = findChildBlock(searchkey); + while (contents.getFlag() > 0) { + contents.close(); + contents = new BTreePage(childblk, ti, tx); + childblk = findChildBlock(searchkey); + } + return childblk.number(); + } + COM: returns the block number of the b tree leaf block + diff --git a/funcom_test/1189767.txt b/funcom_test/1189767.txt new file mode 100644 index 0000000000000000000000000000000000000000..71f5e83f9cfba8797e696869f901507036150ce3 --- /dev/null +++ b/funcom_test/1189767.txt @@ -0,0 +1,11 @@ +TDAT: public void makeNewRoot(DirEntry e) { + Constant firstval = contents.getDataVal(0); + int level = contents.getFlag(); + Block newblk = contents.split(0, level); //ie, transfer all the records + DirEntry oldroot = new DirEntry(firstval, newblk.number()); + insertEntry(oldroot); + insertEntry(e); + contents.setFlag(level+1); + } + COM: creates a new root block for the b tree + diff --git a/funcom_test/1189770.txt b/funcom_test/1189770.txt new file mode 100644 index 0000000000000000000000000000000000000000..3a93f12aff6ec64d42217f8795b5218ad49d9da7 --- /dev/null +++ b/funcom_test/1189770.txt @@ -0,0 +1,11 @@ +TDAT: public DirEntry insert(DirEntry e) { + if (contents.getFlag() == 0) + return insertEntry(e); + Block childblk = findChildBlock(e.dataVal()); + BTreeDir child = new BTreeDir(childblk, ti, tx); + DirEntry myentry = child.insert(e); + child.close(); + return (myentry != null) ? insertEntry(myentry) : null; + } + COM: inserts a new directory entry into the b tree block + diff --git a/funcom_test/1189778.txt b/funcom_test/1189778.txt new file mode 100644 index 0000000000000000000000000000000000000000..2e9fd59cb2e5fe24032a3a252eec144174c99ccf --- /dev/null +++ b/funcom_test/1189778.txt @@ -0,0 +1,9 @@ +TDAT: public void format(Page page) { + page.setInt(0, flag); + page.setInt(INT_SIZE, 0); // #records = 0 + int recsize = ti.recordLength(); + for (int pos=2*INT_SIZE; pos+recsize<=BLOCK_SIZE; pos += recsize) + makeDefaultRecord(page, pos); + } + COM: formats the page by initializing as many index record slots + diff --git a/funcom_test/1189780.txt b/funcom_test/1189780.txt new file mode 100644 index 0000000000000000000000000000000000000000..6bda3c1ac2a5c90ba17d888d2536dc0bb0f45097 --- /dev/null +++ b/funcom_test/1189780.txt @@ -0,0 +1,10 @@ +TDAT: public void beforeFirst(Constant searchkey) { + close(); + BTreeDir root = new BTreeDir(rootblk, dirTi, tx); + int blknum = root.search(searchkey); + root.close(); + Block leafblk = new Block(leafTi.fileName(), blknum); + leaf = new BTreeLeaf(leafblk, leafTi, searchkey, tx); + } + COM: traverses the directory to find the leaf block corresponding + diff --git a/funcom_test/1189784.txt b/funcom_test/1189784.txt new file mode 100644 index 0000000000000000000000000000000000000000..11184bae7a604da43e603458b3165dc217cb654f --- /dev/null +++ b/funcom_test/1189784.txt @@ -0,0 +1,14 @@ +TDAT: public void insert(Constant dataval, RID datarid) { + beforeFirst(dataval); + DirEntry e = leaf.insert(datarid); + leaf.close(); + if (e == null) + return; + BTreeDir root = new BTreeDir(rootblk, dirTi, tx); + DirEntry e2 = root.insert(e); + if (e2 != null) + root.makeNewRoot(e2); + root.close(); + } + COM: inserts the specified record into the index + diff --git a/funcom_test/1189825.txt b/funcom_test/1189825.txt new file mode 100644 index 0000000000000000000000000000000000000000..3963dbeb6ec27e5da3142e9a82b6e62dbb84d24c --- /dev/null +++ b/funcom_test/1189825.txt @@ -0,0 +1,9 @@ +TDAT: public void insert(Constant val, RID rid) { + beforeFirst(val); + ts.insert(); + ts.setInt("block", rid.blockNumber()); + ts.setInt("id", rid.id()); + ts.setVal("dataval", val); + } + COM: inserts a new record into the table scan for the bucket + diff --git a/funcom_test/1189832.txt b/funcom_test/1189832.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d4301d06cc0e7ee7df618ef67cf67b6bd59d47b --- /dev/null +++ b/funcom_test/1189832.txt @@ -0,0 +1,8 @@ +TDAT: public void insertLeaf(int slot, Constant val, RID rid) { + insert(slot); + setVal(slot, "dataval", val); + setInt(slot, "block", rid.blockNumber()); + setInt(slot, "id", rid.id()); + } + COM: inserts a leaf index record at the specified slot + diff --git a/funcom_test/1189908.txt b/funcom_test/1189908.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7cdf35a224aecafbb4b61064f2b06c246fd8650 --- /dev/null +++ b/funcom_test/1189908.txt @@ -0,0 +1,10 @@ +TDAT: public void createIndex(String idxname, String tblname, String fldname, Transaction tx) { + RecordFile rf = new RecordFile(ti, tx); + rf.insert(); + rf.setString("indexname", idxname); + rf.setString("tablename", tblname); + rf.setString("fieldname", fldname); + rf.close(); + } + COM: creates an index of the specified type for the specified field + diff --git a/funcom_test/1189911.txt b/funcom_test/1189911.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dae39a5955332572bef823867d674aab9282809 --- /dev/null +++ b/funcom_test/1189911.txt @@ -0,0 +1,14 @@ +TDAT: private Schema schema() { + Schema sch = new Schema(); + sch.addIntField("block"); + sch.addIntField("id"); + if (ti.schema().type(fldname) == INTEGER) + sch.addIntField("dataval"); + else { + int fldlen = ti.schema().length(fldname); + sch.addStringField("dataval", fldlen); + } + return sch; + } + COM: returns the schema of the index records + diff --git a/funcom_test/1189912.txt b/funcom_test/1189912.txt new file mode 100644 index 0000000000000000000000000000000000000000..671f98839ecb875423512ee92f3ee8eadfd52eb3 --- /dev/null +++ b/funcom_test/1189912.txt @@ -0,0 +1,10 @@ +TDAT: public int blocksAccessed() { + // this guesses at the # of chunks + int avail = SimpleDB.bufferMgr().available(); + int size = new MaterializePlan(rhs, tx).blocksAccessed(); + int numchunks = size / avail; + return rhs.blocksAccessed() + + (lhs.blocksAccessed() * numchunks); + } + COM: returns an estimate of the number of block accesses + diff --git a/funcom_test/1189960.txt b/funcom_test/1189960.txt new file mode 100644 index 0000000000000000000000000000000000000000..8096fd815ae43a750e3f841fde15012f9e217304 --- /dev/null +++ b/funcom_test/1189960.txt @@ -0,0 +1,14 @@ +TDAT: public RemoteResultSet executeQuery(String qry) throws RemoteException { + try { + Transaction tx = rconn.getTransaction(); + Plan pln = SimpleDB.planner().createQueryPlan(qry, tx); + pln.blocksAccessed(); + return new RemoteResultSetImpl(pln, rconn); + } + catch(RuntimeException e) { + rconn.rollback(); + throw e; + } + } + COM: executes the specified sql query string + diff --git a/funcom_test/1189964.txt b/funcom_test/1189964.txt new file mode 100644 index 0000000000000000000000000000000000000000..de74c3522dd30aac952cfece9d82e2a89170063d --- /dev/null +++ b/funcom_test/1189964.txt @@ -0,0 +1,14 @@ +TDAT: public int executeUpdate(String cmd) throws RemoteException { + try { + Transaction tx = rconn.getTransaction(); + int result = SimpleDB.planner().executeUpdate(cmd, tx); + rconn.commit(); + return result; + } + catch(RuntimeException e) { + rconn.rollback(); + throw e; + } + } + COM: executes the specified sql update command + diff --git a/funcom_test/1189978.txt b/funcom_test/1189978.txt new file mode 100644 index 0000000000000000000000000000000000000000..d28e1a597574a03891130b567a9aebd23ef8f615 --- /dev/null +++ b/funcom_test/1189978.txt @@ -0,0 +1,13 @@ +TDAT: public Connection connect(String url, Properties prop) throws SQLException { + try { + String newurl = url.replace("jdbc:simpledb", "rmi") + "/simpledb"; + RemoteDriver rdvr = (RemoteDriver) Naming.lookup(newurl); + RemoteConnection rconn = rdvr.connect(); + return new SimpleConnection(rconn); + } + catch (Exception e) { + throw new SQLException(e); + } + } + COM: connects to the simple db server on the specified host + diff --git a/funcom_test/11940205.txt b/funcom_test/11940205.txt new file mode 100644 index 0000000000000000000000000000000000000000..bac6ecbe004e060ca67ba008323afd99cc9f9706 --- /dev/null +++ b/funcom_test/11940205.txt @@ -0,0 +1,16 @@ +TDAT: public WsmlEntityVo findMatchingWsmlEntityVo(Entity entity) { + + // create new Vo from parsed entity + WsmlEntityVo parsedWsmlEntityVo = new WsmlEntityVo(0, entity); + // compare with each serilized Vo + for (WsmlEntityVo serialWsmlEntityVo : this.getWsmlEntityVos()) { + // compare + if (serialWsmlEntityVo.equals(parsedWsmlEntityVo)) { + return serialWsmlEntityVo; + } + } + // if not found return null + return null; + } + COM: seraches linearly in list for given parsed wsml entity compares using + diff --git a/funcom_test/11940210.txt b/funcom_test/11940210.txt new file mode 100644 index 0000000000000000000000000000000000000000..f45b0df0542492d26285622051da4147b2d22462 --- /dev/null +++ b/funcom_test/11940210.txt @@ -0,0 +1,15 @@ +TDAT: private Concept getSelectedParent(Object parentObject) { + Concept parentConcept = null; + + if (parentObject instanceof Concept) + parentConcept = (Concept) parentObject; + else if (parentObject instanceof String) { + String parentName = ((String) parentObject); + if (parentName.equalsIgnoreCase("root concept")) + // assure parent is null, e.g. concept becomes global + parentConcept = null; + } + return parentConcept; + } + COM: casts parent element into an entity + diff --git a/funcom_test/11940244.txt b/funcom_test/11940244.txt new file mode 100644 index 0000000000000000000000000000000000000000..3f6fb74d4db4d13897c6dd0a2d77766928cd20f5 --- /dev/null +++ b/funcom_test/11940244.txt @@ -0,0 +1,19 @@ +TDAT: protected void setFields(Composite group) { + + // entity name + Label nameLabel = new Label(group, SWT.SINGLE); + nameLabel.setText("Name: "); + + nameText = new Text(group, SWT.SINGLE | SWT.BORDER); + + // entity Type + Label typeLabel = new Label(group, SWT.SINGLE); + typeLabel.setText("Type: "); + + this.typeText = new Text(group, SWT.SINGLE | SWT.BORDER); + + Label parentLabel = new Label(group, SWT.SINGLE); + parentLabel.setText("Parent: "); + } + COM: define the fields used in the grid and form layout examples + diff --git a/funcom_test/11940274.txt b/funcom_test/11940274.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed16affcf80d422bb1edd478a03107d2a80eb434 --- /dev/null +++ b/funcom_test/11940274.txt @@ -0,0 +1,28 @@ +TDAT: private void setRemapAction() { + + this.remapAction = new Action() { + + // action logic here + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IAction#run() + */ + @Override + public void run() { + remap(); + } + + }; + + // remapAction.setEnabled(false); + remapAction.setText("Remap Wsml Entity "); + /* + * remapAction.setImageDescriptor(PlatformUI.getWorkbench() + * .getSharedImages().getImageDescriptor( ISharedImages.IMG_TOOL_REDO)); + */ + remapAction.setImageDescriptor(REMAPIMAGE); + + } + COM: creates remap action + diff --git a/funcom_test/11940280.txt b/funcom_test/11940280.txt new file mode 100644 index 0000000000000000000000000000000000000000..0d9c3f62dff7d6f394cd5e6c941e7baf3d10e581 --- /dev/null +++ b/funcom_test/11940280.txt @@ -0,0 +1,14 @@ +TDAT: private void setSelectionInXsdTreeViewer(MappingVo selectedMappingVo) { + // get selected XsEntity Object + XsEntityVo selectedEntityVo = selectedMappingVo.getXsEntityVo(); + XmlItem selectedXmlItem = selectedMappingVo.getXsEntityVo() + .getXmlItem(); + + // expand and set Selection + int level = selectedEntityVo.getLevel(); + xsdViewer.expandToLevel(level + 1); + xsdViewer.setSelection(new StructuredSelection(selectedXmlItem)); + xsdViewer.refresh(); + } + COM: exapand to selection and highlight it in xsd view remark xsd tree + diff --git a/funcom_test/11940291.txt b/funcom_test/11940291.txt new file mode 100644 index 0000000000000000000000000000000000000000..b145f1f488e41b12257eb4281a4b17c0647486c7 --- /dev/null +++ b/funcom_test/11940291.txt @@ -0,0 +1,16 @@ +TDAT: private void createContextMenu() { + MenuManager mngr = new MenuManager(); + // create context menu + Menu contextMenu = mngr.createContextMenu(this.mappingTable + .getControl()); + // add to control + this.mappingTable.getControl().setMenu(contextMenu); + // add action to context menu + if (remapAction != null) { + mngr.add(remapAction); + } + mngr.add(this.viewAction); + + } + COM: creates a context menu for content viewer adds delete action to context + diff --git a/funcom_test/11940319.txt b/funcom_test/11940319.txt new file mode 100644 index 0000000000000000000000000000000000000000..02d375347e37237d8b959863dbc2f262efc3903d --- /dev/null +++ b/funcom_test/11940319.txt @@ -0,0 +1,22 @@ +TDAT: public void traverseGlobalNodes() { + Node currentGlobalNode = root.getFirstChild(); + + while (currentGlobalNode != null) { + // logic of processing here + + // traverse + XmlItem globalItem = traverseNode(currentGlobalNode); + if (globalItem != null) + this.globalItems.add(globalItem); + // process next + currentGlobalNode = currentGlobalNode.getNextSibling(); + } + try { + this.is.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + COM: processes each of the global elements elements that are children of + diff --git a/funcom_test/11940384.txt b/funcom_test/11940384.txt new file mode 100644 index 0000000000000000000000000000000000000000..95fbd73e26b821f5450bd8b1b7bd1d13a44b6cc2 --- /dev/null +++ b/funcom_test/11940384.txt @@ -0,0 +1,17 @@ +TDAT: private void processFileName(String absFilePath) { + File file = new File(absFilePath); + // set project path and project name = name of xsd file + Constants.PROJECTNAME = Utility.getFileName(file.getName()); + Constants.PROJECTPATH = file.getParent() + "/"; + + Constants.XSDFILE = absFilePath; + // Constants.XSDFILE = Constants.XSDFILETEST; + + Constants.WSMLFILE = Constants.PROJECTPATH + Constants.PROJECTNAME + + ".wsml"; + Constants.MPJFILE = Constants.PROJECTPATH + Constants.PROJECTNAME + + ".mpj"; + + } + COM: sets project file name + diff --git a/funcom_test/11950086.txt b/funcom_test/11950086.txt new file mode 100644 index 0000000000000000000000000000000000000000..c91ea13c67a4131af94edd480d84dd937332bbce --- /dev/null +++ b/funcom_test/11950086.txt @@ -0,0 +1,14 @@ +TDAT: public void testGetNumeroBus() { + System.out.println("getNumeroBus"); + + Cronograma instance = null; + + String expResult = ""; + String result = instance.getNumeroBus(); + assertEquals(expResult, result); + + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + COM: test of get numero bus method of class proyectoventadepasajes + diff --git a/funcom_test/11950091.txt b/funcom_test/11950091.txt new file mode 100644 index 0000000000000000000000000000000000000000..ed42cb99cbf5e64f2c25927ed8141abc3779448a --- /dev/null +++ b/funcom_test/11950091.txt @@ -0,0 +1,13 @@ +TDAT: public void testSetNumeroBus() { + System.out.println("setNumeroBus"); + + String numeroBus = ""; + Cronograma instance = null; + + instance.setNumeroBus(numeroBus); + + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + COM: test of set numero bus method of class proyectoventadepasajes + diff --git a/funcom_test/11950096.txt b/funcom_test/11950096.txt new file mode 100644 index 0000000000000000000000000000000000000000..f77539c8294d61e0fb57b93e0ff8610e33772ac6 --- /dev/null +++ b/funcom_test/11950096.txt @@ -0,0 +1,14 @@ +TDAT: public void testGetDestino() { + System.out.println("getDestino"); + + Cronograma instance = null; + + String expResult = ""; + String result = instance.getDestino(); + assertEquals(expResult, result); + + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + COM: test of get destino method of class proyectoventadepasajes + diff --git a/funcom_test/11950106.txt b/funcom_test/11950106.txt new file mode 100644 index 0000000000000000000000000000000000000000..9735c90688b395d26682cd63c1aad9411a24f27b --- /dev/null +++ b/funcom_test/11950106.txt @@ -0,0 +1,14 @@ +TDAT: public void testGetFecha() { + System.out.println("getFecha"); + + Cronograma instance = null; + + String expResult = ""; + String result = instance.getFecha(); + assertEquals(expResult, result); + + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + COM: test of get fecha method of class proyectoventadepasajes + diff --git a/funcom_test/11950115.txt b/funcom_test/11950115.txt new file mode 100644 index 0000000000000000000000000000000000000000..326385af7b6ad6787639a8582a7ea106b62ca66f --- /dev/null +++ b/funcom_test/11950115.txt @@ -0,0 +1,14 @@ +TDAT: public void testGetHora() { + System.out.println("getHora"); + + Cronograma instance = null; + + String expResult = ""; + String result = instance.getHora(); + assertEquals(expResult, result); + + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + COM: test of get hora method of class proyectoventadepasajes + diff --git a/funcom_test/11950127.txt b/funcom_test/11950127.txt new file mode 100644 index 0000000000000000000000000000000000000000..66836238795a5c6261cecc80d1f12fa1f341dc97 --- /dev/null +++ b/funcom_test/11950127.txt @@ -0,0 +1,14 @@ +TDAT: public void testToString() { + System.out.println("toString"); + + Cronograma instance = null; + + String expResult = ""; + String result = instance.toString(); + assertEquals(expResult, result); + + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + COM: test of to string method of class proyectoventadepasajes + diff --git a/funcom_test/11950130.txt b/funcom_test/11950130.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a75304444d3afa4cc0a86a5e65bd241ebc865ff --- /dev/null +++ b/funcom_test/11950130.txt @@ -0,0 +1,14 @@ +TDAT: public void testGetCodigo() { + System.out.println("getCodigo"); + + Cronograma instance = null; + + String expResult = ""; + String result = instance.getCodigo(); + assertEquals(expResult, result); + + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + COM: test of get codigo method of class proyectoventadepasajes + diff --git a/funcom_test/12022371.txt b/funcom_test/12022371.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ba66c12c879717c6e8ae45e901f333a7caabecf --- /dev/null +++ b/funcom_test/12022371.txt @@ -0,0 +1,7 @@ +TDAT: public CalendarDate getRemoteLocalDate() { + StringBuffer stringBuffer = new StringBuffer("GMT"); + stringBuffer.append(offsetToString(_offset)); + return Gregorian.getGregorianCalendar().getCalendarDate(_utcTime, TimeZone.getTimeZone(stringBuffer.toString())); + } + COM: returns b u transported u b locale time + diff --git a/funcom_test/12074406.txt b/funcom_test/12074406.txt new file mode 100644 index 0000000000000000000000000000000000000000..13fe70ec4393b7a350bcbe341cb53044a140bb8a --- /dev/null +++ b/funcom_test/12074406.txt @@ -0,0 +1,19 @@ +TDAT: private PreferenceStore getPreferenceStore(final Shell shell) { + try { + final File preferencesFile = new File("preferences.properties"); //$NON-NLS-1$ + PreferenceStore store; + + if (!preferencesFile.exists()) { + // create new preferences file + preferencesFile.createNewFile(); + } + + store = new PreferenceStore(preferencesFile.getName()); + store.load(); + return store; + } catch (final IOException e) { + throw new PhotoListerException("Unable to load preferences."); //$NON-NLS-1$ + } + } + COM: creates and the code preference store code for this application + diff --git a/funcom_test/12074447.txt b/funcom_test/12074447.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2b488d7fb95e49457e221deb06cf0c63ec15b16 --- /dev/null +++ b/funcom_test/12074447.txt @@ -0,0 +1,12 @@ +TDAT: public void zoomIn() { + if (sourceImage == null) { + return; + } + final Rectangle rect = getClientArea(); + final int w = rect.width, h = rect.height; + final double dx = ((double) w) / 2; + final double dy = ((double) h) / 2; + centerZoom(dx, dy, ZOOMIN_RATE, transform); + } + COM: zoom in around the center of client area + diff --git a/funcom_test/12074448.txt b/funcom_test/12074448.txt new file mode 100644 index 0000000000000000000000000000000000000000..c6f89527e516abf8c1704f0789a2ffb19efad9f7 --- /dev/null +++ b/funcom_test/12074448.txt @@ -0,0 +1,12 @@ +TDAT: public void zoomOut() { + if (sourceImage == null) { + return; + } + final Rectangle rect = getClientArea(); + final int w = rect.width, h = rect.height; + final double dx = ((double) w) / 2; + final double dy = ((double) h) / 2; + centerZoom(dx, dy, ZOOMOUT_RATE, transform); + } + COM: zoom out around the center of client area + diff --git a/funcom_test/12107446.txt b/funcom_test/12107446.txt new file mode 100644 index 0000000000000000000000000000000000000000..386666aee8c596d6a3e9d1a6c40ddede96e7fc6a --- /dev/null +++ b/funcom_test/12107446.txt @@ -0,0 +1,11 @@ +TDAT: private void startNow(Node n) throws VoidexException { + if (n.isStartSupported()) { + executioner.executeEvent(n.getStart(), n.getSatellite()); + + if (log != null) { + log.logEventExecution(n, "START", n.getStart()); + } + } + } + COM: execute the starting event of node + diff --git a/funcom_test/1212818.txt b/funcom_test/1212818.txt new file mode 100644 index 0000000000000000000000000000000000000000..303d770f15052530598043a51dd05fa5edf1c840 --- /dev/null +++ b/funcom_test/1212818.txt @@ -0,0 +1,11 @@ +TDAT: private int getOverlapArea(int x1, int y1, int x2, int y2, DraggableCard exampleCard) { + int cardWidth = exampleCard.getOffsetWidth(); + int cardHeight = exampleCard.getOffsetHeight(); + + int xOverlap = getOverlapLength(x1, x2, cardWidth); + int yOverlap = getOverlapLength(y1, y2, cardHeight); + + return xOverlap * yOverlap; + } + COM: determines overlap area of 2 congruent rectangles + diff --git a/funcom_test/1212826.txt b/funcom_test/1212826.txt new file mode 100644 index 0000000000000000000000000000000000000000..479f784e3dec6fb7491c876f39405ee05c89c4be --- /dev/null +++ b/funcom_test/1212826.txt @@ -0,0 +1,9 @@ +TDAT: public void onMouseMove(Widget source, int x, int y) { + int scrollY = JSNI.getScrollY(); + int scrollX = JSNI.getScrollX(); + int xTooltipPosition = x + source.getAbsoluteLeft() + scrollX + xTooltipOffset; + int yTooltipPosition = y + source.getAbsoluteTop() + scrollY + yTooltipOffset; + Cardpanda.canvas.setWidgetPosition(tip, xTooltipPosition, yTooltipPosition); + } + COM: moves the tooltip with the mouse cursor + diff --git a/funcom_test/1212944.txt b/funcom_test/1212944.txt new file mode 100644 index 0000000000000000000000000000000000000000..52b5ef14527b72483fae47845e0cc6c176fd295a --- /dev/null +++ b/funcom_test/1212944.txt @@ -0,0 +1,14 @@ +TDAT: public void logPersonalNote(String result, boolean mine) { + if(mine) { + setMyColor(); + } else { + setOpponentColor(); + } + + String thisClientsName = Cardpanda.clientModel.getSessionID().getName(); + setHTML(result.replace(thisClientsName + "'s", "your")); + Window.setTitle("[" + Cardpanda.clientModel.getSessionID().getName() + "] " + + result.replace(thisClientsName + "'s", "your")); + } + COM: logs something that only the client needs to see + diff --git a/funcom_test/1213121.txt b/funcom_test/1213121.txt new file mode 100644 index 0000000000000000000000000000000000000000..055b9e85fd52a70e88839f16a481f0c9e988edf6 --- /dev/null +++ b/funcom_test/1213121.txt @@ -0,0 +1,10 @@ +TDAT: private void addCounter(Color color, long serverID, int x, int y) { + Counter counter = new Counter(color, serverID); + + counters.add(counter); + Cardpanda.canvas.add(counter, x, y); + + System.out.println(counter.getName() + " " + counter.getServerID() + " added at " + x + "," + y); + } + COM: adds a counter to the canvas and the counters in play list + diff --git a/funcom_test/1213163.txt b/funcom_test/1213163.txt new file mode 100644 index 0000000000000000000000000000000000000000..30cc1aa5d3f86eb9734e97814d308ce82838897c --- /dev/null +++ b/funcom_test/1213163.txt @@ -0,0 +1,12 @@ +TDAT: private void setBinHover(Counter counter, int x, int y) { + final List bins = Cardpanda.clientModel.getBinsThisClientControls(); + for(Bin bin : bins) { + if(withinBinCoordinates(counter, bin, x, y)) { + bin.setHover(); + } else { + bin.removeHover(); + } + } + } + COM: set bin hover if this card is dragged over a bin + diff --git a/funcom_test/1213319.txt b/funcom_test/1213319.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cc2b2f40300b04bb7fed58a11826cde2f0d449f --- /dev/null +++ b/funcom_test/1213319.txt @@ -0,0 +1,20 @@ +TDAT: public void shuffleLibrary() { + String logForMe = "You shuffle your library."; + String logForOthers = Cardpanda.clientModel.getSessionID().getName() + "'s library has been shuffled."; + + switch(sessionID) { + case P1: + p1lib.shuffle(); + NoteTip.get().log(logForMe, logForOthers); + break; + + case P2: + p2lib.shuffle(); + NoteTip.get().log(logForMe, logForOthers); + break; + + default: // do nothing + } + } + COM: shuffles the clients library + diff --git a/funcom_test/1227985.txt b/funcom_test/1227985.txt new file mode 100644 index 0000000000000000000000000000000000000000..e0a5b80e6d80b048504cd68d522c6a4200f03df9 --- /dev/null +++ b/funcom_test/1227985.txt @@ -0,0 +1,10 @@ +TDAT: public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("country", this.country) + .append("address", this.address) + .append("province", this.province) + .append("postalCode", this.postalCode) + .append("city", this.city).toString(); + } + COM: returns a multi line string with key value pairs + diff --git a/funcom_test/1228050.txt b/funcom_test/1228050.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d99b4cdcc32d6d6436443a737df71852d9b69a3 --- /dev/null +++ b/funcom_test/1228050.txt @@ -0,0 +1,14 @@ +TDAT: protected Object convertToString(Class type, Object value) { + DateFormat df = new SimpleDateFormat(TS_FORMAT); + if (value instanceof Date) { + try { + return df.format(value); + } catch (Exception e) { + throw new ConversionException("Error converting Timestamp to String"); + } + } + + return value.toString(); + } + COM: convert from a java + diff --git a/funcom_test/1228078.txt b/funcom_test/1228078.txt new file mode 100644 index 0000000000000000000000000000000000000000..9e0bca9ade8ab91363b9c2d1f961cb0de33b1c1a --- /dev/null +++ b/funcom_test/1228078.txt @@ -0,0 +1,17 @@ +TDAT: public void sendMessage(SimpleMailMessage msg, String templateName, Map model) { + String result = null; + + try { + result = + VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, + templateName, model); + } catch (VelocityException e) { + e.printStackTrace(); + log.error(e.getMessage()); + } + + msg.setText(result); + send(msg); + } + COM: send a simple message based on a velocity template + diff --git a/funcom_test/1228112.txt b/funcom_test/1228112.txt new file mode 100644 index 0000000000000000000000000000000000000000..510c654d9ea1602b8bfd1bc675adaaa4ee0c7e40 --- /dev/null +++ b/funcom_test/1228112.txt @@ -0,0 +1,10 @@ +TDAT: public void prepare() { + if (getRequest().getMethod().equalsIgnoreCase("post")) { + // prevent failures on new + if (!"".equals(getRequest().getParameter("user.id"))) { + user = userManager.getUser(getRequest().getParameter("user.id")); + } + } + } + COM: grab the entity from the database before populating with request parameters + diff --git a/funcom_test/12283603.txt b/funcom_test/12283603.txt new file mode 100644 index 0000000000000000000000000000000000000000..af6a58a9c48bdd50d9790dc40ecc4c8664f5a503 --- /dev/null +++ b/funcom_test/12283603.txt @@ -0,0 +1,14 @@ +TDAT: public URL class2URL(final Application application, final String classname) { + URL out = null; + try { + final String sOut = "file://" + application.getRoot() + "/" + + application.getSrc() + "/" + classname.replace('.', '/') + + ".java"; + out = new URL(sOut); + } catch (MalformedURLException exc) { + LOG.error("Exception in URLUtilSingleton.class2URL", exc); + } + return out; + } + COM: transform the name of a class in dot format e + diff --git a/funcom_test/12283615.txt b/funcom_test/12283615.txt new file mode 100644 index 0000000000000000000000000000000000000000..21f8f1f4843230e7f228e2d9b5c21c13b5babd2e --- /dev/null +++ b/funcom_test/12283615.txt @@ -0,0 +1,14 @@ +TDAT: public void consoleHelp() { + this.showHead(); + LOG.info("Usage:"); + LOG.info("