method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b376e44f-d152-4200-882e-c03e341dce76
3
public static void main(String args[]) { new DatabaseInit().go(); new Thread( new AdminThread() ).start(); try { serverSocket = new ServerSocket(port); } catch (IOException e) { e.printStackTrace(); } while (true) { try { clientSocket = serverSocket.accept(); new Thread( new ClientThrea...
d5e70cdb-67ad-47f9-8aef-5618d1a061d2
0
public void setId(int id) { this.id = id; }
88a75678-ed17-4e6d-a3ab-aa2211ba452c
2
public static boolean validaDNI(String dni) { Pattern patron=Pattern.compile("\\d{8}\\-[a-zA-Z]{1}"); // Expresion regular que verifica 8 digitos, guion y letra del DNI Matcher m=patron.matcher(dni); if( m.matches()) // El patron coincide con el patron introducido { if( Clientes.validarLetra(dni)) // Valid...
89223b47-9306-4d9f-8fad-79b7cf61d7a6
0
public static String copyToString(Reader in) throws IOException { StringWriter out = new StringWriter(); copy(in, out); return out.toString(); }
17d4a3e3-ab9a-4400-89c1-0f279e5f5f6d
5
public static Integer getLevelForCaste(int xp, String caste) throws IOException { int lvl = 1; JsonNode root = objectMapper.readValue(new File(LEVELS_FILE), JsonNode.class); JsonNode casteNode = root.path(caste); if (!casteNode.isMissingNode()) { for (int i = 1;; i++) { ...
75cad7f8-4e37-4aa0-bc6a-8fdf853b9e9a
7
public Set<Map.Entry<Float,V>> entrySet() { return new AbstractSet<Map.Entry<Float,V>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TFloatObjectMapDecorator.this.isEmpty(); } public b...
b5127359-c225-4167-b621-5224965b27b2
4
private boolean inBounds(Cell c) { if(c.getX() < 0 || c.getY() < 0 || c.getX() >= board.getWidth() || c.getY() >= board.getHeight())return false; return true; }
5e0ed0cb-c1b4-41fe-accf-2c2cc4e5983b
1
public boolean opEquals(Operator o) { return (o instanceof CompareBinaryOperator) && o.operatorIndex == operatorIndex; }
2afde02a-a408-49fa-a67a-b52f0d18ede3
3
CoreInterface getTreeObject(CoreInterface ci){ if(ci.getClass() == Dvd.class){ return dvdTree.get(ci); }else if(ci.getClass() == Location.class){ return locationTree.get(ci); }else if(ci.getClass() == Genre.class){ return genreTree.get(ci); } return null; }
42db4fdb-e63f-41aa-98db-8aa99a42bfe8
9
private static boolean check(int row, int column) { if (0 == row) { return true; } for (int i = 0; i < row; i ++) { //check the same column if (past[i][column] == 1) { return false; } } for (int i = row - 1, j = column - 1; (i >=0)&&(j >= 0); i --, j --) { //from left top to right bottom if (p...
bb1379d6-ef7b-4bdd-b65d-1567c4b802c6
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...
b749fba6-e8f5-4b0e-a890-87ce958f048d
6
private void printChildren(Node currentNode, Graphics2D g2d, int nextLeft, int numberIncrementLeft) { if (currentNode != null && currentNode.getNext() != null) { Node item = currentNode.getNext(); int numberNextLeft = getNumberNextLeft(false, item != null ? item.getKey() : null, nextLeft); int count = 1; ...
35d22b1e-c70d-48cf-9f56-12d66a16b82d
2
private void relax(Vertex u, Vertex v, Edge uv) { if (u.getDistance() < Integer.MAX_VALUE) { if (v.getDistance() > u.getDistance() + uv.getWeight()) { v.setDistance(u.getDistance() + uv.getWeight()); v.setPath(u); heap.updateDecreasedElement(v); ...
08a459f3-bd0d-4fb9-a9b1-f3e0b036ec58
8
public int createCargo (String name, int amount, int specialInstrument) throws ObjectNotFoundException, ObjectAlreadyExistsException, InvalidInstrumentTypeException, ExhaustedCargoCellsException, IllegalNumberException { int cells[] = new int[0]; int free; Cargo cargo; ...
eff5833c-a48b-4a30-ade2-9b26f18d6fa8
4
public static boolean accept(AbstractSyntaxNode node, TokenReader reader) { boolean result = false; if (Assignment.accept(node, reader) || Creation.accept(node, reader) || Expression.accept(node, reader) || Return.accept(node, reader)) { r...
84d36a78-ad3a-4c04-aebb-d2aa5e1ea331
4
public void broadcast(int id, String message) { for ( ThreadChat th : connections.values() ) { ClientChat cc = th.getClientChat(); if ( cc != null && cc.getId() != id && cc.isOnline() ) { cc.send(message); } } }
6bf3a939-38cb-4c0a-8591-eaf961d01537
5
public int updateAccel() { double rate = getVelocity(); while (lastRates.size() >= SmartDashboard.getNumber("numPoints")) { lastRates.removeElementAt(0); } lastRates.addElement(new Double(rate)); double avgX = 0; for (int i = 0; i < lastRates.size(); i++) { ...
1f724887-0d31-4b51-bc86-08cb516762e4
6
@Override public void execute() throws Exception { if (isHelp()) { showHelp(); } else if (isCompile()) { assembleCode(getCompile()); } else if (isDisassemble()) { disassembleCode(getDisassemble()); } else if (isExecute()) { executeByteC...
56685ddc-6506-4a17-8120-fa56f468f8e5
7
@Override public void tick(Game game) { inventory.checkUnloads(game); SwordItem sword = (SwordItem) inventory.findClass(SwordItem.class); if (sword != null) { setDmg(sword.getDamage()); } ArmorItem armor = (ArmorItem) inventory.findClass(ArmorItem.class); ...
b17cd6b7-c26d-4722-b472-632871f32f4e
8
private void initMenuItems(final List<MenuItem> ITEMS) { Map<Parent, MenuItem> itemMap = new HashMap<>(ITEMS.size()); positions = Double.compare(degrees, 360.0) == 0 ? ITEMS.size() : ITEMS.size() - 1; openTimeLines = new Timeline[ITEMS.size()]; closeTimeLines = new Timeline[ITEMS.s...
ac57f205-a5d3-446e-ba53-15f9d3e47f12
4
@Override public void draw(SpriteBatch batch, float parentAlpha) { if (MyStage.isCameraView(stage, x, y)) { update(Gdx.graphics.getDeltaTime()); if (isDead) { batch.draw(deadTexture, x - 32, y - 32, originX, originY, width, height, 1, 1, rotation); } else ...
6fb98e5f-48d6-407d-bcfb-1e15b686d7a9
5
private boolean Escape() { begin("Escape"); if (Escape_0()) { sem.Unicode(); return accept(); } if (next("\\t")) { sem.Tab(); return accept(); } if (next("\\n")) { sem.Newline(); return accept(); } if (next("\\r")) { sem.CarRet(); return accept(); } if (Es...
90aa4246-7c1e-405c-a4b9-d44c2ecba70f
7
public void setCell(int cellX, int cellY, char mark) { if (cellX < 0 | cellX >= FIELD_SIZE | cellY < 0 | cellY >= FIELD_SIZE) { System.out.println("Для ввода допустимы лишь 'x' и '0', а также координаты должны быть в диапазоне 1-3 включительно! Начните заново!"); eraseField(); ...
33d7c3b3-47c6-4de2-b996-02b960d7ddc4
7
public final void dotted_name() throws RecognitionException { try { // Python.g:235:13: ( NAME ( DOT NAME )* ) // Python.g:235:15: NAME ( DOT NAME )* { match(input,NAME,FOLLOW_NAME_in_dotted_name1717); if (state.failed) return; // Python.g:235:20: ( DOT NAME )* loop47: while (true) { int alt4...
950bb517-dd34-4f22-9554-38968e255873
8
public void tick() { // TODO: wenn alle levels geschafft sind ? if (Map.getInstance().getMobStack().size() == 0 && mobs.size() == 0 && Player.getInstance().getHealth() > 0) { Map.getInstance().setUpNewLevel(); } Map.getInstance().tick(); for (int i = 0; i < mobs.size(); i++) { GenericMinion gm = mob...
148f128b-05ec-4f9b-ba16-e91c6eea0ae2
1
private double RD2lat(double x2, double y2) { // TODO Auto-generated method stub double a = 0; double dX = 1E-5*(x2-X0); double dY = 1E-5*(y2-Y0); for(int i = 1; 12 > i; i++) a+=latpqK[i].K*Math.pow(dX,latpqK[i].p)*Math.pow(dY,latpqK[i].q); return lat0 + a/3600; }
5ad55637-929e-45a7-9133-82f7f1f95173
7
public String toSource(String className) throws Exception { StringBuffer result; int i; result = new StringBuffer(); if (m_ZeroR != null) { result.append(((ZeroR) m_ZeroR).toSource(className)); } else { result.append("class " + className + " {\n"); ...
84019781-9d30-4e24-9d50-63c03b7e2e81
9
private void checkParameters(){ for(double d : discounts){ if(d <= 0.0 || d >= 1.0){ throw new IllegalArgumentException("Discounts must be in (0.0, 1.0)"); } } if(infiniteDiscount <= 0.0 || infiniteDiscount >= 1.0){ throw new IllegalArgumentE...
400bb194-34f4-42cd-bdc3-7296d4d6a3fb
2
@Test public void test() throws Exception { URL url = new URL("http://localhost:7070/sonar-it-example-app/"); BufferedReader in = new BufferedReader(new InputStreamReader(url .openConnection().getInputStream())); String line = in.readLine()...
d9d5453f-74b2-41d3-b808-05e054d5e363
8
private void listFiles() { File file = null; Message msg = null; try { // Send all folder info separately for(int i = 0; i < 3; i++) { switch(i) { case 0: file = new File(Server.SERVERDIRECTORIES[0]); break; case 1: file = new File(Server.SERVERDIRECTORIES[1]); break; def...
1c0e5e9a-68e6-49ef-be09-6ae2cf1d6616
8
private FileHandler htaccess_resolveFileHandler( URI requestURI, File requestedFile, String fileExtension, HypertextAccessFile htaccess ) throws ConfigurationException { // Use this order: // (i) The 'AddHandler' settings (extension-specific; overrides directory-wide 'SetHandle...
ce0f92d2-6382-4296-a4e7-b6caf679cc4d
8
public static List<File> unpack( File file, FileGarbage garbage ) throws IOException { if( !file.exists() || file.isHidden() || !file.isFile() ) { return new ArrayList<File>(); } FontFormat format = FontFormat.forFile( file ); if( format.awtSupported() ) { ...
17aeb36d-d1d9-4f29-b1b4-bfce3ce03f26
3
public void openDevice(int index){ //Opens the device takes in index you want to use deviceIndex = index; //Sets the index to the parameter try { //beginning of a try catch block captor = JpcapCaptor.openDevice(devices[index], 1028, false, 20 ); //Opens the selected device } catch (IOException e) { //catche...
a90f4f0e-f9a5-4d72-a6c3-018177708b8c
5
@Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.white); width = 500; //todo height = 500; g.fillRect(0, 0, width, height); g2d.setColor(Color.black); g2d.drawRect(0, 0, width - 1, he...
80622285-fbad-4d86-9a69-3054aa38c915
8
@Override public void process(JCas arg0) throws AnalysisEngineProcessException { String text = arg0.getDocumentText(); Map<Integer, Integer> begin2end = new HashMap<Integer, Integer>(); Annotation document = new Annotation(text); pipeline.annotate(document); List<CoreMap> sentences = doc...
e5d67a57-dd9b-40cc-b274-75e52607132b
3
static Image loadImage (Device device, Class<AdvancedGraphics> clazz, String string) { InputStream stream = clazz.getResourceAsStream (string); if (stream == null) return null; Image image = null; try { image = new Image (device, stream); } catch (SWTException ex) { } finally { try { stream.close ...
baa64473-a174-42ff-afb3-f6964e75fefb
6
public void update() { int xa = 0; int ya = 0; if (Keyboard.keyPressed(Keyboard.VK_UP)) ya--; if (Keyboard.keyPressed(Keyboard.VK_DOWN)) ya++; if (Keyboard.keyPressed(Keyboard.VK_LEFT)) xa--; if (Keyboard.keyPressed(Keyboard.VK_RIGHT)) xa++; if (xa != 0 || ya != 0) move(xa * 3, ya * 3); level.setOffset(...
0faaa4ae-92c8-4168-9a9a-cb662df8dab6
0
public void setModulus(byte[] value) { this.modulus = value; }
1bec7030-9b3d-447e-a4c1-9ff5e8327a74
3
void galaxyConfig() { System.out.println("\t<param name=\"genomeVersion\" type=\"select\" label=\"Genome\">"); for (String name : namesSorted) { for (String genVer : genVerSorted) { String n = config.getName(genVer); // In this group? if (name.equals(n)) { System.out.println("\t\t<option value...
055d5255-b6ca-4658-b223-af029d94869d
6
@Override public boolean equals(Object o) { boolean isEqual = false; if(o != null && o instanceof FoodGenre) { FoodGenre temp = (FoodGenre) o; if(temp.getCode() == this.getCode()) { isEqual = true; } } else i...
65a54fe2-5e80-477d-a87f-f9c59427b670
2
public boolean change(ServerStatus s){ if(this.name.equals(s.name)){ if(this.statusID == s.statusID){ changed = false; } else { changed = true; } } else { changed = true; } return changed; }
8f2fe08a-c478-4fb4-9a5e-fe1b74e4a715
0
public DoesnServer() { super(PORT); }
b57a6575-f7b7-475c-86d2-00c7c774b0b3
9
@SuppressWarnings({ "deprecation", "unused" }) public boolean itemWithdraw(final InventoryClickEvent event) throws Exception { // Unsupported action if (!this.canWithdraw) { this.player.sendMessage(MineAuction.prefix + ChatColor.RED + MineAuction.lang.getString("action_invalid_withdraw")); return fal...
8de4ba35-9a8e-401e-ae2e-3abeb7e8b89f
4
private void defineButton() { addButton = new JButton("Add"); clearButton = new JButton("Clear"); addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int size = Integer.parseInt(sizeField.getText()); int startX = startXSlider.getValue(); int...
710be055-6919-431b-8c00-372f80d9ef11
2
private int maxBar(int[] histogram) { int max = 0; for (int i : histogram) { if (i > max) { max = i; } } return max; }
01848eb1-e61f-46ab-ae69-b24f885a9df3
4
public Dip(int pinCount,int startX, int startY) { pins = new Pin[pinCount + 1]; //totally untested loop to create pins in this dip int pinIndex = 0; //distance between pins int distanceBtwnPins = 1; Scheme.tiles[startX-1][startY] = TileType.dLEFTTOPCORNER; ...
286e3e8b-255e-425c-8025-78a3bbf6b5da
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
7c7d6463-b723-439c-b2dd-a278d1043bcf
3
@Override /** If the HTML.tag that we get represents a class in an HTMLContainer in *my* hierarchy, * then I need to pop this container, so we don't get the whole body appearing in the TITLE * element (as happened prior to this revision). */ public void handleEndTag(HTML.Tag tag, int pos) { logger.info(String...
df14815f-8bfa-4904-bb57-1d7c0e1f2f7b
4
@Override public void execute(CommandSender sender, String[] args) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (args.length < 1) { sender.sendMessage(ChatColor.RED + "/" + plugin.tpa + " (playername)"); return; } Proxi...
bfa7b159-f412-47af-82b0-51e3f2d60fd2
1
public static Color avgColor(HashSet<Color> colors) { long red=0, green=0, blue=0; for (Iterator<Color> iterator = colors.iterator(); iterator.hasNext();) { Color color = (Color) iterator.next(); red += color.getRed(); green += color.getGreen(); blue += color.getBlue(); } return new Color( (int)(...
c8c505b4-126f-46a0-bb92-dd035f411636
7
public static void main(String[] args) { //start loc if (args.length > 0) { try { int startLocation = Integer.parseInt(args[0]); //check for loc if ( startLocation >= 0 && startLocation <= MAX_LOCALES) { currentLocale = startLocation...
103381f5-2722-4167-80ff-7c3083c9f9d3
1
public static void main(String[] args) { //Low-level modules Employee emp1 = new HourlyEmployee(10.50, 2020); Employee emp2 = new SalariedEmployee(45000, 1250); Employee emp3 = new SalariedEmployee(90000,0); Employee emps[] = {emp1,emp2,emp3}; // High...
3bdb47d3-f9ce-42c7-a162-96546f75b828
1
@Override public void go() { if(stepmode == EStepmode.go) { stepmode = EStepmode.hold; } else { stepmode = EStepmode.go; } }
97833728-ce26-42ae-8add-201bafb3c665
4
private Vector<Vector<String>> getEventTriple(String xml,String ParamAttValue) { if(xml==null){System.out.println("ERROR:SSAP_XMLTools:getEventTriple: XML message is null");return null;} Element parameters = getParameterElement(xml,"name", ParamAttValue); if(parameters==null) {System.out.println("ERROR:SSAP_XML...
5a801ad4-cb19-415b-8108-a20c7e76de8c
9
private void showSolution(List<PieceMovePair<Vehicle, Cell>> solution){ if(solution != null && solution.size() != 0) { solving = true; final Iterator<PieceMovePair<Vehicle, Cell>> pathIterator = solution.iterator(); PieceMovePair<Vehicle, Cell> nextMove = pathIterator.next(); Vehicle nextCar = currentBoar...
264ec4a4-b2b0-437e-b4e3-7ac6f113c701
4
public void postOrderTraversal(TreeNode root,HashMap<TreeNode,int[]> aux){ if(root.left!=null) postOrderTraversal(root.left,aux); if(root.right!=null) postOrderTraversal(root.right,aux); int[] tmp=new int[4]; if(root.left!=null){ tmp[0]=aux.get(root.left)[0]; tmp[...
1c259bfe-cec2-45c9-b06c-afe97a5191ed
2
@SuppressWarnings({"unchecked", "rawtypes"}) public static boolean isEnumType(Class<? extends Enum> clazz, String s) { try { Enum.valueOf(clazz, s.toUpperCase()); return true; } catch (Exception e) { return false; } }
adacaab3-0e27-40c6-ba0e-d56c8c239a63
5
public boolean setValueAt(Object value, int index) { if (index < 0 || index >= this.valueCount()) { logger.error("Property.setValueAt: specified index out of range!"); return false; } try { Value toAdd = new Value(value, null); this.values.set(index, toAdd); ...
0e021982-a061-4b42-b55d-b52b7626e840
1
public IntArrayBag clone( ) { // Clone an IntArrayBag object. IntArrayBag answer; try { answer = (IntArrayBag) super.clone( ); } catch (CloneNotSupportedException e) { // This exception should not occur. But if it does, it would probably // indicate a pr...
bd22c282-147f-444f-addf-b43e7926fda9
3
public static ByteBuffer readLine( ByteBuffer buf ) { ByteBuffer sbuf = ByteBuffer.allocate( buf.remaining() ); byte prev = '0'; byte cur = '0'; while ( buf.hasRemaining() ) { prev = cur; cur = buf.get(); sbuf.put( cur ); if( prev == (byte) '\r' && cur == (byte) '\n' ) { sbuf.limit( sbuf.positio...
3db84e43-26e2-4b9a-866c-9e8c4b5e78bd
8
private byte[] getBytesFromInt(int toTransform){ byte toReturn[] = new byte[2]; /* --fixme-- */ /* The expression of type int is boxed into Integer */ Integer first = toTransform; toReturn[1] = first.byteValue(); int second = 0b00000000; if(toTransform - 32768 >= ...
ee4a7e28-dccb-42fb-b68c-ba8ed8b66984
6
public int playoutMove(State state) { int move = -2; // -2 is our fail state List<Integer> legalMoves = state.legalMoves(); List<Integer> unplayed = new ArrayList<>(); if (children.size() == 0) { return -2; } // check for unplayed values for (int legMove : legalMoves) { if (children.get(legMove) ...
21055e10-cb3a-43ce-afdc-effe29b762de
2
public ArrayList<Fish> reproduceWithFish(Fish f) { Random generator = new Random(); ArrayList<Fish> babies = new ArrayList<Fish>(); double num = generator.nextDouble(); if (num <= .005) { int num1 = generator.nextInt(6); for (int x = 0; x <= num1; x++) { ...
4ef61d5b-47db-4b8b-84f0-a6c1015e7407
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TaxRate taxRate = (TaxRate) o; if (Double.compare(taxRate.rate, rate) != 0) return false; return true; }
d83fb996-b92c-4778-a5bf-72173d7a119c
5
public int dijkstraTry(int s, int n) { PriorityQueue<Edge> q = new PriorityQueue<Edge>(); q.add(new Edge(s, 0)); int[] d = new int[n]; System.arraycopy(dis, 0, d, 0, n); d[s] = 0; while (!q.isEmpty()) { Edge cur = q.poll(); for (int i = 0; i < adj[cur.id].size(); i++) { Edge neigh = adj[c...
9dbd349a-1b09-47e5-95ef-e779a12ca8ab
9
@Override public Room getQuestRoom(int i) { final int[] num={1}; Environmental E=null; synchronized(questState) { if(questState.worldObjects!=null) E=getQuestThing(PreservedQuestObject.getPOIter(questState.worldObjects),i,CMClass.CMObjectType.LOCALE,num); if(E instanceof Room) return (Room)E; ...
c871f2e3-d842-45d2-87ab-86c926a1c235
4
private void sendFile(String filename) { try { // Check that the file exists and report existence to client File file = new File(Server.SERVERDIRECTORIES[0].concat("/" + filename)); if(!file.exists()) { sendAck(COMMAND.F, false); throw new FileNotFoundException(); } else { sendAck(COMMAND.F, t...
d2414c4c-14ab-4f5f-94f9-8262d42fc4f3
2
private Move getBestMove() { for (Move move : this.game.window.board.getAllMoves(this.isWhite)) { // if opponent checkmate: do this! // if opponent stalemate: avoid move if (move.from.file == 'a') { return move; } } return null; }
ef03f305-784e-4788-b311-0e123c0955ac
8
private boolean configCommand(CommandSender sender, String[] args) { if (!xPermissions.has(sender, "xauth.admin.config")) { plugin.getMsgHndlr().sendMessage("admin.permission", sender); return true; } else if (args.length < 3) { plugin.getMsgHndlr().sendMessage("admin.config.usage", sender); return true...
41c81bb5-18c0-4727-8a49-6f8c9eb78462
9
@SuppressWarnings("unchecked") public void generarFeatures() throws ArchivosInconsistentesGeneradorFeaturesException{ ArrayList<PosibleAsociacion> resultadoAsociaciones=new ArrayList<PosibleAsociacion>(); //entre eventos ArrayList<MakeInstance> listaEventosMK=new ArrayList<MakeInstance>(archivoTimeML.getMakei...
c33ea07a-0360-4232-9597-b953373da2ce
9
private void parseFieldMappings(NodeList nl) { for (int i=0; i<nl.getLength(); i++) { Node node = nl.item(i); NamedNodeMap attr = node.getAttributes(); String fieldName = attr.getNamedItem("name").getNodeValue(); NodeList children = node.getChildNodes(); for (int j=0; j<children.getLength(); j...
90c93d08-420c-48b7-b08c-9992d9b95b62
9
public static double[][] benchmarkJLargeArraysByteRandom(long[] sizes, int[] nthreads, int iters, String file) { final int[] randIdx = new int[(int) sizes[sizes.length - 1]]; double[][] results = new double[nthreads.length][sizes.length]; long k; Random r = new Random(0); Sys...
019da7d0-8a46-4dbb-9291-8d205e5764e0
7
private void render() { /* System.out.println("x: " + thePlayer.getX()); System.out.println("y: " + thePlayer.getY()); */ switch ( state ) { case INTRO: drawIntro(); break; case MAIN_MENU: drawMain(); break; case LEADERBOARD: drawLeaderboard(); break; case LEVE...
2bd86ee9-b95a-475a-a685-6c63ccc604a2
0
public Boolean isUsed() { return used; }
f5e6de52-39bc-4533-9139-a7c8019a4fec
9
public byte [] getBlock(final int index, final boolean read) { int start=index*BLOCKSIZE; if((index < 0)||(start >= endOffset)) { return null; } if(index < buffer.size()) { Object block=buffer.elementAt(index); if(block != null) { if(block.getClass().isArray()) ...
3593f6a1-4db3-4b58-9f01-b91604a4273c
8
private void checkParagraphType(final CobolToken lastToken) { if (lastToken.getText().equals(".")) { CobolToken prevToken = allTokens.getFromLast(1); if (prevToken.getType() == CobolType.WORD) { String text = prevToken.getText().toLowerCase(); if (text.equ...
623e95ab-b68b-4438-ad83-537eab732f2d
4
private void Summation() { _sum = null; _abssum = null; _counts = 0; for (DataMeme dm : _items) { //_sum = _sum == null ? dm.asDouble() : (_sum + dm.asDouble()); //_abssum = _abssum == null ? Math.abs(dm.asDouble()) : (_abssum + M...
1979a207-b90a-4c79-a224-ba676545a3fc
1
public void save() { try { FileOutputStream out = new FileOutputStream(settingsFilePath); properties.store(out, ".cfg"); out.close(); } catch (IOException e) { e.printStackTrace(); } }
e0235662-714b-4226-924f-f1457140706f
2
public void dumpInstruction(TabbedPrintWriter writer) throws java.io.IOException { writer.println(output[type] + ((count == 1) ? "" : "2") + ((depth == 0) ? "" : "_X" + depth)); }
5d200e20-1e90-47e2-a7c3-efc84dfaa384
8
private final void method428() { if (aBoolean2848) { return; } aBoolean2848 = true; int i = 32767; int j = 32767; int k = 32767; int l = -32768; int i1 = -32768; int j1 = -32768; for (int k1 = 0; k1 < anInt2830; k1++) { ...
433d7a59-edfa-43da-ab28-6df1f592f74c
8
public void draw(Graphics2D g2d) { double res[] = absPos(); AffineTransform tr = AffineTransform.getTranslateInstance(res[0], res[1]); tr.concatenate(AffineTransform.getRotateInstance(Math.toRadians(res[2]))); switch(this.direction){ case 1: g2d.drawImage(ResourceContainer.images.get("/img/systems/en...
75824436-51a5-4462-891f-bbbf165b5ee3
7
public static void printMonstersAndWeapons(ArrayList<Monster> monsters, ArrayList<Attack> weapons){ ArrayList<String[]> monsterNames = new ArrayList<String[]>(); ArrayList<String[]> weaponNames = new ArrayList<String[]>(); for (int i = 0; i < monsters.size(); i++){ monsterNames.add(new String[]{monste...
2ce0e3a5-9d1c-4fba-b59e-d8cd1f3e474b
7
private void handleEnumeratedAttribute(Instances trainInstances) throws Exception { Distribution newDistribution,secondDistribution; int numAttValues; double currIG,currGR; Instance instance; int i; numAttValues = trainInstances.attribute(m_attIndex).numValues(); newDistribution...
e61fb49e-11fc-4fbe-a299-cc7a7bc04cf5
0
public void setjTextFieldAdresse(JTextField jTextFieldAdresse) { this.jTextFieldAdresse = jTextFieldAdresse; }
0e9f8b42-c262-4148-ae35-539071c4c748
9
public static int solution(int[] A) { List<Integer> array = new ArrayList<Integer>(); // Loop for adding all the peaks to the list. for (int i = 1; i < A.length - 1; i++) { if (A[i - 1] < A[i] && A[i + 1] < A[i]) { array.add(i); } } if (array.size() <= 1) { return array.size(); } ...
11622d6b-ff5f-47d6-aea9-2be491dfaa58
9
private void bracketing(PhraseStructure phraseStructure, int start, int end, PhraseStructureNode parent) throws MaltChainedException { int bracketsdepth = 0; int startpos = start-1; for (int i = start, n = end; i < n; i++) { if (input.charAt(i) == STARTING_BRACKET // Start BracketProgLangReader && (i...
fbcae31a-7807-4b8d-bea2-19a2e80dcff6
5
public void stealTown(int t) { // Pour tous les joueurs. for (Player p: players) { // Si le joueur possede la ville. if (p != players[activePlayer]) { if (p.getTowns().contains(towns[t])) { // Si le joueur possede des ressources. if (p.getTotalRessources() != 0) { int randomResource; // Un...
4103720b-a230-47bc-a252-1983105f1657
8
protected void performRound() { // sequential order cells are computed (every round the same order) // boolean to keep track of whether any moves were made in this round boolean energyHasChanged = false; for (int i = 0; i < v.length; i++) { int index = i; // Obtain the energies for the node is its cu...
ff55945f-8999-42a1-8c73-da5af89b206b
6
public static final EMSA_PKCS1_V1_5 getInstance(final String mdName) { final IMessageDigest hash = HashFactory.getInstance(mdName); final String name = hash.name(); if (!(name.equals(Registry.MD2_HASH) || name.equals(Registry.MD5_HASH) || name.equals(Registry.SHA160_HASH) ...
2aa3b41f-98ab-496c-961b-598c98e9a70d
9
public byte[] toByteArray(XCodeGen codeGen, XCompilerOptions options){ codes.add(codeGen); for(int i=0; i<codes.size(); i++){ XCodeGen code = codes.get(i); baos = new ByteArrayOutputStream(); code.getCode(this, options); bytes.add(baos.toByteArray()); } baos = new ByteArrayOutputStream(); DataOutp...
34b6fe55-9dc9-42c9-82ba-c6b02bb52095
6
public static boolean send(CommandSender sender, String [] args){ Player player = null; if (sender instanceof Player) { player = (Player) sender; } if(player != null){ if(!TeamsManager.getInstance().retrievePlayerTeam(player.getName()).equals("")){ String message = ""; //Concat message...
81d0a537-73df-48b2-95ec-c4aa35f3f5af
0
public String wypozyczFilm() { ow.wypozyczFilm(osobaId, filmId); return null; }
0701a868-4460-4a59-b512-b8fdc0c6af7d
7
@Test public void testBasicEncoding() throws IOException { Bin2Hex encoder = new Bin2Hex(); byte[] inputBuffer = new byte[256]; byte[] answer = new byte[(256*3) - 1]; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayInputStream inputStream; for (int index = 0; index < 256; ind...
4870e9a4-73cc-4bb7-8734-d7e7525e50ec
9
@Override public double[] calculateFractal3DWithPeriodicity(Complex pixel) { iterations = 0; check = 3; check_counter = 0; update = 10; update_counter = 0; period = new Complex(); Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel)));...
8f1b6868-3ed6-47c4-aea5-266c132e96cc
8
public void putAll( Map<? extends Long, ? extends V> map ) { Iterator<? extends Entry<? extends Long,? extends V>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Long,? extends V> e = it.next(); this.put( e.getKey(), e.getValue() ); ...
f814b3e2-ec2e-439b-8fc7-db7dba25ed38
5
private boolean isNoisy(Board board, Checker checker, boolean myTurn) { if (!checker.getJumpMoves(board, false).isEmpty()) { if (myTurn && isMyColor(checker)) return true; else if (!myTurn && !isMyColor(checker)) return true; } return false; }
8f865b80-dd79-4d0a-b7d8-afae96fea0a7
0
private void doAesthetics() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { setSize(new Dimension(700, 700)); setResizable(false); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setLocationRelativeTo(null); ...
0616ba7a-cfd6-4ea1-9808-48f3a586c490
8
@SuppressWarnings("deprecation") public synchronized void killCurrentOperation() { Util.println("**** Killing child process"); if (childThread != null) { int count = 0; // try interrupting it first try { while (childThread != null && childThread.isAli...
08da7f38-1320-4e58-afd4-f54ea0f19567
0
@Override public void execute(VirtualMachine vm) { storedValueForPrinting = vm.peekRunTimeStack(); vm.storeRunTimeStack(offset); }
051b2e18-c2a7-45f5-8eb2-1a467de93452
9
protected static int[] randomAttributes(Random rng, boolean[] selected, int m) { int nbNonSelected = 0; // number of non selected attributes for (boolean sel : selected) { if (!sel) { nbNonSelected++; } } if (nbNonSelected == 0) { log.warn("All attributes are selected !"); ...