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
2. Create dynamic method that allows us to add eventListeners from application runtime
public void addEventListener(Object listener) { API.addEventListener(listener); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void addListener(EventListener eventListener, String componentName);", "public abstract void registerListeners();", "protected void installListeners() {\n\n\t}", "public native void addEventListener(String name, EventCall f);", "void registerListeners();", "protected void installListeners...
[ "0.71080256", "0.6987245", "0.6595612", "0.65897065", "0.6589348", "0.6512561", "0.6512561", "0.6484477", "0.64476544", "0.6441497", "0.6357958", "0.6326576", "0.63260216", "0.63153934", "0.6281913", "0.627334", "0.626812", "0.62431484", "0.62401986", "0.623618", "0.623618", ...
0.0
-1
Created by Administrator on 2018/4/18.
public interface AddDeviceActivityView extends BaseView { void showAddDeviceResult(MdlBaseHttpResp resp); void showDeviceListResult(MdlBaseHttpResp<List<MdlDevice>> resp); void showDelDeviceResult(MdlBaseHttpResp resp); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private stendhal() {\n\t}", "@Override\n public void perish() {\n \n }", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "pro...
[ "0.62136674", "0.6090949", "0.5769723", "0.5736592", "0.5733917", "0.5729521", "0.5672822", "0.56677485", "0.5667281", "0.56564254", "0.5636243", "0.56159574", "0.5613901", "0.56043166", "0.5604009", "0.55797285", "0.5576577", "0.55761015", "0.55689985", "0.55689985", "0.5560...
0.0
-1
Startar (eller omstartar) timern.
public void start(){ started = true; lastTime = System.nanoTime(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void sendeSpielStarten();", "public static void start() { \r\n\t\ttempo_inicial = System.nanoTime(); \r\n\t\ttempo_final = 0; \r\n\t\tdiftempo = 0; \r\n\t}", "private void startTime()\n {\n timer.start();\n }", "@Override\n\tpublic void setStartTime(int t) {\n\t\t\n\t}", "Start creat...
[ "0.7367199", "0.7090825", "0.694091", "0.6852565", "0.6846965", "0.6839265", "0.679624", "0.6790877", "0.6789209", "0.6786371", "0.6778228", "0.6756558", "0.6744871", "0.67304695", "0.672325", "0.66510177", "0.6645139", "0.65803456", "0.6575579", "0.6569303", "0.6560236", "...
0.64683926
24
TODO Autogenerated method stub
@Override public void dispose() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1
TODO Autogenerated method stub
@Override public void pause() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1
TODO Autogenerated method stub
@Override public void resize(int width, int height) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1
TODO Autogenerated method stub
@Override public void resume() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1
0 checkbox disable, 1 checkbox enable
public ListViewItem(String name, int value) { this.name = name; this.value = value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void enableCheckBoxes(){\n fallSemCheckBox.setDisable(false);\n springSemCheckBox.setDisable(false);\n summerSemCheckBox.setDisable(false);\n allQtrCheckBox.setDisable(false);\n allMbaCheckBox.setDisable(false);\n allHalfCheckBox.setDisable(false);\n allCampu...
[ "0.7385569", "0.73807687", "0.68622535", "0.68596196", "0.68354255", "0.67732465", "0.67655593", "0.6662677", "0.66157734", "0.6614002", "0.66001266", "0.65639514", "0.65529335", "0.65124226", "0.6496841", "0.6491491", "0.64885217", "0.6458055", "0.64459455", "0.643391", "0.6...
0.0
-1
Convert the ByteBuffer's contents to a hex string using upper case by default.
public ToHexString() { this(true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static String _bytesToHex( ByteBuffer buf )\n {\n final int offset = buf.position();\n final int size = buf.remaining();\n final char[] hexChars = new char[size * 2];\n\n for (int j = 0; j < size; j++) {\n int v = buf.get(j + offset) & 0xFF;\n hexChars[j...
[ "0.70229465", "0.6293478", "0.6246971", "0.62111294", "0.6157863", "0.6042064", "0.60324013", "0.60104185", "0.59482956", "0.5897985", "0.5866289", "0.58586836", "0.5847956", "0.5846013", "0.5816047", "0.5810747", "0.58062553", "0.5803883", "0.5751252", "0.5727208", "0.572127...
0.0
-1
Convert the ByteBuffer's contents to a hex string upper or lower case.
public ToHexString(boolean useUpperCase) { this.useUpperCase = useUpperCase; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static String _bytesToHex( ByteBuffer buf )\n {\n final int offset = buf.position();\n final int size = buf.remaining();\n final char[] hexChars = new char[size * 2];\n\n for (int j = 0; j < size; j++) {\n int v = buf.get(j + offset) & 0xFF;\n hexChars[j...
[ "0.70602334", "0.6319885", "0.6251581", "0.61283875", "0.6124285", "0.60540986", "0.5978235", "0.5977075", "0.59726137", "0.59720534", "0.5961901", "0.5954431", "0.5943408", "0.5920737", "0.5860175", "0.578358", "0.576934", "0.575343", "0.57422656", "0.5732412", "0.5730253", ...
0.5390713
56
/ Math Functions Absolute value Math.abs(int) > Returns an int Math.abs(double) > returns a double Trig Math.sin(double angle) > returns a double, measured in radians Math.cos(double angle) > returns a double Math.tan(double) > returns a double Math.asin(double) > returns a double Math.acos(double) > returns a double Math.atan(double) > returns a double Exponents Math.pow(double base, double exponent) > returns a double Math.exp(double power) > returns e raised to power, > returns a double Square root Math.sqrt(double) > returns a double Floor/Ceiling Math.ceil(double) > round up on every double. ex. 4.1 > 5, 4.7 > 5, > returns a double Math.floor(double) > rounds down on every value. ex. 4.1 > 4, 5.8 > 5, > returns a double
public static void main(String[] args) { double a = Math.pow(234, 450); System.out.println(Math.abs(-4)); System.out.println(a); /* * Random Numbers * 1) import java.util.Random; * Object Random() - lets us create a new object Random that will generate random numbers * Random name = new Random(); <-- creates the random number generator * Methods - name.nextInt() --> random int between 0 - 1 * name.nextDouble --> random double between 0.0 (inclusive) and 1.0 (exclusive) */ Random gen = new Random(); int random1 = gen.nextInt(10); // <-- 10 is the range of values I can receive, 0 - 9 int random2 = gen.nextInt(24); // <-- range of values: 0 - 23 int random3 = gen.nextInt(10)+1; // <-- 1 - 10? // Generate random numbers between 34-49 int random4 = gen.nextInt(16)+34; System.out.println(random1 + " " + random2 + " " + random3 + " " + random4); int random5 = gen.nextInt(50)+101; int random6 = (gen.nextInt(8)*2)+3; System.out.println(random6); String s = "4"; Integer.parseInt(s); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static double getSinSquare(Double value){\r\n\t\treturn Math.pow(Math.sin(value/2), 2);\r\n\r\n }", "public interface Math2 {\n\n /*\n * PI2 is a constant which is approximately equivalent to 2*PI\n */\n public static final double PI2 = 2 * Math.PI;\n\n /**\n * Method which comp...
[ "0.6551263", "0.626165", "0.6098524", "0.6095192", "0.59997797", "0.59817255", "0.58908343", "0.5867659", "0.5846758", "0.5821505", "0.58092105", "0.577087", "0.57695746", "0.57200944", "0.57072574", "0.5662612", "0.5646581", "0.5628823", "0.561742", "0.56070477", "0.5596954"...
0.0
-1
d (n) = (n 1) [d (n 1) + d (n 2)]
public int findDerangement(int n) { long a = 0, b = 1, i = 3, c; for (; i <= n + 1; i ++) { c = (i - 1) * (a + b) % 1000000007; a = b; b = c; } return (int) a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void sum2(int n){\n int sum =0; //1\n for (int j = 0; j < n; j++) //2n+2\n for (int k = 0; k < n; k++) //2n+2\n sum += k + j; //1\n for (int l = 0; l < n; l++) //2n+2\n sum += l; //1\n }", "static int sum(int n) {\n\t\tif(n==1) \n\t\t\treturn 1;...
[ "0.684193", "0.6806797", "0.66968256", "0.6473691", "0.6394831", "0.6391781", "0.6275162", "0.62662596", "0.6245117", "0.6241995", "0.62259585", "0.62165546", "0.6202924", "0.619046", "0.61739594", "0.61534685", "0.6105153", "0.6059905", "0.6055286", "0.60492647", "0.60375917...
0.55690515
55
Better alternative solution and easier to understand is To understand below check
public void permutationOfString(String s, int start, int end){ if(start == end && !hs.contains(s)){ hs.add(s); System.out.println(s); return; } for(int i=start;i<=end;i++){ s=swap(s,i,start); permutationOfString(s,start+1, end); s=swap(s,i,start); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void checkIsBetterSolution() {\n if (solution == null) {\n solution = generateSolution();\n //Si la solucion que propone esta iteracion es mejor que las anteriores la guardamos como mejor solucion\n } else if (getHealthFromAvailableWorkers(availableWorkersHours, errorPoi...
[ "0.5351627", "0.53516126", "0.52328247", "0.5188321", "0.51307106", "0.5081979", "0.5057126", "0.50397336", "0.50201124", "0.50111866", "0.50063986", "0.5004658", "0.49764296", "0.49633303", "0.4938444", "0.49374342", "0.4928889", "0.49218184", "0.4906384", "0.4892367", "0.48...
0.0
-1
this is the value that the node stores(values may also be repeated/are not unique)
public Node(K key, V value) {// this is the constructor of a new Node mKey = key;// it takes as an arguments a key mValue = value;// and a value mParent = mSentinel;// and makes a nodw with no parent mLeft = mSentinel;// or children mright = mSentinel;// that stores the key and the value }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public AbstractNode getValue()\n\t\t{\n\t\t\treturn value;\n\t\t}", "public E value()\r\n\t// post: returns value associated with this node\r\n\t{\r\n\t\treturn val;\r\n\t}", "@Override\n public N value() {\n return value;\n }", "public Object getValue() { return _value; }", "public String getNode...
[ "0.7258867", "0.68827885", "0.68041456", "0.676643", "0.67583287", "0.67311823", "0.67281145", "0.6714702", "0.6697304", "0.6676799", "0.66598517", "0.6651908", "0.6642995", "0.6630013", "0.6589907", "0.65742594", "0.65657675", "0.6559706", "0.6559706", "0.65441763", "0.65435...
0.0
-1
returns the key and the value of a given node as a formated string
public String toString() { if (this.getKey() == null) { return ""; } else { return "Key:" + this.getKey() + " Value:" + this.getValue(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getNodeValue(Node node) throws Exception;", "String getNodeMetadataValue(int node, String key);", "@Override\n\t\tpublic String toString() {\n\t\t\treturn \"<\"+key.toString()+\",\"+value.toString()+\">\";\n\t\t}", "public String getNodeValue ();", "public static String getNodeValue(Node node...
[ "0.69844526", "0.694273", "0.6655487", "0.6481375", "0.6398487", "0.6375746", "0.6371899", "0.6347924", "0.6333329", "0.6328259", "0.6308937", "0.63047487", "0.63031584", "0.62972105", "0.6292303", "0.6284161", "0.6270612", "0.62664115", "0.6253211", "0.61837333", "0.6180526"...
0.5876816
31
checks if the tree is empty
public boolean isEmpty() { return mSentinel == mRoot;// if the root is equal to the sentinel(empty // node) then the tree is empty otherwise it // is not }
{ "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}", "public boolean empty() {\r\n\t\t return(this.root == null);\r\n\t }", "private boolean isEmpty()\r\n\t{\r\n\t\treturn getRoot() == null;\r\n\t}", "public boolean empty() {\n\t\treturn (this.root == null); // to...
[ "0.8395433", "0.8381555", "0.8307231", "0.82619244", "0.82015055", "0.81967", "0.8134039", "0.8128115", "0.8118073", "0.8101598", "0.8078683", "0.8040988", "0.8029515", "0.7998356", "0.79943424", "0.79943424", "0.79618496", "0.79618496", "0.79553217", "0.79433376", "0.7928275...
0.7768542
38
inserts a new node
public Node insertNode(K key, V value) { Node newNode = new Node(key, value);// first we need to create the new // node Node currentNode = this.getRoot();// then we move to the root ot the // tree that has called the method Node currentNodeParent = mSentinel;// the parent of the root is of // course sentinel while (currentNode != mSentinel) {// and while the current node(starting // from the root) is not a sentinel currentNodeParent = currentNode;// then remember this node as a // parent if (key.compareTo(currentNode.getKey()) < 0) {// and appropriate its currentNode = currentNode.getLeftChild();// left } else {// or currentNode = currentNode.getrightChild();// right child as the // next current node } } // we iterate through the described loop in order to get to the // appropriate place(in respect to the given key) where the new node // should be put newNode.setParent(currentNodeParent);// we make the new node's parent // the last non empty node that // we've reached if (currentNodeParent == mSentinel) { mRoot = newNode;// if there is no such node then the tree is empty // and our node is actually going to be the root } else { if (key.compareTo(currentNodeParent.getKey()) < 0) {// otherwise we // put our new // node currentNodeParent.setLeftChild(newNode);// as a left } else { // or currentNodeParent.setrightChild(newNode);// right child of the // last node we've // reached } } return newNode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void insert(Node n);", "public void insertnode ()\n\t// insert an empty node\n\t{\n\t\tif (Pos.haschildren() && !GF.askInsert()) return;\n\t\tNode n = new Node(Pos.node().number());\n\t\tPos.insertchild(new TreeNode(n));\n\t\tn.main(Pos);\n\t\tgetinformation();\n\t\tPos = Pos.lastChild();\n\t\tsetlast();\...
[ "0.8219565", "0.7697395", "0.76193434", "0.748612", "0.7465784", "0.72557336", "0.7196218", "0.71160513", "0.70998704", "0.7083355", "0.7061961", "0.70314497", "0.7016833", "0.7005316", "0.6905715", "0.689392", "0.6890209", "0.6888708", "0.6867628", "0.6858425", "0.68568933",...
0.64711106
59
this is a simple method that helps the visual representation of trees
private String indent(int spaces) { String result = ""; for (int i = 0; i < spaces; i++) { result = result + " ";// it creates as much spaces as it is told to } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void createTree() {\n\n // custom brown color\n Color brown = new Color(149, 99, 57);\n\n // trunk\n NscComponent trunk = new NscRectangle(49, 164, 13, 51);\n createShape(trunk, brown, true);\n\n // branches\n drawLine(50, 125, 50, 165, 10, brown);\n ...
[ "0.75365156", "0.7253983", "0.71968085", "0.7112814", "0.70762324", "0.6982406", "0.6967107", "0.6944461", "0.69378316", "0.6894723", "0.6892162", "0.6875118", "0.68705547", "0.68357366", "0.68296534", "0.681333", "0.6811807", "0.6788014", "0.67609113", "0.67121583", "0.66096...
0.0
-1
this method translates a node v at the place of node u
private void transplant(Node u, Node v) { if (u.getParent() == mSentinel) {// if u is the root this.mRoot = v;// simply make v the root } else if (u == u.getParent().getLeftChild()) {// if u is a left child // then make v u's // parent's left child u.getParent().setLeftChild(v); } else { u.getParent().setrightChild(v);// otherwise u is a right child and // we should make v u's parent's // right child } if (v != mSentinel) { v.setParent(u.getParent());// and of course if v is not empty make // u's parent - v's parent } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void transplant(Node<E> u, Node<E> v) {\n\t //compares the u.getParent() and the sentinel \n \t\tif (u.getParent() == sentinel) {\n\t\t\troot = v;\n\t\t} else if (u == u.getParent().getLeftChild()) {\n\t\t\tu.getParent().setLeftChild(v);\n\t\t} else {\n\t\t\tu.getParent().setRightChild(v);\n\t\t}\n\t\ti...
[ "0.6841266", "0.63036543", "0.60952735", "0.5937897", "0.5892984", "0.5792859", "0.5583467", "0.55326736", "0.5517994", "0.5476515", "0.5461003", "0.5417584", "0.540159", "0.5389842", "0.5388934", "0.53768146", "0.53579724", "0.5321564", "0.5282639", "0.52738523", "0.5258514"...
0.68965256
0
method allowing the removal of a given node
public void remove(Node nodeBeingRemoved) { if (nodeBeingRemoved.getLeftChild() == mSentinel) { // if the node that is being remove does not possess a left child // then translate the right child of the node that is being removed // in the place of the node itself transplant(nodeBeingRemoved, nodeBeingRemoved.getrightChild()); } else if (nodeBeingRemoved.getrightChild() == mSentinel) { // act on analogy if the node does not possess a right child transplant(nodeBeingRemoved, nodeBeingRemoved.getLeftChild()); } else { // the tricky part Node nextNode = getMinimalNode(nodeBeingRemoved.getrightChild()); // if the node that is being removed has both right and left // children then get the minimal(rightmost child of the node as the // next node that is going to replace it) if (nextNode.getParent() != nodeBeingRemoved) { // if the node that we've acquired does not coincide with the // node that is being removed transplant(nextNode, nextNode.getrightChild());// (1) // replace it with its right child nextNode.setrightChild(nodeBeingRemoved.getrightChild()); // and set its right child to be the right child of the node // that is under removal nextNode.getrightChild().setParent(nextNode); // last but not least make the right' child's parent the not // that we have transfered (look 1) } transplant(nodeBeingRemoved, nextNode); // in all cases change the positions of the node that is being // removed and the node that will replace it // and adjust the children accordingly nextNode.setLeftChild(nodeBeingRemoved.getLeftChild()); nextNode.getLeftChild().setParent(nextNode); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void onRemoveNode(Node node) {\n\t}", "public boolean removeNode(Node n);", "public abstract void removeChild(Node node);", "void removeNode(NodeKey key);", "boolean removeNode(N node);", "void removeHasNodeID(Integer oldHasNodeID);", "protected void notifyChildRemoval(FONode node) {\n /...
[ "0.79980516", "0.7543207", "0.7471591", "0.74340415", "0.73963755", "0.7290228", "0.7244936", "0.72426623", "0.7190414", "0.715081", "0.7132777", "0.7132536", "0.7120506", "0.70235854", "0.701797", "0.69637287", "0.6938318", "0.6938318", "0.6938318", "0.6938318", "0.6938318",...
0.0
-1
this method returns the minimal/leftmost(relative to its key) node
public Node getMinimalNode(Node currentNode) { while (currentNode.getLeftChild() != mSentinel) { currentNode = currentNode.getLeftChild(); // simply go left until you reach an empty node } return currentNode; // return the last non-empty node }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private long minKey() {\n if (left.size == 0) return key;\n // make key 'absolute' (i.e. relative to the parent of this):\n return left.minKey() + this.key;\n }", "public K min() {\n if (root == null)\n return null;\n else {\n Node curr = root;\n ...
[ "0.81612974", "0.78027016", "0.756999", "0.7436632", "0.7413336", "0.7399567", "0.7320764", "0.72563154", "0.72221386", "0.7172183", "0.7149134", "0.7131017", "0.7128583", "0.71238536", "0.712062", "0.71080714", "0.7081565", "0.7081175", "0.7075294", "0.70197827", "0.70087594...
0.0
-1
this method returns the maximal/rightmost(relative to its key) node
public Node getMaximalNode(Node currentNode) { while (currentNode.getrightChild() != mSentinel) { currentNode = currentNode.getrightChild(); // simply go right until you reach an empty node } return currentNode; // return the last non-empty node }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Key max(Node node)\n {\n \tif(node==null)\n \t return null;\n \tif(node.right==null)\n \t return node.key;\n \telse\n \t return max(node.right);\n }", "public int getMaxKey() {\r\n return getMax(this.root).getKey();\r\n }", "public TreeNode<T...
[ "0.78352994", "0.74212664", "0.7348507", "0.73100805", "0.72906965", "0.7254407", "0.7249522", "0.7243569", "0.7183592", "0.71438265", "0.7138847", "0.70939666", "0.708939", "0.70773226", "0.7062941", "0.70628387", "0.7035953", "0.70149195", "0.6959007", "0.6935772", "0.69286...
0.65020305
48
find the node with a specific key(it returns the first node that has the given key)
public Node search(K key) { Node currentNode = this.mRoot; // start from the root of the tree that calls the method while (currentNode != mSentinel && key.compareTo(currentNode.getKey()) != 0) { // if the current node is not empty and its key is not equal to the // search key if (key.compareTo(currentNode.getKey()) < 0) { currentNode = currentNode.getLeftChild(); // go left if the search key is lower } else { currentNode = currentNode.getrightChild(); // go right if the search key is higher } // break the loop if the search key matches the node key } if (currentNode == mSentinel) { return null; // if there is not a match return nu;; } else { return currentNode; // return the first node with the same key as the search key } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private Node findKey(String key){\n Node N = front;\n while(N != null){\n if(N.key.equals(key)){\n return N; \n }\n else{\n N = N.next; \n }\n }\n return null;\n }", "@Override\r\n public Object findElement(Object key) {\r\n\r\n // Search for node possibly...
[ "0.80861753", "0.8083351", "0.79533255", "0.79017115", "0.78995246", "0.7881532", "0.78505605", "0.7728152", "0.7564721", "0.75455767", "0.753012", "0.751525", "0.7506547", "0.74879324", "0.7406138", "0.73363364", "0.73351014", "0.7335026", "0.72983444", "0.72664666", "0.7263...
0.76255125
8
this method calculates the depth of a given node in a tree
public int calculateNodeDepth(Node startNode) { int depthCounter = 0; // start from zero if (!(startNode == this.mRoot)) { while (startNode.getParent() != this.mRoot) { startNode = startNode.getParent(); depthCounter++; // count upwards while the node's parent is not root } } else { return 0; } return depthCounter; // return the count }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "int depth(BTNode node) {\n int d = 0;\n while (node != root) {\n node = node.parent;\n d++;\n }\n return d;\n }", "public int getNodeDepth() {\n int depth = 0;\n TreeNode tn = this;\n \n while(tn.getFather() != null) {\n ...
[ "0.7819409", "0.76942414", "0.7601714", "0.75723034", "0.7517223", "0.7464283", "0.7424462", "0.7359595", "0.7275473", "0.7236457", "0.7184921", "0.7176689", "0.7127687", "0.71101695", "0.7088153", "0.7088153", "0.70637214", "0.7010329", "0.6952117", "0.68938017", "0.68145156...
0.70838904
16
this method calculates the height of a given node in a tree
public int calculateNodeHeigth(Node startNode) { if (startNode == mSentinel) { return 0; // if the start node is empty return 0 } else { return 1 + Math.max(calculateNodeHeigth(startNode.getLeftChild()), calculateNodeHeigth(startNode.getrightChild())); // otherwise recursively call the same function on the right and // left child of the node(until u meet the recursion's end - empty // node/0 and get the higher result) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int height(Node<T> node){\n if(node == null){\n return 0;\n }else{\n int leftHight = height(node.left) + 1;\n int rightHight = height(node.right) + 1;\n if(leftHight > rightHight){\n return leftHight;\n }else{\n ...
[ "0.8164452", "0.8024024", "0.78986263", "0.78889775", "0.7847998", "0.7841207", "0.7834053", "0.783321", "0.7821793", "0.7816994", "0.779777", "0.77849025", "0.77748066", "0.77418333", "0.7705788", "0.76947874", "0.7688929", "0.7676178", "0.76691353", "0.76655567", "0.7662651...
0.0
-1
Set title of the PhraseCollection before we shift to loading view
public void quitAndSave(final View v) { mPhraseCollection.setListTitle(((EditText) findViewById(R.id.edit_list_title)).getText().toString()); // Open layout with ProgressBar while we are processing DriveFile setContentView(R.layout.activity_circle); // Open a new Thread to save the file and exit back to ListSelectionActivity new Thread(new Runnable() { @Override public void run() { if (mPhraseCollection.writeChangesToDrive((EditListActivity)v.getContext())) { // Open new Intent to create Bundle to pass back to ListSelectionActivity Intent rIntent = new Intent(); rIntent.putExtra("PhraseCollection", mPhraseCollection); rIntent.putExtra("position", mPosition); setResult(RESULT_CODE_SAVE, rIntent); finish(); } else { // TODO Display error to user when writing changes to Drive is unsuccessful } } }).start(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic void setTitle(java.lang.String title) {\n\t\t_dictData.setTitle(title);\n\t}", "public void setTitle(String title) { this.title = title; }", "public void setTitle(String title) {\r\n _title = title;\r\n }", "public void setTitle(java.lang.String title);", "@Override\r\n\t\tpub...
[ "0.71820027", "0.70993704", "0.6973542", "0.69734764", "0.69667405", "0.69636333", "0.6963187", "0.69502646", "0.6939686", "0.6937294", "0.6933181", "0.6933181", "0.6930579", "0.6924307", "0.6919106", "0.6919106", "0.69065", "0.69065", "0.69065", "0.69011706", "0.69011706", ...
0.0
-1
Utility function for creating log timestamps, in W3C/ISO8601 format, assuming UTC. Use current time. Format is yyyyMMdd'T'HH:mm:ss'Z'
public static String getLog14Date(){ return TIMESTAMP14ISO8601Z.get().format(new Date()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static String getNowAsTimestamp() {\r\n\r\n DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_PATTERN);\r\n dateFormat.setTimeZone(TimeZone.getTimeZone(\"UTC\"));\r\n return dateFormat.format(new Date()).replaceAll(\"\\\\+0000\", \"Z\").replaceAll(\"([+-][0-9]{2}):([0-9]{2})\", \...
[ "0.652758", "0.6412308", "0.6233016", "0.60804427", "0.5977896", "0.59601194", "0.5914427", "0.5833401", "0.5821589", "0.57322305", "0.5708146", "0.56595415", "0.56404835", "0.55953443", "0.557633", "0.5567938", "0.5549819", "0.5528512", "0.54875004", "0.54862964", "0.5470828...
0.5849794
7
Log.d("DFM", "danmakuShown(): text=" + danmaku.text);
@Override public void danmakuShown(BaseDanmaku danmaku) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void showText(String s){\n }", "@Override\n public void run() {\n text_tracking.setText(tt);\n }", "@Override\n public void run() {\n text_tracking.setText(tt);\n }", "@Override\n pub...
[ "0.6249965", "0.5942046", "0.5942046", "0.59258574", "0.5892634", "0.58621484", "0.5842554", "0.58266723", "0.57570475", "0.5743536", "0.5729315", "0.57060194", "0.56654847", "0.5632636", "0.5622229", "0.5611961", "0.5602906", "0.56025577", "0.5593052", "0.5586007", "0.558499...
0.6599065
0
Constructor using action field.
public AssertSoapFaultBuilder(TestDesigner designer, AssertSoapFault action) { super(designer, action); // for now support one single soap fault detail SoapFaultDetailValidationContext soapFaultDetailValidationContext = new SoapFaultDetailValidationContext(); soapFaultDetailValidationContext.addValidationContext(validationContext); action.setValidationContext(soapFaultDetailValidationContext); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void init_actions()\n {\n action_obj = new CUP$ParserForms$actions(this);\n }", "protected PMBaseAction() {\r\n super();\r\n }", "public MemberAction() {\n\t\tsuper();\n\t}", "protected void init_actions()\r\n {\r\n action_obj = new CUP$Parser$actions(this);\r\n }", ...
[ "0.7140362", "0.69764364", "0.6940265", "0.6931596", "0.69026864", "0.69026864", "0.69026864", "0.69026864", "0.69026864", "0.68927425", "0.6872586", "0.6857899", "0.68503946", "0.68503946", "0.68503946", "0.68503946", "0.68503946", "0.68503946", "0.68503946", "0.68503946", "...
0.0
-1
Default constructor using runner and action container.
public AssertSoapFaultBuilder(TestRunner runner, AssertSoapFault action) { super(runner, action); // for now support one single soap fault detail SoapFaultDetailValidationContext soapFaultDetailValidationContext = new SoapFaultDetailValidationContext(); soapFaultDetailValidationContext.addValidationContext(validationContext); action.setValidationContext(soapFaultDetailValidationContext); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public ActionManager() {\n\t\tsuper();\n\t}", "protected TeststepRunner() {}", "public ScheduledActionAction() {\n\n }", "public UpcomingContestsManagerAction() {\r\n }", "public ExecuteAction()\n {\n this(null);\n }", "private ActionPackage() {}", "public Action(GameManager gameManager){\n ...
[ "0.6814794", "0.6527829", "0.6442214", "0.6437484", "0.64117557", "0.64088774", "0.6335143", "0.628364", "0.6268999", "0.6255189", "0.62083817", "0.6151275", "0.61507094", "0.61361605", "0.6089673", "0.6031053", "0.59831065", "0.59743637", "0.59548295", "0.5888215", "0.586329...
0.0
-1
Default constructor using test runner.
public AssertSoapFaultBuilder(TestRunner runner) { this(runner, new AssertSoapFault()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected TeststepRunner() {}", "public SwerveAutoTest() {\n // Initialize base classes.\n // All via self-construction.\n\n // Initialize class members.\n // All via self-construction.\n }", "public TestDriverProgram(){\n iTestList = new SortableArray(iSize); // tests i...
[ "0.81325185", "0.77971476", "0.76674825", "0.75791895", "0.7553342", "0.74560785", "0.74057525", "0.7404493", "0.7395155", "0.73674715", "0.73540586", "0.73382306", "0.7323621", "0.7314422", "0.7311936", "0.72899544", "0.7262568", "0.72588897", "0.723808", "0.71851766", "0.71...
0.0
-1
Expect fault code in SOAP fault message.
public AssertSoapFaultBuilder faultCode(String code) { action.setFaultCode(code); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getFaultCode() {\n return faultCode;\n }", "public void setFaultCode(final String faultCode) {\n this.faultCode = faultCode;\n }", "NamespacedProperty getFaultCodeExpression();", "String getFaultReasonValue();", "String getFaultStringValue();", "public int getFaultCode() {\n\t\tretu...
[ "0.708266", "0.69826007", "0.6776471", "0.6611714", "0.6533891", "0.64262116", "0.6308855", "0.6257969", "0.62096184", "0.6206776", "0.614063", "0.6088593", "0.60798985", "0.59847796", "0.586281", "0.5859033", "0.58479613", "0.58302796", "0.577657", "0.57442796", "0.57143784"...
0.7081484
1
Expect fault string in SOAP fault message.
public AssertSoapFaultBuilder faultString(String faultString) { action.setFaultString(faultString); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setFaultString(final String faultString) {\n this.faultString = faultString;\n }", "public String getFaultString() {\n return faultString;\n }", "String getFaultStringValue();", "public void setFaultMessage(String faultMessage) {\n this.faultMessage = faultMessage;\n }", "Name...
[ "0.73173606", "0.71795803", "0.6994866", "0.6787119", "0.6243739", "0.6181726", "0.6177673", "0.6110021", "0.6067233", "0.60443336", "0.60170406", "0.6008915", "0.5997388", "0.5968276", "0.5904381", "0.5883865", "0.58310133", "0.58016825", "0.57840526", "0.5766726", "0.575594...
0.7037373
2
Expect fault actor in SOAP fault message.
public AssertSoapFaultBuilder faultActor(String faultActor) { action.setFaultActor(faultActor); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "String getFaultActor();", "@Override\r\n\t\t\tpublic void onFault(Throwable fault) {\n\t\t\t\t\r\n\t\t\t}", "public static void serializeSOAPFault(SOAPFault fault, XMLStreamWriter writer) throws XMLStreamException {\n\n\t\tOMSerializerUtil.serializeStartpart(fault, writer);\n\t\tOMElement e = null;\n\n\t\t// b...
[ "0.64521074", "0.61457384", "0.59230494", "0.5883457", "0.5872841", "0.5800333", "0.5780089", "0.5760588", "0.5752922", "0.56909496", "0.5680712", "0.56636995", "0.56571543", "0.5650301", "0.5602497", "0.5531012", "0.5483746", "0.5481273", "0.5466813", "0.5414746", "0.5406759...
0.7371539
0
Expect fault detail in SOAP fault message.
public AssertSoapFaultBuilder faultDetail(String faultDetail) { action.getFaultDetails().add(faultDetail); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getFaultString() {\n return faultString;\n }", "String getFaultStringValue();", "public String getFaultMessage() {\n return faultMessage;\n }", "@Override\r\n\t\t\tpublic void onFault(Throwable fault) {\n\t\t\t\t\r\n\t\t\t}", "String getFaultReasonValue();", "protected Element...
[ "0.6919421", "0.68075776", "0.6625023", "0.66169035", "0.65445304", "0.6539107", "0.6500426", "0.64942205", "0.6451822", "0.64148426", "0.63875014", "0.6330147", "0.6185244", "0.61568296", "0.61289966", "0.61249864", "0.6112877", "0.61115295", "0.6107125", "0.60816944", "0.60...
0.63779885
11
Expect fault detail from file resource.
public AssertSoapFaultBuilder faultDetailResource(Resource resource) { return faultDetailResource(resource, FileUtils.getDefaultCharset()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public FileWithFaultLocations getFile(final String file);", "void fileReceiveFailed(IMSession session, String requestId, String fileId, ReasonInfo reason);", "public AssertSoapFaultBuilder faultDetailResource(String filePath) {\n action.getFaultDetailResourcePaths().add(filePath);\n return this;\...
[ "0.6571318", "0.58333874", "0.5803207", "0.57096803", "0.55385387", "0.55325675", "0.55314606", "0.55004245", "0.5499129", "0.5493624", "0.5457347", "0.5416177", "0.5410847", "0.5402986", "0.53646696", "0.5279853", "0.5244353", "0.52365345", "0.5186679", "0.5183676", "0.51619...
0.5427529
11
Expect fault detail from file resource.
public AssertSoapFaultBuilder faultDetailResource(Resource resource, Charset charset) { try { action.getFaultDetails().add(FileUtils.readToString(resource, charset)); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read fault detail resource", e); } return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public FileWithFaultLocations getFile(final String file);", "void fileReceiveFailed(IMSession session, String requestId, String fileId, ReasonInfo reason);", "public AssertSoapFaultBuilder faultDetailResource(String filePath) {\n action.getFaultDetailResourcePaths().add(filePath);\n return this;\...
[ "0.6571318", "0.58333874", "0.5803207", "0.57096803", "0.55385387", "0.55314606", "0.55004245", "0.5499129", "0.5493624", "0.5457347", "0.5427529", "0.5416177", "0.5410847", "0.5402986", "0.53646696", "0.5279853", "0.5244353", "0.52365345", "0.5186679", "0.5183676", "0.516194...
0.55325675
5
Expect fault detail from file resource.
public AssertSoapFaultBuilder faultDetailResource(String filePath) { action.getFaultDetailResourcePaths().add(filePath); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public FileWithFaultLocations getFile(final String file);", "void fileReceiveFailed(IMSession session, String requestId, String fileId, ReasonInfo reason);", "public void errorFileEscenario() {\n\t\tvisorEscenario.errorFileEscenario();\t\n\t}", "void fileTransferFailed(IMSession session, String requestId, Re...
[ "0.6571318", "0.58333874", "0.57096803", "0.55385387", "0.55325675", "0.55314606", "0.55004245", "0.5499129", "0.5493624", "0.5457347", "0.5427529", "0.5416177", "0.5410847", "0.5402986", "0.53646696", "0.5279853", "0.5244353", "0.52365345", "0.5186679", "0.5183676", "0.51619...
0.5803207
2
Set explicit SOAP fault validator implementation.
public AssertSoapFaultBuilder validator(SoapFaultValidator validator) { action.setValidator(validator); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setValidator(Validator validator) {\n/* 603 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "public AssertSoapFaultBuilder schemaValidation(boolean enabled) {\n validationContext.setSchemaValidation(enabled);\n return this;\n }", "public AssertSoapFaultBuilder valida...
[ "0.59437984", "0.56054604", "0.5513765", "0.54995495", "0.54423094", "0.5344227", "0.53051114", "0.5264908", "0.5172762", "0.512993", "0.5123767", "0.5109485", "0.5065881", "0.5048283", "0.5042648", "0.50122166", "0.5011215", "0.49769667", "0.49760103", "0.49527216", "0.49465...
0.6146096
0
Set explicit SOAP fault validator implementation by bean name.
public AssertSoapFaultBuilder validator(String validatorName, ApplicationContext applicationContext) { action.setValidator(applicationContext.getBean(validatorName, SoapFaultValidator.class)); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setValidator(Validator validator) {\n/* 603 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "public AssertSoapFaultBuilder validator(SoapFaultValidator validator) {\n action.setValidator(validator);\n return this;\n }", "public void setValidatorName(String name) {\r\...
[ "0.5376908", "0.5376522", "0.52409476", "0.50086087", "0.49607664", "0.4889346", "0.484698", "0.47565028", "0.47434255", "0.47361076", "0.4724054", "0.47009113", "0.46994174", "0.46388525", "0.461407", "0.46134743", "0.46005973", "0.46005642", "0.45922038", "0.4578264", "0.45...
0.59535724
0
Sets schema validation enabled/disabled for this SOAP fault assertion.
public AssertSoapFaultBuilder schemaValidation(boolean enabled) { validationContext.setSchemaValidation(enabled); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public AssertSoapFaultBuilder xsd(String schemaName) {\n validationContext.setSchema(schemaName);\n return this;\n }", "public void setIsValidToSchema(boolean iIsValidToSchema) {\r\n\t\tmIsValidToSchema = iIsValidToSchema;\r\n\t}", "@Override\n public void setValidationMode(int validationMo...
[ "0.59246457", "0.5923469", "0.56551397", "0.5461057", "0.54305696", "0.5399773", "0.5375032", "0.52302927", "0.5054054", "0.5028343", "0.5005237", "0.4994806", "0.49615902", "0.48916006", "0.48738304", "0.484969", "0.48413718", "0.48106098", "0.4771406", "0.47646603", "0.4764...
0.79730916
0
Sets explicit schema instance name to use for schema validation.
public AssertSoapFaultBuilder xsd(String schemaName) { validationContext.setSchema(schemaName); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setSchemaInstance(String schemaInstance) {\n\t\t\r\n\t}", "public void setSchema(java.lang.String schema) {\r\n this.schema = schema;\r\n }", "public void setSchema(String schema) {\n this.schema = schema;\n }", "public String getSchemaName() { return schemaName; }", "public...
[ "0.7071011", "0.6441966", "0.6312878", "0.6270068", "0.6223917", "0.6098602", "0.59394985", "0.5915534", "0.5913848", "0.5859499", "0.5670391", "0.5664786", "0.5664786", "0.56048214", "0.5593433", "0.5591235", "0.55559206", "0.5526797", "0.54242456", "0.54134905", "0.5348486"...
0.49471638
43
Sets explicit xsd schema repository instance to use for validation.
public AssertSoapFaultBuilder xsdSchemaRepository(String schemaRepository) { validationContext.setSchemaRepository(schemaRepository); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void setXMLSchema(Schema schema) throws XMLPlatformException {\n documentBuilderFactory.setSchema(schema);\n }", "public XMLSchemaValidatorProvider() {\n this(Optional.empty());\n }", "@Override\n public void setXMLSchema(URL url) throws XMLPlatformException {\n if...
[ "0.6199913", "0.6174016", "0.585771", "0.57992303", "0.5782078", "0.5754796", "0.5729847", "0.55606294", "0.5543347", "0.549613", "0.5345016", "0.53339446", "0.5313325", "0.5303879", "0.52807564", "0.52592736", "0.5238467", "0.5224594", "0.5212315", "0.51832956", "0.51832956"...
0.6390167
0
Sets the Spring bean application context.
public AssertSoapFaultBuilder withApplicationContext(ApplicationContext applicationContext) { if (applicationContext.containsBean("soapFaultValidator")) { validator(applicationContext.getBean("soapFaultValidator", SoapFaultValidator.class)); } return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void setApplicationContext(ApplicationContext applicationContext)\r\n\t\t\tthrows BeansException {\n\t\tcontext = (WebApplicationContext) applicationContext;\r\n\t}", "@Override\n\tpublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException {\n\t\tcontext=...
[ "0.7990539", "0.7822849", "0.77856714", "0.7738964", "0.7719056", "0.7716051", "0.7675699", "0.7587523", "0.7575889", "0.7561347", "0.75449556", "0.74852145", "0.74571884", "0.74541", "0.74237496", "0.74028957", "0.728707", "0.72469985", "0.7226825", "0.71949977", "0.7148888"...
0.0
-1
Iterative approach is based on the idea that a parent of the subtree is visited just right after its right child (if it exists) is visited. Thus, whenever we are going to pop a top node from the stack we have to check 2 things: 1. if the top node has a right child 2. and its right child is not equal to previously visited node If above conditions are false, then it means that we visited both left and right subtrees of the top node and it can be popped out from the stack. If above are true, then we have to first check out the right subtree and then come back to the current top node
public List<Integer> iterativeTraversal(TreeNode root) { List<Integer> list = new ArrayList<>(); if (root == null) { return list; } Deque<TreeNode> stack = new LinkedList<>(); TreeNode curr = root; TreeNode prev = null; while (curr != null || !stack.isEmpty()) { while (curr != null) { stack.push(curr); curr = curr.left; } TreeNode top = stack.peek(); // we have to check whether the top node has a right child and it is not equal to the previously visited node // if above is true, we have to first traverse the right subtree before we pop the parent if (top.right != null && top.right != prev) { curr = top.right; } else { stack.pop(); // we can remove the node from the stack as we already processed left and right subtrees. prev = top; // we have to remember previously visited node, as we will compare it later list.add(top.val); // visit a node // curr reference is null at this point } } return list; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void getInorderIteratively(Node node) {\n Stack<Node> stack = new Stack<Tree.Node>();\n if (node == null)\n return;\n Node current = node;\n while (!stack.isEmpty() || current != null) {\n // While the sub tree is not empty keep on adding them\n while (c...
[ "0.6442197", "0.636845", "0.61221737", "0.60884744", "0.5988342", "0.5960463", "0.59158003", "0.58755493", "0.58473563", "0.58470434", "0.584223", "0.57953167", "0.5771069", "0.57489526", "0.57302016", "0.5706806", "0.5687341", "0.5680602", "0.5655089", "0.56237894", "0.56175...
0.527762
70
Create a new board with the given width and height. This method must return null if the given width and height are invalid.
@Override public Board createBoard(long width, long height) { return new Board(width, height); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public GameBoard (int height, int width)\n {\n mHeight = height;\n mWidth = width;\n }", "public Board(int width, int height) {\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tgrid = new boolean[width][height];\n\t\tcommitted = true;\n\t\twidths = new int[height];\n\t\theights = new int[width];\...
[ "0.7298967", "0.6843327", "0.67646486", "0.66729236", "0.6563533", "0.6526634", "0.65200955", "0.64303994", "0.6420366", "0.64036727", "0.6286826", "0.62632215", "0.6236135", "0.6221917", "0.62003326", "0.6188771", "0.6100175", "0.6064774", "0.6061499", "0.60324544", "0.60059...
0.8277208
0
Merge board1 and board2.
@Override public void merge(Board board1, Board board2) { try { board1.merge(board2); } catch(IllegalStateException exc) { System.out.println("Either this board or the other board is terminated; the boards cannot be merged."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public GridCollector merge(GridCollector other) {\n\t\t// cell-wise merge\n\t\tIntStream.range(0, cells.size())\n\t\t .forEach(i -> cells.get(i).addAll(other.cells.get(i)));\n\t\treturn this;\n\t}", "void merge();", "private void merge(List<Estado> states1, List<Estado> states2) {\n\t\tfor (Estado stat...
[ "0.62500757", "0.60645247", "0.57681", "0.57275856", "0.5653379", "0.56484723", "0.5616444", "0.5586764", "0.55543405", "0.552536", "0.5469033", "0.54607517", "0.54100764", "0.53834957", "0.53739196", "0.5359589", "0.5352943", "0.53419214", "0.533029", "0.5294518", "0.5279698...
0.77395624
0
Create a new battery with initial energy equal to initialEnergy and weight equal to weight. This method must return null if the given parameters are invalid (e.g. negative weight).
@Override public Battery createBattery(double initialEnergy, int weight) { return new Battery(initialEnergy, weight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Battery(double initialCapacity) {\r\n capacity = initialCapacity;\r\n originalCapacity = initialCapacity;\r\n }", "public Boat(String name, double lengthOverAll, double beam, double weightCapacity) {\n this.name = name;\n this.lengthOverAll = lengthOverAll;\n this.beam = beam;\n ...
[ "0.64713985", "0.5658764", "0.55789375", "0.5573179", "0.54318047", "0.52133304", "0.5134086", "0.5105794", "0.5078952", "0.5022043", "0.49815282", "0.497666", "0.49530086", "0.49266472", "0.49223864", "0.48976716", "0.4860719", "0.48392874", "0.482889", "0.48244348", "0.4819...
0.8309855
0
Put battery at position (x, y) on board (if possible).
@Override public void putBattery(Board board, long x, long y, Battery battery) { try { battery.setPosition(new Position(x,y)); battery.setBoard(board); } catch(IllegalStateException exc) { System.out.println("Either this battery or this board is terminated; the battery cannot be placed on the board."); } catch(IllegalPositionException exc) { System.out.println("This is not a valid position on the board to place an element."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void place(Piece p, int x, int y) {\n\t\tif (x >= 8 || y >= 8 || p == null) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tif (pieceAt(x, y) != null) {\n\t\t\t\tremove(x, y);\n\t\t\t}\n\t\t\tb[x][y] = p;\n\t\t\tif (p.isFire()) {\n\t\t\t\tnumFire += 1;\n\t\t\t} else {\n\t\t\t\tnumWater += 1;\n\t\t\t}\n\t\t}\n\t}", ...
[ "0.64339226", "0.62941164", "0.6242769", "0.61671305", "0.6071843", "0.58891106", "0.58585405", "0.58523303", "0.5851702", "0.5779188", "0.5769622", "0.5768049", "0.5670234", "0.56487274", "0.56241846", "0.56124866", "0.5590459", "0.55826855", "0.553541", "0.55279577", "0.551...
0.8147061
0
Return the xcoordinate of battery. This method must throw IllegalStateException if battery is not placed on a board.
@Override public long getBatteryX(Battery battery) throws IllegalStateException { if (battery.getBoard() != null) { return battery.getPosition().getCoordX(); } else throw new IllegalStateException(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic long getRobotX(Robot robot) throws IllegalStateException\r\n\t{\r\n\t\tif (robot.getBoard() != null)\r\n\t\t{\r\n\t\t\treturn robot.getPosition().getCoordX();\r\n\t\t}\r\n\t\telse throw new IllegalStateException();\r\n\t}", "public double getX() {\n return position.getX();\n }", ...
[ "0.6384352", "0.6369745", "0.6349201", "0.63018084", "0.62543684", "0.62543684", "0.6248805", "0.62190855", "0.62178373", "0.61987704", "0.6197342", "0.6188697", "0.6175418", "0.61743045", "0.61664027", "0.61446774", "0.61324304", "0.61324304", "0.61317027", "0.612306", "0.61...
0.840943
0
Return the ycoordinate of battery. This method must throw IllegalStateException if battery is not placed on a board.
@Override public long getBatteryY(Battery battery) throws IllegalStateException { if (battery.getBoard() != null) { return battery.getPosition().getCoordY(); } else throw new IllegalStateException(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double getY() {\n return position.getY();\n }", "public int getyCoordinate() {\n return yCoordinate;\n }", "public int getyCoordinate() {\n return yCoordinate;\n }", "public int getLocationY() {\r\n\t\treturn y;\r\n\t}", "public int getBattery() {\n return batter...
[ "0.64576167", "0.6451278", "0.6451278", "0.64230627", "0.6415611", "0.6408193", "0.6405778", "0.640314", "0.640156", "0.63643444", "0.63489604", "0.6332679", "0.6330822", "0.6317109", "0.63058627", "0.6294216", "0.6281967", "0.6270134", "0.62593114", "0.62571824", "0.6254692"...
0.8243283
0
Create a new repair kit that repairs repairAmount. This method must return null if the given parameters are invalid (e.g. negative repairAmount).
@Override public RepairKit createRepairKit(double repairAmount, int weight) { return new RepairKit(repairAmount, weight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public RecoveryLinear(int recoveryAmount)\n\t{\n\t\tthis.recoveryAmount = recoveryAmount; \n\t}", "QualityRisk createQualityRisk();", "public IResourceDepot createResourceDepot() {\n\n /*\n * Defining a ResourceDepot \"JackTruckDepot\" that can store DeliverGood and PickupGood.\n *\n */\n\n /...
[ "0.49994195", "0.48074654", "0.4782288", "0.46757942", "0.46541268", "0.4648134", "0.46117812", "0.46050376", "0.45789245", "0.45406353", "0.45313743", "0.44942814", "0.44882238", "0.44655895", "0.44634506", "0.44547653", "0.4446816", "0.44373393", "0.4428319", "0.44177356", ...
0.68017024
0
Put repairKit at position (x, y) on board (if possible).
@Override public void putRepairKit(Board board, long x, long y, RepairKit repairKit) { try { repairKit.setPosition(new Position(x,y)); repairKit.setBoard(board); } catch(IllegalStateException exc) { System.out.println("Either this repair kit or this board is terminated; the repair kit cannot be placed on the board."); } catch(IllegalPositionException exc) { System.out.println("This is not a valid position on the board to place an element."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setPiece(int x, int y, int player) throws GameException {\n if (!squareInBounds(x, y)) {\n throw new GameException(\"Square is off the board\");\n }\n int arrayPos = getArrayPos(x, y);\n if (!isSquareFree(arrayPos)) {\n throw new GameException(\"Location is already taken\");\n ...
[ "0.6332777", "0.6292649", "0.6206695", "0.6182023", "0.6136774", "0.61333656", "0.60635793", "0.6021614", "0.59194016", "0.5913409", "0.5910836", "0.5893515", "0.5892581", "0.58821905", "0.5817605", "0.581293", "0.57961476", "0.57951677", "0.5781112", "0.5780157", "0.57715374...
0.8189344
0
Return the xcoordinate of repairKit. This method must throw IllegalStateException if repairKit is not placed on a board.
@Override public long getRepairKitX(RepairKit repairKit) throws IllegalStateException { if (repairKit.getBoard() != null) { return repairKit.getPosition().getCoordX(); } else throw new IllegalStateException(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public final int getPositionX() {\r\n return (int) position.x();\r\n }", "public int getX() {\n return (int) center.getX();\n }", "public int getX() {\n\t\t\n\t\treturn xPosition;\t\t// Gets the x integer\n\t}", "public double getPositionX() {\n\t\treturn this.tilePositionX;\n\t}", "pub...
[ "0.688758", "0.6849573", "0.6835585", "0.6818578", "0.681378", "0.6807152", "0.68030936", "0.6776794", "0.67362744", "0.6732178", "0.67292553", "0.67186147", "0.6695235", "0.6694449", "0.66934544", "0.6691406", "0.66907984", "0.6663321", "0.6663321", "0.6663176", "0.66535354"...
0.88539743
0
Return the ycoordinate of repairKit. This method must throw IllegalStateException if repairKit is not placed on a board.
@Override public long getRepairKitY(RepairKit repairKit) throws IllegalStateException { if (repairKit.getBoard() != null) { return repairKit.getPosition().getCoordY(); } else throw new IllegalStateException(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getY() {\r\n\t\treturn ycoord;\r\n\t}", "public int getY() {\n synchronized (this.yLock) {\n return (int) this.movementComposer.getYPosition();\n }\n }", "public int getY() {\n return PADDING;\n //return rowToY(this.getRows());\n //throw new Unsupport...
[ "0.69486356", "0.6947233", "0.69119954", "0.69075155", "0.6899383", "0.68880576", "0.68880576", "0.68770415", "0.68664646", "0.68639314", "0.6862785", "0.68614125", "0.68575776", "0.68575776", "0.68575776", "0.68445915", "0.68425655", "0.6821859", "0.6821859", "0.6821859", "0...
0.8449404
0
Create a new surprise box with weighing weight. This method must return null if the given parameters are invalid (e.g. negative weight).
@Override public SurpriseBox createSurpriseBox(int weight) { return new SurpriseBox(weight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void testSetWeight()\n {\n WeightedKernel<Vector> instance = new WeightedKernel<Vector>();\n assertEquals(WeightedKernel.DEFAULT_WEIGHT, instance.getWeight());\n \n double weight = RANDOM.nextDouble();\n instance.setWeight(weight);\n assertEquals(weight, instance...
[ "0.5629283", "0.54583836", "0.5414648", "0.54007846", "0.5265859", "0.5262858", "0.5254486", "0.5244365", "0.5195884", "0.5193027", "0.5111058", "0.5095961", "0.5056132", "0.5023445", "0.5004456", "0.49961755", "0.49957457", "0.49949658", "0.49949658", "0.49825525", "0.497911...
0.81605864
0
Put surpriseBox at position (x, y) on board (if possible).
@Override public void putSurpriseBox(Board board, long x, long y, SurpriseBox surpriseBox) { try { surpriseBox.setPosition(new Position(x,y)); surpriseBox.setBoard(board); } catch(IllegalStateException exc) { System.out.println("Either this surprise box or this board is terminated; the surprise box cannot be placed on the board."); } catch(IllegalPositionException exc) { System.out.println("This is not a valid position on the board to place an element."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void putPiece(Piece piece, int x, int y)\r\n {\r\n if(isValidSqr(x, y))\r\n {\r\n board[x][y] = piece;\r\n if(piece != null) piece.setLocation(x, y);\r\n }\r\n }", "private void UpdateSurround(int row, int col) {\n\t\t\n\t\t// updates the 3 positions below ...
[ "0.67930377", "0.65930176", "0.6466083", "0.6396689", "0.62959516", "0.62678367", "0.6225915", "0.612343", "0.607027", "0.6063356", "0.5982312", "0.59452677", "0.5942211", "0.59329814", "0.59314275", "0.59252083", "0.5891279", "0.5889623", "0.58809793", "0.5880098", "0.586591...
0.8323775
0
Return the xcoordinate of surpriseBox. This method must throw IllegalStateException if surpriseBox is not placed on a board.
@Override public long getSurpriseBoxX(SurpriseBox surpriseBox) throws IllegalStateException { if (surpriseBox.getBoard() != null) { return surpriseBox.getPosition().getCoordX(); } else throw new IllegalStateException(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic long getRepairKitX(RepairKit repairKit) throws IllegalStateException\r\n\t{\r\n\t\tif (repairKit.getBoard() != null)\r\n\t\t{\r\n\t\t\treturn repairKit.getPosition().getCoordX();\r\n\t\t}\r\n\t\telse throw new IllegalStateException();\r\n\t}", "private int get_x() {\n return cent...
[ "0.71046853", "0.67062026", "0.6586946", "0.6539601", "0.6533614", "0.6495761", "0.6486897", "0.6471802", "0.64567673", "0.64459527", "0.64310056", "0.642839", "0.642839", "0.64205486", "0.6405411", "0.6405349", "0.6392244", "0.6391231", "0.63909084", "0.6374378", "0.63708925...
0.88538677
0
Return the ycoordinate of surpriseBox. This method must throw IllegalStateException if surpriseBox is not placed on a board.
@Override public long getSurpriseBoxY(SurpriseBox surpriseBox) throws IllegalStateException { if (surpriseBox.getBoard() != null) { return surpriseBox.getPosition().getCoordY(); } else throw new IllegalStateException(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic long getRepairKitY(RepairKit repairKit) throws IllegalStateException\r\n\t{\r\n\t\tif (repairKit.getBoard() != null)\r\n\t\t{\r\n\t\t\treturn repairKit.getPosition().getCoordY();\r\n\t\t}\r\n\t\telse throw new IllegalStateException();\r\n\t}", "public final int getY()\n\t{\n\t\treturn pos.y...
[ "0.67018145", "0.663198", "0.6561997", "0.65593153", "0.65081674", "0.65081674", "0.65056986", "0.6494495", "0.6494495", "0.6494495", "0.64933026", "0.64922", "0.6483896", "0.6467897", "0.6466499", "0.64642084", "0.6461033", "0.64560455", "0.64560455", "0.64448994", "0.644358...
0.8637382
0
Create a new Robot looking at orientation with energy wattsecond. This method must return null if the given parameters are invalid (e.g. negative energy). 0, 1, 2, 3 respectively represent up, right, down and left.
@Override public Robot createRobot(int orientation, double initialEnergy) { Orientation ori = Orientation.convertIntToOrientation(orientation); if(Robot.canHaveAsOrientation(ori)) { Robot robot = new Robot(null, null, ori, initialEnergy, (double) 20000); if(robot.canHaveAsEnergy(initialEnergy)) { return robot; } else { return null; } } else { return null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Robot() {\t\n\t\tthis.step = myclass.STD_STEP ; \n\t\tthis.speed = myclass.STD_SPEED ; \n\t\tthis.rightM = new EV3LargeRegulatedMotor(myclass.rightP) ; \n\t\tthis.leftM = new EV3LargeRegulatedMotor(myclass.leftP) ; \n\t}", "Robot getRobot(Position pos);", "private void calculateLocation()\r\n\t{\r\n\t\t...
[ "0.61242586", "0.56679106", "0.5544317", "0.54908955", "0.5485238", "0.54706514", "0.545283", "0.5404678", "0.5397624", "0.5331218", "0.5329291", "0.53048444", "0.5248528", "0.52318805", "0.5220308", "0.5218037", "0.5214738", "0.5205896", "0.51759475", "0.51743925", "0.516494...
0.6582389
0
Put robot at position (x, y) on board (if possible).
@Override public void putRobot(Board board, long x, long y, Robot robot) { try { robot.setPosition(new Position(x,y)); robot.setBoard(board); } catch(IllegalStateException exc) { System.out.println("Either this robot or this board is terminated; the robot cannot be placed on the board."); } catch(IllegalPositionException exc) { System.out.println("This is not a valid position on the board to place an element."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void placeRobot(List<String> args) {\n int x;\n int y;\n Position.Direction direction;\n\n try {\n x = Integer.parseInt(args.get(0));\n y = Integer.parseInt(args.get(1));\n direction = Position.Direction.valueOf(args.get(2));\n } catch (Nu...
[ "0.651104", "0.6507533", "0.64307404", "0.6379152", "0.632765", "0.6256533", "0.62564135", "0.6249974", "0.6221492", "0.61844087", "0.6091605", "0.60773814", "0.6062405", "0.60531604", "0.6023253", "0.6021914", "0.6006585", "0.5994162", "0.5993896", "0.5993147", "0.5989568", ...
0.80962104
0
Return the xcoordinate of robot. This method must throw IllegalStateException if robot is not placed on a board.
@Override public long getRobotX(Robot robot) throws IllegalStateException { if (robot.getBoard() != null) { return robot.getPosition().getCoordX(); } else throw new IllegalStateException(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getX() {\n\t\t\tint lastRobot = (state[2 * k] + k - 1) % k;\n\t\t\treturn state[lastRobot];\n\t\t}", "public final int getPositionX() {\r\n return (int) position.x();\r\n }", "public int getX() {\n synchronized (this.xLock) {\n return (int) this.movementComposer.getXPosit...
[ "0.6909655", "0.6862693", "0.6814756", "0.6698004", "0.6693816", "0.66933113", "0.6682005", "0.6682005", "0.66722006", "0.6665289", "0.66515404", "0.6646519", "0.6646286", "0.6635208", "0.6635208", "0.6614507", "0.66038954", "0.6571792", "0.65687597", "0.65679", "0.65672624",...
0.88233745
0
Return the ycoordinate of robot. This method must throw IllegalStateException if robot is not placed on a board.
@Override public long getRobotY(Robot robot) throws IllegalStateException { if (robot.getBoard() != null) { return robot.getPosition().getCoordY(); } else throw new IllegalStateException(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getY() {\n synchronized (this.yLock) {\n return (int) this.movementComposer.getYPosition();\n }\n }", "public int getY() {\n\t\t\tint lastRobot = (state[2 * k] + k - 1) % k;\n\t\t\treturn state[lastRobot + k];\n\t\t}", "public int getyCoordinate() {\n return yCoord...
[ "0.71372443", "0.7072989", "0.703775", "0.703775", "0.6939772", "0.6925061", "0.6913028", "0.6877286", "0.6844012", "0.6841058", "0.6824252", "0.6777193", "0.67758656", "0.67484474", "0.6746411", "0.6744397", "0.674412", "0.67423666", "0.6737875", "0.67365724", "0.67357945", ...
0.8575249
0
Return the orientation (either 0, 1, 2 or 3) of robot. 0, 1, 2, 3 respectively represent up, right, down and left.
@Override public int getOrientation(Robot robot) { return robot.getOrientation().ordinal(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getOrientation(){\n\n if(robot.getRotation()%360 == 0){\n return \"NORTH\";\n } else if(robot.getRotation()%360 == 90\n ||robot.getRotation()%360 == -270){\n return \"EAST\";\n } else if(robot.getRotation()%360 == 180\n ||robot....
[ "0.7933545", "0.71143806", "0.6960955", "0.6939776", "0.6900556", "0.6793691", "0.67908627", "0.6782272", "0.67589104", "0.67355216", "0.6720861", "0.66651404", "0.6656829", "0.6609996", "0.65772253", "0.6536298", "0.6535519", "0.6451856", "0.64450353", "0.6427382", "0.642042...
0.79392713
0
Return the current energy in wattsecond of robot.
@Override public double getEnergy(Robot robot) { return robot.getEnergy(EnergyUnit.WATTSECOND); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic float getEnergyConsumption() {\r\n\t\treturn 2500 - robot.getBatteryLevel();\r\n\t}", "public double getEnergy() {\n\t\treturn energy;\n\t}", "public double getEnergy() { return energy; }", "public double getEnergy() {\n\t\treturn _energy;\n\t}", "int getEnergy();", "public double g...
[ "0.77324295", "0.77277726", "0.7714401", "0.7650569", "0.7538683", "0.7534983", "0.75112545", "0.75003904", "0.74907804", "0.74060726", "0.7387983", "0.7364444", "0.7250351", "0.7206885", "0.7202092", "0.7175825", "0.70458347", "0.7027343", "0.70110923", "0.6990221", "0.69194...
0.86616665
0
Move robot one step in its current direction if the robot has sufficient energy. Do not modify the state of the robot if it has insufficient energy.
@Override public void move(Robot robot) { try { if(robot.canMoveOneStep()) { robot.moveOneStep(); } else { System.out.println("This robot cannot move in its current state."); } } catch(IllegalStateException exc) { System.out.println("A terminated robot cannot be moved."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void moveOneStep() {\n if (velocity.getDx() < 0 && this.center.getX() - this.radius < bottomLeftBound) {\n this.setVelocity(-velocity.getDx(), velocity.getDy());\n } else if (velocity.getDx() > 0 && this.center.getX() + this.radius > bottomRightBound) {\n this.setVelocity...
[ "0.72609293", "0.7014481", "0.69087315", "0.6901371", "0.6816644", "0.67973334", "0.6760453", "0.66845244", "0.66341007", "0.66141194", "0.6595262", "0.6567337", "0.65278643", "0.6480756", "0.6476849", "0.64601475", "0.64548886", "0.64500636", "0.6438862", "0.6432493", "0.641...
0.74779433
0
Turn robot 90 degrees in clockwise direction if the robot has sufficient energy. Do not modify the state of the robot if it has insufficient energy.
@Override public void turn(Robot robot) { try { if(robot.canTurn(Direction.CLOCKWISE)) { robot.turnClockwise(); } else { System.out.println("This robot cannot turn in its current state."); } } catch(IllegalStateException exc) { System.out.println("A terminated robot cannot be turned."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void Turn(double degrees) {\n\n // Update the target angle\n TargetAngle = NormalizeAngle(TargetAngle + degrees);\n\n // Loops until the robot has reached the target\n while (opModeIsActive()) {\n\n // Calculate how many degrees the robot still has to turn\n ...
[ "0.7076164", "0.6813384", "0.6598622", "0.65792733", "0.656475", "0.6520244", "0.6468118", "0.64626807", "0.6446807", "0.64456993", "0.6444081", "0.6407107", "0.64027494", "0.63602793", "0.6313372", "0.63053244", "0.6301109", "0.6288971", "0.62882835", "0.62746", "0.6269902",...
0.69383925
1
Make robot pick up battery (if possible).
@Override public void pickUpBattery(Robot robot, Battery battery) { try { if(robot.canPickUp(battery)) { robot.pickUp(battery); } else { System.out.println("This battery could not be picked up by this robot."); } } catch(IllegalStateException exc) { System.out.println("Either this robot or this battery is terminated; the robot cannot pick up the battery."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int monitorBattery(PrintWriter pw) throws Exception {\n boolean enabled;\n checkPermission(\"change battery monitoring\");\n String opt = getNextArgRequired();\n if (\"on\".equals(opt)) {\n enabled = true;\n } else if (\"off\".equals(opt)) {\n enable...
[ "0.66185725", "0.6525374", "0.6427244", "0.6408734", "0.6388559", "0.6381295", "0.6343871", "0.631996", "0.6289794", "0.6273711", "0.62524796", "0.6244983", "0.6207337", "0.6121633", "0.6109793", "0.6083362", "0.6067685", "0.6057168", "0.6056948", "0.6017028", "0.6006475", ...
0.7286301
0
Make robot use battery (if possible).
@Override public void useBattery(Robot robot, Battery battery) { try { if(robot.canUse(battery)) { robot.use(battery); } else { System.out.println("This battery could not be used by this robot."); } } catch(IllegalStateException exc) { System.out.println("Either this robot or this battery is terminated; the robot cannot use the battery."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int monitorBattery(PrintWriter pw) throws Exception {\n boolean enabled;\n checkPermission(\"change battery monitoring\");\n String opt = getNextArgRequired();\n if (\"on\".equals(opt)) {\n enabled = true;\n } else if (\"off\".equals(opt)) {\n enable...
[ "0.6698333", "0.6679694", "0.6597823", "0.65677476", "0.6525692", "0.65211856", "0.6514249", "0.64825237", "0.64392424", "0.643855", "0.6409518", "0.6395725", "0.6309309", "0.6261828", "0.62355494", "0.61933494", "0.6185826", "0.6159555", "0.6145423", "0.61306983", "0.6104017...
0.70001185
0
Make robot drop battery (if possible).
@Override public void dropBattery(Robot robot, Battery battery) { try { if(robot.canDrop(battery)) { robot.drop(battery); } else { System.out.println("This battery could not be dropped by this robot."); } } catch(IllegalStateException exc) { System.out.println("Either this robot or this battery is terminated; the robot cannot drop the battery."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void brake() {\n\t\tsetPower(Motor.STOP);\r\n\t}", "public void liftArm(){armLifty.set(-drivePad.getThrottle());}", "public void brake(){\n if (speed <= 0){\n speed = 0;\n }\n else{\n speed -= 5;\n }\n }", "public void action() {\r\n\t\tsuppressed =...
[ "0.694587", "0.64018106", "0.63001573", "0.6264294", "0.6252969", "0.6226289", "0.62094676", "0.62034607", "0.6197995", "0.61897224", "0.61495405", "0.612817", "0.6115241", "0.610834", "0.60953015", "0.60925364", "0.6082595", "0.6080912", "0.604423", "0.60419416", "0.6022813"...
0.68359137
1
Make robot pick up repairKit (if possible).
@Override public void pickUpRepairKit(Robot robot, RepairKit repairKit) { try { if(robot.canPickUp(repairKit)) { robot.pickUp(repairKit); } else { System.out.println("This repair kit could not be picked up by this robot."); } } catch(IllegalStateException exc) { System.out.println("Either this robot or this repair kit is terminated; the robot cannot pick up the repair kit."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void useRepairKit(Robot robot, RepairKit repairKit)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif(robot.canUse(repairKit))\r\n\t\t\t{\r\n\t\t\t\trobot.use(repairKit);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"This repair kit could not be used by this robot.\");\r\n\t\t\t}\r...
[ "0.72299767", "0.59849244", "0.5831381", "0.5795758", "0.57433057", "0.5715285", "0.5552116", "0.54862815", "0.541523", "0.5399749", "0.538119", "0.53121716", "0.52974385", "0.5257424", "0.5232062", "0.5218225", "0.5206913", "0.5193749", "0.5187422", "0.5179717", "0.51729774"...
0.7684432
0
Make robot use repairKit (if possible).
@Override public void useRepairKit(Robot robot, RepairKit repairKit) { try { if(robot.canUse(repairKit)) { robot.use(repairKit); } else { System.out.println("This repair kit could not be used by this robot."); } } catch(IllegalStateException exc) { System.out.println("Either this robot or this repair kit is terminated; the robot cannot use the repair kit."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void pickUpRepairKit(Robot robot, RepairKit repairKit)\r\n\t{\t\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif(robot.canPickUp(repairKit))\r\n\t\t\t{\r\n\t\t\t\trobot.pickUp(repairKit);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"This repair kit could not be picked up by this robot.\...
[ "0.66592133", "0.5768771", "0.57654727", "0.57531136", "0.5587795", "0.5483957", "0.54819316", "0.54807174", "0.53475976", "0.5251415", "0.5197066", "0.51696026", "0.5147688", "0.5144684", "0.51359767", "0.51289296", "0.51192814", "0.5113134", "0.51036525", "0.510324", "0.509...
0.76275456
0
Make robot drop repairKit (if possible).
@Override public void dropRepairKit(Robot robot, RepairKit repairKit) { try { if(robot.canDrop(repairKit)) { robot.drop(repairKit); } else { System.out.println("This repair kit could not be dropped by this robot."); } } catch(IllegalStateException exc) { System.out.println("Either this robot or this repair kit is terminated; the robot cannot drop the repair kit."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void useRepairKit(Robot robot, RepairKit repairKit)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif(robot.canUse(repairKit))\r\n\t\t\t{\r\n\t\t\t\trobot.use(repairKit);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"This repair kit could not be used by this robot.\");\r\n\t\t\t}\r...
[ "0.65580666", "0.65445435", "0.5920476", "0.5643171", "0.5608907", "0.5532191", "0.55310994", "0.5524818", "0.55179584", "0.55160105", "0.54975724", "0.5477975", "0.5477174", "0.5467595", "0.5436681", "0.54218584", "0.5416671", "0.5413156", "0.5370084", "0.5335627", "0.533143...
0.68751895
0
Make robot pick up surpriseBox (if possible).
@Override public void pickUpSurpriseBox(Robot robot, SurpriseBox surpriseBox) { try { if(robot.canPickUp(surpriseBox)) { robot.pickUp(surpriseBox); } else { System.out.println("This surprise box could not be picked up by this robot."); } } catch(IllegalStateException exc) { System.out.println("Either this robot or this surprise box is terminated; the robot cannot pick up the surprise box."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void useSurpriseBox(Robot robot, SurpriseBox surpriseBox)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif(robot.canUse(surpriseBox))\r\n\t\t\t{\r\n\t\t\t\trobot.use(surpriseBox);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"This surprise box could not be used by this robot.\");\...
[ "0.71784484", "0.6201923", "0.6038483", "0.5962026", "0.5955142", "0.59022766", "0.58610594", "0.58125323", "0.57462525", "0.57384807", "0.57168263", "0.5630888", "0.5625025", "0.55953777", "0.5593662", "0.5576668", "0.55564636", "0.553259", "0.5531975", "0.55021715", "0.5477...
0.8148005
0
Make robot use surpriseBox (if possible).
@Override public void useSurpriseBox(Robot robot, SurpriseBox surpriseBox) { try { if(robot.canUse(surpriseBox)) { robot.use(surpriseBox); } else { System.out.println("This surprise box could not be used by this robot."); } } catch(IllegalStateException exc) { System.out.println("Either this robot or this surprise box is terminated; the robot cannot use the surprise box."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void pickUpSurpriseBox(Robot robot, SurpriseBox surpriseBox)\r\n\t{\t\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif(robot.canPickUp(surpriseBox))\r\n\t\t\t{\r\n\t\t\t\trobot.pickUp(surpriseBox);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"This surprise box could not be picked up by ...
[ "0.72289187", "0.6135169", "0.55470663", "0.54371583", "0.5405781", "0.51755446", "0.5126086", "0.51075065", "0.5075394", "0.50753117", "0.50653267", "0.50449646", "0.50338864", "0.5032266", "0.5028615", "0.49873325", "0.49863443", "0.4954113", "0.49532273", "0.49405965", "0....
0.790446
0
Make robot drop surpriseBox (if possible).
@Override public void dropSurpriseBox(Robot robot, SurpriseBox surpriseBox) { try { if(robot.canDrop(surpriseBox)) { robot.drop(surpriseBox); } else { System.out.println("This surprise box could not be dropped by this robot."); } } catch(IllegalStateException exc) { System.out.println("Either this robot or this surprise box is terminated; the robot cannot drop the surprise box."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void pickUpSurpriseBox(Robot robot, SurpriseBox surpriseBox)\r\n\t{\t\r\n\t\ttry\r\n\t\t{\r\n\t\t\tif(robot.canPickUp(surpriseBox))\r\n\t\t\t{\r\n\t\t\t\trobot.pickUp(surpriseBox);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tSystem.out.println(\"This surprise box could not be picked up by ...
[ "0.690517", "0.646985", "0.5927126", "0.58935034", "0.5832075", "0.5792542", "0.5692224", "0.561131", "0.56067634", "0.5603558", "0.55813634", "0.5574912", "0.55503374", "0.55320495", "0.5499696", "0.54479355", "0.54365903", "0.54357517", "0.54267824", "0.54116064", "0.539208...
0.71637625
0
Transfer all items possessed by from to to.
@Override public void transferItems(Robot from, Robot to) { from.transferItems(to); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void moveAllItems() {\n for (BaseObject object : getAllItems()) {\n object.move();\n }\n }", "void onItemMove(int fromPosition, int toPosition) {\n Collections.swap(mItems, fromPosition, toPosition);\n notifyItemMoved(fromPosition, toPosition);\n }", "private...
[ "0.6565013", "0.6348059", "0.6332833", "0.61840206", "0.6115049", "0.6098079", "0.60066426", "0.5881162", "0.58500975", "0.57457733", "0.5741868", "0.5730792", "0.5628945", "0.55974543", "0.5528438", "0.5512448", "0.5479607", "0.54459465", "0.53823984", "0.53535247", "0.53522...
0.80574137
0
Return whether your implementation of isMinimalCostToReach takes into account other robots, walls and turning (required to score 17+). The return value of this method determines the expected return value of isMinimalCostToReach in the test suite. This method must return either 0 or 1.
@Override public int isMinimalCostToReach17Plus() { return 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private boolean isEligibleForRealMin() {\n return eligibleForRealMin;\n }", "public double calculateCostInclusive() {\n\t\tdouble accumulatedCost = 0;\n\t\taccumulatedCost += calculateEuclideanDistance(host.grid.getLocation(host), solutionRepresentation.get(0));\n\t\taccumulatedCost += calculat...
[ "0.6981132", "0.6256184", "0.61798024", "0.59347486", "0.5904697", "0.58826363", "0.58263856", "0.5790191", "0.57562995", "0.5725721", "0.5724156", "0.5711183", "0.56946474", "0.56125486", "0.55935764", "0.5592624", "0.558843", "0.5587489", "0.5583571", "0.5569119", "0.556235...
0.7166121
0
Return the minimal amount of energy required for robot to reach (x, y) taking into account the robot's current load and energy level. Do not take into account shooting and picking up/using/dropping batteries. The expected return value of this method depends on isMinimalCostToReach17Plus: If isMinimalCostToReach17Plus returns 0, then getMinimalCostToReach will only be called if there are no obstacles in the rectangle covering robot and the given position. Moreover, the result of this method should not include the energy required for turning. If isMinimalCostToReach17Plus returns 1, then getMinimalCostToReach must take into account obstacles (i.e. walls, other robots) and the fact that turning consumes energy. This method must return 1 if the given position is not reachable given the current amount of energy. In any case, this method must return 1 if robot is not placed on a board.
@Override public double getMinimalCostToReach(Robot robot, long x, long y) { try { return robot.getEnergyRequiredToReach(new Position(x, y)); } catch(IllegalBoardException exc) { System.out.println("The given robot is not placed on a board.."); return -1; } catch(IllegalStateException exc) { System.out.println("The given robot is terminated."); return -1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double calculateCostInclusive() {\n\t\tdouble accumulatedCost = 0;\n\t\taccumulatedCost += calculateEuclideanDistance(host.grid.getLocation(host), solutionRepresentation.get(0));\n\t\taccumulatedCost += calculateCostExclusive();\n\t\t\n\t\treturn accumulatedCost;\n\t}", "@Override\r\n\tpublic int isMinima...
[ "0.61487", "0.5658287", "0.5365024", "0.5293348", "0.5230923", "0.51359314", "0.5068767", "0.5010543", "0.49997044", "0.49729985", "0.49341193", "0.49125254", "0.49124795", "0.48820412", "0.48260581", "0.4800379", "0.4782758", "0.47790277", "0.47779968", "0.47671694", "0.4767...
0.76724833
0
Return whether your implementation of moveNextTo takes into account other robots, walls and the fact that turning consumes energy (required to score 18+). The return value of this method determines the expected effect of moveNextTo in the test suite. This method must return either 0 or 1.
@Override public int isMoveNextTo18Plus() { return 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean canMove() {\n ArrayList<Location> valid = canMoveInit();\n if (valid == null || valid.isEmpty()) {\n return false;\n }\n ArrayList<Location> lastCross = crossLocation.peek();\n for (Location loc : valid) {\n Actor actor = (Actor) getGrid().get...
[ "0.68994445", "0.6864811", "0.67015386", "0.64668906", "0.641153", "0.641094", "0.6383532", "0.6367318", "0.6349534", "0.63448817", "0.6300175", "0.62864", "0.6284398", "0.62679386", "0.626621", "0.6217696", "0.6216244", "0.6207924", "0.62043524", "0.620391", "0.6192571", "...
0.0
-1
Move robot as close as possible (expressed as the manhattan distance) to other given their current energy and load. If multiple optimal (in distance) solutions exist, select the solution that requires the least amount of total energy. Both robots can move and turn to end up closer to each other. Do not take into account shooting and picking up/using/dropping batteries. The expected return value of this method depends on isMoveNextTo18Plus: If isMoveNextTo18Plus returns 0, then moveNextTo will only be called if there are no obstacles in the rectangle covering robot and other. Moreover, your implementation must be optimal only in the number of moves (i.e. ignore the fact that turning consumes energy). If isMoveNextTo18Plus returns 1, then moveNextTo must take into account obstacles (i.e. walls, other robots) and the fact that turning consumes energy. Do not change the state if robot and other are not located on the same board.
@Override public void moveNextTo(Robot robot, Robot other) { try { robot.moveNextTo(other); } catch(IllegalBoardException exc) { System.out.println("Both robots are not placed on the same board"); } catch(IllegalStateException exc) { System.out.println("One or both robots is either terminated or does not have a board."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void move(Maze here) {\n\n\t\tCoordinates target = here.getPlayer().find(); // where the player is\n\n\t\tArrayList<Coordinates> canMove = freeMoves(here); // the ways that aren't\n\t\t\t\t\t\t\t\t\t\t\t\t\t// blocked\n\n\t\tif (!canMove.isEmpty()) { // you can move\n\n\t\t\tCoordinates go = find(); // go i...
[ "0.6654058", "0.6209509", "0.6180211", "0.6016648", "0.5948397", "0.59146035", "0.588749", "0.5872363", "0.5870754", "0.58668345", "0.5847279", "0.58174366", "0.58158547", "0.5814269", "0.5789638", "0.57889235", "0.57823634", "0.5776004", "0.5769157", "0.5759278", "0.57535154...
0.62955785
1
Make robot shoot in the orientation it is currently facing (if possible). Students working on their own are allowed to throw UnsupportedOperationException.
@Override public void shoot(Robot robot) throws UnsupportedOperationException { try { if(robot.canShoot()) { robot.shoot(); } } catch(IllegalStateException exc) { System.out.println("A terminated robot cannot shoot."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n protected void execute() {\n headingPID.setSetpoint(-angle); //should be -angle \n Robot.driveBase.DriveAutonomous();\n }", "protected void execute() {\n\t//\tif (Math.abs(Robot.launcher.getDegrees()) < 5.5) {\n\t\t\tif (up)\n\t\t\t\tRobot.launcher.tiltDown();\n\t\t\telse\n\t\t\t\tRobot.launc...
[ "0.6795645", "0.6138678", "0.6082846", "0.6072228", "0.6054524", "0.60084975", "0.6008064", "0.596942", "0.5917883", "0.58792275", "0.5870422", "0.5843617", "0.582684", "0.5825516", "0.58162576", "0.58156896", "0.5809895", "0.5804949", "0.58028275", "0.5795888", "0.57791424",...
0.676752
1
Create a new wall. Students working on their own are allowed to throw UnsupportedOperationException.
@Override public Wall createWall() throws UnsupportedOperationException { return new Wall(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Square createWall() {Collect.Hit(\"BoardFactory.java\",\"createWall()\"); Collect.Hit(\"BoardFactory.java\",\"createWall()\", \"1976\");return new Wall(sprites.getWallSprite()) ; }", "WallType createWallType();", "private void createWalls(){\n\t \tfloat wallWidth = GameRenderer.BOARD_WIDTH ;\n\t \...
[ "0.72829753", "0.6855897", "0.6710254", "0.66748935", "0.66143215", "0.65283746", "0.65004736", "0.64859205", "0.63901716", "0.6058376", "0.60270727", "0.59224445", "0.57755774", "0.5770485", "0.57598513", "0.5727457", "0.5688981", "0.5640074", "0.5593567", "0.55870646", "0.5...
0.81822884
0
Put robot at position (x, y) on board (if possible). Students working on their own are allowed to throw UnsupportedOperationException.
@Override public void putWall(Board board, long x, long y, Wall wall) throws UnsupportedOperationException { try { wall.setPosition(new Position(x,y)); wall.setBoard(board); } catch(IllegalStateException exc) { System.out.println("Either this wall or this board is terminated; the wall cannot be placed on the board."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void putRobot(Board board, long x, long y, Robot robot)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\trobot.setPosition(new Position(x,y));\r\n\t\t\trobot.setBoard(board);\r\n\t\t}\r\n\t\tcatch(IllegalStateException exc)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"Either this robot or this board is terminat...
[ "0.76829004", "0.64633375", "0.63362956", "0.62788033", "0.6267895", "0.6224045", "0.6179415", "0.6107979", "0.6053112", "0.60327864", "0.60311943", "0.5997327", "0.5970898", "0.5868566", "0.58575785", "0.5852853", "0.58490163", "0.5827849", "0.58261156", "0.5787169", "0.5773...
0.61846644
6
Return the xcoordinate of wall. This method must throw IllegalStateException if wall is not placed on a board. Students working on their own are allowed to throw UnsupportedOperationException.
@Override public long getWallX(Wall wall) throws IllegalStateException, UnsupportedOperationException { if (wall.getBoard() != null) { return wall.getPosition().getCoordX(); } else throw new IllegalStateException(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic long getRobotX(Robot robot) throws IllegalStateException\r\n\t{\r\n\t\tif (robot.getBoard() != null)\r\n\t\t{\r\n\t\t\treturn robot.getPosition().getCoordX();\r\n\t\t}\r\n\t\telse throw new IllegalStateException();\r\n\t}", "public int getX() {\n if (this.coordinates == null)\n retu...
[ "0.6827657", "0.67032164", "0.6682258", "0.6682258", "0.6642982", "0.6640676", "0.66188824", "0.6599084", "0.657369", "0.6531217", "0.6529813", "0.6529813", "0.65204847", "0.65129364", "0.6512649", "0.6509771", "0.64999187", "0.64985466", "0.64973116", "0.6497107", "0.6493967...
0.8476345
0
Return the ycoordinate of wall. This method must throw IllegalStateException if wall is not placed on a board. Students working on their own are allowed to throw UnsupportedOperationException.
@Override public long getWallY(Wall wall) throws IllegalStateException, UnsupportedOperationException { if (wall.getBoard() != null) { return wall.getPosition().getCoordY(); } else throw new IllegalStateException(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getyCoordinate() {\n return yCoordinate;\n }", "public int getyCoordinate() {\n return yCoordinate;\n }", "public int getyCoord() {\r\n\t\treturn yCoord;\r\n\t}", "public int y() {\r\n\t\treturn yCoord;\r\n\t}", "public int getyCoord() {\n\t\treturn yCoord;\n\t}", "protecte...
[ "0.6860792", "0.6860792", "0.6775678", "0.6755849", "0.6733603", "0.6674291", "0.6669012", "0.6657757", "0.66574234", "0.66407835", "0.6626812", "0.66072", "0.65933144", "0.65892553", "0.6585618", "0.6568523", "0.65683615", "0.65377766", "0.6531468", "0.6525537", "0.6516853",...
0.8250519
0
Return a set containing all robots on board.
@Override public Set<Robot> getRobots(Board board) { return board.getElements(Robot.class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public List<Robot> getRobots();", "public List<Robot> getRobotsAlive() {\r\n\t\tList<Robot> listOfAlive = new ArrayList<Robot>();\r\n\r\n\t\tfor(int x = 0; x < 3; ++x) {\r\n\t\t\tif (robots.get(x).isAlive()) {\r\n\t\t\t\tlistOfAlive.add(robots.get(x));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn listOfAlive;\r\n\t}", ...
[ "0.6685336", "0.6407249", "0.6307097", "0.62511784", "0.61883074", "0.6057492", "0.6035451", "0.5968715", "0.59071773", "0.5842997", "0.5768713", "0.57181215", "0.5706729", "0.56836724", "0.5664434", "0.56387246", "0.5631908", "0.5618537", "0.5616972", "0.56026405", "0.558242...
0.78949624
0
Return a set containing all walls on board. Students working on their own are allowed to throw UnsupportedOperationException.
@Override public Set<Wall> getWalls(Board board) throws UnsupportedOperationException { return board.getElements(Wall.class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Set<Wall> getWallSet() {\n return walls;\n }", "Set<Point2D> getWallSet();", "public Wall[] getWalls() {\n/* 3438 */ if (this.walls != null) {\n/* 3439 */ return this.walls.<Wall>toArray(new Wall[this.walls.size()]);\n/* */ }\n/* 3441 */ return emptyWalls;\n/* */ ...
[ "0.75894403", "0.7473418", "0.6863052", "0.6814272", "0.66844994", "0.64969105", "0.64687437", "0.61087453", "0.6063062", "0.60295457", "0.6015561", "0.6015241", "0.60147977", "0.5954198", "0.5926347", "0.59080106", "0.5907566", "0.5894701", "0.58536816", "0.58522964", "0.582...
0.7914331
0
Return a set containing all repair kits on board.
@Override public Set<RepairKit> getRepairKits(Board board) { return board.getElements(RepairKit.class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tpublic Set<K> keySet() {\n\t\tArrayList<K> claves = new ArrayList<K>();\n\t\tIterator it = tabla.iterator();\n\t\tint i = 0;\n\t\twhile (it.hasNext()) {\n\t\t\tIterator it2 = tabla.get(i).keySet().iterator();\n\t\t\tit.next();\n\t\t\tint j = 0;\n\t\t\twhile (it2.hasNext()) {\n\t\t\t\tit2.next();\n\t\t...
[ "0.6031041", "0.6012228", "0.5986719", "0.58596677", "0.58406264", "0.5752585", "0.5737319", "0.5638938", "0.5627742", "0.55889505", "0.55802566", "0.5531974", "0.5525574", "0.541659", "0.5408353", "0.5407384", "0.5403974", "0.53826046", "0.5348405", "0.53451824", "0.5344235"...
0.7947716
0
Return a set containing all surprise boxes on board.
@Override public Set<SurpriseBox> getSurpriseBoxes(Board board) { return board.getElements(SurpriseBox.class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BoardSquare[] findSet() {\n ArrayList<BoardSquare> allCards = new ArrayList<>(12);\n\n // flatten BoardSquares into one-dimensional array\n for (int row = 0; row < board.numRows(); row++)\n for (int col = 0; col < board.numCols(); col++)\n allCards.add(board.ge...
[ "0.6382069", "0.61239845", "0.59751225", "0.5936398", "0.59188485", "0.5904096", "0.58798903", "0.5844808", "0.58331496", "0.5809781", "0.5787834", "0.57103693", "0.5678979", "0.56494516", "0.56314117", "0.56077373", "0.5600531", "0.5553062", "0.55485106", "0.553267", "0.5530...
0.80221176
0
Return a set containing all batteries on board.
@Override public Set<Battery> getBatteries(Board board) { return board.getElements(Battery.class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BoardSquare[] findSet() {\n ArrayList<BoardSquare> allCards = new ArrayList<>(12);\n\n // flatten BoardSquares into one-dimensional array\n for (int row = 0; row < board.numRows(); row++)\n for (int col = 0; col < board.numCols(); col++)\n allCards.add(board.ge...
[ "0.63879", "0.6312854", "0.6268853", "0.61445296", "0.61445296", "0.6091583", "0.6013415", "0.5991791", "0.5957425", "0.59498906", "0.5896974", "0.5826935", "0.5814884", "0.57881", "0.57737947", "0.57624954", "0.5761021", "0.5756671", "0.5741317", "0.5709523", "0.5708543", ...
0.694546
0
Load the program stored at path and assign it to robot. Return 0 if the operation completed successfully; otherwise, return a negative number.
@Override public int loadProgramFromFile(Robot robot, String path) { String inputProgram = null; java.io.FileReader fileReader = null; StringBuffer buffer = null; java.io.File file = new java.io.File(path); if(file.exists() && file.canRead()) { try { fileReader = new java.io.FileReader(file); buffer = new StringBuffer(); int len; char[] chr = new char[4096]; // if the read()-method returns -1 the end of the string is reached while ((len = fileReader.read(chr)) > 0) { buffer.append(chr, 0, len); } } catch (IOException e) { } finally { try { fileReader.close(); } catch (IOException e) { } } inputProgram = buffer.toString(); } if(inputProgram == null) { return -1; } try { robot.setProgram(inputProgram); } catch(IllegalSyntaxException exc) { return -1; } if(robot.getProgram() == Parser.parse(0, robot, inputProgram)) { return -1; } return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic int saveProgramToFile(Robot robot, String path)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t\t\tBufferedWriter out = new BufferedWriter(new java.io.FileWriter(new java.io.File(path)));\r\n\t\t\tout.write(robot.getProgram().toString());\r\n\t\t\tout.close();\r\n\t\t} \r\n\t\tcatch (IOException e) \r\n\t\t...
[ "0.5833819", "0.5697843", "0.54658896", "0.53781426", "0.52181375", "0.5072247", "0.50038403", "0.499152", "0.49894318", "0.49841142", "0.49656436", "0.4961583", "0.49592385", "0.4875321", "0.4873352", "0.48656183", "0.48647943", "0.48587665", "0.48443526", "0.48369068", "0.4...
0.7617722
0
Save the program of robot in a file at path. Return 0 if the operation completed successfully; otherwise, return a negative number.
@Override public int saveProgramToFile(Robot robot, String path) { try { BufferedWriter out = new BufferedWriter(new java.io.FileWriter(new java.io.File(path))); out.write(robot.getProgram().toString()); out.close(); } catch (IOException e) { System.out.println("The operation failed."); return -1; } return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void save() throws FileNotFoundException, IOException, ClassNotFoundException ;", "public void saveGame(File fileLocation);", "public void saveFile() {\n\t\tPrintWriter output = null;\n\t\ttry {\n\t\t\toutput = new PrintWriter(\"/Users/katejeon/Documents/Spring_2020/CPSC_35339/avengers_project/game_resu...
[ "0.6129017", "0.60436314", "0.59248626", "0.5833849", "0.58283156", "0.58089364", "0.57721525", "0.57600737", "0.5740215", "0.5725687", "0.5671113", "0.56668633", "0.5663856", "0.565493", "0.56306404", "0.5622423", "0.56121236", "0.56083775", "0.560311", "0.5576379", "0.55623...
0.8579439
0
Pretty print the program of robot via writer.
@Override public void prettyPrintProgram(Robot robot, Writer writer) { if(robot.getProgram() == null) { System.out.println("This robot does not yet contain a program in its memory."); } else { try { writer.append(robot.getProgram().toString()); } catch (IOException e) { } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void printIndications() {\n\t\tSystem.out.println(\"\\n\" + \"Usage :\"\n\t\t\t\t+ \"\\n\\t\" + \"java -jar <jar-file> nodeScopeDirectoryPath windowSize\"\n\t\t\t\t+ \"\\n\\t\\t\" + \"nodeScopeDirectoryPath is the path of the directory where the tagged corpus is located\"\n\t\t\t\t+ \"\\n\\t\\t\" + \...
[ "0.6230043", "0.61794174", "0.60264605", "0.5896689", "0.58197993", "0.57704794", "0.57285815", "0.57258695", "0.5687703", "0.56849414", "0.56774616", "0.56743264", "0.5649417", "0.56473243", "0.56374353", "0.5614053", "0.5601801", "0.55833244", "0.5580257", "0.55745447", "0....
0.80803144
0
Execute n basic steps in the program of robot. For example, consider the program (seq (move) (shoot)). The first step performs a move command, the second step performs a shoot command and all subsequent steps have no effect. Note that if n equals 1, then only the move command is executed. The next call to stepn then starts with the shoot command.
@Override public void stepn(Robot robot, int n) { robot.runProgramStep(n); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void step(int nSteps) {\n \tif(simState != State.RUNNING) {\n \t\tSystem.err.println(\"ERROR: Can't step a simulation that is not\" +\n \" runnig!\");\n \t\treturn;\n \t}\n \t\n \tfor(int i = 0; i < nSteps; ++i) step();\n }", "public void redoUndoneComman...
[ "0.6449712", "0.58983773", "0.5816195", "0.57804894", "0.5658462", "0.5609459", "0.5425236", "0.5375769", "0.53358996", "0.529257", "0.529257", "0.5292459", "0.52820677", "0.52743214", "0.52676123", "0.526392", "0.5206441", "0.51616925", "0.51472825", "0.50867814", "0.5084399...
0.7691127
0
TODO Autogenerated method stub
public static void main(String[] args) { SessionFactory factory = UtilesHibernate.getSessionfactory(); Session sesion = factory.getCurrentSession(); sesion.beginTransaction(); Cancion cancion = sesion.get(Cancion.class,1); Club club = sesion.get(Club.class,1); System.out.println(club.getNombre()); sesion.getTransaction().commit(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1
TODO Autogenerated method stub
@Override public int getCount() { return listInfo.size(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1
TODO Autogenerated method stub
@Override public Object getItem(int index) { return listInfo.get(index); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1
TODO Autogenerated method stub
@Override public long getItemId(int index) { return index; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1
TODO Autogenerated method stub
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; final ScorePointsItemInfo itemInfo = listInfo.get(position); if(convertView == null || convertView.getTag() == null){ convertView = inflater.inflate(R.layout.list_item_score_potions,null); holder = new ViewHolder(); holder.numView = (TextView)convertView.findViewById(R.id.qt_question_num); convertView.setTag(holder); }else{ holder = (ViewHolder)convertView.getTag(); } holder.numView.setText(itemInfo.score); holder.numView.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { // TODO Auto-generated method stub // TODO Auto-generated method stub itemClickListener.Callback(itemInfo); } }); return convertView; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1