query
stringlengths
7
33.1k
document
stringlengths
7
335k
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Test all the functions in AVLTree
public static void main(String[] arg) { leftLeftInsert(); rightRightInsert(); leftRightInsert(); rightLeftInsert(); leftLeftDelete(); rightRightDelete(); leftRightDelete(); rightLeftDelete(); System.out.println("\nEnd"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void visualiseTree()\n {\n System.out.println(avlTree.toString());\n }", "@Test\n public void testSetCitiesSearchTree02() {\n System.out.println(\"setCitiesSearchTree\");\n sn10.setCitiesSearchTree();\n\n AVL<CityAndUsers> expResult = new AVL<>();\n \n A...
[ "0.6182829", "0.60847783", "0.5936983", "0.5870914", "0.5823397", "0.5801368", "0.57167304", "0.5681092", "0.56347567", "0.5587317", "0.55705965", "0.5560109", "0.54968333", "0.5467622", "0.5384644", "0.53684604", "0.5323911", "0.5311541", "0.53102636", "0.5307471", "0.530170...
0.0
-1
Check whether a tree is empty or not
@Override public boolean isEmpty() { return (that.rootNode == null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean isEmpty() \n\t{\n\t\treturn root == null;//if root is null, tree is empty\n\t}", "private boolean isEmpty()\r\n\t{\r\n\t\treturn getRoot() == null;\r\n\t}", "public boolean empty() {\r\n\t\t return(this.root == null);\r\n\t }", "public boolean isEmpty()\r\n {\r\n return root == n...
[ "0.8332961", "0.8232174", "0.81822085", "0.81161165", "0.7991825", "0.7987069", "0.7957699", "0.7948758", "0.7923826", "0.79211277", "0.78912497", "0.7883143", "0.7878311", "0.7878311", "0.78595525", "0.7840872", "0.7828062", "0.78214633", "0.78214633", "0.7805011", "0.779736...
0.78653395
14
Insert a node into a tree, and this node's value is key If tree doesn't have a rootNode, build the first node
@Override public void insert(K key) { try { this.rootNode = insertNode(this.rootNode, key); } catch (DuplicateKeyException e) { System.out.println(e.getMessage()); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public TreeNode insert(TreeNode root, int key) {\n if (root == null) {\n root = new TreeNode(key);\n return root;\n }\n TreeNode cur = root, par = root;\n while (cur != null) {\n par = cur;\n if (cur.key == key) {\n return root;\n }\n if (key < cur.key) {\n c...
[ "0.75600505", "0.7508371", "0.7494424", "0.7366386", "0.7317046", "0.73077387", "0.72859746", "0.7277214", "0.7231065", "0.72276986", "0.7121941", "0.7099219", "0.70742166", "0.6983005", "0.6968884", "0.6946729", "0.6934458", "0.68693966", "0.68348813", "0.68028104", "0.67894...
0.69696575
14
Start searching the AVLtree from root First, check each node's value and compare with key until find the suitable position for key Second, use a bottomup method, from the new node, which has value key, trace back to its ancestor and do rotate to update AVLTree if necessary
private BSTNode<K> insertNode(BSTNode<K> currentNode, K key) throws DuplicateKeyException, IllegalArgumentException { // if key is null, throw an IllegalArgumentException if (key == null) { throw new IllegalArgumentException("Please input a valid key"); } // if currentNode is null, create a new node, because of reaching a leaf if (currentNode == null) { BSTNode<K> newNode = new BSTNode<K>(key); return newNode; } // otherwise, keep searching through the tree until meet a leaf, or find a duplicated node else { switch(key.compareTo(currentNode.getId())){ case -1: currentNode.setLeftChild(insertNode(currentNode.getLeftChild(), key)); break; case 1: currentNode.setRightChild(insertNode(currentNode.getRightChild(), key)); break; default: throw new DuplicateKeyException("A node with the same value is already existed"); } // after update currentNode's left and right childNote, let's check currentNode's balanceValue // ancestor two levels away from a lead node, its absolute balanceValue may exceeds 1, // so codes below has meaning for it int balanceValue = getNodeBalance(currentNode); if (balanceValue < -1) { // balanceValue < -1 means sublefttree is longer than subrighttree switch (key.compareTo(currentNode.getLeftChild().getId())) { case -1: // after Left Left Case, balance is updated, so sent currentNode to its ancestor return rotateRight(currentNode); case 1: // after Left Right Case, balance is updated, so sent currentNode to its ancestor currentNode.setLeftChild(rotateLeft(currentNode.getLeftChild())); return rotateRight(currentNode); } } else if (balanceValue > 1) { // balanceValue < -1 means subrighttree is longer than sublefttree switch (key.compareTo(currentNode.getRightChild().getId())){ case 1: // after Right Right Case, balance is updated, so sent currentNode to its ancestor return rotateLeft(currentNode); case -1: // after Right Left Case, balance is updated, so sent currentNode to its ancestor currentNode.setRightChild(rotateRight(currentNode.getRightChild())); return rotateLeft(currentNode); } } } // for leaf node's balanceValue == 0, and for -1 <= leaf node's first ancestor's balanceValue <= 1, // codes above(from balanceValue) has no meaning for it, return currentNode straight forward return currentNode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int insert(int k, String i) { // insert a node with a key of k and info of i, the method returns the number of rebalance operation\r\n WAVLNode x = new WAVLNode(k,i);// create the new node to insert\r\n x.left=EXT_NODE;\r\n x.right=EXT_NODE;\r\n if(root==EXT_NODE) { // ch...
[ "0.6499902", "0.6499635", "0.6431104", "0.6355825", "0.62676656", "0.6239654", "0.62333184", "0.6219584", "0.6162324", "0.61578214", "0.6085964", "0.60530853", "0.6050404", "0.603916", "0.60344535", "0.6010949", "0.59983355", "0.59729195", "0.59635633", "0.5951168", "0.594949...
0.6595833
0
Given a node with value key If it exists in a tree, delete it If it doesn't, do nothing
@Override public void delete(K key){ try { this.rootNode = deleteNode(this.rootNode, key); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void removeNode(NodeKey key);", "public void deleteNode(int key){\n\t\t//System.out.println(\" in delete Node \");\n\t\tNode delNode = search(key);\n\t\tif(delNode != nil){\n\t\t\t//System.out.println(\" del \" + delNode.id);\n\t\t\tdelete(delNode);\n\t\t}else{\n\t\t\tSystem.out.println(\" Node not in RB Tree\")...
[ "0.76096296", "0.73214704", "0.7273837", "0.7209773", "0.7188967", "0.71525526", "0.71134835", "0.7078109", "0.7064088", "0.7046684", "0.70441616", "0.6979084", "0.697578", "0.69648224", "0.69648224", "0.69648224", "0.69648224", "0.69648224", "0.69648224", "0.69648224", "0.69...
0.7253907
3
Start searching the AVLtree from root First, check each node's value and compare with key until find the node with value key Second,
private BSTNode<K> deleteNode(BSTNode<K> currentNode, K key) throws IllegalArgumentException{ // if key is null, throw an IllegalArgumentException if (key == null) { throw new IllegalArgumentException("Please input a valid key"); } // if currentNode is null, return null if (currentNode == null) return currentNode; // otherwise, keep searching through the tree until meet the node with value key switch(key.compareTo(currentNode.getId())){ case -1: currentNode.setLeftChild(deleteNode(currentNode.getLeftChild(), key)); break; case 1: currentNode.setRightChild(deleteNode(currentNode.getRightChild(), key)); break; case 0: // build a temporary node when finding the node that need to be deleted BSTNode<K> tempNode = null; // when the node doesn't have two childNodes // has one childNode: currentNode = tempNode = a childNode // has no childNode: currentNode = null, tempNode = currentNode if ((currentNode.getLeftChild() == null) || (currentNode.getRightChild() == null)) { if (currentNode.getLeftChild() == null) tempNode = currentNode.getRightChild(); else tempNode = currentNode.getLeftChild(); if (tempNode == null) { //tempNode = currentNode; currentNode = null; } else currentNode = tempNode; } // when the node has two childNodes, // use in-order way to find the minimum node in its subrighttree, called rightMinNode // set tempNode = rightMinNode, and currentNode's ID = tempNode.ID // do recursion to update the subrighttree with currentNode's rightChild and tempNode's Id else { BSTNode<K> rightMinNode = currentNode.getRightChild(); while (rightMinNode.getLeftChild() != null) rightMinNode = rightMinNode.getLeftChild(); tempNode = rightMinNode; currentNode.setId(tempNode.getId()); currentNode.setRightChild(deleteNode(currentNode.getRightChild(), tempNode.getId())); } } // since currentNode == null means currentNode has no childNode, return null to its ancestor if (currentNode == null) return currentNode; // since currentNode != null, we have to update its balance int balanceValue = getNodeBalance(currentNode); if (balanceValue < -1) { // balanceValue < -1 means sublefttree is longer than subrighttree if (getNodeBalance(currentNode.getLeftChild()) < 0) { // Left Left Case return rotateRight(currentNode); } else if (getNodeBalance(currentNode.getLeftChild()) >= 0) { // Left Right Case currentNode.setLeftChild(rotateLeft(currentNode.getLeftChild())); return rotateRight(currentNode); } } else if (balanceValue > 1) { // balanceValue < -1 means subrighttree is longer than sublefttree if ((getNodeBalance(currentNode.getRightChild()) > 0)) { // Right Right Case return rotateLeft(currentNode); } else if ((getNodeBalance(currentNode.getRightChild()) <= 0)) {// Right Left Case currentNode.setRightChild(rotateRight(currentNode.getRightChild())); return rotateLeft(currentNode); } } return currentNode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Node searchAux(Node tree, K key) {\n if(root == null) { return null; } //empty tree\n int cmp = key.compareTo(tree.key);\n if(cmp == 0 || cmp < 0 && tree.left == null || cmp > 0 && tree.right == null) { //found the node or last checked\n comparisons += 1;\n return...
[ "0.6591897", "0.63914853", "0.6358523", "0.63282853", "0.6312867", "0.6192795", "0.61209923", "0.61174136", "0.6076478", "0.6066873", "0.6021927", "0.6021927", "0.6021927", "0.6021927", "0.6021927", "0.6021927", "0.6021927", "0.6021927", "0.6021927", "0.6021927", "0.6021927",...
0.0
-1
Call exist() to search node with value key in a tree
@Override public boolean search(K key) { if (rootNode == null) return false; try { return exist(key, rootNode); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean search(T key) {\r\n\t\tRBNode<T, E> c = root;\r\n\t\twhile (c != nillLeaf) {\r\n\t\t\t// If Node is less than the current Node then go left.\r\n\t\t\tif (key.compareTo(c.uniqueKey) < 0) {\r\n\t\t\t\t// we go left\r\n\t\t\t\tc = c.leftChild;\r\n\t\t\t}\r\n\t\t\t// If Node is bigger than the current N...
[ "0.7144003", "0.6986536", "0.6891294", "0.6862387", "0.6860052", "0.6781669", "0.6677659", "0.6634445", "0.6633303", "0.66254133", "0.6591475", "0.65761566", "0.6532947", "0.6532769", "0.65213835", "0.6521221", "0.6512492", "0.6511929", "0.6485793", "0.6476793", "0.64697146",...
0.788045
0
Search node with value key in a tree
private boolean exist(K key, BSTNode<K> currentNode) throws IllegalArgumentException { // if key is null, throw an IllegalArgumentException if (key == null) { throw new IllegalArgumentException("Please input a valid key"); } switch (key.compareTo(currentNode.getId())) { case -1: if (currentNode.getLeftChild() != null) return exist(key, currentNode.getLeftChild()); else return false; case 1: if (currentNode.getRightChild() != null) return exist(key, currentNode.getRightChild()); else return false; case 0: return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public RBNode<T> search(T key) {\r\n return search1(key);\r\n//\t\treturn search2(root, key); //recursive version\r\n }", "public RBNode<T, E> searchAndRetrieve(T key) {\r\n\t\tRBNode<T, E> c = root;\r\n\t\tRBNode<T, E> p = nillLeaf;\r\n\t\twhile (c != nillLeaf) {\r\n\t\t\t// if when comparing if it ha...
[ "0.75714886", "0.73985165", "0.7396027", "0.7355775", "0.7320088", "0.7272074", "0.7253271", "0.7236464", "0.722816", "0.71676767", "0.7156648", "0.714654", "0.71431077", "0.7140323", "0.71234185", "0.7051528", "0.70250744", "0.6935079", "0.69245917", "0.690344", "0.69024724"...
0.0
-1
Call print() to print out all nodes in a tree in an inorder way
@Override public String print() { ArrayList<K> inorderTraverse = inOrdorTraverseBST(); System.out.print("In ascending order: "); for (int i=0; i<inorderTraverse.size(); i++) { System.out.print(inorderTraverse.get(i)+" "); } System.out.println(""); return ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void print(){\n inorderTraversal(this.root);\n }", "public void printInorder() {\n if (myRoot == null) {\n System.out.println(\"(empty tree)\");\n } else {\n myRoot.printInorder();\n System.out.println();\n }\n }", "public void printInor...
[ "0.83719945", "0.81275797", "0.81275797", "0.80821276", "0.79729337", "0.79313594", "0.779848", "0.7780632", "0.7753536", "0.7719686", "0.7698944", "0.76962835", "0.7692786", "0.76637954", "0.7658664", "0.7632453", "0.7619278", "0.75958216", "0.75564075", "0.7541633", "0.7505...
0.7641534
15
Call print() to print out a tree
public String printTree() { printSideways(); return ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void printTree() {\n printTreeHelper(root);\n }", "public void printTree() {\n Object[] nodeArray = this.toArray();\n for (int i = 0; i < nodeArray.length; i++) {\n System.out.println(nodeArray[i]);\n }\n }", "public void printTree() {\r\n ...
[ "0.8602719", "0.855736", "0.8492616", "0.83936965", "0.8278289", "0.8187405", "0.8144372", "0.8140132", "0.8136274", "0.8079412", "0.80740654", "0.8035634", "0.80275446", "0.80204874", "0.7973856", "0.79242814", "0.7906956", "0.79024553", "0.7887669", "0.7834457", "0.77885187...
0.8248033
5
Print nodes in a tree
private void recursivePrintSideways(BSTNode<K> current, String indent) { if (current != null) { recursivePrintSideways(current.getRightChild(), indent + " "); System.out.println(indent + current.getId()); recursivePrintSideways(current.getLeftChild(), indent + " "); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void printTree() {\n Object[] nodeArray = this.toArray();\n for (int i = 0; i < nodeArray.length; i++) {\n System.out.println(nodeArray[i]);\n }\n }", "public void tree()\n\t{\n\t\tIterable<Position<FileElement>> toPrint = fileSystem.PreOrder();\n\t\tfor (Pos...
[ "0.845282", "0.8041286", "0.7975833", "0.796011", "0.7909238", "0.789454", "0.7854516", "0.78283924", "0.7813835", "0.77710485", "0.7764243", "0.7759655", "0.7754479", "0.77498347", "0.7734438", "0.76625025", "0.7657291", "0.7649739", "0.7640544", "0.7604757", "0.75942975", ...
0.0
-1
Assumed tree is balanced and check whether each node in a tree is balanced or not
@Override public boolean checkForBalancedTree() { BSTNode<K> currentNode = this.rootNode; boolean balancedTree = true; return checkLoop(currentNode, null, balancedTree, null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean isBalanced(TreeNode root) {\n if(root == null) return true;\n \n //key is node, value is height of subtree rooted at this node\n HashMap<TreeNode, Integer> hs = new HashMap<TreeNode, Integer>();\n \n Stack<TreeNode> stack = new Stack<TreeNode>();\n st...
[ "0.81056684", "0.7689851", "0.7558244", "0.7521735", "0.7481829", "0.7425478", "0.74164695", "0.73805195", "0.73775685", "0.73658967", "0.7280508", "0.7273667", "0.72689176", "0.72441876", "0.7179388", "0.7164992", "0.71612626", "0.7160448", "0.71048814", "0.70817876", "0.705...
0.7804774
1
Traverse a tree in preorder way, if all nodes are balanced then return true return false when meeting the first node that is not balanced
public boolean checkLoop(BSTNode<K> currentNode, BSTNode<K> preNode, boolean balancedTree, String direction) { if (currentNode == null) return true; if (checkNodeBalance(currentNode) == true) { balancedTree = checkLoop(currentNode.getLeftChild(), currentNode, balancedTree, "left") && checkLoop(currentNode.getRightChild(), currentNode, balancedTree, "right"); } else { balancedTree = false; } return balancedTree; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean isBalanced(TreeNode root) {\n if(root == null) return true;\n \n //key is node, value is height of subtree rooted at this node\n HashMap<TreeNode, Integer> hs = new HashMap<TreeNode, Integer>();\n \n Stack<TreeNode> stack = new Stack<TreeNode>();\n st...
[ "0.7296705", "0.7102204", "0.70695966", "0.695722", "0.6807008", "0.6795533", "0.6767155", "0.6762184", "0.67270565", "0.6716221", "0.6612515", "0.65897185", "0.6555936", "0.65278226", "0.6500442", "0.6436648", "0.63917494", "0.63912994", "0.6372083", "0.637016", "0.6317104",...
0.6217769
26
Check whether subRightTreeDeep minus subLeftTreeDeep is between 1 and 1
public boolean checkNodeBalance(BSTNode<K> currentNode) { if (currentNode == null) return true; if (subTreeDiff(currentNode) < -1 || subTreeDiff(currentNode) > 1) return false; return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void main(String[] args) {\n TreeNode root = new TreeNode(3);//true\n root.left = new TreeNode(9);\n root.right = new TreeNode(20);\n root.right.left = new TreeNode(15);\n root.right.right = new TreeNode(7);\n\n // 1\n // / \\\n // ...
[ "0.57990986", "0.57100356", "0.5648106", "0.55916154", "0.5515817", "0.5512035", "0.55098695", "0.5504777", "0.5484796", "0.54726356", "0.5433316", "0.5368811", "0.53425384", "0.53359133", "0.53036326", "0.52985", "0.5282698", "0.5238425", "0.5231973", "0.52286565", "0.522784...
0.50029767
57
Get the height difference of subrighttree and sublefttree
public int getNodeBalance(BSTNode<K> currentNode) { if (currentNode == null) return 0; return subTreeDiff(currentNode); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static int heightOfTree(Tree tree) {\n\n if(tree == null){\n return 0;\n }\n int leftHeight = 0;\n if(tree.left!=null){\n leftHeight = heightOfTree(tree.left);\n }\n int rightHeight = 0;\n if(tree.right!=null){\n rightHeight...
[ "0.75361633", "0.72737205", "0.72507477", "0.72035587", "0.71549356", "0.71351635", "0.71298254", "0.71174324", "0.7113152", "0.70625985", "0.70082825", "0.70032877", "0.69892097", "0.6984246", "0.6952704", "0.69468236", "0.6939933", "0.6891588", "0.68898773", "0.68628573", "...
0.0
-1
Compute the difference between currentNode's subRightTreeHeight and subLeftTreeHeight
public int subTreeDiff(BSTNode<K> currentNode) { int diff = nodeHeight(currentNode.getRightChild()) - nodeHeight(currentNode.getLeftChild()); return diff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "int getDifference (AVLNode Node){\r\n \treturn findHeight(Node.left)-findHeight(Node.right);\r\n }", "private int getHeightDifference(long addr) throws IOException {\n Node current = new Node(addr);\r\n Node left = new Node(current.left);\r\n Node right = new Node(current.right);\r\n\r...
[ "0.6923729", "0.690893", "0.681567", "0.66373724", "0.6603501", "0.6589592", "0.65727776", "0.6550516", "0.6541305", "0.6527833", "0.65246767", "0.6504855", "0.6504144", "0.64973104", "0.6483945", "0.64811206", "0.6480233", "0.64736634", "0.6471886", "0.6464384", "0.64625704"...
0.8109175
0
Compute how high a node is
public int nodeHeight(BSTNode<K> currentNode) { if (currentNode == null) return 0; return Math.max(nodeHeight(currentNode.getLeftChild()), nodeHeight(currentNode.getRightChild()))+1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int height()\r\n {\r\n return head.height; //Should return log base 2 of n or the height of our head node. \r\n }", "private int getHeightofNode(TreeNode node){\n if (node == null) return 0;\n if (getColor(node) == RED) {\n return Math.max(getHeightofNode(node.left), g...
[ "0.68898773", "0.6836598", "0.6716202", "0.66261464", "0.66198653", "0.6500936", "0.64950216", "0.64743614", "0.6469642", "0.64481866", "0.6435306", "0.64037114", "0.63766116", "0.6376483", "0.63697404", "0.6368145", "0.6350952", "0.6338849", "0.6324852", "0.62973213", "0.628...
0.0
-1
Check if values of all nodes are retrieved in ascending order
@Override public boolean checkForBinarySearchTree() { if (this.rootNode == null) return true; ArrayList<K> inorderTraverse = inOrdorTraverseBST(); for (int i=1; i<inorderTraverse.size(); i++) { if(inorderTraverse.get(i-1).compareTo(inorderTraverse.get(i)) == 1) return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void findSearchOrder() {\n boolean filled = false;\n for(int node: queryGraphNodes.keySet()) {\n\n vertexClass vc = queryGraphNodes.get(node);\n searchOrderSeq.add(node);\n for(int edge: queryGraphNodes.get(node).edges.keySet()) {\n filled = calcOrderi...
[ "0.6618876", "0.6276519", "0.59248495", "0.5783984", "0.57835174", "0.5742973", "0.56727916", "0.564488", "0.56232613", "0.5585605", "0.55174625", "0.54871505", "0.5478894", "0.5459841", "0.5459841", "0.5447818", "0.5446683", "0.54446346", "0.5435925", "0.53957397", "0.534836...
0.5559176
10
Traverse a tree in inorder way and record it
public ArrayList<K> inOrdorTraverseBST(){ BSTNode<K> currentNode = this.rootNode; LinkedList<BSTNode<K>> nodeStack = new LinkedList<BSTNode<K>>(); ArrayList<K> result = new ArrayList<K>(); if (currentNode == null) return null; while (currentNode != null || nodeStack.size() > 0) { while (currentNode != null) { nodeStack.add(currentNode); currentNode = currentNode.getLeftChild(); } currentNode = nodeStack.pollLast(); result.add(currentNode.getId()); currentNode = currentNode.getRightChild(); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void inOrderTraverseRecursive();", "public void inorder()\n {\n inorderRec(root);\n }", "public void inorderTraverse(){\n\t\tinorderHelper(root);\n\t\tSystem.out.println();\n\t}", "private void inorder() {\n inorder(root);\n }", "public void inorder()\r\n {\r\n ...
[ "0.80969733", "0.77399534", "0.7714363", "0.73333", "0.7328469", "0.7309854", "0.7283563", "0.72343475", "0.7201147", "0.7201147", "0.71750325", "0.7130555", "0.71264", "0.71244174", "0.711298", "0.71048135", "0.70755774", "0.7039219", "0.7038503", "0.70014995", "0.69948184",...
0.0
-1
A test case for leftLeftInsert
private static void leftLeftInsert() { AVLTree<Integer> tree1 = new AVLTree<Integer>(); System.out.println("LeftLeft Tree Insert Case"); System.out.println("Before insert nodes, tree is empty: "+tree1.isEmpty()); Integer[] numbers = {50, 60, 30, 40, 10, 20}; for (int i=0; i<numbers.length; i++) { tree1.insert(numbers[i]); } System.out.println("After insert nodes, tree is empty: "+tree1.isEmpty()); System.out.println("Tree looks like: "); tree1.printTree(); tree1.print(); System.out.println("Tree is balanced: "+tree1.checkForBalancedTree()); System.out.println("Tree is a BST: "+tree1.checkForBinarySearchTree()+"\n"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract Position<E> insertLeftChild(Position<E> p, E e);", "private static void leftRightInsert() {\n System.out.println(\"LeftRight Tree Insert Case\");\n AVLTree<Integer> tree1 = new AVLTree<Integer>();\n System.out.println(\"Before insert nodes, tree is empty: \"+tree1.isEmpty());\n \n ...
[ "0.70979357", "0.6919131", "0.6898734", "0.67994153", "0.6797483", "0.67860544", "0.67750466", "0.67706215", "0.67393863", "0.6589816", "0.6565863", "0.65280044", "0.6469629", "0.6443547", "0.6408528", "0.64039963", "0.63984704", "0.639372", "0.6373736", "0.63369477", "0.6273...
0.73262
0
A test case for rightRightInsert
private static void rightRightInsert() { System.out.println("RightRight Tree Insert Case"); AVLTree<Integer> tree1 = new AVLTree<Integer>(); System.out.println("Before insert nodes, tree is empty: "+tree1.isEmpty()); Integer[] numbers = {50, 60, 30, 70, 55, 65}; for (int i=0; i<numbers.length; i++) { tree1.insert(numbers[i]); } System.out.println("After insert nodes, tree is empty: "+tree1.isEmpty()); System.out.println("Tree looks like: "); tree1.printTree(); tree1.print(); System.out.println("Tree is balanced: "+tree1.checkForBalancedTree()); System.out.println("Tree is a BST: "+tree1.checkForBinarySearchTree()+"\n"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void rightLeftInsert() {\n System.out.println(\"RightLeft Tree Insert Case\");\n AVLTree<Integer> tree1 = new AVLTree<Integer>();\n System.out.println(\"Before insert nodes, tree is empty: \"+tree1.isEmpty());\n \n Integer[] numbers = {50, 60, 30, 70, 55, 57};\n for (int i=0; i<num...
[ "0.6868943", "0.66612846", "0.65840876", "0.651593", "0.6307445", "0.63054127", "0.62961787", "0.6279248", "0.6216736", "0.6169314", "0.61188596", "0.608568", "0.5931004", "0.5911634", "0.58678293", "0.5818969", "0.58159196", "0.58058417", "0.58053064", "0.5771345", "0.573968...
0.72265255
0
A test case for leftRightInsert
private static void leftRightInsert() { System.out.println("LeftRight Tree Insert Case"); AVLTree<Integer> tree1 = new AVLTree<Integer>(); System.out.println("Before insert nodes, tree is empty: "+tree1.isEmpty()); Integer[] numbers = {50, 60, 30, 10, 40, 35}; for (int i=0; i<numbers.length; i++) { tree1.insert(numbers[i]); } System.out.println("After insert nodes, tree is empty: "+tree1.isEmpty()); System.out.println("Tree looks like: "); tree1.printTree(); tree1.print(); System.out.println("Tree is balanced: "+tree1.checkForBalancedTree()); System.out.println("Tree is a BST: "+tree1.checkForBinarySearchTree()+"\n"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void rightLeftInsert() {\n System.out.println(\"RightLeft Tree Insert Case\");\n AVLTree<Integer> tree1 = new AVLTree<Integer>();\n System.out.println(\"Before insert nodes, tree is empty: \"+tree1.isEmpty());\n \n Integer[] numbers = {50, 60, 30, 70, 55, 57};\n for (int i=0; i<num...
[ "0.7347884", "0.72003055", "0.6909269", "0.67203885", "0.6657016", "0.6572142", "0.65264565", "0.64607096", "0.6368258", "0.6350461", "0.63501704", "0.63447523", "0.63393366", "0.6260466", "0.62466395", "0.61484945", "0.61000246", "0.6099575", "0.60978204", "0.60855937", "0.6...
0.72950554
1
A test case for rightLeftInsert
private static void rightLeftInsert() { System.out.println("RightLeft Tree Insert Case"); AVLTree<Integer> tree1 = new AVLTree<Integer>(); System.out.println("Before insert nodes, tree is empty: "+tree1.isEmpty()); Integer[] numbers = {50, 60, 30, 70, 55, 57}; for (int i=0; i<numbers.length; i++) { tree1.insert(numbers[i]); } System.out.println("After insert nodes, tree is empty: "+tree1.isEmpty()); System.out.println("Tree looks like: "); tree1.printTree(); tree1.print(); System.out.println("Tree is balanced: "+tree1.checkForBalancedTree()); System.out.println("Tree is a BST: "+tree1.checkForBinarySearchTree()+"\n"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void leftRightInsert() {\n System.out.println(\"LeftRight Tree Insert Case\");\n AVLTree<Integer> tree1 = new AVLTree<Integer>();\n System.out.println(\"Before insert nodes, tree is empty: \"+tree1.isEmpty());\n \n Integer[] numbers = {50, 60, 30, 10, 40, 35};\n for (int i=0; i<num...
[ "0.7183016", "0.70965874", "0.6891482", "0.6662736", "0.65843606", "0.6535152", "0.65272105", "0.65178454", "0.6489381", "0.64053947", "0.63615763", "0.635649", "0.635021", "0.62580645", "0.61763394", "0.6149194", "0.6119298", "0.61119735", "0.60966223", "0.6089616", "0.60637...
0.72911114
0
A test case for leftLeftDelete
private static void leftLeftDelete() { System.out.println("LeftLeft Tree Delete Case"); AVLTree<Integer> tree1 = new AVLTree<Integer>(); System.out.println("Before insert nodes, tree is empty: "+tree1.isEmpty()); Integer[] numbers = {60, 50, 70, 30, 65, 55, 20, 40}; for (int i=0; i<numbers.length; i++) { tree1.insert(numbers[i]); } System.out.println("After insert nodes, tree is empty: "+tree1.isEmpty()); System.out.println("Tree looks like: "); tree1.printTree(); tree1.print(); tree1.delete(65); System.out.println("After delete nodes 65, Tree looks like: "); tree1.printTree(); tree1.print(); System.out.println("Tree is balanced: "+tree1.checkForBalancedTree()); System.out.println("Tree is a BST: "+tree1.checkForBinarySearchTree()+"\n"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void leftRightDelete() {\n System.out.println(\"LeftRight Tree Delete Case\");\n AVLTree<Integer> tree1 = new AVLTree<Integer>();\n System.out.println(\"Before insert nodes, tree is empty: \"+tree1.isEmpty());\n \n Integer[] numbers = {50, 30, 60, 40, 10, 70, 35};\n for (int i=0; i...
[ "0.6922848", "0.6620423", "0.6363654", "0.6309567", "0.6262848", "0.6218443", "0.62160385", "0.61850727", "0.6180446", "0.6155306", "0.6155306", "0.6155306", "0.6155306", "0.6155306", "0.6155306", "0.6155306", "0.6155306", "0.6155306", "0.6155306", "0.6155306", "0.6155306", ...
0.7260002
0
A test case for rightRightDelete
private static void rightRightDelete() { System.out.println("LeftLeft Tree Delete Case"); AVLTree<Integer> tree1 = new AVLTree<Integer>(); System.out.println("Before insert nodes, tree is empty: "+tree1.isEmpty()); Integer[] numbers = {50, 30, 60, 40, 70, 55, 65}; for (int i=0; i<numbers.length; i++) { tree1.insert(numbers[i]); } System.out.println("After insert nodes, tree is empty: "+tree1.isEmpty()); System.out.println("Tree looks like: "); tree1.printTree(); tree1.print(); tree1.delete(40); System.out.println("After delete nodes 40, Tree looks like: "); tree1.printTree(); tree1.print(); System.out.println("Tree is balanced: "+tree1.checkForBalancedTree()); System.out.println("Tree is a BST: "+tree1.checkForBinarySearchTree()+"\n"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\r\n\tpublic void checkDeleteTest() {\n\t\tassertFalse(boardService.getGameRules().checkDelete(board.field[13][13])); \r\n\t}", "private static void leftRightDelete() {\n System.out.println(\"LeftRight Tree Delete Case\");\n AVLTree<Integer> tree1 = new AVLTree<Integer>();\n System.out.println(\"Be...
[ "0.6483473", "0.6455125", "0.6358492", "0.6255376", "0.62126374", "0.6200063", "0.6196231", "0.6123628", "0.61048144", "0.60987085", "0.60933286", "0.60827374", "0.6076919", "0.6060811", "0.60575056", "0.6055786", "0.6050947", "0.6044761", "0.6016302", "0.60001564", "0.599008...
0.68621206
0
A test case for leftRightDelete
private static void leftRightDelete() { System.out.println("LeftRight Tree Delete Case"); AVLTree<Integer> tree1 = new AVLTree<Integer>(); System.out.println("Before insert nodes, tree is empty: "+tree1.isEmpty()); Integer[] numbers = {50, 30, 60, 40, 10, 70, 35}; for (int i=0; i<numbers.length; i++) { tree1.insert(numbers[i]); } System.out.println("After insert nodes, tree is empty: "+tree1.isEmpty()); System.out.println("Tree looks like: "); tree1.printTree(); tree1.print(); tree1.delete(70); System.out.println("After delete nodes 70, Tree looks like: "); tree1.printTree(); tree1.print(); System.out.println("Tree is balanced: "+tree1.checkForBalancedTree()); System.out.println("Tree is a BST: "+tree1.checkForBinarySearchTree()+"\n"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void rightRightDelete() {\n System.out.println(\"LeftLeft Tree Delete Case\");\n AVLTree<Integer> tree1 = new AVLTree<Integer>();\n System.out.println(\"Before insert nodes, tree is empty: \"+tree1.isEmpty());\n \n Integer[] numbers = {50, 30, 60, 40, 70, 55, 65};\n for (int i=0; i...
[ "0.7267779", "0.6702981", "0.66286534", "0.643311", "0.63618034", "0.6252117", "0.61867946", "0.61796933", "0.61538714", "0.61499226", "0.6115862", "0.60947776", "0.6090689", "0.609051", "0.60068846", "0.5992391", "0.59829193", "0.5960725", "0.59458894", "0.5934921", "0.59339...
0.71756935
1
A test case for rightLeftDelete, search()
private static void rightLeftDelete() { System.out.println("RightLeft Tree Delete Case"); AVLTree<Integer> tree1 = new AVLTree<Integer>(); System.out.println("Before insert nodes, tree is empty: "+tree1.isEmpty()); Integer[] numbers = {50, 30, 60, 40, 55, 70, 57}; for (int i=0; i<numbers.length; i++) { tree1.insert(numbers[i]); } System.out.println("After insert nodes, tree is empty: "+tree1.isEmpty()); System.out.println("Tree looks like: "); tree1.printTree(); tree1.print(); tree1.delete(40); System.out.println("After delete nodes 40, Tree looks like: "); tree1.printTree(); tree1.print(); System.out.println("Tree is balanced: "+tree1.checkForBalancedTree()); System.out.println("Tree is a BST: "+tree1.checkForBinarySearchTree()+"\n"); System.out.println("Does 40 exist in tree? "+tree1.search(40)); System.out.println("Does 50 exist in tree? "+tree1.search(50)); System.out.print("Does null exist in tree? "); System.out.println(tree1.search(null)); System.out.println("Try to insert 55 again: "); tree1.insert(55); System.out.println("Try to insert null: "); tree1.insert(null); System.out.println("Try to delete null: "); tree1.delete(null); System.out.println("Try to delete 100: nothing happen!"); tree1.delete(100); tree1.print(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void rightRightDelete() {\n System.out.println(\"LeftLeft Tree Delete Case\");\n AVLTree<Integer> tree1 = new AVLTree<Integer>();\n System.out.println(\"Before insert nodes, tree is empty: \"+tree1.isEmpty());\n \n Integer[] numbers = {50, 30, 60, 40, 70, 55, 65};\n for (int i=0; i...
[ "0.6109685", "0.6090105", "0.6036801", "0.59239197", "0.5919837", "0.5917417", "0.59119576", "0.580367", "0.58006495", "0.57084036", "0.5671102", "0.56671983", "0.5666809", "0.5646214", "0.5635453", "0.5621683", "0.56031656", "0.5594551", "0.5582562", "0.5566294", "0.5514674"...
0.6079376
2
Inflate the menu; this adds items to the action bar if it is present.
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_game_submissions, menu); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n \tMenuInflater inflater = getMenuInflater();\n \tinflater.inflate(R.menu.main_activity_actions, menu);\n \treturn super.onCreateOptionsMenu(menu);\n }", "@Override\n public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {...
[ "0.7246102", "0.7201358", "0.7194834", "0.7176498", "0.71066517", "0.7039537", "0.7037961", "0.70112145", "0.70094734", "0.69807225", "0.6944953", "0.69389373", "0.6933199", "0.6916928", "0.6916928", "0.6891486", "0.68831646", "0.68754137", "0.68745375", "0.68621665", "0.6862...
0.0
-1
Handle action bar item clicks here. The action bar will automatically handle clicks on the Home/Up button, so long as you specify a parent activity in AndroidManifest.xml.
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public boolean onOptionsItemSelected(MenuItem item) { Handle action bar item clicks here. The action bar will\n // automatically handle clicks on the Home/Up button, so long\n // as you specify a parent activity in AndroidManifest.xml.\n\n //\n // HANDLE BACK BUTTON\n ...
[ "0.79041183", "0.7805934", "0.77659106", "0.7727251", "0.7631684", "0.7621701", "0.75839096", "0.75300384", "0.74873656", "0.7458051", "0.7458051", "0.7438486", "0.742157", "0.7403794", "0.7391802", "0.73870087", "0.7379108", "0.7370295", "0.7362194", "0.7355759", "0.73454577...
0.0
-1
to display object as a string in spinner
@Override public String toString() { return PET_NAME; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic String getText(Object object) {\r\n\t\tString label = ((Spinner)object).getName();\r\n\t\treturn label == null || label.length() == 0 ?\r\n\t\t\tgetString(\"_UI_Spinner_type\") :\r\n\t\t\tgetString(\"_UI_Spinner_type\") + \" \" + label;\r\n\t}", "String getSpinnerText();", "@Override\n\tp...
[ "0.76327276", "0.69208723", "0.5956827", "0.5938823", "0.5855502", "0.58250594", "0.5798336", "0.57423025", "0.5733069", "0.570177", "0.5701367", "0.5694485", "0.56711286", "0.5657973", "0.5656142", "0.56538355", "0.56432396", "0.5642665", "0.5635146", "0.56349844", "0.563265...
0.0
-1
understanding the flow of data
public static void main(String[] args) throws ClassNotFoundException, SQLException { ApplicationContext context=new ClassPathXmlApplicationContext("beans.xml"); StudentDAO studentDao=context.getBean("studentDAO",StudentDAO.class); studentDao.selectAllRows(); ((ClassPathXmlApplicationContext)context).close(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void parseData() {\n\t\t\r\n\t}", "@Override\n\tpublic void processData() {\n\t\t\n\t}", "private void verificaData() {\n\t\t\n\t}", "private void populateData() {\n\t\tList<TrafficRecord> l = TestHelper.getSampleData();\r\n\t\tfor(TrafficRecord tr: l){\r\n\t\t\tput(tr);\r\n\t\t}\r\n\t\t \r\n\t...
[ "0.63983285", "0.62202424", "0.5829715", "0.5813989", "0.5809018", "0.580643", "0.5791413", "0.5656233", "0.56549215", "0.56168336", "0.55423677", "0.5538747", "0.54984254", "0.5488867", "0.54240155", "0.5402658", "0.53644633", "0.53499305", "0.5309869", "0.5298512", "0.52969...
0.0
-1
Map map = new HashMap();
public void addSalart(K k,V v) { v.setSalary((int)k); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public MyHashMap() {\n map = new HashMap();\n }", "public MyHashMap() {\n\n }", "public MyHashMap() {\n\n }", "void setHashMap();", "private static <K, V> Map<K, V> newHashMap() {\n return new HashMap<K, V>();\n }", "public MyHashMap() {\n hashMap = new ArrayList<>();...
[ "0.79833287", "0.78447515", "0.7487953", "0.7450463", "0.7441486", "0.7420109", "0.7304367", "0.728067", "0.7208408", "0.7158201", "0.7090588", "0.7086554", "0.70106477", "0.69077444", "0.6887382", "0.68303216", "0.6829373", "0.68021166", "0.68011236", "0.679967", "0.6746774"...
0.0
-1
This method instantiates a particular subclass implementing the DAO methods based on the information obtained from the deployment descriptor
public static ChoiceDAO getDAO() throws ChoiceDAOSysException { ChoiceDAO dao = null; try { dao = new ChoiceDAOImpl(); } catch (Exception se) { throw new ChoiceDAOSysException( "ChoiceDAOFactory.getDAO: Exception while getting DAO type : \n" + se.getMessage()); } return dao; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public OnibusDAO() {}", "public interface DAOFactory {\n\n /**\n *\n * @param context\n * @return\n */\n public abstract DAO createPersonBeaconDAO(Context context);\n}", "public DAOBaseImpl() {\n\t\tsuper();\n\t}", "public AdministratorDAO() {\n super();\n DAOClassType = A...
[ "0.6488413", "0.6433815", "0.641013", "0.6349321", "0.6337939", "0.6327313", "0.6326507", "0.6313463", "0.63079894", "0.6273346", "0.6204535", "0.6164514", "0.6155287", "0.6106934", "0.6091174", "0.60833377", "0.6071988", "0.6058805", "0.6046807", "0.60285074", "0.6024978", ...
0.0
-1
Constructor for Point class
public Point(double x, double y) { this.x = x; this.y = y; this.c = Color.COLORLESS; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Point() {\n }", "public Point() {\n }", "public Point()\n\t{ \n\t\t// Instantiate default properties\n\t\tx = 0;\n\t\ty = 0;\n\t}", "public MyPoint1 (double x, double y) {}", "public Point(Point point) {\n super(point.getReferenceX(), point.getReferenceY());\n this.x = point.x;\n ...
[ "0.8728309", "0.8728309", "0.85035706", "0.8401661", "0.83110654", "0.8304849", "0.82787114", "0.82749104", "0.82197964", "0.8135497", "0.81012416", "0.80950904", "0.80742574", "0.8033156", "0.7964707", "0.796438", "0.79582536", "0.79512125", "0.7910063", "0.7907392", "0.7902...
0.7488474
52
get private var x
public double x() { return this.x; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getx() {\n return x;\n }", "public int Getx(){\n\t\treturn x;\n\t}", "public int getX()\n {\n \t return _x;\n }", "public final int getX()\n{\n\treturn _x;\n}", "int getX() {\n return x;\n }", "int getX() {\n return x;\n }", "public int getX() { return x;...
[ "0.8599153", "0.8424114", "0.8140196", "0.80645573", "0.7986906", "0.7986906", "0.7971121", "0.7971121", "0.7971121", "0.79426396", "0.79242325", "0.7917734", "0.79161423", "0.79157054", "0.79157054", "0.79157054", "0.7897387", "0.78872716", "0.78872716", "0.78732955", "0.787...
0.74813473
96
get private var y
public double y() { return this.y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int gety() {\n return y;\n }", "public double getY() { return y; }", "public final int getY()\n{\n\treturn _y;\n}", "public double y() { return _y; }", "public double getY() {\n return y;\r\n }", "public int Gety(){\n\t\treturn y;\n\t}", "public double getY(){\r\n ret...
[ "0.88198906", "0.8741074", "0.866112", "0.86554354", "0.86550695", "0.86522186", "0.86477184", "0.8640946", "0.8640946", "0.8640946", "0.8640371", "0.8640371", "0.8640371", "0.8640371", "0.8640371", "0.8612533", "0.8611866", "0.86056685", "0.8580398", "0.85778606", "0.8565989...
0.85115963
42
get color as a string for class outside Point
public String c() { switch (c) { case RED: return "Red"; case BLUE: return "Blue"; case YELLOW: return "Yellow"; case GREEN: return "Green"; default: return "Colorless"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public String toString() {\n return color.name();\n }", "public String getColorString();", "String getColor();", "public String getPointColor()\n {\n return myPointColor;\n }", "abstract String getColor();", "String getColour();", "public String getColor(){\r\n ...
[ "0.7651516", "0.76312697", "0.7500853", "0.74865544", "0.7302876", "0.7244024", "0.7199756", "0.7138961", "0.7138961", "0.709796", "0.70915085", "0.7066528", "0.70206213", "0.6996067", "0.6983122", "0.6983122", "0.69295454", "0.69273764", "0.6925029", "0.6894032", "0.68869054...
0.0
-1
set color as a Color for classes outside Point
public void setColor(String color) { color = color.toLowerCase(); switch (color) { case "red": this.c = Color.RED; break; case "blue": this.c = Color.BLUE; break; case "green": this.c = Color.GREEN; break; case "yellow": this.c = Color.YELLOW; break; default: this.c = Color.COLORLESS; break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setPointColor(String pointColor)\n {\n myPointColor = pointColor;\n }", "public void setColor(Color c) { color.set(c); }", "public void setColor(Color c);", "public PointDetails setColor(Color color){\n\t\t\treturn setColor(color.getRGB());\n\t\t}", "public PointDetails setColor(In...
[ "0.7026213", "0.6963819", "0.6905614", "0.68665874", "0.68126863", "0.67985255", "0.67659515", "0.67397404", "0.6736286", "0.6698985", "0.6607373", "0.6607373", "0.65999275", "0.6580974", "0.65719754", "0.65719754", "0.6559442", "0.65493417", "0.65197116", "0.6514675", "0.651...
0.0
-1
print out Point color and coordinates
public void print() { System.out.println(c() + "(" + x + ", " + y + ")"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getPointColor()\n {\n return myPointColor;\n }", "public String toString() {\n\t\treturn \"#Point {x: \" + this.getX() + \", y: \" + this.getY() + \"}\";\n\t}", "public String toString()\n\t{\n\t\treturn \"x:\"+xPos+\" y:\"+yPos+\" width:\"+width+\" height:\"+height+\" color:\"+ colo...
[ "0.6807885", "0.67447305", "0.665825", "0.6577287", "0.65638745", "0.6444986", "0.6412158", "0.6374266", "0.6315622", "0.63146853", "0.62896234", "0.6239037", "0.61203545", "0.6055442", "0.6051886", "0.6030055", "0.6024966", "0.6023454", "0.60119843", "0.5976029", "0.5938949"...
0.6385651
7
Returns a copy of this.
public Statistics getCopyForTest() { Statistics statistics = new Statistics(); statistics.sentMessageTypes.putAll(sentMessageTypes); statistics.receivedMessageTypes.putAll(receivedMessageTypes); statistics.incomingOperationTypes.putAll(incomingOperationTypes); statistics.listenerEventTypes.putAll(listenerEventTypes); statistics.clientErrorTypes.putAll(clientErrorTypes); return statistics; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Object clone(){\n \t\n \treturn this;\n \t\n }", "public CopyBuilder copy() {\n return new CopyBuilder(this);\n }", "public Object clone() {\n return this.copy();\n }", "public Coordinates copy() {\n\t\treturn new Coordinates(this);\n\t}", "public Dispatchable copy() {\n r...
[ "0.7696339", "0.7541677", "0.73022795", "0.7275109", "0.7218508", "0.7171947", "0.71432304", "0.71045315", "0.7059949", "0.69264", "0.69236726", "0.68242997", "0.6805024", "0.6803471", "0.6713863", "0.6706742", "0.6680959", "0.6624283", "0.66101426", "0.6604836", "0.6596695",...
0.0
-1
TODO: Warning this method won't work in the case the id fields are not set
@Override public boolean equals(Object object) { if (!(object instanceof Item)) { return false; } Item other = (Item) object; if ((this.itemPK == null && other.itemPK != null) || (this.itemPK != null && !this.itemPK.equals(other.itemPK))) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setId(Integer id) { this.id = id; }", "private Integer getId() { return this.id; }", "public void setId(int id){ this.id = id; }", "public void setId(Long id) {this.id = id;}", "public void setId(Long id) {this.id = id;}", "public void setID(String idIn) {this.id = idIn;}", "public void se...
[ "0.6896886", "0.6838461", "0.67056817", "0.66419715", "0.66419715", "0.6592331", "0.6579151", "0.6579151", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.65624106", "0.65624106", "0.65441847", "0.65243006", "0.65154546", "0.6487427", "0.64778...
0.0
-1
0 is nothing, 1 is an ArrowTower, 2 is an IceTower
public static int getGold() { return gold; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract Class<? extends Tower> getTower();", "@Test\n\tpublic void testTower()\n\t{\n\t\tassertEquals(1,tower.getNum());\n\t\tassertEquals(22,tower.getPosition().getIntAbscisse());\n\t\tassertEquals(23,tower.getPosition().getIntOrdonne());\n\t}", "void placeTower();", "int getGunType();", "@Overrid...
[ "0.63057846", "0.6076661", "0.6023255", "0.59730536", "0.5964307", "0.5789609", "0.5737597", "0.5721849", "0.5719827", "0.5582932", "0.5509625", "0.5482732", "0.5479514", "0.5459967", "0.54443073", "0.54276055", "0.54098904", "0.5367123", "0.5340507", "0.5305438", "0.53048545...
0.0
-1
Creates the field editors. Field editors are abstractions of the common GUI blocks needed to manipulate various types of preferences. Each field editor knows how to save and restore itself.
@Override public void createFieldEditors() { useForSysHCSteepestEditor = new BooleanFieldEditor(Preferences.P_USE4SYS_HILL_CLIMBING_STEEPEST, "Use &Hill Climbing - Steepest Asc./Descent", getFieldEditorParent()); addField(useForSysHCSteepestEditor); useForSysHCFirstChoiceEditor = new BooleanFieldEditor(Preferences.P_USE4SYS_HILL_CLIMBING_FIRST_CHOICE, "Use Hill Climbing - &First Choice", getFieldEditorParent()); addField(useForSysHCFirstChoiceEditor); useForSysHCTabuSearchEditor = new BooleanFieldEditor(Preferences.P_USE4SYS_TABU_SEARCH, "Use &Tabu Search w Static Tenure", getFieldEditorParent()); addField(useForSysHCTabuSearchEditor); useForSysHCTabuSearchDynEditor = new BooleanFieldEditor(Preferences.P_USE4SYS_TABU_SEARCH_DYNAMIC, "Use Tabu Search w &Dynamic Tenure", getFieldEditorParent()); addField(useForSysHCTabuSearchDynEditor); useForSysHCSimAnnealingEditor = new BooleanFieldEditor(Preferences.P_USE4SYS_SIMULATED_ANNEALING, "Use &Simulated Annealing", getFieldEditorParent()); addField(useForSysHCSimAnnealingEditor); doPreoptimizeEditor = new BooleanFieldEditor(Preferences.P_DO_PREOPTIMIZE, "&Pre-optimize at class/package level", getFieldEditorParent()); addField(doPreoptimizeEditor); logResultsEditor = new BooleanFieldEditor(Preferences.P_LOG_RESULTS, "&Log searching moves and results", getFieldEditorParent()); addField(logResultsEditor); logPathEditor = new DirectoryFieldEditor(Preferences.P_LOG_PATH, "Moves log path:", getFieldEditorParent()); logPathEditor.setEnabled(Activator.getDefault().getPreferenceStore().getBoolean(Preferences.P_LOG_RESULTS), getFieldEditorParent()); logPathEditor.setEmptyStringAllowed(true); addField(logPathEditor); logResultsFileEditor = new FileFieldEditor(Preferences.P_LOG_RESULTS_FILE, "Results log file:", getFieldEditorParent()); logResultsFileEditor.setEnabled( Activator.getDefault().getPreferenceStore().getBoolean(Preferences.P_LOG_RESULTS), getFieldEditorParent()); logResultsFileEditor.setEmptyStringAllowed(true); addField(logResultsFileEditor); limitTimeEditor = new BooleanFieldEditor(Preferences.P_SEARCH_LIMIT_TIME, "&Limit running time", getFieldEditorParent()); addField(limitTimeEditor); maxRunningTimeEditor = new IntegerFieldEditor(Preferences.P_SEARCH_MAX_RUNNING_TIME, "Ma&x time per algorithm (sec)", getFieldEditorParent()); maxRunningTimeEditor.setEnabled( Activator.getDefault().getPreferenceStore().getBoolean(Preferences.P_SEARCH_LIMIT_TIME), getFieldEditorParent()); maxRunningTimeEditor.setEmptyStringAllowed(false); addField(maxRunningTimeEditor); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void createFieldEditors() {\n\t\t\n\t\taddField(new IntegerFieldEditor(PreferenceConstants.SPACES_PER_TAB, \"Spaces per tab (Re-open editor to take effect.)\", getFieldEditorParent(), 2 ) );\n\t\taddField(new IntegerFieldEditor(PreferenceConstants.SECONDS_TO_REEVALUATE, \"Seconds between syntax reevaluation...
[ "0.8323602", "0.8133292", "0.8045674", "0.7986044", "0.7736398", "0.77248096", "0.7704767", "0.7693355", "0.7567126", "0.7518082", "0.6921344", "0.6645468", "0.6462859", "0.625289", "0.59445983", "0.5922609", "0.58852714", "0.58435345", "0.58027", "0.57684094", "0.57630527", ...
0.7887664
4
Get the tile at the given x, y grid coordinates
@Override public SquareTile getTile(int x, int y) { // Check that the location is inside the grid if (x < 0 || x >= width || y < 0 || y >= height) return null; return tiles[x * width + y]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract Tile getTileAt(int x, int y);", "public Tile getTile(int x, int y) {\n\t\tif(!isValidCoordinates(x,y)){\n\t\t\t//remove later -F\n\t\t\tSystem.out.println(\"Invalid\");\n\t\t\treturn tileGrid[0][0]; //will add handling in check later -F\n\t\t}\n\t\telse{\n\t\t\treturn tileGrid[x][y];\n\t\t}\n\t...
[ "0.8346505", "0.8124253", "0.8114176", "0.7964992", "0.79321456", "0.78767866", "0.7876737", "0.77919215", "0.77735806", "0.77193844", "0.76977825", "0.7667515", "0.7657319", "0.75799316", "0.75710297", "0.7489117", "0.74874175", "0.7458257", "0.7451444", "0.7417914", "0.7372...
0.8224426
1
Get the tile at the given x, y grid coordinates
@Override public SquareTile getTile(Point location) { return getTile(location.getX(), location.getY()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract Tile getTileAt(int x, int y);", "@Override\n public SquareTile getTile(int x, int y) {\n // Check that the location is inside the grid\n if (x < 0 || x >= width || y < 0 || y >= height)\n return null;\n\n return tiles[x * width + y];\n }", "public Tile getT...
[ "0.8346505", "0.8224426", "0.8124253", "0.8114176", "0.7964992", "0.79321456", "0.78767866", "0.7876737", "0.77919215", "0.77735806", "0.77193844", "0.76977825", "0.7667515", "0.7657319", "0.75799316", "0.75710297", "0.7489117", "0.74874175", "0.7458257", "0.7451444", "0.7417...
0.6633228
49
Get the number of tiles high the grid is
@Override public int getWidth() { return width; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getHeight() {\n return getTileHeight() * getHeightInTiles();\n }", "int getTileSize();", "@Override\n public int getNumYTiles() {\n return getMaxTileY() - getMinTileY() + 1;\n }", "public int getActualHeightInTiles() {\n return getHeight() / getActualTileHeight();\n }", "pub...
[ "0.7398608", "0.7336", "0.72737825", "0.725537", "0.71832925", "0.7179476", "0.71450543", "0.7062097", "0.70318323", "0.695906", "0.6945232", "0.69039845", "0.6896038", "0.6893959", "0.6827372", "0.68006647", "0.67783606", "0.67541534", "0.67461294", "0.67007375", "0.6695741"...
0.0
-1
Get the number of tiles wide the grid is
@Override public int getHeight() { return height; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getActualWidthInTiles() {\n return getWidth() / getActualTileWidth();\n }", "public int getWidth() {\n return getTileWidth() * getWidthInTiles();\n }", "public int getWidth(){\r\n\t\treturn grid.length;\r\n\t}", "private int getWidth() {\r\n if (ix < 0) \r\n throw new NoS...
[ "0.81723773", "0.8076992", "0.76418424", "0.75947285", "0.75572526", "0.7538881", "0.7469065", "0.7382434", "0.733866", "0.731486", "0.73045796", "0.7162129", "0.7128372", "0.70494545", "0.7007725", "0.7002091", "0.6993737", "0.69851816", "0.69699347", "0.6969801", "0.6962260...
0.0
-1
Gets the closest tile to the given point
@Override public SquareTile getClosestTile(Point pos, float scale) { // The current best tile int bestDist = Integer.MAX_VALUE; SquareTile best = null; for (SquareTile tile : tiles) { int dist = pos.distance(tile.getPixelCenterLocation(scale)); // Check if this tile is closer if (best == null || dist < bestDist) { // Update the best tile best = tile; bestDist = dist; } } return best; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public ITile getClosestTile(int x, int y) {\n return getClosestTile(new Point(x, y), getTileSize());\n }", "public Point getClosestPoint(Point p) {\n\t\t// If the node is not diveded and there are no points then we \n\t\t// cant return anything\n\t\tif (!divided && points.keySet().size()...
[ "0.7362331", "0.65262944", "0.65132415", "0.64913696", "0.6481483", "0.63882804", "0.63839185", "0.6356894", "0.6336112", "0.63287795", "0.6321831", "0.6320034", "0.630141", "0.6289122", "0.6260239", "0.62382674", "0.623604", "0.62233347", "0.6208625", "0.61963195", "0.616294...
0.68276554
1
Gets the closest tile to the given point
@Override public ITile getClosestTile(int x, int y) { return getClosestTile(new Point(x, y), getTileSize()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public SquareTile getClosestTile(Point pos, float scale) {\n // The current best tile\n int bestDist = Integer.MAX_VALUE;\n SquareTile best = null;\n\n for (SquareTile tile : tiles) {\n int dist = pos.distance(tile.getPixelCenterLocation(scale));\n\n ...
[ "0.68276554", "0.65262944", "0.65132415", "0.64913696", "0.6481483", "0.63882804", "0.63839185", "0.6356894", "0.6336112", "0.63287795", "0.6321831", "0.6320034", "0.630141", "0.6289122", "0.6260239", "0.62382674", "0.623604", "0.62233347", "0.6208625", "0.61963195", "0.61629...
0.7362331
0
Stupid simple example of guessing if we have an email or not
@Override protected Object defaultObject(String completionText) { int index = completionText.indexOf('@'); if (index == -1) { return new Usuarios(completionText, completionText.replace(" ", "") + "@gmail.com"); } else { return new Usuarios(completionText.substring(0, index), completionText); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean hasEmail();", "boolean hasEmail();", "boolean hasEmail();", "boolean hasEmail();", "boolean hasEmail();", "public boolean findEmail(String email);", "boolean isEmailExist(String email);", "private boolean checkemail(String s) {\n\t\tboolean flag = false;\r\n\t\tString[] m = s.split(\"@\");\r\...
[ "0.75866", "0.75866", "0.75866", "0.75866", "0.75866", "0.74265796", "0.73612607", "0.72328526", "0.71928763", "0.71044934", "0.7093323", "0.7077838", "0.7031617", "0.7022415", "0.7022415", "0.7022415", "0.7022415", "0.7017125", "0.7016031", "0.69265383", "0.6862615", "0.68...
0.0
-1
Single array element to array:
public static void printColor(String color){ System.out.println(color); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "E[] toArray();", "T[] toArray(T[] a);", "Object[] toArray();", "Object[] toArray();", "Object[] toArray();", "JAVATYPE [] convertArray(JAVATYPE [] oldArray, final METATYPE meta);", "public <T> T[] toArray(T[] arr);", "int[] toArray();", "public <T> T[] toArray(T[] a) {\n int k = 0;\n ...
[ "0.7320666", "0.71412015", "0.69135404", "0.69135404", "0.69135404", "0.67985994", "0.67404306", "0.67210066", "0.66837955", "0.66335136", "0.65966964", "0.6579305", "0.65774024", "0.64952815", "0.6487041", "0.64540136", "0.64432174", "0.6347775", "0.63319963", "0.63236904", ...
0.0
-1
Whole array to Method:
public static void printColor(String[] colors){ for(int i=0; i<colors.length; i++){ System.out.println(colors[i]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void toSelf(def<T> func) {\n $(array).forEach((e, i) -> {\n array[$(i)] = func.apply(e);\n });\n }", "JAVATYPE [] convertArray(JAVATYPE [] oldArray, final METATYPE meta);", "void mo12207a(int[] iArr);", "private Function1<Seq<String>, String[...
[ "0.66033244", "0.6166477", "0.61018836", "0.60498697", "0.6047994", "0.59675395", "0.58735424", "0.5825391", "0.57774115", "0.57738996", "0.57738996", "0.57738996", "0.5765144", "0.57460713", "0.5655879", "0.5625674", "0.562055", "0.5600114", "0.5553717", "0.553474", "0.55035...
0.0
-1
TESTS DEFINITIONS / Original code Comparator stringVar_2 = this.atr1.trim().CASE_INSENSITIVE_ORDER; //mutGenLimit 1 String stringVar_3 = this.stringMethod_3(1, 2).concat("lalala").intern(); //mutGenLimit 1 Comparator stringVar_4 = this.stringMethod_4(1, 2).CASE_INSENSITIVE_ORDER; //mutGenLimit 1
@Parameters public static Collection<Object[]> firstValues() { List<Pattern> mceJTD_1 = new LinkedList<Pattern>(); mceJTD_1.add(Pattern.compile("(.+\\.)?Comparator\\<String\\> stringVar_2 = atr1\\.trim\\(\\)\\.CASE_INSENSITIVE_ORDER; //mutGenLimit 0")); mceJTD_1.add(Pattern.compile("(.+\\.)?String stringVar_3 = stringMethod_3\\( 1, 2 \\)\\.concat\\( \"lalala\" \\)\\.intern\\(\\); //mutGenLimit 0")); mceJTD_1.add(Pattern.compile("(.+\\.)?Comparator\\<String\\> stringVar_4 = stringMethod_4\\( 1, 2 \\)\\.CASE_INSENSITIVE_ORDER; //mutGenLimit 0")); Property propJTD_1 = new Property(MutationOperator.JTD, "test/JTD_1", "radiatedMethod", 3, 3, mceJTD_1, TestingTools.NO_PATTERN_EXPECTED); /* * Original code * * Comparator<String> stringVar_2 = this.atr1.trim().CASE_INSENSITIVE_ORDER; //mutGenLimit 1 * String stringVar_3 = this.stringMethod_3(1, 2); //mutGenLimit 1 * String stringVar_4 = this.atr2; //mutGenLimit 1 * String stringVar_5 = this.atr2; //mutGenLimit 1 * */ List<Pattern> mceJTD_2 = new LinkedList<Pattern>(); mceJTD_2.add(Pattern.compile("(.+\\.)?Comparator\\<String\\> stringVar_2 = atr1\\.trim\\(\\)\\.CASE_INSENSITIVE_ORDER; //mutGenLimit 0")); mceJTD_2.add(Pattern.compile("(.+\\.)?String stringVar_3 = stringMethod_3\\( 1, 2 \\); //mutGenLimit 0")); mceJTD_2.add(Pattern.compile("(.+\\.)?String stringVar_4 = atr2; //mutGenLimit 0")); mceJTD_2.add(Pattern.compile("(.+\\.)?String stringVar_5 = atr2; //mutGenLimit 0")); Property propJTD_2 = new Property(MutationOperator.JTD, "test/JTD_2", "radiatedMethod", 4, 4, mceJTD_2, TestingTools.NO_PATTERN_EXPECTED); /* * Original code * * int var1 = this.field1; //mutGenLimit 2 * int var2 = this.method1(field1, field2); //mutGenLimit 2 * int var3 = this.method1(this.field1, field2); //mutGenLimit 2 * int var4 = this.method1(this.method1(this.field1, this.method2(this.field2, this.field3)), 0); //mutGenLimit 2 * return this.method1(this.field1, var5); //mutGenLimit 2 * */ List<Pattern> mceJTD_3 = new LinkedList<Pattern>(); mceJTD_3.add(Pattern.compile("int var1 = field1; //mutGenLimit 1")); mceJTD_3.add(Pattern.compile("int var2 = method1\\( field1, field2 \\); //mutGenLimit 1")); mceJTD_3.add(Pattern.compile("int var3 = method1\\( this\\.field1, field2 \\); //mutGenLimit 1")); mceJTD_3.add(Pattern.compile("int var3 = this\\.method1\\( field1, field2 \\); //mutGenLimit 1")); mceJTD_3.add(Pattern.compile("int var4 = method1\\( this\\.method1\\( this\\.field1, this\\.method2\\( this\\.field2, this\\.field3 \\) \\), 0 \\); //mutGenLimit 1")); mceJTD_3.add(Pattern.compile("int var4 = this\\.method1\\( method1\\( this\\.field1, this\\.method2\\( this\\.field2, this\\.field3 \\) \\), 0 \\); //mutGenLimit 1")); mceJTD_3.add(Pattern.compile("int var4 = this\\.method1\\( this\\.method1\\( field1, this\\.method2\\( this\\.field2, this\\.field3 \\) \\), 0 \\); //mutGenLimit 1")); mceJTD_3.add(Pattern.compile("int var4 = this\\.method1\\( this\\.method1\\( this\\.field1, method2\\( this\\.field2, this\\.field3 \\) \\), 0 \\); //mutGenLimit 1")); mceJTD_3.add(Pattern.compile("int var4 = this\\.method1\\( this\\.method1\\( this\\.field1, this\\.method2\\( field2, this\\.field3 \\) \\), 0 \\); //mutGenLimit 1")); mceJTD_3.add(Pattern.compile("int var4 = this\\.method1\\( this\\.method1\\( this\\.field1, this\\.method2\\( this\\.field2, field3 \\) \\), 0 \\); //mutGenLimit 1")); mceJTD_3.add(Pattern.compile("")); mceJTD_3.add(Pattern.compile("")); Property propJTD_3 = new Property(MutationOperator.JTD, "test/JTD_3", "radiatedMethod", 12, 12, mceJTD_3, TestingTools.NO_PATTERN_EXPECTED); //MUTANTS FOLDERS List<MutantInfo> mfJTD_1; List<MutantInfo> mfJTD_2; List<MutantInfo> mfJTD_3; //MUTANTS GENERATION mfJTD_1 = TestingTools.generateMutants(propJTD_1); mfJTD_2 = TestingTools.generateMutants(propJTD_2); mfJTD_3 = TestingTools.generateMutants(propJTD_3); //PARAMETERS return Arrays.asList(new Object[][] { {propJTD_1, mfJTD_1}, {propJTD_2, mfJTD_2}, {propJTD_3, mfJTD_3}, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void method0() {\npublic static final RefComparisonWarningProperty SAW_CALL_TO_EQUALS = new RefComparisonWarningProperty(\"SAW_CALL_TO_EQUALS\", PriorityAdjustment.AT_MOST_LOW);\n/** Method is private (or package-protected). */\npublic static final RefComparisonWarningProperty PRIVATE_METHOD = new RefComparisonWar...
[ "0.6458539", "0.61157596", "0.6037449", "0.5980297", "0.59137905", "0.58372855", "0.57708186", "0.5716311", "0.56795025", "0.560379", "0.55275357", "0.55146277", "0.5500214", "0.54727215", "0.5455574", "0.5442984", "0.54405135", "0.54254514", "0.5417205", "0.54159003", "0.541...
0.5611103
9
/ Set Logica y Coordinador
private void initCoordLogic() throws SQLException { coordUsuario = new CoordinadorUsuario(); logicaUsuario = new LogicaUsuario(); coordUsuario.setLogica(logicaUsuario); logicaUsuario.setCoordinador(coordUsuario); /* Listados de ComboBox*/ rol = new RolVO(); empleado = new EmpleadoVO(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public logicaEnemigos(){\n\t\t//le damos una velocidad inicial al enemigo\n\t\tsuVelocidad = 50;\n\t\tsuDireccionActual = 0.0;\n\t\tposX = 500 ;\n\t\tposY = 10;\n\t}", "public void setHoraCompra() {\n LocalTime hora=LocalTime.now();\n this.horaCompra = hora;\n }", "public void SetValues(Map<St...
[ "0.6430125", "0.5854627", "0.57611364", "0.5756026", "0.574215", "0.5739791", "0.56561905", "0.56330395", "0.5615488", "0.5600551", "0.55885506", "0.55798", "0.55535424", "0.55503035", "0.5538669", "0.5533618", "0.5526444", "0.54952", "0.5491556", "0.54765105", "0.5475555", ...
0.5088728
88
/ Llenar ComboBox Rol
private void listadoRol(JComboBox cbb) throws SQLException { int selected = cbb.getSelectedIndex(); DefaultComboBoxModel model = (DefaultComboBoxModel) cbb.getModel(); if (!coordUsuario.listaRol().isEmpty()) { listaRol = coordUsuario.listaRol(); // Borrar Datos Viejos model.removeAllElements(); for (int i=0;i<listaRol.size();i++) { model.addElement(listaRol.get(i).getNombre()); } // setting model with new data cbb.setModel(model); cbb.setRenderer(new MyComboBox("Rol")); cbb.setSelectedIndex(selected); }}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void llenarCombo() {\n cobOrdenar.removeAllItems();\n cobOrdenar.addItem(\"Fecha\");\n cobOrdenar.addItem(\"Nro Likes\");\n cobOrdenar.setSelectedIndex(-1); \n }", "@Override\r\n\tprotected void InitComboBox() {\n\t\t\r\n\t}", "public void llenarComboBox(){\n ...
[ "0.7741338", "0.74711955", "0.72704995", "0.7068874", "0.70613337", "0.700979", "0.69635767", "0.6943263", "0.68460536", "0.6714424", "0.6710089", "0.6708498", "0.6688562", "0.66326517", "0.6618527", "0.6611719", "0.659962", "0.6594221", "0.6585689", "0.6579711", "0.65749997"...
0.673812
9
Set the expected value of the Constant in the class to be woven
public void setExpected(String expected) { this.expected = checkAndPad(expected); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setConstant(){\n \tisConstant = true;\n }", "public Constant (int value){\r\n this.value = value;\r\n\r\n }", "@Override\n\tpublic void setConstant(InterpreteConstants c) {\n\t\t\n\t}", "public void setConst() {\r\n\t\tthis.isConst = true;\r\n\t}", "@Override\n public boolean...
[ "0.6945383", "0.67355883", "0.6369496", "0.6192673", "0.61438805", "0.60050696", "0.5974653", "0.5937038", "0.57991844", "0.5797008", "0.5787826", "0.57641256", "0.571156", "0.5677924", "0.56507045", "0.5614068", "0.5557091", "0.55554396", "0.55548877", "0.55495393", "0.54888...
0.0
-1
Set the value of the Constant to weave into the class
public void setChangeTo(String changeTo) { this.changeTo = checkAndPad(changeTo); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setConstant(){\n \tisConstant = true;\n }", "public Constant (int value){\r\n this.value = value;\r\n\r\n }", "@Override\n\tpublic void setConstant(InterpreteConstants c) {\n\t\t\n\t}", "public IRubyObject setConstant(String name, IRubyObject value) {\n IRubyObject oldValu...
[ "0.7075525", "0.65546983", "0.6369652", "0.61647516", "0.6081574", "0.5914451", "0.58990085", "0.5866078", "0.572412", "0.5719224", "0.5692349", "0.5626929", "0.56037235", "0.5598374", "0.55895746", "0.55458397", "0.5521654", "0.54662645", "0.5410223", "0.5408504", "0.5406633...
0.0
-1
Add a dynamic import
public void addImport(String importString) { dynamicImports.add(importString); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Import createImport();", "Import createImport();", "Imports createImports();", "public void testMultipleConflictingDynamicImports() throws Exception {\n\n\t\tsetupImportChoices();\n\t\tConfigurableWeavingHook hook = new ConfigurableWeavingHook();\n\t\thook.addImport(IMPORT_TEST_CLASS_PKG + \";version=\\\"(1....
[ "0.6896103", "0.6896103", "0.66272026", "0.63880146", "0.631225", "0.6284994", "0.62614393", "0.61754376", "0.61316895", "0.6106133", "0.6056307", "0.6029672", "0.6010843", "0.5979761", "0.59664977", "0.5947775", "0.59052575", "0.5882024", "0.58740085", "0.58528227", "0.58467...
0.71012664
0
Has this weaving hook been called for a test class
public boolean isCalled() { return called; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testWovenClassListenerNotNotifiedWhenNoWeavingHooks() throws Exception {\n\t\tregisterThisListener();\n\t\ttry {\n\t\t\tweavingClasses.loadClass(TEST_CLASS_NAME);\n\t\t\tassertNull(\"Listener notified with no weaving hooks registered\", listenerWovenClass);\n\t\t\tassertStates();\n\t\t}\n\t\tfinally {\...
[ "0.6430886", "0.61235636", "0.599349", "0.5930206", "0.5862173", "0.5800489", "0.5683203", "0.5658811", "0.5637273", "0.562066", "0.5599209", "0.55695957", "0.55507344", "0.55369705", "0.55350083", "0.5529218", "0.5492233", "0.54892224", "0.54892224", "0.54728603", "0.5468331...
0.0
-1
Set an exception to throw instead of weaving the class
public void setExceptionToThrow(RuntimeException re) { toThrow = re; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void throwException() throws Exception {\n\t\tthrow new Exception();\r\n\t}", "public void throwException()\n\t{\n\t\tthrow new RuntimeException(\"Dummy RUNTIME Exception\");\n\t}", "@Override\n protected boolean shouldSendThrowException() {\n return false;\n }", "public void test...
[ "0.686389", "0.663972", "0.6341357", "0.6313665", "0.6299393", "0.62726176", "0.62052876", "0.614897", "0.61291224", "0.6063948", "0.60516435", "0.60477746", "0.6039707", "0.5982289", "0.595508", "0.5886249", "0.5869772", "0.5859745", "0.58419514", "0.58369726", "0.58236843",...
0.60468817
12
We are only interested in classes that are in the test
public void weave(WovenClass wovenClass) { if(wovenClass.getClassName().startsWith(TESTCLASSES_PACKAGE)) { called = true; //If there is an exception, throw it and prevent it being thrown again if(toThrow != null) { try { throw toThrow; } finally { toThrow = null; } } // Load the class and change the UTF8 constant try { byte[] classBytes = wovenClass.getBytes(); byte[] existingConstantBytes = expected .getBytes(StandardCharsets.UTF_8); // Brute force is simple, and sufficient for our use case int location = -1; outer: for (int i = 0; i < classBytes.length; i++) { for (int j = 0; j < existingConstantBytes.length; j++) { if (classBytes[j + i] != existingConstantBytes[j]) { continue outer; } } location = i; break; } if(location < 0) throw new RuntimeException("Unable to locate the expected " + expected + " in the class file."); byte[] changeToConstantBytes = changeTo .getBytes(StandardCharsets.UTF_8); System.arraycopy(changeToConstantBytes, 0, classBytes, location, changeToConstantBytes.length); //Add any imports and set the new class bytes for(int i = 0; i < dynamicImports.size(); i++) { wovenClass.getDynamicImports().add(dynamicImports.get(i)); } wovenClass.setBytes(classBytes); } catch (Exception e) { //Throw on any IllegalArgumentException as this comes from //The dynamic import. Anything else is an error and should be //wrapped and thrown. if(e instanceof IllegalArgumentException) throw (IllegalArgumentException)e; else throw new RuntimeException(e); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testGetClasses() throws Exception {\n for (Class clazz : TestClass.class.getClasses()) {\n System.out.println(clazz.getName());\n }\n }", "@Test\n public void testGetDecalredClasses() {\n for (Class clazz : TestClass.class.getDeclaredClasses()) {\n ...
[ "0.7022075", "0.6847985", "0.67302805", "0.6636653", "0.6623168", "0.66116554", "0.6565331", "0.65480936", "0.6537779", "0.6459387", "0.63778985", "0.63667727", "0.6332885", "0.6270363", "0.62124157", "0.6191927", "0.6169916", "0.6166979", "0.61435974", "0.61228245", "0.61012...
0.0
-1
Register this hook using the supplied context
public ServiceRegistration<WeavingHook> register(BundleContext ctx) { return register(ctx, 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void add(T context);", "public void use(Context context)\n {\n useImplementation.use(context);\n }", "default void update(T context) {\n add(context);\n }", "public static void registerInContext(Context ctx) {\n DictProto.registerInContext(ctx);\n ctx.registerProto(OBJE...
[ "0.6781442", "0.6188873", "0.6126876", "0.60476154", "0.5972535", "0.59692746", "0.5949843", "0.59496856", "0.58884406", "0.5888106", "0.58809835", "0.58590823", "0.58481103", "0.58351225", "0.5811505", "0.5795897", "0.5770474", "0.57586026", "0.57521105", "0.57239336", "0.57...
0.65716463
1
Register this hook using the supplied context and ranking
public ServiceRegistration<WeavingHook> register(BundleContext ctx, int rank) { Hashtable<String, Object> table = new Hashtable<String, Object>(); table.put(Constants.SERVICE_RANKING, Integer.valueOf(rank)); return ctx.registerService(WeavingHook.class, this, table); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void add(T context);", "default void update(T context) {\n add(context);\n }", "public void use(Context context)\n {\n useImplementation.use(context);\n }", "private MatchFunctRegistry<Function> registerCustomFunctions(\n\t\t\tfinal BundleContext context) {\n\t\tcustomFunctionServiceRe...
[ "0.571765", "0.5621723", "0.55961645", "0.5195213", "0.50482917", "0.5033059", "0.49173433", "0.4900735", "0.489059", "0.48438406", "0.48378503", "0.48341513", "0.48199227", "0.4812574", "0.4798858", "0.47950947", "0.47706938", "0.4770279", "0.47663543", "0.47627345", "0.4745...
0.69900584
0
Create a Listener expecting an error with the supplied cause and source
public ClassLoadErrorListener(RuntimeException cause, Bundle source) { this.cause = cause; this.source = source; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public interface ErrorListener {\r\n /**\r\n * Responds to the error event in any way that the listener chooses\r\n * @param source The object that raised the error event\r\n * @param msg An optional message created by the source object\r\n */\r\n public void respondToError(Object source, Str...
[ "0.6357912", "0.6241759", "0.5899334", "0.58011854", "0.5768849", "0.5721904", "0.56119126", "0.54511154", "0.54485327", "0.5431597", "0.54278004", "0.54154617", "0.5384052", "0.5332266", "0.5300402", "0.5255644", "0.52358484", "0.5196363", "0.51780236", "0.51610136", "0.5157...
0.6690877
0
Receieve and validate the framework event
public synchronized void frameworkEvent(FrameworkEvent event) { if(!validated) { validated = (event.getType() == FrameworkEvent.ERROR && event.getThrowable() == cause && event.getBundle() == source); } events.add(event); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void checkEvents()\n\t{\n\t\t((MBoxStandalone)events).processMessages();\n\t}", "public abstract EventMsg msgRequired();", "void validateDates(ComponentSystemEvent event);", "void event(Event e) throws Exception;", "private void validateEvent(final Event event) {\n if (null == event) {\n ...
[ "0.6742175", "0.6453756", "0.63929975", "0.63790107", "0.63374037", "0.623641", "0.6202417", "0.6199936", "0.6177857", "0.6146275", "0.6125801", "0.61244714", "0.6116495", "0.6116495", "0.6116495", "0.6116495", "0.6116495", "0.60832196", "0.60832196", "0.6058687", "0.6050315"...
0.6782226
0
True if one, and only one, valid event was received
public boolean wasValidEventSent() { return validated; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean hasEvent();", "boolean isSetEvent();", "boolean hasEvents() {\n return !currentSegment.isEmpty() || !historySegments.isEmpty();\n }", "public boolean hasNextEvent() {\n \treturn next != null;\n }", "boolean hasReceived();", "boolean hasChangeEvent();", "public boolean isSetEvent...
[ "0.74120057", "0.7108794", "0.69455665", "0.67288244", "0.6704669", "0.66947097", "0.66708326", "0.66376853", "0.6563136", "0.6508872", "0.64967585", "0.64592767", "0.6439229", "0.6396222", "0.635352", "0.62994164", "0.6269924", "0.6269625", "0.6209716", "0.620759", "0.618867...
0.6694689
6
Perform a basic weave, and show the loaded class is changed
public void testBasicWeaving() throws Exception { // Install the bundles necessary for this test ServiceRegistration<WeavingHook> reg = null; try { reg = new ConfigurableWeavingHook().register(getContext(), 0); Class<?> clazz = weavingClasses.loadClass(TEST_CLASS_NAME); assertEquals("Weaving was unsuccessful", DEFAULT_CHANGE_TO, clazz.getConstructor().newInstance().toString()); } finally { if (reg != null) reg.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void weave(WovenClass cls) {\r\n\r\n String clsName = cls.getClassName();\r\n GeminiUtil.debugWeaving(\"Gemini WeavingHookTransformer.weave() called on class \", clsName);\r\n\r\n Bundle b = cls.getBundleWiring().getBundle();\r\n ClassLoader loader = cls.getBundleWiring().getClas...
[ "0.72358567", "0.5765753", "0.5704153", "0.5679098", "0.5671083", "0.56484735", "0.5544892", "0.5492036", "0.5459971", "0.545318", "0.5430332", "0.5422411", "0.5323243", "0.5242514", "0.52197397", "0.51809335", "0.51755184", "0.51359665", "0.5135489", "0.5135068", "0.50978225...
0.48893723
38
Perform a basic weave that adds an import, and show the loaded class fails if the hook does not add the import
public void testBasicWeavingNoDynamicImport() throws Exception { // Install the bundles necessary for this test ServiceRegistration<WeavingHook> reg = null; ConfigurableWeavingHook hook = new ConfigurableWeavingHook(); hook.setChangeTo("org.osgi.framework.Bundle"); try { reg = hook.register(getContext(), 0); Class<?>clazz = weavingClasses.loadClass(DYNAMIC_IMPORT_TEST_CLASS_NAME); clazz.getConstructor().newInstance().toString(); fail("Should fail to load the Bundle class"); } catch (RuntimeException cnfe) { assertTrue("Wrong exception: " + cnfe.getCause().getClass(), (cnfe.getCause() instanceof ClassNotFoundException)); } finally { if (reg != null) reg.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void weave(WovenClass cls) {\r\n\r\n String clsName = cls.getClassName();\r\n GeminiUtil.debugWeaving(\"Gemini WeavingHookTransformer.weave() called on class \", clsName);\r\n\r\n Bundle b = cls.getBundleWiring().getBundle();\r\n ClassLoader loader = cls.getBundleWiring().getClas...
[ "0.6800332", "0.6208778", "0.61226803", "0.60525554", "0.6043814", "0.5902596", "0.5851622", "0.56259775", "0.5513306", "0.54995793", "0.5490056", "0.5464605", "0.54638386", "0.5375962", "0.5322041", "0.5294433", "0.5291428", "0.526432", "0.5212353", "0.5206304", "0.5200977",...
0.6151533
2
Perform a basic weave that adds an import, and show the loaded class works if the hook adds the import
public void testBasicWeavingDynamicImport() throws Exception { // Install the bundles necessary for this test ServiceRegistration<WeavingHook> reg = null; ConfigurableWeavingHook hook = new ConfigurableWeavingHook(); hook.addImport("org.osgi.framework"); hook.setChangeTo("org.osgi.framework.Bundle"); try { reg = hook.register(getContext(), 0); Class<?>clazz = weavingClasses.loadClass(DYNAMIC_IMPORT_TEST_CLASS_NAME); assertEquals("Weaving was unsuccessful", "interface org.osgi.framework.Bundle", clazz.getConstructor().newInstance().toString()); } finally { if (reg != null) reg.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void weave(WovenClass cls) {\r\n\r\n String clsName = cls.getClassName();\r\n GeminiUtil.debugWeaving(\"Gemini WeavingHookTransformer.weave() called on class \", clsName);\r\n\r\n Bundle b = cls.getBundleWiring().getBundle();\r\n ClassLoader loader = cls.getBundleWiring().getClas...
[ "0.6803684", "0.60924274", "0.59555304", "0.5855069", "0.5780256", "0.57768476", "0.56950533", "0.5614454", "0.55488795", "0.5493658", "0.54500735", "0.5361777", "0.53437746", "0.5336411", "0.52760446", "0.52651745", "0.52420974", "0.5195747", "0.5194109", "0.51834655", "0.51...
0.6185954
1
Test that multiple weavers get called in service id order
public void testMultipleWeavers() throws Exception { ConfigurableWeavingHook hook1 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook2 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook3 = new ConfigurableWeavingHook(); hook1.setChangeTo("1 Finished"); hook2.setExpected("1 Finished"); hook2.setChangeTo("2 Finished"); hook3.setExpected("2 Finished"); hook3.setChangeTo("Chain Complete"); ServiceRegistration<WeavingHook> reg1 = null; ServiceRegistration<WeavingHook> reg2= null; ServiceRegistration<WeavingHook> reg3 = null; try { reg1 = hook1.register(getContext(), 0); reg2 = hook2.register(getContext(), 0); reg3 = hook3.register(getContext(), 0); Class<?>clazz = weavingClasses.loadClass(TEST_CLASS_NAME); assertEquals("Weaving was unsuccessful", "Chain Complete", clazz.getConstructor().newInstance().toString()); } finally { if (reg1 != null) reg1.unregister(); if (reg2 != null) reg2.unregister(); if (reg3 != null) reg3.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testMultipleWeaversWithRankings() throws Exception {\n\n\t\tConfigurableWeavingHook hook1 = new ConfigurableWeavingHook();\n\t\tConfigurableWeavingHook hook2 = new ConfigurableWeavingHook();\n\t\tConfigurableWeavingHook hook3 = new ConfigurableWeavingHook();\n\n\t\t//Called in proper order\n\t\thook3.s...
[ "0.67743", "0.6508515", "0.5862888", "0.5463099", "0.54471433", "0.53672385", "0.5323773", "0.5321276", "0.528239", "0.5205749", "0.5199412", "0.5173121", "0.51235765", "0.51020813", "0.50886726", "0.50545496", "0.5037427", "0.5000438", "0.49757883", "0.49475434", "0.4947146"...
0.69273347
0
Test that multiple weavers get called in ranking and service id order
public void testMultipleWeaversWithRankings() throws Exception { ConfigurableWeavingHook hook1 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook2 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook3 = new ConfigurableWeavingHook(); //Called in proper order hook3.setChangeTo("3 Finished"); hook1.setExpected("3 Finished"); hook1.setChangeTo("1 Finished"); hook2.setExpected("1 Finished"); hook2.setChangeTo("Chain Complete"); ServiceRegistration<WeavingHook> reg1 = null; ServiceRegistration<WeavingHook> reg2= null; ServiceRegistration<WeavingHook> reg3 = null; try { reg1 = hook1.register(getContext(), 0); reg2 = hook2.register(getContext(), 0); reg3 = hook3.register(getContext(), 1); Class<?>clazz = weavingClasses.loadClass(TEST_CLASS_NAME); assertEquals("Weaving was unsuccessful", "Chain Complete", clazz.getConstructor().newInstance().toString()); // We expect the order to change if we update our ranking Hashtable<String, Object> table = new Hashtable<String, Object>(); table.put(Constants.SERVICE_RANKING, Integer.valueOf(2)); reg2.setProperties(table); hook2.setExpected(DEFAULT_EXPECTED); hook2.setChangeTo("2 Finished"); hook3.setExpected("2 Finished"); hook3.setChangeTo("3 Finished"); hook1.setChangeTo("org.osgi.framework.hooks.weaving.WovenClass"); hook2.addImport("org.osgi.framework.hooks.weaving"); clazz = weavingClasses.loadClass(DYNAMIC_IMPORT_TEST_CLASS_NAME); assertEquals("Weaving was unsuccessful", "interface org.osgi.framework.hooks.weaving.WovenClass", clazz.getConstructor().newInstance().toString()); } finally { if (reg1 != null) reg1.unregister(); if (reg2 != null) reg2.unregister(); if (reg3 != null) reg3.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testMultipleWeavers() throws Exception {\n\n\t\tConfigurableWeavingHook hook1 = new ConfigurableWeavingHook();\n\t\tConfigurableWeavingHook hook2 = new ConfigurableWeavingHook();\n\t\tConfigurableWeavingHook hook3 = new ConfigurableWeavingHook();\n\n\t\thook1.setChangeTo(\"1 Finished\");\n\t\thook2.set...
[ "0.64546", "0.6309339", "0.5884583", "0.5686537", "0.5668163", "0.5654719", "0.5553649", "0.5490252", "0.5450457", "0.53945833", "0.52965105", "0.5296331", "0.5294174", "0.5287703", "0.52313656", "0.521156", "0.5207893", "0.5192116", "0.5168521", "0.5159724", "0.5150467", "...
0.7445956
0
Test that an exception stops the weaving chain midway
public void testExceptionPreventsSubsequentCalls() throws Exception { ConfigurableWeavingHook hook1 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook2 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook3 = new ConfigurableWeavingHook(); RuntimeException cause = new RuntimeException(); //If hook 2 throws an exception then 3 should not be called hook1.setChangeTo("1 Finished"); hook2.setExceptionToThrow(cause); hook3.setExpected("2 Finished"); hook3.setChangeTo("Chain Complete"); ServiceRegistration<WeavingHook> reg1 = null; ServiceRegistration<WeavingHook> reg2= null; ServiceRegistration<WeavingHook> reg3 = null; try { reg1 = hook1.register(getContext(), 0); reg2 = hook2.register(getContext(), 0); reg3 = hook3.register(getContext(), 0); weavingClasses.loadClass(TEST_CLASS_NAME); fail("Class should fail to Load"); } catch (ClassFormatError cfe) { assertSame("Should be caused by our Exception", cause, cfe.getCause()); assertTrue("Hook 1 should be called", hook1.isCalled()); assertTrue("Hook 2 should be called", hook2.isCalled()); assertFalse("Hook 3 should not be called", hook3.isCalled()); } finally { if (reg1 != null) reg1.unregister(); if (reg2 != null) reg2.unregister(); if (reg3 != null) reg3.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void exceptionCase(Robot r)\n {\n r.turnLeft();\n if(r.frontIsClear() == false) // If after traversing street x forward and street y backward\n { // the front is not clear (i.e. the robot has traversed the entire square area),\n stopCase(...
[ "0.6664795", "0.6276058", "0.6261692", "0.6225921", "0.6224584", "0.6156048", "0.6147072", "0.6120187", "0.6110068", "0.6074359", "0.6073819", "0.60720927", "0.60704833", "0.6063356", "0.60449314", "0.6032141", "0.6023603", "0.60209453", "0.6010464", "0.59952384", "0.5991914"...
0.64895594
1
Test that an exception causes deny listing
public void testExceptionCausesDenyListing() throws Exception { ConfigurableWeavingHook hook1 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook2 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook3 = new ConfigurableWeavingHook(); RuntimeException cause = new RuntimeException(); hook1.setChangeTo("1 Finished"); hook2.setExceptionToThrow(cause); hook3.setExpected("1 Finished"); hook3.setChangeTo("Chain Complete"); ServiceRegistration<WeavingHook> reg1 = null; ServiceRegistration<WeavingHook> reg2= null; ServiceRegistration<WeavingHook> reg3 = null; ClassLoadErrorListener listener = new ClassLoadErrorListener(cause, getContext().getBundle()); try { try { reg1 = hook1.register(getContext(), 0); reg2 = hook2.register(getContext(), 0); reg3 = hook3.register(getContext(), 0); getContext().addFrameworkListener(listener); weavingClasses.loadClass(TEST_CLASS_NAME); fail("Class should fail to Load"); } catch (ClassFormatError cfe) { waitForListener(listener); getContext().removeFrameworkListener(listener); assertTrue("Wrong event was sent " + listener, listener.wasValidEventSent()); assertSame("Should be caused by our Exception", cause, cfe.getCause()); assertTrue("Hook 1 should be called", hook1.isCalled()); assertTrue("Hook 2 should be called", hook2.isCalled()); assertFalse("Hook 3 should not be called", hook3.isCalled()); } hook1.clearCalls(); hook2.clearCalls(); hook3.clearCalls(); hook1.addImport("org.osgi.framework.wiring;version=\"[1.0.0,2.0.0)\""); hook3.setChangeTo("org.osgi.framework.wiring.BundleWiring"); Class<?>clazz = weavingClasses.loadClass(DYNAMIC_IMPORT_TEST_CLASS_NAME); assertTrue("Hook 1 should be called", hook1.isCalled()); assertFalse("Hook 2 should not be called", hook2.isCalled()); assertTrue("Hook 3 should be called", hook3.isCalled()); assertEquals("Weaving was unsuccessful", "interface org.osgi.framework.wiring.BundleWiring", clazz.getConstructor().newInstance().toString()); } finally { if (reg1 != null) reg1.unregister(); if (reg2 != null) reg2.unregister(); if (reg3 != null) reg3.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic boolean isDenied();", "@Test\n public void swallowExceptionsAspect() throws Exception {\n ProductDemand demand = swallowing(parseDoc().getDemands().get(0));\n\n // probably will throw IllegalStateException\n demand.fancyBusinessLogic();\n\n List<Throwable> excep...
[ "0.6562096", "0.6503022", "0.6390242", "0.6348682", "0.6343033", "0.62630117", "0.6261888", "0.6224966", "0.61826944", "0.6161619", "0.6152173", "0.6150164", "0.6061328", "0.6054151", "0.60444695", "0.60343313", "0.60281926", "0.599059", "0.59628373", "0.5947794", "0.59438056...
0.0
-1
Test that a WeavingException does not result in deny listing
public void testWeavingExceptionDoesNotCauseDenyListing() throws Exception { ConfigurableWeavingHook hook1 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook2 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook3 = new ConfigurableWeavingHook(); RuntimeException cause = new WeavingException("Test Exception"); hook1.setChangeTo("1 Finished"); hook2.setExceptionToThrow(cause); hook2.setExpected("1 Finished"); hook2.setChangeTo("2 Finished"); hook3.setExpected("2 Finished"); hook3.setChangeTo("Chain Complete"); ServiceRegistration<WeavingHook> reg1 = null; ServiceRegistration<WeavingHook> reg2= null; ServiceRegistration<WeavingHook> reg3 = null; ClassLoadErrorListener listener = new ClassLoadErrorListener(cause, getContext().getBundle()); try { try { reg1 = hook1.register(getContext(), 0); reg2 = hook2.register(getContext(), 0); reg3 = hook3.register(getContext(), 0); getContext().addFrameworkListener(listener); weavingClasses.loadClass(TEST_CLASS_NAME); fail("Class should fail to Load"); } catch (ClassFormatError cfe) { waitForListener(listener); getContext().removeFrameworkListener(listener); assertTrue("Wrong event was sent " + listener, listener.wasValidEventSent()); assertSame("Should be caused by our Exception", cause, cfe.getCause()); assertTrue("Hook 1 should be called", hook1.isCalled()); assertTrue("Hook 2 should be called", hook2.isCalled()); assertFalse("Hook 3 should not be called", hook3.isCalled()); } hook1.clearCalls(); hook2.clearCalls(); hook3.clearCalls(); hook2.addImport("org.osgi.framework.wiring;version=\"[1.0.0,2.0.0)\""); hook3.setChangeTo("org.osgi.framework.wiring.BundleWiring"); Class<?>clazz = weavingClasses.loadClass(DYNAMIC_IMPORT_TEST_CLASS_NAME); assertTrue("Hook 1 should be called", hook1.isCalled()); assertTrue("Hook 2 should not be called", hook2.isCalled()); assertTrue("Hook 3 should be called", hook3.isCalled()); assertEquals("Weaving was unsuccessful", "interface org.osgi.framework.wiring.BundleWiring", clazz.getConstructor().newInstance().toString()); } finally { if (reg1 != null) reg1.unregister(); if (reg2 != null) reg2.unregister(); if (reg3 != null) reg3.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void swallowExceptionsAspect() throws Exception {\n ProductDemand demand = swallowing(parseDoc().getDemands().get(0));\n\n // probably will throw IllegalStateException\n demand.fancyBusinessLogic();\n\n List<Throwable> exceptions = exceptions(demand);\n Assertio...
[ "0.65024334", "0.6232764", "0.6230595", "0.61738527", "0.6125064", "0.6022943", "0.5969689", "0.594196", "0.5926906", "0.5917821", "0.5877827", "0.5873906", "0.5848896", "0.582803", "0.57903206", "0.5785012", "0.57824737", "0.57685983", "0.57314134", "0.57221764", "0.5716335"...
0.6422009
1
Test that the registration, not the object, is deny listed
public void testDenyListingOnlyAppliesToRegistration() throws Exception { ConfigurableWeavingHook hook1 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook2 = new ConfigurableWeavingHook(); ConfigurableWeavingHook hook3 = new ConfigurableWeavingHook(); RuntimeException cause = new RuntimeException(); hook1.setChangeTo("1 Finished"); hook2.setExceptionToThrow(cause); hook3.setExpected("1 Finished"); hook3.setChangeTo("Chain Complete"); ServiceRegistration<WeavingHook> reg1 = null; ServiceRegistration<WeavingHook> reg2= null; ServiceRegistration<WeavingHook> reg3 = null; ClassLoadErrorListener listener = new ClassLoadErrorListener(cause, getContext().getBundle()); try { try { reg1 = hook1.register(getContext(), 0); reg2 = hook2.register(getContext(), 0); reg3 = hook3.register(getContext(), 0); getContext().addFrameworkListener(listener); weavingClasses.loadClass(TEST_CLASS_NAME); fail("Class should fail to Load"); } catch (ClassFormatError cfe) { waitForListener(listener); getContext().removeFrameworkListener(listener); assertTrue("Wrong event was sent " + listener, listener.wasValidEventSent()); assertSame("Should be caused by our Exception", cause, cfe.getCause()); assertTrue("Hook 1 should be called", hook1.isCalled()); assertTrue("Hook 2 should be called", hook2.isCalled()); assertFalse("Hook 3 should not be called", hook3.isCalled()); } hook1.clearCalls(); hook2.clearCalls(); hook3.clearCalls(); hook1.addImport("org.osgi.framework.wiring;version=\"[1.0.0,2.0.0)\""); hook3.setChangeTo("3 Finished"); hook2.setExpected("3 Finished"); hook2.setChangeTo("org.osgi.framework.wiring.BundleRevision"); reg2.unregister(); reg2 = hook2.register(getContext()); Class<?>clazz = weavingClasses.loadClass(DYNAMIC_IMPORT_TEST_CLASS_NAME); assertTrue("Hook 1 should be called", hook1.isCalled()); assertTrue("Hook 2 should not be called", hook2.isCalled()); assertTrue("Hook 3 should be called", hook3.isCalled()); assertEquals("Weaving was unsuccessful", "interface org.osgi.framework.wiring.BundleRevision", clazz.getConstructor().newInstance().toString()); } finally { if (reg1 != null) reg1.unregister(); if (reg2 != null) reg2.unregister(); if (reg3 != null) reg3.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\r\n\t public void isRegisterIfdroped1() {\n\t\t \tthis.admin.createClass(\"ecs60\",2017,\"sean\",4);\r\n\t\t \tthis.student.dropClass(\"gurender\", \"ecs60\", 2017);\r\n\t assertFalse(this.student.isRegisteredFor(\"gurender\", \"ecs60\", 2017));\r\n\t \r\n\t }", "public boolean canRegister() {...
[ "0.6550333", "0.6435691", "0.6392183", "0.63727796", "0.6345008", "0.6339704", "0.63108003", "0.6242055", "0.62202156", "0.62089735", "0.6178318", "0.61750257", "0.60113114", "0.6000751", "0.59719044", "0.59649897", "0.59606427", "0.59385335", "0.59222376", "0.59149796", "0.5...
0.5735753
29
Test that adding attributes gets the correct resolution
private void doTest(String attributes, String result) throws Exception { setupImportChoices(); ConfigurableWeavingHook hook = new ConfigurableWeavingHook(); hook.addImport(IMPORT_TEST_CLASS_PKG + attributes); hook.setChangeTo(IMPORT_TEST_CLASS_NAME); ServiceRegistration<WeavingHook> reg = null; try { reg = hook.register(getContext(), 0); Class<?>clazz = weavingClasses.loadClass(DYNAMIC_IMPORT_TEST_CLASS_NAME); assertEquals("Weaving was unsuccessful", result, clazz.getConstructor().newInstance().toString()); } finally { if (reg != null) reg.unregister(); tearDownImportChoices(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testAttributeManagement() {\n Tag tag = new BaseTag(\"testtag\");\n String attributeName = \"testAttr\";\n String attributeValue = \"testValue\";\n tag.addAttribute(attributeName, attributeValue);\n assertEquals(\"Wrong attribute value returned\", attributeValue, tag.getAttribut...
[ "0.7068149", "0.64275014", "0.64113706", "0.62102085", "0.61791235", "0.6159042", "0.6128445", "0.6101619", "0.60768425", "0.60645735", "0.60550576", "0.6045054", "0.6030259", "0.5996571", "0.59761333", "0.59475994", "0.59393054", "0.5914127", "0.5889941", "0.5865501", "0.584...
0.0
-1
A basic test with a version range
public void testDynamicImport() throws Exception { doTest(";version=\"[1,2)\"", TEST_ALT_IMPORT_SYM_NAME + "_1.0.0"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void testVersionCheck() throws Exception{\n\t}", "@Test\n public void versionTest() {\n // TODO: test version\n }", "@Test\n public void appVersionTest() {\n // TODO: test appVersion\n }", "@Test\n public void testCanRun() {\n final int oldestSupported = Accumulo...
[ "0.702821", "0.69977206", "0.6686208", "0.65460235", "0.64730304", "0.6417527", "0.63935393", "0.6355299", "0.63427985", "0.63142514", "0.63142514", "0.6296995", "0.6257092", "0.6221451", "0.6214767", "0.6189877", "0.6142308", "0.6131528", "0.6121718", "0.61191595", "0.610788...
0.0
-1
A test with a version range that prevents the "best" package
public void testVersionConstrainedDynamicImport() throws Exception { doTest(";version=\"[1,1.5)\"" , TEST_IMPORT_SYM_NAME + "_1.1.0"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static final boolean shouldUseVersions() {\n return true;\n }", "@Test\n public void testPermitUpgradeUberNew() {\n assertFalse(underTest.permitCmAndStackUpgrade(\"2.2.0\", \"3.2.0\"));\n\n assertFalse(underTest.permitExtensionUpgrade(\"2.2.0\", \"3.2.0\"));\n }", "private ...
[ "0.6789472", "0.6699778", "0.65155375", "0.6447715", "0.64205784", "0.64028627", "0.6360288", "0.634262", "0.62905675", "0.6268778", "0.6268778", "0.62670714", "0.6208632", "0.6156688", "0.6131037", "0.6080228", "0.5958548", "0.5939274", "0.59363115", "0.5922427", "0.58935577...
0.6419299
5
A test with a bundlesymbolicname attribute
public void testBSNConstrainedDynamicImport() throws Exception { doTest(";" + Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE + "=" + TEST_IMPORT_SYM_NAME, TEST_IMPORT_SYM_NAME + "_1.1.0"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void isBundleTest() {\n // TODO: test isBundle\n }", "String getBundleSymbolicName();", "public String getBundleSymbolicName();", "@Test\r\n\tpublic void testBogus() {\n\t\tassertLookup(\"bogus.phony.fake.namespace\",\"bogus.phony.fake.namespace\");\r\n\t}", "public void setBund...
[ "0.6724545", "0.64048046", "0.6328346", "0.5909611", "0.5895469", "0.56847996", "0.5640515", "0.56177807", "0.549779", "0.54521835", "0.5403102", "0.53861105", "0.5311763", "0.5289538", "0.52741563", "0.527345", "0.5259975", "0.52595556", "0.5258027", "0.5234907", "0.5223414"...
0.5009787
37
A test with a bundlesymbolicname attribute and a version constraint
public void testBSNAndVersionConstrainedDynamicImport() throws Exception { doTest(";version=\"[1.0,1.1)\";" + Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE + "=" + TEST_IMPORT_SYM_NAME, TEST_IMPORT_SYM_NAME + "_1.0.0"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void isBundleTest() {\n // TODO: test isBundle\n }", "public void testVersionConstrainedDynamicImport() throws Exception {\n\t\tdoTest(\";version=\\\"[1,1.5)\\\"\" , TEST_IMPORT_SYM_NAME + \"_1.1.0\");\n\t}", "public void testBSNConstrainedDynamicImport() throws Exception {\n\t\tdoT...
[ "0.64436454", "0.5940162", "0.5762525", "0.5623383", "0.5597679", "0.55575424", "0.5529247", "0.55286044", "0.5490027", "0.5331596", "0.53259087", "0.5254885", "0.5249823", "0.52237165", "0.5157977", "0.51181865", "0.51030624", "0.50989115", "0.50814146", "0.5074404", "0.5071...
0.6405566
1
A test with an attribute constraint
public void testAttributeConstrainedDynamicImport() throws Exception { doTest(";foo=bar", TEST_IMPORT_SYM_NAME + "_1.0.0"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void validateAttribute(FactAttribute[] param) {\r\n\r\n }", "protected abstract int compareOnAttribute( U obj );", "boolean isAttribute();", "public void checkAttribute(String arg1) {\n\t\t\n\t}", "boolean isAttribute(Object object);", "public static boolean AttributeTest(PsiBuilder b, i...
[ "0.6629154", "0.6469665", "0.64362913", "0.6307859", "0.5986766", "0.58597726", "0.58371097", "0.580114", "0.57964957", "0.5766864", "0.57574445", "0.57574445", "0.57518077", "0.5715227", "0.57078207", "0.5699285", "0.5684223", "0.56297153", "0.5604476", "0.5596514", "0.55860...
0.0
-1
A test with a mandatory attribute constraint
public void testMandatoryAttributeConstrainedDynamicImport() throws Exception { doTest(";prop=val", TEST_IMPORT_SYM_NAME + "_1.6.0"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void validateAttribute(FactAttribute[] param) {\r\n\r\n }", "public void testAbstractHelperClass() {\n assertFalse(\n BLIP_SCHEMA_CONSTRAINTS.permitsAttribute(\"body\", \"x\"));\n assertEquals(Collections.singletonList(\"line\"),\n BLIP_SCHEMA_CONSTRAINTS.getRequiredInitialCh...
[ "0.6426687", "0.63416713", "0.62804174", "0.6247861", "0.6247861", "0.6247861", "0.62468225", "0.6160538", "0.60684633", "0.6050784", "0.603646", "0.6024492", "0.60239786", "0.6007915", "0.5995739", "0.5976382", "0.59689194", "0.59578377", "0.59570074", "0.5951414", "0.593479...
0.6035337
11
A test with multiple imports that would wire differently
public void testMultipleConflictingDynamicImports() throws Exception { setupImportChoices(); ConfigurableWeavingHook hook = new ConfigurableWeavingHook(); hook.addImport(IMPORT_TEST_CLASS_PKG + ";version=\"(1.0,1.5)\""); hook.addImport(IMPORT_TEST_CLASS_PKG + ";foo=bar"); hook.setChangeTo(IMPORT_TEST_CLASS_NAME); ServiceRegistration<WeavingHook> reg = null; try { reg = hook.register(getContext(), 0); Class<?>clazz = weavingClasses.loadClass(DYNAMIC_IMPORT_TEST_CLASS_NAME); assertEquals("Weaving was unsuccessful", TEST_IMPORT_SYM_NAME + "_1.1.0", clazz.getConstructor().newInstance().toString()); } finally { if (reg != null) reg.unregister(); tearDownImportChoices(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void testNonSpecifiedImports() throws Exception {\n final DefaultConfiguration checkConfig =\n createModuleConfig(CustomImportOrderCheck.class);\n checkConfig.addAttribute(\"thirdPartyPackageRegExp\", \"org.\");\n checkConfig.addAttribute(\"customImportOrderRul...
[ "0.6490961", "0.6374829", "0.6220677", "0.6066759", "0.6054575", "0.5994313", "0.59697413", "0.5961235", "0.59608", "0.5921422", "0.58884656", "0.5783987", "0.5765009", "0.57602006", "0.57602006", "0.5753354", "0.5732166", "0.57320523", "0.5704356", "0.5700695", "0.56589055",...
0.6577246
0
A test with a bad input that causes a failure
public void testBadDynamicImportString() throws Exception { setupImportChoices(); ConfigurableWeavingHook hook = new ConfigurableWeavingHook(); // Note the missing quote for the version attribute hook.addImport(IMPORT_TEST_CLASS_PKG + ";version=(1.0,1.5)\""); hook.setChangeTo(IMPORT_TEST_CLASS_NAME); ServiceRegistration<WeavingHook> reg = null; try { reg = hook.register(getContext(), 0); weavingClasses.loadClass(DYNAMIC_IMPORT_TEST_CLASS_NAME); fail("Should not get here!"); } catch (ClassFormatError cfe) { if(!(cfe.getCause() instanceof IllegalArgumentException)) fail("The class load should generate an IllegalArgumentException due " + "to the bad dynamic import string " + cfe.getMessage()); } finally { if (reg != null) reg.unregister(); tearDownImportChoices(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testInvalidInput(){\n\t\tString input = \"bye\";\n\t\tString actual = operation.processOperation(input);\n\t\tString expected = \"bye bye could not be performed\";\n\t\tassertEquals(expected,actual);\n\t}", "public void testInvalidNoType() { assertInvalid(\"a\"); }", "@Test\n\t// exception for when...
[ "0.8044618", "0.7161406", "0.7072594", "0.7061013", "0.69157493", "0.6895873", "0.67745143", "0.67558837", "0.6750146", "0.6734309", "0.6721783", "0.6716309", "0.6685506", "0.6674747", "0.6667791", "0.6644022", "0.66303366", "0.6613772", "0.66013074", "0.6595797", "0.65743864...
0.0
-1
Test the basic contract of WovenClass, incluing immutability after a weave has finished
public void testWovenClass() throws Exception { registerThisHook(); try { Class<?>clazz = weavingClasses.loadClass(TEST_CLASS_NAME); assertWiring(); assertTrue("Should be complete now", wc.isWeavingComplete()); assertNotSame("Should get copies of the byte array now", realBytes, wc.getBytes()); assertEquals("Wrong class", TEST_CLASS_NAME, wc.getClassName()); assertSame("Should be set now", clazz, wc.getDefinedClass()); assertSame("Should be set now", clazz.getProtectionDomain(), wc.getProtectionDomain()); assertImmutableList(); try { wc.setBytes(fakeBytes); fail("Should not be possible"); } catch (IllegalStateException ise) { //No action needed } } finally { unregisterThisHook(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testBadWeaveClass() throws Exception {\n\n\t\tregisterThisHook();\n\n\t\ttry {\n\t\t\treg2.unregister();\n\n\t\t\ttry {\n\t\t\t\tweavingClasses.loadClass(TEST_CLASS_NAME);\n\t\t\t\tfail(\"Should have dud bytes here!\");\n\t\t\t} catch (ClassFormatError cfe) {\n\t\t\t\tassertWiring();\n\n\t\t\t\tassertT...
[ "0.65385646", "0.61160076", "0.6005329", "0.5887437", "0.57818234", "0.5753192", "0.5684164", "0.5636366", "0.5632474", "0.55966395", "0.55835354", "0.55749786", "0.5570611", "0.55551654", "0.55445546", "0.55091995", "0.55027753", "0.54628456", "0.54567236", "0.54445446", "0....
0.75598043
0
Test the basic contract of WovenClass, including immutability after a weave has failed with bad bytes
public void testBadWeaveClass() throws Exception { registerThisHook(); try { reg2.unregister(); try { weavingClasses.loadClass(TEST_CLASS_NAME); fail("Should have dud bytes here!"); } catch (ClassFormatError cfe) { assertWiring(); assertTrue("Should be complete now", wc.isWeavingComplete()); assertNotSame("Should get copies of the byte array now", fakeBytes, wc.getBytes()); assertTrue("Content should still be equal though", Arrays.equals(fakeBytes, wc.getBytes())); assertEquals("Wrong class", TEST_CLASS_NAME, wc.getClassName()); assertNull("Should not be set", wc.getDefinedClass()); assertImmutableList(); try { wc.setBytes(fakeBytes); fail("Should not be possible"); } catch (IllegalStateException ise) { //No action needed } } reg2 = getContext().registerService(WeavingHook.class, this, null); } finally { unregisterThisHook(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testWovenClass() throws Exception {\n\n\t\tregisterThisHook();\n\n\t\ttry {\n\t\t\tClass<?>clazz = weavingClasses.loadClass(TEST_CLASS_NAME);\n\n\t\t\tassertWiring();\n\n\t\t\tassertTrue(\"Should be complete now\", wc.isWeavingComplete());\n\t\t\tassertNotSame(\"Should get copies of the byte array now\...
[ "0.7385413", "0.61506164", "0.60258114", "0.6002973", "0.5948756", "0.5938011", "0.59043837", "0.5901235", "0.5879893", "0.58474797", "0.5841444", "0.58019936", "0.58002055", "0.577662", "0.5768699", "0.5766732", "0.5755679", "0.5739076", "0.5737838", "0.57374835", "0.5731192...
0.70058095
1
Test the basic contract of WovenClass, including immutability after a weave has failed with an exception
public void testHookException() throws Exception { registerThisHook(); try { ConfigurableWeavingHook hook = new ConfigurableWeavingHook(); hook.setExceptionToThrow(new RuntimeException()); ServiceRegistration<WeavingHook>reg3 = hook.register(getContext()); try { weavingClasses.loadClass(TEST_CLASS_NAME); fail("Should blow up"); } catch (ClassFormatError cfe) { assertWiring(); assertTrue("Should be complete now", wc.isWeavingComplete()); assertNotSame("Should get copies of the byte array now", realBytes, wc.getBytes()); assertTrue("Content should still be equal though", Arrays.equals(realBytes, wc.getBytes())); assertEquals("Wrong class", TEST_CLASS_NAME, wc.getClassName()); assertNull("Should not be set", wc.getDefinedClass()); assertImmutableList(); try { wc.setBytes(fakeBytes); fail("Should not be possible"); } catch (IllegalStateException ise) { //No action needed } } reg3.unregister(); } finally { unregisterThisHook(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testWovenClass() throws Exception {\n\n\t\tregisterThisHook();\n\n\t\ttry {\n\t\t\tClass<?>clazz = weavingClasses.loadClass(TEST_CLASS_NAME);\n\n\t\t\tassertWiring();\n\n\t\t\tassertTrue(\"Should be complete now\", wc.isWeavingComplete());\n\t\t\tassertNotSame(\"Should get copies of the byte array now\...
[ "0.7317463", "0.7107922", "0.6097986", "0.60049725", "0.5985367", "0.5945131", "0.5944443", "0.58723384", "0.5865071", "0.5864111", "0.58469987", "0.5840484", "0.5837984", "0.58227146", "0.5822388", "0.58180285", "0.5809503", "0.57924294", "0.5781061", "0.57564884", "0.574991...
0.626977
2
Try messing up the Dynamic import list in any way possible
private void assertImmutableList() { assertImmutableList(wc); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testMultipleConflictingDynamicImports() throws Exception {\n\n\t\tsetupImportChoices();\n\t\tConfigurableWeavingHook hook = new ConfigurableWeavingHook();\n\t\thook.addImport(IMPORT_TEST_CLASS_PKG + \";version=\\\"(1.0,1.5)\\\"\");\n\t\thook.addImport(IMPORT_TEST_CLASS_PKG + \";foo=bar\");\n\t\thook.se...
[ "0.73134935", "0.66269", "0.6552019", "0.6471726", "0.6420799", "0.64081717", "0.6282285", "0.6255936", "0.62159157", "0.6193379", "0.6158568", "0.6108822", "0.6083402", "0.60584015", "0.60417086", "0.5995775", "0.599272", "0.59887075", "0.5974707", "0.5965158", "0.5933522", ...
0.0
-1
Check that the BundleWiring is usable
private void assertWiring() { BundleWiring bw = wc.getBundleWiring(); assertTrue("Should be the current bundle", bw.isCurrent()); assertEquals("Wrong bundle", TESTCLASSES_SYM_NAME, bw.getBundle().getSymbolicName()); assertEquals("Wrong bundle", Version.parseVersion("1.0.0"), bw.getBundle().getVersion()); assertNotNull("No Classloader", bw.getClassLoader()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void isBundleTest() {\n // TODO: test isBundle\n }", "boolean generateBundle();", "public boolean isBundle() {\r\n return bundle;\r\n }", "protected void checkIfReady() throws Exception {\r\n checkComponents();\r\n }", "public boolean isBundle() {\r\n\t\tretu...
[ "0.6438672", "0.6177963", "0.61153543", "0.60176295", "0.5983552", "0.5953046", "0.59341574", "0.5895841", "0.5713253", "0.55350274", "0.5499789", "0.54794276", "0.5451157", "0.54474074", "0.5446938", "0.54385626", "0.54321563", "0.542874", "0.5418991", "0.5392424", "0.539131...
0.7200136
0
Test the basic contract of WovenClassListener.
public void testWovenClassListener() throws Exception { registerAll(); try { Class<?> clazz = weavingClasses.loadClass(TEST_CLASS_NAME); assertDefinedClass(listenerWovenClass, clazz); assertStates(WovenClass.TRANSFORMED, WovenClass.DEFINED); } finally { unregisterAll(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testWovenClassListenerCalledWhenClassDefinitionFails() throws Exception {\n\t\tfinal AtomicInteger integer = new AtomicInteger(0);\n\t\tServiceRegistration<WeavingHook> reg = getContext().registerService(\n\t\t\t\tWeavingHook.class, \n\t\t\t\tnew WeavingHook() {\n\t\t\t\t\tpublic void weave(WovenClass ...
[ "0.7426214", "0.7399198", "0.73983085", "0.70928526", "0.6682762", "0.6333609", "0.6331109", "0.6306129", "0.6226515", "0.61690825", "0.61123693", "0.6045473", "0.6016794", "0.5978106", "0.5968173", "0.5924301", "0.5813867", "0.5802874", "0.57837147", "0.5755114", "0.5755114"...
0.8570588
0
Test the class load does not fail if a listener throws an exception.
public void testWovenClassListenerExceptionDoesNotCauseClassLoadToFail() throws Exception { final AtomicInteger integer = new AtomicInteger(0); ServiceRegistration<WovenClassListener> reg = getContext().registerService( WovenClassListener.class, new WovenClassListener() { public void modified(WovenClass wovenClass) { integer.set(1); throw new RuntimeException(); } }, null); try { registerAll(); try { Class<?> clazz = weavingClasses.loadClass(TEST_CLASS_NAME); assertEquals("Listener not called", 1, integer.get()); assertDefinedClass(listenerWovenClass, clazz); assertStates(WovenClass.TRANSFORMED, WovenClass.DEFINED); } finally { unregisterAll(); } } finally { reg.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testWovenClassListenerCalledWhenClassDefinitionFails() throws Exception {\n\t\tfinal AtomicInteger integer = new AtomicInteger(0);\n\t\tServiceRegistration<WeavingHook> reg = getContext().registerService(\n\t\t\t\tWeavingHook.class, \n\t\t\t\tnew WeavingHook() {\n\t\t\t\t\tpublic void weave(WovenClass ...
[ "0.7415273", "0.7282251", "0.7213944", "0.6999649", "0.6462411", "0.6420225", "0.6283914", "0.615011", "0.6018868", "0.5962595", "0.5957745", "0.5860389", "0.5791467", "0.5790165", "0.5764297", "0.57550734", "0.57519376", "0.57496965", "0.5677865", "0.563779", "0.56341404", ...
0.8295199
0
Test that listeners are still notified when weaving hook throws exception.
public void testWovenClassListenerCalledWhenWeavingHookException() throws Exception { final AtomicInteger integer = new AtomicInteger(0); Dictionary<String, Object> props = new Hashtable<String, Object>(1); props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MIN_VALUE)); ServiceRegistration<WeavingHook> reg = getContext().registerService( WeavingHook.class, new WeavingHook() { public void weave(WovenClass wovenClass) { integer.set(1); throw new RuntimeException(); } }, props); try { registerAll(); try { weavingClasses.loadClass(TEST_CLASS_NAME); fail("Class should have failed to load"); } catch (ClassFormatError e) { assertEquals("Hook not called", 1, integer.get()); assertStates(WovenClass.TRANSFORMING_FAILED); } finally { unregisterAll(); } } finally { reg.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testWovenClassListenerNotNotifiedWhenNoWeavingHooks() throws Exception {\n\t\tregisterThisListener();\n\t\ttry {\n\t\t\tweavingClasses.loadClass(TEST_CLASS_NAME);\n\t\t\tassertNull(\"Listener notified with no weaving hooks registered\", listenerWovenClass);\n\t\t\tassertStates();\n\t\t}\n\t\tfinally {\...
[ "0.73651457", "0.69885427", "0.648997", "0.64479405", "0.63957036", "0.63309276", "0.6261932", "0.62507564", "0.6098662", "0.6079132", "0.6063067", "0.605814", "0.6030922", "0.6021976", "0.6020687", "0.60070723", "0.60002387", "0.5959208", "0.5955262", "0.590804", "0.58865964...
0.70454526
1
Test that listeners are still notified when class definition fails.
public void testWovenClassListenerCalledWhenClassDefinitionFails() throws Exception { final AtomicInteger integer = new AtomicInteger(0); ServiceRegistration<WeavingHook> reg = getContext().registerService( WeavingHook.class, new WeavingHook() { public void weave(WovenClass wovenClass) { integer.set(1); wovenClass.setBytes(new byte[0]); } }, null); try { registerThisListener(); try { weavingClasses.loadClass(TEST_CLASS_NAME); fail("Class should have failed to load"); } catch (ClassFormatError e) { assertEquals("Hook not called", 1, integer.get()); assertStates(WovenClass.TRANSFORMED, WovenClass.DEFINE_FAILED); } finally { unregisterThisListener(); } } finally { reg.unregister(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testWovenClassListenerExceptionDoesNotCauseClassLoadToFail() throws Exception {\n\t\tfinal AtomicInteger integer = new AtomicInteger(0);\n\t\tServiceRegistration<WovenClassListener> reg = getContext().registerService(\n\t\t\t\tWovenClassListener.class, \n\t\t\t\tnew WovenClassListener() {\n\t\t\t\t\tpu...
[ "0.71412885", "0.67384523", "0.6680977", "0.6205021", "0.6163672", "0.6160444", "0.6010708", "0.59386045", "0.5916069", "0.59088707", "0.5878134", "0.58415544", "0.58121866", "0.5795428", "0.57702667", "0.57492274", "0.57241243", "0.5690863", "0.56894004", "0.5662084", "0.565...
0.7698452
0
Test that listeners are not notified when no weaving hooks are registered.
public void testWovenClassListenerNotNotifiedWhenNoWeavingHooks() throws Exception { registerThisListener(); try { weavingClasses.loadClass(TEST_CLASS_NAME); assertNull("Listener notified with no weaving hooks registered", listenerWovenClass); assertStates(); } finally { unregisterThisListener(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testExternalListeners() {\n\n\t\tLogAndTraceBroker broker = LogAndTraceBroker.getBroker();\n\t\tbroker.clearLogListeners();\n\t\tbroker.clearTraceListeners();\n\n\t\tSystem.setProperty(WBEMConfigurationProperties.LOG_CONSOLE_LEVEL, \"WARNING\");\n\t\tSystem.setProperty(WBEMConfigurationProperties.LOG_F...
[ "0.67200875", "0.6521815", "0.64795625", "0.64512515", "0.64485407", "0.64101046", "0.63702154", "0.63270867", "0.6307076", "0.6305079", "0.62786925", "0.6270186", "0.6210776", "0.6149848", "0.6141606", "0.60021985", "0.59578156", "0.59347737", "0.5922101", "0.5921289", "0.59...
0.7833856
0
populates flights table according the data in the database
private void initFlightsTable() { try ( Connection con = DbCon.getConnection()) { PreparedStatement pst = con.prepareStatement("select * from Flights"); ResultSet rs = pst.executeQuery(); ResultSetMetaData rsmd = rs.getMetaData(); int columnCount = rsmd.getColumnCount(); //create a model to of the flights table to be populated later flightsDftTblMdl = (DefaultTableModel) flightsTable.getModel(); flightsDftTblMdl.setRowCount(0); while (rs.next()) { //holds all valauese from table Flight Object[] a = new Object[6]; //assigning of the values from Flight for (int i = 0; i < columnCount; i++) { a[0] = rs.getString("departure"); a[1] = rs.getString("destination"); a[2] = rs.getString("depTime"); a[3] = rs.getString("arrTime"); a[4] = rs.getInt("number"); a[5] = rs.getDouble("price"); }// add new row to the model flightsDftTblMdl.addRow(a); } } catch (ClassNotFoundException | SQLException ex) { Logger.getLogger(BookTicket.class.getName()).log(Level.SEVERE, null, ex); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void populateFlights() {\n flightsList = database.getFlights(spnSource.getSelectedItem().toString().substring(0,3),\n spnDestination.getSelectedItem().toString().substring(0,3),\n tvDate.getText().toString());\n// flightsAdapter.notifyDataSetChanged();\n\n ...
[ "0.69500375", "0.6874036", "0.6399039", "0.6081407", "0.6060142", "0.6055702", "0.5999357", "0.59373486", "0.59048617", "0.58807194", "0.5853379", "0.58416283", "0.5833516", "0.5823034", "0.57913715", "0.5788834", "0.57410276", "0.57290196", "0.56936765", "0.56850696", "0.563...
0.7690136
0
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { createCustomerBackground = new javax.swing.JPanel(); exchangeRateBackground = new javax.swing.JPanel(); exchangeRateTitle = new javax.swing.JLabel(); backButton = new javax.swing.JButton(); deleteButton = new javax.swing.JButton(); editButton = new javax.swing.JButton(); addButton = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); flightsTable = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); createCustomerBackground.setBackground(new java.awt.Color(255, 255, 255)); createCustomerBackground.setPreferredSize(new java.awt.Dimension(1200, 1539)); exchangeRateBackground.setBackground(new java.awt.Color(102, 255, 255)); exchangeRateTitle.setFont(new java.awt.Font("Tahoma", 0, 72)); // NOI18N exchangeRateTitle.setText("FLIGHTS"); backButton.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N backButton.setText("BACK"); backButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { backButtonActionPerformed(evt); } }); javax.swing.GroupLayout exchangeRateBackgroundLayout = new javax.swing.GroupLayout(exchangeRateBackground); exchangeRateBackground.setLayout(exchangeRateBackgroundLayout); exchangeRateBackgroundLayout.setHorizontalGroup( exchangeRateBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(exchangeRateBackgroundLayout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(exchangeRateTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(196, 196, 196) .addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); exchangeRateBackgroundLayout.setVerticalGroup( exchangeRateBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(exchangeRateBackgroundLayout.createSequentialGroup() .addContainerGap() .addGroup(exchangeRateBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(exchangeRateTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(backButton)) .addContainerGap(28, Short.MAX_VALUE)) ); deleteButton.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N deleteButton.setText("DELETE"); deleteButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteButtonActionPerformed(evt); } }); editButton.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N editButton.setText("EDIT"); editButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { editButtonActionPerformed(evt); } }); addButton.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N addButton.setText("ADD"); addButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addButtonActionPerformed(evt); } }); flightsTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Flight Departure", "Flight Destination", "Departure Time", "Arrival Time", "Flight Number", "Price" } ) { Class[] types = new Class [] { java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Integer.class, java.lang.Double.class }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } }); flightsTable.setPreferredSize(new java.awt.Dimension(1200, 1539)); flightsTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { flightsTableMouseClicked(evt); } }); jScrollPane1.setViewportView(flightsTable); javax.swing.GroupLayout createCustomerBackgroundLayout = new javax.swing.GroupLayout(createCustomerBackground); createCustomerBackground.setLayout(createCustomerBackgroundLayout); createCustomerBackgroundLayout.setHorizontalGroup( createCustomerBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(exchangeRateBackground, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(createCustomerBackgroundLayout.createSequentialGroup() .addContainerGap() .addGroup(createCustomerBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1) .addGroup(createCustomerBackgroundLayout.createSequentialGroup() .addComponent(editButton, javax.swing.GroupLayout.PREFERRED_SIZE, 352, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE) .addComponent(addButton, javax.swing.GroupLayout.PREFERRED_SIZE, 352, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(deleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 352, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); createCustomerBackgroundLayout.setVerticalGroup( createCustomerBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(createCustomerBackgroundLayout.createSequentialGroup() .addComponent(exchangeRateBackground, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(36, 36, 36) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 356, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 108, Short.MAX_VALUE) .addGroup(createCustomerBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(deleteButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(createCustomerBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(editButton) .addComponent(addButton))) .addContainerGap()) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(createCustomerBackground, javax.swing.GroupLayout.DEFAULT_SIZE, 1111, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(createCustomerBackground, javax.swing.GroupLayout.DEFAULT_SIZE, 704, Short.MAX_VALUE) ); pack(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Form() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public frmRectangulo() {\n initComponents();\n }", "public form() {\n ...
[ "0.73201853", "0.7291607", "0.7291607", "0.7291607", "0.7285772", "0.7248832", "0.721371", "0.72083634", "0.71965843", "0.7190274", "0.71847606", "0.71592176", "0.71481156", "0.70935035", "0.70799935", "0.70570904", "0.6987588", "0.6977819", "0.69557554", "0.6953564", "0.6945...
0.0
-1
GENLAST:event_deleteButtonActionPerformed User is allowed to change the rows values. Pressing "EDIT" button will save the changes.
private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed try ( Connection con = DbCon.getConnection()) { int rowCount = flightsTable.getRowCount(); selectedRow = flightsTable.getSelectedRow(); //if row is chosen if (selectedRow >= 0) { PreparedStatement pst = con.prepareStatement("update Flights set departure = '" + flightsDftTblMdl.getValueAt(selectedRow, 0) + "', destination = '" + flightsDftTblMdl.getValueAt(selectedRow, 1) + "', depTime = '" + flightsDftTblMdl.getValueAt(selectedRow, 2) + "', arrTime = '" + flightsDftTblMdl.getValueAt(selectedRow, 3) + "', number = '" + flightsDftTblMdl.getValueAt(selectedRow, 4) + "', price = '" + flightsDftTblMdl.getValueAt(selectedRow, 5) + "' where number = '" + flightsDftTblMdl.getValueAt(selectedRow, 4) + "'"); pst.execute(); initFlightsTable();//refresh the table after edit } else { JOptionPane.showMessageDialog(null, "Please select row first"); } } catch (ClassNotFoundException | SQLException ex) { Logger.getLogger(CustomerRecords.class.getName()).log(Level.SEVERE, null, ex); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\teditRow();\n\t\t\t}", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\teditRow();\n\t\t\t}", "private void btnEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditActionPerformed\n bool...
[ "0.7330534", "0.7330534", "0.7195866", "0.6975074", "0.69560313", "0.692166", "0.6921292", "0.68200696", "0.67407835", "0.67370296", "0.6729822", "0.67188793", "0.66983765", "0.66859025", "0.66633797", "0.6605019", "0.66019267", "0.65895385", "0.65238905", "0.65085465", "0.65...
0.7031546
3
GENLAST:event_editButtonActionPerformed Adds new row to the existing table if the last row is populated. Clicking "ADD" after populating the last row will save it into the database instead of adding new row here.
private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed try ( Connection con = DbCon.getConnection()) { PreparedStatement pst = con.prepareStatement("select count(number) from flights"); ResultSet rs = pst.executeQuery(); rs.next();//check how many rows we have in the db int result = rs.getInt("count(number)"); int rowCnt = flightsTable.getRowCount(); //if we already added row then insert it into the database if (rowCnt > result) { rowCnt--; pst = con.prepareStatement("INSERT INTO Flights (\n" + " departure,\n" + " destination,\n" + " depTime,\n" + " arrTime,\n" + " number,\n" + " price\n" + ")\n" + "VALUES (\n" + " '" + flightsDftTblMdl.getValueAt(rowCnt, 0) + "',\n" + " '" + flightsDftTblMdl.getValueAt(rowCnt, 1) + "',\n" + " '" + flightsDftTblMdl.getValueAt(rowCnt, 2) + "',\n" + " '" + flightsDftTblMdl.getValueAt(rowCnt, 3) + "',\n" + " '" + flightsDftTblMdl.getValueAt(rowCnt, 4) + "',\n" + " '" + flightsDftTblMdl.getValueAt(rowCnt, 5) + "'\n" + ");"); pst.execute(); initFlightsTable(); } else {//else add new row flightsDftTblMdl.addRow(new Object[5]); flightsDftTblMdl.setValueAt("Fill Up and Press \"ADD\" ...", rowCnt, 0); } } catch (ClassNotFoundException | SQLException ex) { Logger.getLogger(Flights.class.getName()).log(Level.SEVERE, null, ex); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void addRow() {\n tableModel.insertRow(this.getRowCount(), new String[]{});\n this.setModel(tableModel);\n\n }", "private void insertButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN\n // -\n // FIRST\n // :\n // event_insertButtonActionPerformed\n int...
[ "0.6888777", "0.67737967", "0.66111", "0.6598565", "0.6529759", "0.6435545", "0.63095933", "0.61712456", "0.6156039", "0.6155112", "0.60611707", "0.60591245", "0.6017598", "0.5993474", "0.5971634", "0.5948697", "0.5920644", "0.59161496", "0.5895361", "0.58949125", "0.58935577...
0.6469531
5
Adds a round to the list of moves and records its place.
public void addRound(ArrayList<Move> round) { for (Move move : round) { add(move); } int lastIndex = offsets.size() - 1; offsets.add(round.size() + offsets.get(lastIndex)); // accumulate the // index }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Round(ArrayList<Move> niceMoves) {\n\t\tthis.niceMoves = niceMoves;\n\t\tthis.roundNo = 1;\n\t}", "public Round(ArrayList<Move> niceMoves, int roundNo) {\n\t\tthis.niceMoves = niceMoves;\n\t\tthis.roundNo = roundNo;\n\t}", "public Round(int roundNo) {\n\t\tthis.niceMoves = new ArrayList<Move>();\n\t\tth...
[ "0.69759345", "0.67883056", "0.6572858", "0.646261", "0.6283393", "0.62499857", "0.6218492", "0.61771834", "0.6150254", "0.61004496", "0.6086123", "0.60821205", "0.6060542", "0.604042", "0.60319906", "0.59468937", "0.5927565", "0.59261626", "0.59223175", "0.58732015", "0.5870...
0.79071164
0
Returns the number of rounds in this GameResult.
public int numberOfRounds() { return offsets.size() - 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getRounds() {\n\n\t\treturn rounds;\n\t}", "public static int numRounds() {\n\t\treturn numRounds;\n\t}", "public int getCount() {\n\t\treturn this.countRound;\n\t}", "public int getTotalOfwins() {\n return statistics.get(TypeOfGames.SIMGAME).getNumberOfWins()\n + statistics....
[ "0.72110355", "0.71942264", "0.6862919", "0.67775565", "0.676412", "0.67007387", "0.663779", "0.6562355", "0.6495665", "0.64281166", "0.6367787", "0.63562936", "0.632734", "0.63232714", "0.62819666", "0.6268457", "0.61884916", "0.6180713", "0.61699533", "0.6155543", "0.613043...
0.62549305
16