method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b8a6abca-e7db-47f8-bcd6-9b7bbcb1592f
8
public ConstantArrayOperator(Type type, int size) { super(type); argType = (type instanceof ArrayType) ? Type .tSubType(((ArrayType) type).getElementType()) : Type.tError; Object emptyVal; if (argType == type.tError || argType.isOfType(Type.tUObject)) emptyVal = null; else if (argType.isOfType(Type.tB...
e7653cd0-4f98-406d-bd54-c9a5f177d584
3
@Override public GameState doAction(GameState state, Card card, int time) { if(time == Time.DAY) { state = preacherDay(state, card); } else if(time == Time.DUSK) { PickTreasure temp = new PickTreasure(); state = temp.doAction(state, card, time); } else if(time == Time.NIGHT) { //Do nothi...
6a7cac5f-bc7d-4cc0-9efc-1279308ca7d3
2
private void buttonClicked(int id){ System.out.println("click click : " + id); if(id == 0){ Crafting.craft(player, Crafting.Sticks); } if(id == 1){ Crafting.craft(player, Crafting.CraftTable); } }
7dd07068-d864-409a-bb33-9094a472e082
9
public static void programme(String chaine, int nbEch, float amplMin, float amplMax, String forme, float snr, boolean sondes) throws InformationNonConforme { // Forme int type; // Message aleatoire ? boolean aleatoire; float teb; if (Pattern.matches("\\d{1,6}", chaine)) { aleatoire = true; } ...
838e881d-b08b-4d54-bfca-88f3d44b0f6c
8
public List<SubCategory> getDataForMoment(int year, int month) { // Itereer door alle subsets heen en retourneer de dichtsbijzijnde selected subcat periods List<SubCategory> result = new ArrayList<SubCategory>(); // Itereer de datasets for (DataSet set: this.datasets) { for (Category cat: s...
74cafb82-5340-47ea-b479-c571b5206807
0
public Chlodzenie produkujemyChlodzenie(){ return null; }
588f40c5-d124-4413-aa6c-30b225ccc4a7
9
@Override public void actionPerformed(ActionEvent ev) { if (ev.getSource().equals(btnCancel)) { fireWizardEvent(new WizardEvent(WizardEvent.WIZARD_EVENT_CANCEL)); } else if (ev.getSource().equals(btnNext) && ev.getActionCommand().equals(FINISH_TEXT)) { fireWizardEvent(new WizardEvent(WizardEvent.WIZARD_E...
621a32f8-580f-4f8f-8319-8be97af076e6
1
public void deleteAdmin(int index){ if (getAdminSize()==1) JOptionPane.showMessageDialog(null, "There should be at least one Admin user, user is not deleted","Delete", JOptionPane.ERROR_MESSAGE); else{ admin.remove(index); JOptionPane.showMessageDialog(null, "Admin is deleted","Delete", JOptionPane.PLAIN_M...
2b9ac624-faae-4fdb-af44-7322a50a95f6
6
public static OperatingSystem detect() { String s = System.getProperty("os.name").toLowerCase(); if (s.contains("win")) { return OperatingSystem.WINDOWS; } if (s.contains("mac")) { return OperatingSystem.MAC_OS_X; } if (s.contains("solaris") || s.c...
6283f085-2684-4945-8fcb-07e533a807a1
8
* @param errorP * @return Module */ public static Module getStellaModule(String pathname, boolean errorP) { { StringWrapper wrappedpathname = new StringWrapper(); Module module = null; wrappedpathname.wrapperValue = pathname; { MemoizationTable memoTable000 = null; Cons memoizedEn...
78eaec1f-9d6a-4889-a8cd-2609117cf848
0
public int getUptime() { return lastUptime; }
7d6c11f1-a399-47c6-abe3-e28053f08e60
8
public static <E extends Comparable<E>> BinaryTreeNode<E> deleteNodeRec(BinaryTreeNode<E> node, E value) { if(node == null) { return node; } if(value.compareTo(node.value)<=0) { node.left = deleteNodeRec(node.left, value); } else if(value.compareTo(node.value)>0) { node.right = deleteNodeRec(node.ri...
044612d0-e2c1-4a46-be96-906101e6d046
1
@Override public JSONObject main(Map<String, String> params, Session session) throws Exception { JSONObject rtn = new JSONObject(); long activeUserId = session.getActiveUserId(); long venueId = Long.parseLong(params.get("id")); Venue venue = Venue.findById(venueId); if(venue == null) { rtn.put("rtnC...
139da501-f90d-4126-879f-2d334ed88fcd
2
public static void main(String args[]){ CountDownLatch latch = new CountDownLatch(3); ExecutorService ex = Executors.newFixedThreadPool(3); for (int i =0; i<3;i++){ ex.submit(new processor(latch)); } try { latch.await(); } catch (InterruptedException e) { // TODO Auto-generated catch block ...
1f7c5313-3695-4d26-ab78-c1d4a326f3a9
4
@Override public void execute(CommandSender sender, String worldName, List<String> args) { this.sender = sender; if (worldName == null) { error("No world given."); reply("Usage: /gworld setgamerule <worldname> <rulename> <value>"); } else if (!hasWorld(worldName)) { reply("World not found: " + worldN...
e459ca30-9330-42cb-bef0-33d227464717
4
public boolean validarFeed(Feed feed) throws ObjetoNuloException{ if(feed == null){ throw new ObjetoNuloException("Feed is null"); } if(feed.getDescription().equals("")){ throw new ObjetoNuloException("Feed.description is null"); } if(feed.getLi...
a76547e2-5348-4df6-80c5-50a85cc8fd24
0
private OthelloBoardPrinter(){}
858beda2-4757-46d8-84a3-cde2de962ae6
9
public Point getDrawLocation() { Point p = this.getLocation(); int sizepx = 10; if (layout == Port.RELATIVE) { } else if (layout == Port.NORTH) { p.y -= sizepx; p.x -= sizepx / 2; } else if (layout == Port.EAST) { p.y -= sizepx / 2; } else if (layout == Port.WEST) { p.x -= sizepx; p.y -= size...
52d7da61-33cc-4ba7-8aef-d5db80608461
4
private void expand2(byte[] src, byte[] dst) { for(int i=1,n=dst.length ; i<n ; i+=4) { int val = src[1 + (i >> 2)] & 255; switch(n-i) { default: dst[i+3] = (byte)((val ) & 3); case 3: dst[i+2] = (byte)((val >> 2) & 3); case 2: dst[i+...
804b83fc-cd28-4c0f-a340-bfe1a6ec587c
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { String dir=CMParms.combine(commands,0); if(commands.size()>0) dir=commands.get(commands.size()-1); final int dirCode=CMLib.directions().getGoodDirectionCode(dir); if(!preInvoke(mob,commands,gi...
6008db22-fcc0-4c09-a84d-ec3b32f0c09b
5
public boolean canSplitInDim(int i) { int data = 0; boolean seen = false; for (MultiColor c : freqTable.keySet()) if (inside(c)) if (c.data[i] != -1) if (!seen) //First val we see { ...
c840b972-e504-4256-b563-d01c867c4880
9
public static void createSubBatchfile(String path, String batchfile, int contentInPercent, int session) { int numberExamples= -1; try { numberExamples = TestSupervisor.count(path + batchfile); } catch (IOException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } ArrayList<Integer> num...
38497c1d-a256-444f-ae69-88268f6ffe7b
1
public Persistent LoadData() { Persistent p = null; try { p = DataWorker.Instance().LoadObjectById(this.Id, this); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } return p; }
321bbbb5-8d2b-4323-8667-2431d3cba140
6
private void writeBKGD() throws IOException { if (param.isBackgroundSet()) { ChunkStream cs = new ChunkStream("bKGD"); switch (colorType) { case PNG_COLOR_GRAY: case PNG_COLOR_GRAY_ALPHA: int gray = ((mxPngEncodeParam.Gray) param) .getBackgroundGray(); cs.writeShort(gray); b...
48e2e5f0-6a93-439c-a173-91aa6213c631
5
private void executeNextAction() { if (actions != null && actions.size() > 0) { switch (actions.get(0)) { case A: avancer(); break; case G: rotateLeft(); break; case D: rotateRight(); break; } } }
d31b2d12-ddad-49b1-a80b-267100536df5
7
public int historicalNumParams(int type){ switch (type) { case HE_POP_SIZE: return 1; case HE_POP_SIZE_EXP: return 3; /* end_gen, start_size, end_size */ case HE_BOTTLENECK: return 1; case HE_ADMIX: return 1; case HE_MIGRATION: return 1; case HE_SPLIT: return 0; case HE_SWEEP: ...
0ff19ec9-7513-40ba-8057-98f90905aa4b
0
private void addComponentsToPane() { JButton button = new JButton("Clear"); //button.addActionListener(this); typingArea = new JTextField(20); typingArea.addKeyListener(this); displayArea = new JTextArea(); displayArea.setEditable(false); ...
649d3dd5-bcd7-4e55-a187-a875f8f10105
0
protected void onUnknown(String line) { // And then there were none :) }
4df170d5-b814-42d9-8871-b583d0cd9eba
3
private void createProgram() { shaderProgram = ARBShaderObjects.glCreateProgramObjectARB(); if(shaderProgram == 0) return; /* * if the vertex and fragment shaders setup sucessfully, * attach them to the shader program, link the sahder program * (into the GL context I suppose), and validate */ ARBSha...
307c174e-7144-42ea-b6d1-fcf117d0cf7d
2
static String toText(Color color) { String text = colorMap.get(color); if (null == text && null != color) { StringBuilder sb = new StringBuilder(); sb.append('[').append(color.getRed()). append(',').append(color.getGreen()). append(',').app...
3f289ff3-0215-4972-82a2-a3d15e6f5d16
2
@Override public Set<Record> getRecords(Account account) { Set<Record> records = new HashSet<Record>(); PreparedStatement pStmt = null; ResultSet rs = null; try { pStmt = conn.prepareStatement("SELECT * FROM RECORD WHERE id_account = ? ORDER BY id;"); pStmt.setInt(1, account.getId()); rs = p...
ee7f1821-551d-405a-ad6f-6e279259ea46
3
@Override public void execute(String args) { String[] array = args.split(" "); String temp = ""; for (int i = 1; i < array.length; i++) { temp += array[i] + " "; } try { Server.broadcast((new Data(temp, "[SERVER]", Color.MAGENTA, InetAddress.getLocalHost())).getData()); } catch (Socke...
cb6cdf30-6fba-429d-ba3a-9060ca4584ed
5
public void createTable() throws Exception { String columnFamilyDir; String DBLocation; Configuration config = new Configuration(); DBLocation = config.getDBLoc(); long StartTime = System.currentTimeMillis(); MetaStore meta = new MetaStore(); meta.setTable(this.TableName); meta.setColumnFamily(this.Col...
7bda9291-aa27-4794-a2df-319fb354cc17
5
public String getParsedTime() { String time = ""; if(!ampm) { if(minute <10) { time += Integer.toString(hour) +":0" +Integer.toString(minute); } else { time += Integer.toString(hour) +":" +Integer.toS...
20330970-eb03-4349-b17e-005c1653ec71
2
public boolean GenerateRoomItem() { Grizzly.GrabDatabase().SetQuery("SELECT * FROM server_room_items WHERE room = '" + this.ID + "' ORDER BY id DESC LIMIT 1"); try { ResultSet Results = Grizzly.GrabDatabase().GrabTable(); while (Results.next()) { this.FloorItems.put(Results.getInt("id"), ne...
18003844-f319-4871-b8bc-7816d2601709
3
@Test public void pointIsAdded() { Point p = vc.addPoint(3, 5); Vertex test = vc.getVertices().toLinkedList().getNext(); assertTrue(p.X() == 3 && p.Y() == 5 && test.X() == 3 && test.Y() == 5); }
5587f28a-435a-46f1-a2d5-4f2aab01c1e1
2
private List<Integer> availableIndex() { List<Integer> list = new LinkedList<>(); for (int i = 0; i < tiles.length; i++) { if (tiles[i].empty()) list.add(i); } return list; }
ac500d24-a7a3-4280-af0e-13ce45158cb3
5
public static void main(String[] args) { final double[][] matrix = generateMatrix(10, 1000000); evaluate(new Runnable(){ @Override public void run() { for (int i = 0; i<matrix.length; i++){ for (int j = 0; j< matrix[i].length; j++){ ...
167afc76-7dea-4bfc-9bab-395140e0353f
0
public void setSpecialArrangement(int i, String sa){ specialArrangement[i]=sa; }
a6308143-2ee9-490e-a9ee-d5ff31073266
1
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { String[] queue = plugin.queue; if (args.length == 0) { queue = new String[queue.length]; return true; } return false; }
a8ad1b08-bb8c-48b9-8140-99a61ce46b75
8
public void setTab(GraphicsTab tab) { Control[] children = tabControlPanel.getChildren(); for (int i = 0; i < children.length; i++) { Control control = children[i]; control.dispose(); } if (this.tab != null) this.tab.dispose(); this.tab = tab; if (tab != null) { setDoubleBuffered(tab.getDoubleBuffered()); ...
56488ed2-f742-4a39-a56f-cbd500f5b552
7
@Test public void reTest1() { userInput.add("hi"); userInput.add("my name is meng meng"); userInput.add("can you tell me about hamburger"); userInput.add("errorhandling"); userInput.add("errorhandling"); userInput.add("errorhandling"); userInput.add("errorhandling"); userInput.add("handle the error"); ...
e52664af-6fa7-4d66-90fd-b345ff7df16a
4
public static int[] generaVector(int tamaño, boolean modo) { int[] res = new int[tamaño]; if (modo) { for (int i = 0; i < tamaño; i++) { res[i] = i + 1; } java.util.Random r = new java.util.Random(); for (int i = 0; i < tamaño; i++) { ...
fb8759d4-6f2b-4f16-a970-6797d2e7a30d
3
@Override public void fill(Graphics2D g){ velocity*=decay; Point2D prev = new Point2D.Double(phys.getX(),phys.getY()); boolean moveWithPlayer=false; if(Display.player.me(0,1).intersects(phys)&&collide){ moveWithPlayer=true; } phys=new Rectangle2D.Double(phys.getX(),phys.getY()+velocity,phys.getWidth(),p...
35588e33-f5e3-4ef9-a3fb-ddd6156b574d
9
private void initComponents() { saveButton = new JButton(rh.getString(PROPERTY_NAME, BUTTON_SAVE)); saveButton.addActionListener(this); saveButton.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { if (e.getKeyChar() == KeyEvent...
9f981dfe-305d-4c3d-b714-b2f309fc656c
5
private void getNextChangingElement(int a0, boolean isWhite, int[] ret) { // Local copies of instance variables int[] pce = this.prevChangingElems; int ces = this.changingElemSize; // If the previous match was at an odd element, we still // have to search the preceeding element. // int start = lastChanging...
3661e4ee-f1cd-473b-a220-3ac9beef074b
2
public Point2D getPointAt( double position ) { if( position < 0 || position > 1 ) { throw new IllegalArgumentException( "position out of range: " + position ); } int segment = segmentAt( position ); double delta = position * totalLength - segmentLengthsSum[segment]; delta /= segmentLengths[segment]; Po...
74623750-3e7d-46b8-b121-2404a94a7a25
3
public static int[] readCode(String filename) throws Exception { FileInputStream in = new FileInputStream(filename); ArrayList<Integer> r = new ArrayList<Integer>(); int b; int count = 0; int current = 0; while((b = in.read()) != -1) { current = current | (b ...
aa7caed4-6b72-4989-88c7-e407c88003b0
3
public boolean registrarSeriales(entidadElemento datos_elementos){ conectarse(); boolean retornarObj = false; String regser = "insert into tbl_seriales (Seriales,Estado,Codigo) values(?,?,?)"; ArrayList seriales_recorrer = datos_elementos.getSeriales(); String estado = datos_elementos...
b6ae3255-b5c7-43c8-8acb-f51d282cab00
4
Calculator(String s) { // Начало определения конструктора Calculator super(s); // Вызов конструктора суперкласса (JFrame) temp = 0; op = ' '; setLayout(new GridBagLayout()); // Отказ от менеджера размещения setSize(250, 250); // Установка размеров окна setVisible(true); ...
85fae72e-bf3e-412e-aea6-5fcfa99571b9
5
public static MaplePacket showThread(int localthreadid, ResultSet threadRS, ResultSet repliesRS) throws SQLException, RuntimeException { MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); mplew.writeShort(SendPacketOpcode.BBS_OPERATION); mplew.write(0x07); ...
513bea87-64f8-4e04-a5b4-d5e4087f7d7d
4
@Test public void testInit() { Puzzle puzzle = new Puzzle(2); for(int r = 0; r < 4; r++) for(int c = 0; c < 4; c++) assertEquals(puzzle.getColor(r, c), '.'); assertEquals(puzzle.getCliques().length, 3); for(Clique[] cliques : puzzle.getCliques()){ assertEquals(cliques.length, 4); for(Clique ...
08f8d491-97ff-4704-b30f-76c4db99c68d
6
public String SetLength(String x){ String y = null; if(x.length()==1){ y = "00000"+x; }else if(x.length()==2){ y = "0000"+x; }else if(x.length()==3){ y = "000"+x; }else if(x.length()==4){ y = "00"+x; }else if(x.length()==5){...
60f61057-25cf-461d-ac67-845d54c21f7a
7
public Collection<Camino> getPaths(Nodo origen, Nodo destino) { if(!this.containsNodo(origen) || !this.containsNodo(destino)) throw new IllegalArgumentException("Nodo no contenido en el grafo"); ArrayList<Camino> caminos = new ArrayList<Camino>(); ArrayList<Camino> caminosValido...
76109b3b-de78-43a1-a898-26745e4fa96a
2
private double probLessThan(double b) { if (sigma<1e-8) { if (b>mu) { return 1; }else { return 0; } } return Phi((b - mu) / sigma); }
c680388c-ff1f-4708-82ec-973fb2d36830
2
public List<Schedule> getScheduleByDayList(String day) { List<Schedule> list = new ArrayList<Schedule>(); try { PreparedStatement ps = con.prepareStatement("SELECT * FROM schedule WHERE week_day=?"); ps.setString(1, day); ResultSet rs = ps.executeQuery(); while(rs.next()) { list.add(getS...
bfb9fac2-1284-48d6-9951-74da1c1abcf1
3
public FailureEvent(int NodeID, int eventType, double startTime, double endTime){ this.NodeID = NodeID; if(this.eventType == null) { this.eventType = new ArrayList<Integer>(); } if(this.startTime == null) { this.startTime = new ArrayList<Double>(); } if(this.endTime == null) { thi...
0d619568-4105-457b-b74d-b780c60f6be0
9
public static void main(String[] g) throws IOException { Scanner s = new Scanner(new File(g[0])); String l; while (s.hasNext()) { String[] L = new String[5]; String[] R = new String[5]; for (int i = 0; i < 5; i++) { L[i] = replace(s.next()); } for (int i = 0; i < 5; i++) { R[i] = replac...
6b154d31-e90e-4c1f-b309-e01d57ada04e
5
static Object toEnum(Object value, Class cls) throws ConversionException { if (value.getClass().equals(cls)) { return value; } else if (value instanceof String) { try { Method valueOfMethod = cls.getMethod("valueOf", new Class[] { String.class ...
ce9d6953-e795-4fdf-b868-b6e119408728
0
public CommandAction(CLC clc) { this.clc = clc; }
cc8c4707-6aa0-45e3-9724-37b51c48bec8
6
public void run() { if(url != null) { // Obtain the results of the project's file feed if(readFeed()) { if(versionCheck(versionTitle)) { String fileLink = getFile(versionLink); ...
a1180998-a18d-4810-b2f9-9b5747a13a05
9
@Override public void manageDigits(int[] digits, Queue<SpellResult> results) throws SpellOutException { super.manageDigits(digits, results); // manages its figure EnglishSpellResult result = new EnglishSpellResult(false, false); result.setFigure(digits[2]); result.setMag...
518ab120-3d35-4af5-bd9c-b302fd8f46f5
7
public void start() { Set<Long> vertices = graph.getVertexes(); Set<Long> edges = graph.getEdges(); // Step 1 // initialize the two hashmaps for storing the distance // and predecessor distance = new HashMap<>(); predecessor = new HashMap<>(); for (long vId : vertices) { if (vId == this.srcVId) ...
02c3e501-0988-4503-845f-0490133362f5
9
private RowsIEventData.Row parseRow(ByteArrayInputStream input, RowsIEventData data) throws IOException { RowsIEventData.Row row = new RowsIEventData.Row(); // row.setNullColumns(input.readBitSet(getNonZeroLength(data.getColumnUsageBeforeUpdate()), true)); TableMapIEventData tableData = TableMapC...
fb7ed23b-65da-4f1d-829b-e2d3b10b0c08
8
public Element output(Document doc, String slot) { String realslot = slot.toLowerCase(); TNode main = new TNode(realslot, getName(), doc); if (realslot == "helmet" || realslot == "chestplate" || realslot == "leggings" || realslot == "boots") { if (getVisiblename() != null) { ...
ddbb4c52-5f71-44b4-9c51-ee32a542f675
4
public int getCategoryIndex() { if (options.mode == Mode.BURIAL_ARMOUR) { switch (options.ingotGrade) { case ONE: return 0; case TWO: return 1; case THREE: return 2; } } return 0; }
559f7b92-dc4b-4703-8a68-7b960449bd20
9
private void zipDir(String zipName, String dirToZip, File dirToZipFile, ZipOutputStream zos, JProgressBar Fortschritt) { if (zipName == null || dirToZip == null || dirToZipFile == null || zos == null || !dirToZipFile.isDirectory()) return; // Inhalt des Ü...
39c9c7f5-6e81-4366-ab97-f198c7c09ce2
2
public void set(String key, String state) { if(!Quest.allowedStates.contains(state)){ System.out.println("INVALID STATE: " + key); } else { if(flag.containsKey(key)){ flag.remove(key); } flag.put(key, state); } }
0e4cdac0-ebe9-4e2b-919c-6ef986577ab7
2
@Override public void update(GameContainer container,StateBasedGame sbg,int delta) throws SlickException { xpos = container.getInput().getMouseX(); ypos = container.getInput().getMouseY(); if (mousePress==1){ enterGameState(sbg); } else if(mousePress==2){ enterCreditState(sbg); } }
e1f6b738-2ddb-41da-812c-1cd3623ccb9b
3
public boolean setWeights(double[] weights) { if (weights == null) { return false; } // check whether the value of weights are correct for (int i = 0; i < weights.length; i++) { if (weights[i] <= 0) { System.out.println(nam...
adca7d46-e359-418c-a83d-bb8e5577646c
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...
4c990760-fcfa-468f-9d87-67fe28056bf7
1
public void visit_dup2_x1(final Instruction inst) { // If the top two values are of category 1, then dup them and put // them three down. Otherwise, the top two values are of category // 2 and the top value is put two down. final Set top = atDepth(0); final int category = checkCategory(top); if (category ...
fd62e2e1-072f-4532-8514-79b0e7ca5e0e
7
public void generateMoves(Piece[][] squares, ArrayList<Move> validMoves, ArrayList<Move> validCaptures) { // for each possible direction (NE, SE, SW, NW) int xPos; int yPos; for (int direction = 0; direction < xMoves.length; direction++) { xPos = xPosition + xMoves[direction]; yPos = yPosition + yMoves[d...
d4c5612e-5ae9-4994-9bb3-5289485eb500
0
public void setH(int h) { this.h = h; }
95067fab-2f8d-4417-aa57-63db1dccc174
6
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (boolValue ? 1231 : 1237); result = prime * result + byteValue; result = prime * result + ((dateTimeValue == null) ? 0 : dateTimeValue.hashCode()); result = prime * result + ((decimalValue == null) ? 0...
b656425c-f0de-49e5-8ced-23ce04960d10
4
public void render() { glBegin(GL_QUADS); { for (int y = 0; y < map.length; y++) { for (int x = 0; x < map[0].length; x++) { if (map[y][x] == 1) { if (Collision.isPlayerIntersectingBlock(getObsticleMap(), x, y)) { glColor3d(1, 0, 0); } glVertex2d(x * BLOCK_SIZE, y * BLOCK_SIZE);...
0a6be22a-0521-4919-a9b1-2edc8c224248
1
public Builder id(int receivedId) { if (receivedId < 0) { log.warn("Wrong ID. receivedId =", id); throw new IllegalArgumentException("Id must be integer value more than 0. Received value =" + receivedId); } this.id = receivedId; return this...
147d7ad2-3478-43e3-87b6-c2860a375710
4
@Override public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return saves.get(rowIndex).getName(); case 1: return DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.SHORT).format(saves.get(rowIndex).getCreationDate()); case 2: return saves.get(rowIndex).g...
0a0833df-08b6-4823-9c1d-467d9edc5540
5
public static boolean setMode(final StoreMode m) { if (m == null) return false; WidgetChild wc; return getMode() == m || visible(wc = getChild(m == StoreMode.WIDE ? WIDE_MODE : THIN_MODE)) && wc.click(true) && new TimedCondition(1400) { @Override public boolean isDone() { return getMode() ...
836b4a1b-9428-43c7-b75b-660cd5a2f55a
7
private static void createTrees(int width, int height) { Random rand = new Random(); for(int i = 0; i < width; i++) { if(rand.nextInt(10) == 9) { if(blockSheet[i-1][dirtBoundary-1] == World.AIR) { for(int x = 0; x < tree.length; x++) { for(int y = 0; y < tree[x].length; y++) { if(x + i <...
e2dbf54b-d809-409a-8afe-f938eee418a1
7
private void resize(Signature signature, int size) { double minX = Double.MAX_VALUE; double maxX = Double.MIN_VALUE; double minY = Double.MAX_VALUE; double maxY = Double.MIN_VALUE; for (Point point : signature.getPoints()) { if (point.getX() < minX) minX = point.getX(); if (point.getX() > maxX) ...
eafe3e25-ded3-4f43-b365-40f84a134ece
5
public static void lcs(String x, String y) { int n = x.length(); int m = y.length(); for (int i = 0; i < n + 1; i++) for (int j = 0; j < m + 1; j++) if (i == 0 || j == 0) dp[i][j] = 0; else if (x.charAt(i - 1) == y.charAt(j - 1)) dp[i][j] = dp[i - 1][j - 1] + 1; else dp[i][j] = Math....
4be20295-8ed0-42bd-855a-5a0a12094da9
7
public static BufferedImage rotate(Rotn rotn, BufferedImage img) { int W = img.getWidth(); int H = img.getHeight(); int W1; int H1; int angle; double WOffSet = 0; double HOffSet = 0; if (W % 2 == 1) WOffSet = 0.5; if (H % 2 == 1) HOffSet = 0.5; switch (rotn) { case COUNTER_QUARTER: W1 ...
96db1470-5599-4754-b3f2-cdfc3ce5256d
8
private static String combatDiffColor(int i, int j) { int k = i - j; if(k < -9) return "@red@"; if(k < -6) return "@or3@"; if(k < -3) return "@or2@"; if(k < 0) return "@or1@"; if(k > 9) return "@gre@"; if(k > 6) return "@gr3@"; if(k > 3) return "@gr2@"; if(k > 0) return "@gr1@...
063cdecd-62b8-45f0-8f06-6069d5fe06b5
3
public void visitTree(final Tree tree) { final Stmt last = tree.lastStmt(); if (last instanceof JumpStmt) { final JumpStmt stmt = (JumpStmt) last; if (FlowGraph.DEBUG) { System.out.println(" Replacing " + oldDst + " with " + newDst + " in " + stmt); } if (stmt.catchTargets().remove(oldDst)...
1ece0bc0-0056-44c6-b149-0c50367a7ed9
5
@Override public void mouseClicked(float x, float y, Integer objNumber, MouseEvent e) { mouseClickButton = e.getButton(); if (objNumber != null) { active = models.get(objNumber); } if (active == null) { // deligiere an moegliche untergruppen weiter ...
48038461-97b5-4917-8556-a0487e0f1c42
5
@Override public void deserialize(Buffer buf) { type = buf.readByte(); if (type < 0) throw new RuntimeException("Forbidden value on type = " + type + ", it doesn't respect the following condition : type < 0"); worldX = buf.readShort(); if (worldX < -255 || worldX > 255) ...
e479dd5b-0141-4881-b766-bcd5d4f17e5a
8
private boolean isWalkable(FieldState state) { if (mode == Mode.EDITOR) { if (state == FieldState.EMPTY || state == FieldState.GOAL || state == FieldState.DIAMOND || state == FieldState.PLAYER) { return true; } } else if (mode == Mode.GAME) { if (state == FieldState.EMPTY || state == FieldState.GO...
2be4011f-5acc-4a2e-8117-d50caebd8976
1
public void atMethodArgs(ASTList args, int[] types, int[] dims, String[] cnames) throws CompileError { int i = 0; while (args != null) { ASTree a = args.head(); a.accept(this); types[i] = exprType; dims[i] = arrayDim; ...
4d4d162f-d7bb-4119-9dcd-ff17278b700a
7
@Override public void create(DataObject obj) throws SQLException { if(!(obj instanceof ItemDO)) throw new IllegalArgumentException("Tried to save a non StorageUnit in " + "DBStorageUnitDAO"); PreparedStatement stmt = null; Statement keyStmt = null; ResultSet keyRS = null; SQLException exception = nul...
49295b87-c63d-45bc-a147-7048c3333770
5
private List<CalEvent> processGCalData(List<GoogleCal> calendarData) throws ParseException { // TODO Auto-generated method stub List<CalEvent> list=new ArrayList<CalEvent>(); try { for (GoogleCal cal : calendarData) { if(cal.getData() != null) { JSONObject eventJson=new JSONObject(cal.getData()); ...
e13d0f8e-6df5-4c5f-9718-ae9f2bec83f4
4
private boolean getSymbolFreqBin (CircularDataBuffer circBuf,WaveData waveData,int start) { boolean bit; // Run FFTs on the early and late parts of the symbol double early[]=do160FFTHalfSymbolBinRequest(circBuf,start,lowBin,highBin); start=start+((int)samplesPerSymbol/2); double late[]=do160FFTHalfSymbolBinRe...
e8e9dbc8-84ac-4cb4-b706-507e379f0149
5
private Quality randomQuality(){ switch(randNum.nextInt(5)){ case 0: return library.shoddy; case 1: return library.inferior; case 2: return library.average; case 3: return library.superior; case 4: return library.masterwork; } return null; }
89342c1b-5e64-4f0d-82ee-169896d43a7f
6
public String getWord(int number) { word=""; getWordFromNumber(number); int i = 0; for (String s : words) { boolean dx = false; if (i < words0.size()) { for (int j = 19; j < 27; j++) { if (s.equals(wordsOfNumber.get(j))) { dx = true; break; } } if (!dx) word += s + "...
309aac83-7485-4d99-b425-61c791849b90
8
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { CertificateFactory cf; try { crlM.createCRL(getServletContext().getRealPath("/")+"certificat.p12", "toto", "webmail.monsite.fr", "webmail.monsite.fr", "toto"); crlM.save(getServletConte...
7a77e64a-de17-4875-b513-03f4b471c234
2
protected void move(double nx, double ny) { if (level.tileCollision(x, y, nx, ny, 7)) { remove(); onCollision(); } this.x += nx; this.y += ny; if (distance() > range) { remove(); } }
ad3d99c7-dc59-4b1e-9ebd-d58a0b03c828
9
public void update(GameContainer gc, StateBasedGame sb, int delta) { Input in = gc.getInput(); int bposx = this.owner.getPosX(); int bposy = this.owner.getPosY(); int nposx = bposx; int nposy = bposy; int limx = RPG372.gameInstance.getMap().getX(); int limy = RPG372.gameInstance.getMap().getY(); if(in....
4687a374-724a-4def-9867-7f0c5973db4c
3
private void remove() { String key; List<String> keys = new ArrayList<String>(); for (int i = 0; i < listDroite.getSize(); i++) { if (droite.isSelectedIndex(i)) keys.add(listDroite.getKey(i)); } for (Iterator<String> e = keys.iterator(); e.hasNext(...
09ec5054-fa34-419e-8d3a-58c8df59539f
8
@Override public void execute(Tuple tuple) { speed++; if (speed == 1){ ptime = System.currentTimeMillis(); } if (logger.isInfoEnabled()){ logger.info(format("updateTimeBolt received:%s,%s", tuple.getString(0), tuple.getLong(1))); } long time = ...
328c1ccc-ce4e-4224-a954-95143490ea5c
7
private void calculateScores () { resetScores(); Champion[] champions = getChampions(); Strategy[] strategies = Strategy.values(); for (int i = 0; i < strategies.length; i++) { for (int j = 0; j < 10; j++) { if (champions [j] != null && (Initialiser.getMainFrame().getButtonPanel().isTacticEnabled (i) ...