method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
eb6a42ab-bff9-4431-9523-e081a982e809
1
public void mergeBreakedStack(VariableStack stack) { if (breakedStack != null) breakedStack.merge(stack); else breakedStack = stack; }
0ffcf52c-db26-4490-988f-3ede3c0108c4
0
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { eventName = new javax.swing.JLabel(); eventStreet = new javax.swing.JLabel(); whereLabel = new javax.swing.JLabel(); eventDesc...
52c31cc3-76ac-4aea-a56d-87aa6b6a4817
0
public void makePaths() throws IOException { PathLoader loader = new PathLoader(); path = new SVGPath(); path2 = new SVGPath(); path3 = new SVGPath(); path4 = new SVGPath(); path5 = new SVGPath(); path.setContent(loader.getPath(1)); path2.setContent(loader.getPath(2)); path3.setContent(loader.getPat...
482f508b-3b98-421a-84f5-5b225bcb128f
9
public static void addUnitIntoReferential(Unite unite) { if (unite == null || unite.getGrandeur() == null || unite.getNom() == null || unite.getRatio() == null) { throw new IllegalArgumentException("Problème dans l'unitée passée en paramètre !"); } boolean premiereUnite = false; ...
b269016d-b4f9-4287-ab54-fc1c4e2d1d94
0
public String getLieu() { return lieu; }
7184d30c-de59-4227-bd1e-f743d43a53df
1
public static boolean saveLocal(File file) { try { PrintStream out = new PrintStream(file); out.println(userName); out.println(coins); out.println(playtime); out.println(new BigInteger(lck_lvl)); out.println(new BigInteger(lck_bg)); out.println(new BigInteger(lck_chr)); out.println(new BigInte...
5eb840aa-c41a-423b-b6cf-94f405136157
0
public Abstraction(Implementor implementor) { this.implementor = implementor; }
93371be5-c0b4-4655-9405-499ffa44e646
8
public void insert(Comparable in){ if(smallest == null || in.compareTo(smallest) < 0) { smallest = in; } // Create new node with in as content RBNode insertedNode = createNode(in); if (root == null) { insertedNode.color = NodeColor.RED; ...
1d7c070b-1527-4fc8-85af-c35d171013fe
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
2a81b295-6c2f-4176-8a1f-c3620e004cd5
1
private void setGlobalConnection() { for (int i = 0; i < this.connection.length; i++) { int upI = i + 1; this.scene[i] = this.setCurrentConnection(upI); } }
1b4cf95f-e641-4529-8584-8f6a197be264
2
public int readUnsignedInt() { if(inf) { if(sc.hasNextInt()) return sc.nextInt(); else return -1; } else { ExceptionLog.println("Попытка записи в неоткрытый файл"); return -1; } }
f067ec7a-ae7a-4476-bbbb-000bc3400113
1
private void loadUsers(){ User[] alstUsers = dbCon.loadUsers(channel); if(alstUsers != null){ Arrays.sort(alstUsers); jlstUsers.setListData(alstUsers); } }
74e23dc6-3f5c-4fca-a012-5de8168e0dd2
7
public void load(Sheet sheet) { LinkedList<String> lines = new LinkedList<String>(); try { while (ready()) { lines.add(readLine()); } LinkedList<String> sorted = new LinkedList<String>(); for (String s : lines) { boolean isR...
015d3b84-46a3-40a0-9cf8-b8a13800e1ac
4
public void goSpeed(){ if(hspeed!=0){ if(collideCheck(hspeed,0)!=0){ moveHorizontal(hspeed); } } if(vspeed!=0){ if(collideCheck(0,vspeed)!=0){ moveVertical(vspeed); } } }
06aa1831-c270-4686-9574-5df0cb838fb4
7
public char getConsensusBase(int site, boolean useAmbiguities) { double[] freqs = getColumnBaseFreqs(site); char[] bases = {'A', 'C', 'T', 'G'}; for(int i=0; i<freqs.length; i++) { //Sort by frequency, but sort bases at the same time for(int j=i; j<freqs.length; j++) { if (freqs[i]<freqs[j]) { double ...
74673d28-ce25-4d54-a9c9-008311932f49
9
private String checkForAbbreviation(String bookToCompare) { System.out.println("CHECKING: " + bookToCompare); if (bookToCompare.contains(" of ")) { if (!bookToCompare.equals("Song of Solomon")) { String[] splitter= bookToCompare.split(" "); bookToCom...
4dec9512-2de7-4c0f-9a18-f6b82f90ac80
2
@Override public boolean halt() { if(gBest >= solution - error && gBest <= solution + error){ return true; }else{ return false; } }
b8a67518-0fb1-4aa3-96d2-81f8d49f172b
1
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { writer.print(getOperatorString()); if ((Options.outputStyle & Options.GNU_SPACING) != 0) writer.print(" "); subExpressions[0].dumpExpression(writer, 700); }
551ffea2-3c2e-46c5-8082-228d6c7c1ca3
2
public static void test(Robot r) { if (r instanceof Null) System.out.println("[Null Robot]"); System.out.println("Robot name: " + r.name()); System.out.println("Robot model: " + r.model()); for (Operation operation : r.operations()) { System.out.println(operation.description()); operation.comman...
3434060b-95fa-4531-bcab-6048d41937e7
0
public void setSignatureValue(SignatureValueType value) { this.signatureValue = value; }
0b1ea09f-4138-4b4e-8059-f987340e535f
5
@Override public OccurrenceAllocation select(SolverState schedule, Occurrence forOccurrence) { if (schedule.constraintsCost() < smallestConflict) { smallestConflict = schedule.constraintsCost(); } // until we are lowering conflict value, store last iteration to ...
22c5df4e-e5e2-4558-b677-63692f88e209
2
public static employeeTypes intToEmployeeType(int type) { for (employeeTypes tmpType : employeeTypes.values()) { if (tmpType.ordinal() == type) { return tmpType; } } return employeeTypes.CLERK; }
aea3ffe6-3721-4392-ab50-2b7b70e62663
0
@Test(expected=IllegalStateException.class) public void testIllegalCallOfThreshold() { CircleAccumulator test = new CircleAccumulator(new boolean[][]{{true}}, 0, 1); test.threshold(1); }
82552157-8361-40ac-95c0-2ee716360146
4
public static void move(Point p, int i){ switch (i) { case 0: //up p.y++; break; case 1: //down p.y--; break; case 2: //right p.x++; break; case 3: //left p.x--; break; default: break; } }
8a9d40ea-557a-4f0c-a6e5-54c8687bae97
6
public int minDepth(TreeNode root) { if (root == null) return 0; Queue<TreeNode> nodeq = new LinkedList<TreeNode>(); Queue<Integer> deepq = new LinkedList<Integer>(); nodeq.add(root); deepq.add(1); while (true) { TreeNode node = nodeq.poll(); int...
006077f4-b661-4ffe-8915-147957174251
9
public void Color(InterferenceGraph graph) { // Retrieve random node with fewer than NUM_REGISTERS neighbors int x = ig.getVertexWithMaxDegree(NUM_REGISTERS); if (x == -1) { x = ig.getSmallestCost(); } // Remove the vertex and recover its neighbors regSet.add(x); ArrayList<Integer> neighbors = ig.r...
e8b4b220-8ade-4f41-895e-0ce07c2ea0c5
8
public void processEvent(Event event) { System.out.println("login client's processEvent"); if (event.getType() == Event.COMPLETION_EVENT) { System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle()); return; } System.out.pr...
bf2825dd-c5f7-4adc-94f1-94a50f70b960
9
private void incrementHour() { hour += 1; server.onHourIncrement(); if (hour > 23) { hour = 0; incrementDay(); } // TODO deal with redundancy, set time of day sends a regular server messages, but then we send a debug version.. if (this.hour == 0) { setTimeOfDay(TimeOfDay.MIDNIGHT, new Message("I...
4f820871-8832-41f1-9911-64c95330dac7
4
@Override protected void clearDiscardPile(TurnContext state) { super.clearDiscardPile(state); System.out.print("The discard pile has been cleared. "); if (state.selection == null && state.g.canDraw() && state.currentPlayable.isEmpty()) { System.out.println("Since cards can be drawn, you must draw and you cann...
a00c774c-5ab6-40d9-862d-d98e85efdf20
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the ...
ab5c4f00-eca9-4a10-aab2-a93f82c659c6
1
private Vector solve(Node node) { Vector solution = new Vector(); solution.addElement(node); while (node.parent != null) { solution.insertElementAt(node.parent, 0); node = node.parent; } return solution; }
90572e6e-31c5-4c36-81fa-5f4112cc4532
9
public void load(String[] filenames) { String line, stroke, english; String[] fields; boolean simple= (filenames.length<=1); TST<String> forwardLookup = new TST<String>(); for (String filename : filenames) { if (validateFilename(filename)) { try { ...
21c7c8fc-b332-4561-aa09-dc6af351a751
1
public String toString() { return this.mode == 'd' ? this.writer.toString() : null; }
7fb90ded-44f0-4946-9d3b-80a5bacdf3de
7
private void addLog(Cell cell, int flag) { DataFormatter formatter = new DataFormatter(); switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: { if (flag == OK_PRINT) { //System.out.print(formatter.formatCellValue(cell) + "\t"); ...
f72dd607-7603-4dc2-9bca-1378255919a8
5
private void blockCellThatPlayerWillNotBeWinnerInTheNextStep (Square square, Human human) { Mark mark = new Mark(human.getMark()); for (char i=FIRST_LEFT_COORD; i<FIRST_LEFT_COORD + STRINGS_MATRIX_COUNT; i++) { for (char j=FIRST_TOP_COORD; j<FIRST_TOP_COORD + STRINGS_MATRIX_COUNT; j++) { ...
1c3e19c4-d770-493c-b0fc-9c637bab4c79
1
public void listarDepartamentos() { DepartamentoDAO departamento = new DepartamentoDAO(); try { tblDepartamentos.setModel(DbUtils.resultSetToTableModel(departamento.PreencheTabelaDepartamentos())); } catch (SQLException ex) { } }
303fd356-1a3f-425e-9192-392a97ca8e33
2
public static void renderQuad(Texture texture, Colour colour, float x, float y, float width, float height){ glEnable(GL_TEXTURE_2D); if(texture != null) texture.bind(); if(colour != null) colour.bind(); glBegin(GL_TRIANGLES); { glTexCoord2f(0, 0); glVertex2f(x, y); glTexCoord2f(1, 0); glVertex...
a1b2e29e-9404-4da9-a13b-ac1b8c3242b2
8
public void addAccount(){ boolean agregada = false; if(!activo.validateTipo(Usuario.LIMITADO)){ System.out.print("Ingrese el Nombre del Cliente: "); String nombre = scan.next(); int num; do{ do{ System.out.print("Ingrese num...
9fdbc208-d9c2-45ca-9456-4bc202dd8f6a
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
70dc8be4-7e14-4415-8a05-584c7bf2863b
4
boolean tryMethod(Object o,String name,Object [] args) { try { Method met=getMethod(o.getClass(),name,args); if (met==null) return false; met.invoke(o,args); } catch (InvocationTargetException ex) { Throwable ex_t = ex.getTargetException(); if (ex_t instanceof JGameError) { eng.exitEngine(eng.dbg...
96a31962-5b30-4839-b34c-7689a3feecf5
2
public Metrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.load...
73a05fdb-b200-40fd-8f2e-f948b1b03af9
9
private void stateAltDraw(int x,int y){ if(!sedna.getSelected() ||sedna.getSelection(x,y)){ if(statefillflag){ switch(sft){ case 0: mainBrain.setCellState(x,y,0);viewer.setAState(x,y,0); break; case 1: mainBrain.getCell(x, y).setOption(toolstring[1], false); break; cas...
f95fe5b9-5562-4e4d-a159-ed48fd5939be
9
private void processLine(RdpPacket_Localised data, LineOrder line, int present, boolean delta) { if ((present & 0x01) != 0) line.setMixmode(data.getLittleEndian16()); if ((present & 0x02) != 0) line.setStartX(setCoordinate(data, line.getStartX(), delta)); if ((present & 0x04) != 0) line.setStartY(setC...
a14d43be-bfc6-4137-8f21-0a5b96fd8b21
0
@Override public String toString() { return value; }
73a7dc71-d913-451b-aae3-e6350c91fde7
4
public List<SingleCounter> extractKeyNouns (Documents docs, int n) { Counter c = new Counter(); for (Document d : docs.documents) { for (Sentence s : d.sentences) { Phrases p = s.phrases; for (int idx = 0; idx < p.size(); idx++) { for (String term : p.getNouns(idx)) { ...
33cde9fc-78d7-4005-970f-baf5e23d490e
8
private void updateStopMarkers() { currentGTFSStopsMarker = new HashSet<Stop>(); currentOSMStopsMarker = new HashSet<Stop>(); if (currentGTFSStops.size() == 0 || currentOSMStops.size() == 0){ return; }else{ for (Stop s:currentGTFSStops) if (currentOSMStops.contains(s) && currentGTFSStops.indexOf(s) >=...
cf66ef4b-8cf5-48bb-aafb-fe0f247a52e0
8
public final void add( final int key, final T value){ if ( size == 0 ){ if (keys.length >0){ keys[0] = key; values[0] = value; } else{ keys = new int[]{key}; values = new Object[]{value}; } size = 1; return; } // Find index where to put it: final int index = closestIndex(key); i...
dc6b2906-3d38-4d1d-95d4-cf57407b0236
5
public String buscarClientePorTelefono(String telefono){ //##########################CARGA_BASE DE DATOS############# tablaDeClientes(); //##########################INGRESO_VACIO################### if(telefono.equals("")){ telefono = "No busque nada"; ret...
fd548190-6337-4fc7-83c8-fe83defa4256
6
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed try { /* * Validity check */ if (!valid()) { return; } DateFormatter df = new DateFormatter(new SimpleDateForma...
c958e275-2265-46f3-bd6d-0dc59ea08b99
9
private void addDataS(int nGaussians) { if (atomCoordBohr[atomIndex] == null) { moCoeff++; return; } if (doDebug) dumpInfo(nGaussians, "S "); int moCoeff0 = moCoeff; // all gaussians of a set use the same MO coefficient // so we just reset each time, then move on setMinMax...
9265a062-58af-4ada-b34e-b6ab0774dcf6
2
public LinkedList<Student> getAllStudent() { LinkedList<Student> ans = new LinkedList<Student>(); String select = "SELECT * FROM STUDENT"; try { ResultSet rs = stat.executeQuery(select); Student t; // ȡǰ Calendar now = Calendar.getInstance(); now.setTime(new java.util.Date()); final int year =...
b3b83d16-d940-4b01-8345-db2a36e5b725
2
private void logIfEnabled(String content) { if (!isChatLoggingEnabled) return; if (chatLogger == null) chatLogger = new FileLogger( getServerTab().getTabName(), getTabName() ); chatLogger.log(content); }
5eebe119-0610-4e19-9cb8-ee172cee5154
3
public void setLastArg(int argsToSkip_) { //Set the args to skip = to the args to skip plus previous arguments. int argsToSkip = argsToSkip_; //Form the final argument for (int i = argsToSkip; i < args.length; i++) { if (!args[i].equals("")) { if (i != argsToSkip) finalArgument += " " + arg...
69833a68-7d69-4081-a483-187c80f13cb6
8
final public void Class_body() throws ParseException { /*@bgen(jjtree) Class_body */ SimpleNode jjtn000 = new SimpleNode(JJTCLASS_BODY); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { Class_variable_declarations(); Class_fun...
4b310bbd-8baf-46cd-a666-89f90c0779ae
3
@Override public List<Integer> getHops(Integer start, Integer target) { NodePair pair = NodePair.get(getNode(start), getNode(target)); if(!distances.containsKey(pair) || distances.get(pair).isNonterminating()) return null; List<Integer> hops = new ArrayList<Integer>(); Integer current = start;...
2a9b07bc-6c43-4855-ad3c-aede39d23b69
7
public void run(){ while(true){ try { sleep(60000); } catch (InterruptedException e) { e.printStackTrace(); } GregorianCalendar fecha = new GregorianCalendar(); fecha.get(Calendar.DAY_OF_WEEK); for (int i = 0; i < rutinas.length; i++) for (int j = 0; j < 7; j++) if (rutinas[i].getDi...
cd9d9af7-6e53-4df8-9f7f-d9a906e2f0a1
8
public void connect1(TreeLinkNode root) { if (root == null) return; Queue<TreeLinkNode> curLev = new LinkedList<TreeLinkNode>(); curLev.add(root); while (!curLev.isEmpty()) { Queue<TreeLinkNode> nextLev = new LinkedList<TreeLinkNode>(); while (!curLev.isEmpty()) { TreeLinkNode cur = curLev.poll(); ...
b765395b-7baa-468a-9a0f-bbbebac260e0
8
public static Vector2d valueOf(String arg) { Vector2d result = null; boolean goFlag = true; String tmp = ""; String strX = ""; String strY = ""; Scanner s1 = new Scanner(arg); if (goFlag) { tmp = s1.findInLine("\\s*\\(\\s*"); goFlag = (tmp != null); } if (goFlag) { strX = s1.findInLine(MdM...
73d95594-40b6-435f-8360-8c91604e9115
0
public int hashCode() { return 13 * description.hashCode() + 17 * partNumber; }
6e251918-7533-450b-b826-e00cd98ed406
3
public static List<String> keysForBounds(CSProperties csp, int boundCount) { List<String> l = new ArrayList<String>(); for (String key : csp.keySet()) { if (csp.getInfo(key).keySet().contains("bound")) { String bound = csp.getInfo(key).get("bound"); StringToke...
d38615c2-ca97-40a0-87e5-96b152e9fbe3
8
private int decodePacket(Packet packet) { // check the endianes of the computer. final boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN; if (block.synthesis(packet) == 0) { // test for success! dspState.synthesis_blockin(block); } // **pcm is a multichannel float vector. In ster...
098c1233-11ec-41ff-ae29-57e1cfe33105
0
@Test public void runTestListAccess1() throws IOException { InfoflowResults res = analyzeAPKFile("ArraysAndLists_ListAccess1.apk"); Assert.assertEquals(0, res.size()); }
58a73bd6-b660-4d97-8727-8d334dcbccb9
6
public void render(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.black); g2.setStroke(new BasicStroke(1F)); int width = 20; for (int i = 0; i < this.board.getWidth(); i++) { // Draw horizontal lines g2.drawLine(0, width ...
a362c9d1-4e48-4392-8de1-833fc49e5dc9
9
public int uniquePathsWithObstacles(int[][] obstacleGrid) { int rows = obstacleGrid.length; if (rows == 0) { return 0; } int cols = obstacleGrid[0].length; if (cols == 0) { return 0; } if (obstacleGrid[0][0] == 1) { return 0; ...
72451676-1d1c-403c-a5cb-1011434b94cd
4
public void run() { while (true) { try { String message = messages.take(); Iterator<Socket> iter = sockets.iterator(); while (iter.hasNext()) { Socket socket = iter.next(); try { OutputStream out = socket.getOutputStream(); PrintWriter writer = new PrintWriter(out...
7e6215ab-bfdf-4905-b8ea-765c8c2511fb
7
private int miniMax(Board board, char mark, int depth, int color, boolean max, int alpha, int beta) { char oppMark = getOppMark(mark); gameLogic = new BoardLogic(board); if(gameLogic.isOver() || depth == 7) return getGameScore(board, depth, mark) * color; else if(max) { Arra...
d7638811-7ce2-4eb9-9c11-c643dbc0a96d
5
public String toString() { String theWholeDamnBoard = "";// temporary initialization. Hopefully I // remember to delete that one part of // it. // this is gonna be a reeeally long string. /* * The toString method's going to get called a lot. I'm thinking about a * few ways to...
aa5e069a-bb54-4ce1-8ecc-8df9b6c895c4
7
@EventHandler public void GhastFireResistance(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Ghast.Fi...
8c0d3f75-345e-4268-9c11-5582b5c87ba5
6
public static void main(String args[]) { /* * Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* * If Nimbus (introduced in Java SE 6) is not available, stay with the * default look and fe...
f3219334-8aff-4c0c-9952-2243ceb359a0
5
@Override public void serverMessageReceived(int code, String message) { if (code > 400 && code < 500) { message = message.split(" ", 2)[1]; appendError(message); final int ERR_NOMOTD = 422; AbstractTab tab = InputHandler.getActiveTab(); if ( code ...
572aacd6-bc1f-4bc3-a76c-ee57412b12f6
4
public void setLocale(Object loc) throws JspTagException { if (loc == null || (loc instanceof String && ((String) loc).length() == 0)) { this.locale = null; } else if (loc instanceof Locale) { this.locale = (Locale) loc; } else { locale = Util....
76360482-fc71-4bcd-bedf-5be1e9ace7c5
7
public QueryResultTable executeQueryForResult() throws DataBaseException { // result object QueryResultTable queryResult = new QueryResultTable(); // 2D arraylist for result table ArrayList<ArrayList<String>> resultTable = new ArrayList<ArrayList<String>>(); // hashmap for header details LinkedHashMap<Stri...
0d6a29c6-46f6-4196-aa17-d9b02bf05400
1
public static void printQ(Queue queue) { while (queue.peek() != null) System.out.print(queue.remove() + " "); System.out.println(); }
a709513f-6041-4c39-a97a-1c68739b6593
3
public static List<Id> getUniqueIds(List<Id> ids) { Id[] idsArray = ids.toArray(new Id[ids.size()]); Arrays.sort(idsArray); List<Id> uniqueList = new ArrayList<Id>(); for (Id id : idsArray) { if (uniqueList.isEmpty() || (!id.equals(uniqueList.get(uniqueList.size() - 1)))) { uniqueList.ad...
482355d8-a205-46c2-a8a8-edef8b4950e7
4
public int getReplicaLocation(String lfn) { if (lfn == null) { return -1; } int resourceID = -1; int eventTag = DataGridTags.CTLG_GET_REPLICA; // set tag name // consult with the RC first int rcID = getReplicaCatalogueID(); if (rcID == -1) { ...
09529899-d39a-4bfb-85ec-3ecb54019a2d
2
public CatalogHandler() throws SQLException { Pages = new HashMap<Integer, CatalogPage>(); Grizzly.GrabDatabase().SetQuery("SELECT * FROM server_store_pages"); ResultSet CatalogPages = Grizzly.GrabDatabase().GrabTable(); while(CatalogPages.next()) { Pages.put(new Integer(CatalogPages.getInt("id")...
b6a85183-0def-4117-ab35-4fa2eca4ab65
7
public boolean equals(Object object) { if (!(object instanceof NBTBase)) { return false; } else { NBTBase nbtbase = (NBTBase) object; return this.getTypeId() != nbtbase.getTypeId() ? false : ((this.name != null || nbtbase.name == null) && (this.name == null || nbtbas...
322ce807-4768-4200-a84b-b7a68e8b05a4
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RunAutomaton other = (RunAutomaton) obj; if (initial != other.initial) return false; if (maxInterval != other.maxInterval) return false; ...
247e0377-2517-43c0-a162-df6bc889dbfe
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
a364da26-4b1f-4698-afff-17ec5981b4ad
7
@Override public Object plugin(Object target) { if (reusePreparedStatements && target instanceof BatchExecutor) { target = replaceBatchExecutor((BatchExecutor) target); } if (reusePreparedStatements && target instanceof CachingExecutor) { try { Object ...
32c49197-673a-4b26-8130-49e913c93300
2
public final void setTotalHrsForYear(double totalHrsForYear) { if(totalHrsForYear < 0 || totalHrsForYear > 5000) { throw new IllegalArgumentException(); } this.totalHrsForYear = totalHrsForYear; }
0a57c18e-ae36-4c25-93df-98dd06481472
9
public Move move(boolean[] foodpresent, int[] neighbors, int foodleft, int energyleft) throws Exception { Move m = null; // placeholder for return value // this player selects randomly int direction = rand.nextInt(6); switch (direction) { case 0: m = new Move(STAYPUT); break; case 1: m = new Move(WES...
3c5f1118-2d40-43d1-ba13-65f83653bed9
0
public String getSeatNumber() { return this._seatNumber; }
d04ba654-f047-41a4-ba47-c659978e87e7
8
private int getDirectionID(Direction d) { switch(d) { case NORTH: return 0; case SOUTH: return 1; case EAST: return 2; case WEST: return 3; case NORTHEAST: return 4; case NORTHWEST: return 5; case SOUTHEAST: return 6; case SOUTHWEST: return 7; } return 0; }
cb3d55c6-4792-47f3-aca8-f842f26b1f3f
6
public static InetAddress parseIpAddress(String ip) throws IllegalArgumentException { StringTokenizer tok = new StringTokenizer(ip, "."); if (tok.countTokens() != 4) { throw new IllegalArgumentException("IP address must be in the format 'xxx.xxx.xxx.xxx'"); } byte[] data = new byte[4]; int i = 0; while...
8a4500f7-8b18-4759-90bd-418a9c2966f8
1
@Override protected void render() throws Exception { glClearColor(0f, 0f, 0f, 1f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (this.currentScene != null) this.currentScene.render(); }
9523c9b3-1a6d-4d45-b7c3-631043c74529
7
public static void main(String[] args) { Scanner scan = new Scanner(System.in); /* Creating object of AVLTree */ AVLTree avlt = new AVLTree(); System.out.println("AVLTree Tree Test\n"); char ch; /* Perform tree operations */ do ...
31dc5652-5429-4b38-99a9-ed71ed305f5c
8
protected void act() { if(state == -1) { doBehavior(new WaitMoveBehavior()); } else if(state == 0) { // On cherche a savoir si on es bien sur une ligne. if(Robot.getInstance().getEyes().onNoise()) { stop("I am not along a line !!"); } else { Robot.getInstance().getMotion().getPilot().arcFor...
3c41d17d-9a09-46b8-9283-c7cab29011d1
5
public void heapDecKey(Vortex vortex, int dayDistance, double dayTravelDistance) { if (vortex.getDayDistance() < dayDistance) { return; } if (vortex.getDayDistance() == dayDistance && vortex.getDayTravelDistance() < dayTravelDistance) { return; } int i = 1; for (i=1; i<=length; i++) { //right upper...
05ced9c2-81db-40c9-827d-0d8f97d52fdf
9
public void makeSegmentation(String type) { String request = ""; if(type.equals(SIMPLY_SEGM)) request = "Enter simply segments count"; else if(type.equals(ROUND_N_TIMES)) request = "Enter rounding count"; else if(type.equals(ROUND_TO_N_SEGM)) request =...
60aa01af-f0dc-4f94-b8af-04d88937aff7
0
public FlatternerIterator(final T ancestor, final Selector<T, Iterable<T>> selector) { this._ancestor = ancestor; this._selector = selector; }
e41539d1-a190-41bb-911f-ed7fc7d9e350
2
private int attaque(Soldat soldat){ int maxDegats = 0; /* Combat au CaC */ if (distance(soldat) == 1){ maxDegats = this.puissance; } /* Combat à distance */ else if (distance(soldat) <= portee) maxDegats = this.tir; /* L'ennemi est hors de ...
52a74220-8dbf-4060-b5f2-3f4905fb348e
9
public double[] distributionForInstance(BayesNet bayesNet, Instance instance) throws Exception { Instances instances = bayesNet.m_Instances; int nNumClasses = instances.numClasses(); double[] fProbs = new double[nNumClasses]; for (int iClass = 0; iClass < nNumClasses; iClass++) { ...
216c7b31-fa44-4ce5-af09-0d408dd12d76
1
public static String getConstructorDescriptor(final Constructor c) { Class[] parameters = c.getParameterTypes(); StringBuffer buf = new StringBuffer(); buf.append('('); for (int i = 0; i < parameters.length; ++i) { getDescriptor(buf, parameters[i]); } return b...
c6d96c4b-b774-47d7-a8cf-200e959ea587
6
public void loadLevel(){ tileManager.clear(); ws.mechanismList.clear(); ws.circuitList.clear(); switch(ws.level){ case 0: // Load Map tileManager.loadMap(TileMaps.level0, 2, 2, TileMaps.TPlevel1); // Set Players ws.p1 = new Player(16, 16, true); ws.p2 = new Player(48, 48, false); ...
734c4a8a-63ab-4d85-a884-73b7bc2b3c7a
9
public static void main(String[] args) { ArrayList <Destination>WorkAddresses = new ArrayList(); ArrayList <Destination>HomeAddresses = new ArrayList(); Destination home = new Destination("80 Balcombe Road Mentone VIC 3194",false,true,false); Destination wo...
60305fd4-1207-4b1c-98e1-ce7e0c23fa35
0
public Dealer(int staylvl) { super(staylvl); shuffledDeck = ShuffleDeck(shuffledDeck); //setHold(17);//This could bypass the inherited constructor from player and just sets the dealer to stay on 17. //Though this can also be ignored/removed if the dealer is always constructed with 17 from calling method. }
7981c095-ca6d-42ca-99ec-0fd577aeb606
7
public void endElement(String uri, String localName, String qName) throws SAXException { if (qName.equals("type")) { tempMove.type = tempStr; } else if (qName.equals("class")) { tempMove.damageClass = tempStr; } else if (qName.equals("power")) { tempMove.power...
d4c2b767-8574-4f37-b41b-2b7fb8a9abb2
2
public void createPlayer(String player, String connection) throws SQLException { sql.initialise(); if(plugin.globalDefault){ sql.standardQuery("INSERT INTO BungeePlayers (PlayerName, DisplayName, Current, LastOnline, IPAddress) VALUES ('"+player+"','"+player+"','Global', CURDATE(), '"+connection+"')"); }else{ ...
7d972b6d-e5da-43ee-9962-6fd7affa0aab
7
public final TLParser.addExpr_return addExpr() throws RecognitionException { TLParser.addExpr_return retval = new TLParser.addExpr_return(); retval.start = input.LT(1); Object root_0 = null; Token set121=null; TLParser.mulExpr_return mulExpr120 = null; TLParser.mulExpr...