method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
bc7fb457-89db-44d2-9b51-fb6906ff6007
7
public static void changeCopyState(int copyID, String state) { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.parse(new File("db/DBcopies.xml")); ...
4152bf9f-2374-4126-98d7-58e9ebd45eac
6
public void render() { for (int y = 0; y < height; y++) { ya = y; for (int x = 0; x < width; x++) { if (topped) ya -= 0.3; if (!topped) ya += 0.3; if (ya > height / 2) topped = true; if (ya < 0) topped = false; pixels[x + (int) ya * width] = 0xffFF0000; } } }
ba49295f-3b72-4ece-90e3-281045058918
3
public IntervalAllocationsAlignedToStopsIterator(M allocationDuration, List<? extends BaseInterval<K>> values, Metric<K,M> metric) { this.metric = metric; this.allocationDuration = allocationDuration; this.values = values; startPoint = values.get(0).getStart...
ce0b6223-114e-43ff-a977-ae93ce562975
4
@EventHandler public void onSignChange(SignChangeEvent event){ Player eventPlayer = event.getPlayer(); if(event.getLine(0).equalsIgnoreCase("[starlift]")){ if(!event.getLine(1).isEmpty()){ if(!event.getLine(2).isEmpty()){ int liftID = Integer.parseInt(event.getLine(1)); int floor = Intege...
034c8d99-5fcb-4a31-b533-700ec4747580
5
private void storageMaintenance() { Storage storage = node.getStorage(); long currentTime = System.currentTimeMillis(); synchronized (storage) { for (StorageEntry entry : storage.values()) { if (entry.isExpired()) s...
bc9884d6-dd59-4b2b-92ac-2a376ebee026
2
public void enable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (isOptOut()) { configuration.set("opt-out", ...
2d034e1a-36ab-4cfa-8621-eae07c330956
2
public void createServer(int inPortNumber){ if(inPortNumber <= 0){ inPortNumber = DEFAULT_PORT_NUMBER; } portNumber = inPortNumber; try { serverSocket = new ServerSocket(portNumber); } catch (IOException e) { System.out.println("Порт занят: ...
6b5d15dc-f8f7-479d-9258-0933cf750979
9
public void levelPlayer() { Random random = new Random(); // Levels up player starting from 1 to current level. for (int i = 1; i < level; i++) { // CON, EVD, HIT, LUK, SPD, and STR has a 50% chance to increase by 1 per level // HP has two chances to ...
fcbc6c87-a169-4fc8-850c-a72d2d7384bc
6
public static long[] findKUglyNums(int k) { int idx2 = 0; //store the last index whose value multipy 2 is bigger than the biggest ugly number in array int idx3 = 0; //store the last index whose value multipy 3 is bigger than the biggest ugly number in array int idx5 = 0; //store the last index whose value multipy...
e7594117-7dfc-4e7d-a010-6ad63cb924ac
0
public int getF() { return f; }
f72b9be3-b00e-4bdf-b713-570b6fd14aa5
3
@Override public void run() { // keep receiving messages and handling them. handlers are supposed to // send the acknowledgement message try { outputStream = new ObjectOutputStream( connectionSocket.getOutputStream()); inputStream = new ObjectInputStream( connectionSocket.getInputStream()); me...
64ecb27d-fd54-4101-9355-a5db97d6b96b
1
public boolean IsEmpty(int colonne, int rangee){ if(emplacement.getCoordoneeJeu().get(rangee)[colonne]==false) return true; return false; }
61eac9fc-3a9c-4141-9169-00e542530079
8
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { String parm = (commands.size() > 1) ? CMParms.combine(commands,1) : ""; if((!mob.isAttributeSet(MOB.Attrib.AUTOEXITS) && (parm.length()==0))||(parm.equalsIgnoreCase("ON"))) { mob.setAttribute(MOB.A...
c3de0435-7816-4f06-b181-d36667e960de
4
@Test public void testGetPartsFromLines() { String fileName = "CsvImportTestFile.txt"; File testFile = TextFileImporterTest.getTestFile(fileName); boolean fileNotFoundException = false; CsvImporter csvImporter = null; try { csvImporter = new CsvImporter(testFile); } catch (FileNotFoundException e) { ...
83b32f05-a4f9-4a17-a23b-69c7f22a53ab
5
private Field checkAndAdd(List<Field> queue, List<Field> env, Field f) { for (Field t : env) { if (!used[t.getPosition()] && t.isEmpty() && !(t instanceof BorderField)) { used[t.getPosition()] = true; queue.add(t); predecessor[t.getPosition()] = f; ...
742c95f2-503f-4422-be54-2475e251bc2b
3
public boolean disjointAbove(RPChromosomeRegion testRegion) { if (startChromID > testRegion.endChromID || startChromID == testRegion.endChromID && startBase >= testRegion.endBase) return true; else return false; }
93527236-6e37-40c9-967e-c148e2fe69de
0
public void setEmailPer(String emailPer) { this.emailPer = emailPer; }
5013a3e5-bfba-48ea-946a-34913bb4a301
4
public void clickedMouse(Point p) { int x = (int) (p.getX() / tileSize); int y = (int) (p.getY() / tileSize); int objLocX = (int) ((p.getX() - (x * tileSize)) / (tileSize / 3)); int objLocY = (int) ((p.getY() - (y * tileSize)) / (tileSize / 3)); int objLoc = (objLocY * 3) + objLocX; int fenceLocX = ...
a83f4e7c-3af8-4b51-98df-348ed45a0bba
4
public String mode_string() { switch (h_mode) { case STEREO: return "Stereo"; case JOINT_STEREO: return "Joint stereo"; case DUAL_CHANNEL: return "Dual channel"; case SINGLE_CHANNEL: return "Single channel"; } return null; }
2e779a5e-0db9-44f0-a226-a2a38d19acd5
1
static boolean ensurePlayer(CommandSender sender) { if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + "You must be a player to use this command"); return false; } return true; }
3cd72318-1c43-41b4-86a9-0fe0a2f03e1e
4
public static int sizeOfUnsigned(int value) { return (value < (1 << 7) ? 1 : (value < (1 << 14) ? 2 : (value < (1 << 21) ? 3 : (value < (1 << 28) ? 4 : 5)))); }
f51344e0-c84e-4ce7-ba8a-7b8d23cfaa51
9
@Override public void affectCharStats(MOB affectedMOB, CharStats affectableStats) { for(final int i: CharStats.CODES.BASECODES()) { if(stats[i]!=0) { int newStat=affectableStats.getStat(i)+stats[i]; if(newStat<1) newStat=1; if(adjustMax) affectableStats.setStat(CharStats.STAT_MAX_STREN...
fc3b4050-d276-4adc-8be6-18e40570881a
4
public void start() { this.loginDialog = new LoginDialog(); this.loginDialog.setAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // um einen fehlerhaften Usernamen erneut eingeben lassen zu koennen. if (!GUI.th...
cb8b0c75-d3c0-41ec-ac8d-345ffbeeb966
1
private static Map<String, Object> serializeCustom(Class<?> clazz, Map<String, Object> customData) { Map<String, Object> data = new HashMap<String, Object>(); data.put("T", "L"); data.put("class", clazz.getName()); data.put("data", customData); return data; }
7d90e361-08d7-404b-b8b4-4c18b0088a6e
3
@Override public void updateIllness(IllnessDTO illness) throws SQLException { Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.update(illness); session.getTransaction().commit(...
7f6cd83c-a141-45ba-8a4c-344b86267231
8
public SoccerMatch(int matchType, Playmode playmode) { super(matchType, playmode); this.pressedKeys = new HashSet<>(); this.lastContactUserID = -1; this.playerAnimationTimer = 6; this.ballSpeedRun = 5.0; this.ballSpeedShoot = 9.0; this.ballSpeedReduction = 0.2; this.animationStand = "STAND"; this.anim...
a5457f41-2d2c-4b2e-b28e-e2141dd45531
7
public void rotarAdelanteDerecha() { if (direccion.equals(Direccion.derecha)) { rotar(tipoTrans.enZ, 45); } else if (direccion.equals(Direccion.adelante)) { rotar(tipoTrans.enZ, -45); } else if (direccion.equals(Direccion.atras)) { rotar(tipoTrans.enZ, 135); ...
505cd84d-0e63-4b2e-a907-72aa0a5bb2da
8
public void writeTable(Map table, boolean reversed) { if (!isReachable() && (Main.stripping & Main.STRIP_UNREACH) != 0) return; if (getAlias().length() != 0) { String name = getName(); Identifier outer = getParent(); while (outer != null && outer.getAlias().length() == 0) { if (outer.getName().leng...
0c59df94-de9b-466b-9907-b6cf20c15926
3
public int lookupToken(int base, String key) { int start = SPECIAL_CASES_INDEXES[base]; int end = SPECIAL_CASES_INDEXES[base+1]-1; while (start <= end) { int half = (start+end)/2; int comp = SPECIAL_CASES_KEYS[half].compareTo(key); if (comp == ...
7cb9e2bb-771f-4fd2-b6f2-56eb8cfb3397
2
public static void drawPlayersAtMinimap(GOut g, Coord tc, Coord hsz) { if(UI.instance.minimap == null) return; synchronized (UI.instance.minimap.players) { for (Pair<Coord, Color> arg : UI.instance.minimap.players) { Coord ptc = arg.fst.div(tileSize).add(tc.inv()) .add(hsz.div(2)); g.chcolor(Color....
e8b8f3d8-1605-4088-8f81-80cc5f310648
5
private void count(String input) { char prev = 0; char current = '0'; int count = 1; for (int i = 0; i < input.length(); i++) { current = input.charAt(i); if (i != 0) { prev = input.charAt(i - 1); if (current == prev) { count++; } } if ((i >= input.length() - 1) || (current != input...
c2af30cf-0ff5-4f9a-af6f-d2f067253497
7
public static HashSet<Integer> randomInts(int size, int range, int ... notThese) { Random r = new Random(); HashSet<Integer> hs = new HashSet<Integer>(size); while(hs.size() < size) { // while(hs.add(r.nextInt(range)) != true) // ; while(true) { int x = r.nextInt(range); boolean cont = false...
c7e86c52-db5e-4976-80ad-0486fb79efb2
5
public static int getPosIndex(char tag) { switch(tag) { case 'N': return 1; case 'V': return 2; case 'A': return 3; case 'R': return 4; case 'O': return 5; } return -1; }
44e65b4f-9e1b-4498-98ae-60cf65a9505c
0
protected JTable initParseTable() { return null; }
fe999baf-9203-4afc-916b-532979c37fce
5
public void run() { try { while(true) { String loop; boolean first = true; loop = br.readLine(); // File is ready to be sent from the sender's end PrintWriter fileWriter = new PrintWriter(new BufferedWriter(new FileWriter(file))); while(true) { loop = br.readLine(); if(loop.equals(Config....
9b687358-75c1-4920-b02f-fa5ccc85f0b8
3
@Override public void onTurnEnded(final Event e) { radar.execute(state); if (!radar.isInitialScan()) { if (!doMove) { gun.setNextPosition(state.robotPosition); } else { move.execute(state); gun.setNextPosition(move.getNextPosition()); } if (doFire) { gun.execute(state); } } execu...
7dd652d0-9ffe-41c8-a635-c004465f4c45
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Physical target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY); if(target==null) return false; if(!(target instanceof Item)) { mob.tell(L("You can't cast this...
b8b6a679-97eb-48c2-a286-fbae210d4175
3
public int logOut(String username){ try { String host = "localhost"; socket = new Socket(host, 2001); in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new PrintWriter(socket.getOutputStream(), true); } catch (IOEx...
0bdfc65b-e1c9-4207-946c-8fc5d7acd7ad
1
public Document buildValidMovesList(Document document, Element root, ReversiBoard board) { Element validMovesElement = document.createElement("valid_moves"); for (int i = 0; i < board.getValidMoves(board.getCurrentPlayerNum()).size(); i++) { Element position = document.createElement("move_" ...
ab9e3163-58b7-4ed6-a2ab-ae47e0e833e9
8
public void run(){ String col = Ejecutable.getControl().getGui().getIdColeccion().getText(); String em = Ejecutable.getControl().getGui().getIdEmision().getText(); String rut = Ejecutable.getControl().getGui().getRutaCarpeta().getText(); if(col == "" || em == "" || rut == ""){ ...
c3109920-c77d-41c5-9152-596ecf0d32df
6
public void freeSpills() { ArrayList<Value> permanentDeletions = new ArrayList<Value>(); for(Value v : adjacencyList.keySet()) { if(v instanceof Fetch) { if(((Instruction)v).getUseCount() <= 1) { // placeholder color to access it directly ...
f12252d9-abf7-4421-a899-cae9598ddc2b
9
private void jComboBox_NymsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_NymsActionPerformed System.out.println("In Action for NYM Combo Main tab"); /*String nymID = Utility.getKey(nymMap, (String) jComboBox1.getSelectedItem()); String assetID = Utility.getKey(asse...
64688757-c682-41cb-b2f9-db613ee65278
6
public void run() { isRunning = true; startTime = System.currentTimeMillis(); while (isRunning) { try { Thread.sleep(100); if (!isPause) { if (audioClip != null && audioClip.isRunning()) { labelRecordTime.setText(toTimeString()); int currentSecond = (int) audioClip.getMicrosecond...
8f4622a4-047f-4de4-b815-635ee4a0c239
1
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((deviceGroup == null) ? 0 : deviceGroup.hashCode()); return result; }
5fbf2ad3-226e-4d0c-bbde-0925bedccf29
2
public int getInt(String key) { try { if(hasKey(key)) return ((NBTNumber<Integer>) get(key)).getValue(); return 0; } catch (ClassCastException e) { return 0; } }
17b1503f-9f82-4724-8c76-70607b86e193
3
private void comboCidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboCidadeActionPerformed String item = String.valueOf(comboModelCidade.getSelectedItem()); if(item.equals("Selecionar ...") || item == "null"){ System.out.println("Olá"); if(listaChei...
42420295-9dd4-4114-9679-4cade503ff02
8
public Property sequence(final Property p) { return fromGen(gen().bind(p.gen(), new F<Result, F<Result, Result>>() { public F<Result, Result> f(final Result res1) { return new F<Result, Result>() { public Result f(final Result res2) { return res1.isException() || res1.isProven() ...
87cff8f4-ce1c-417a-9716-030161da7ece
0
public Set<Person> getPersons() { return this.persons; }
56779c94-7b02-4b8f-8b47-94afe3cc59d5
7
public void process(StringReader reader) throws StringReader.EOFException { char ch; switch (state) { case Init: ch = reader.read(); if (ch == 'a') { state = State.AfterA; accum.append(ch); } ...
5c54ec54-ec26-4a62-a361-adfdb8e6642b
0
public SimpleStringProperty stateNameProperty() { return stateName; }
e7afa3cb-7eb5-460f-b91b-b983aae8c096
6
public void update(int delta) { x = oX - Playing.offsetX; y = oY - Playing.offsetY; //Changes stages depending on time. if (time.day() && justTicked && finishedGrowing == false) { state += 1; justTicked = false; System.out.println("Plant state: " + state); if (state == seed.length - 1) { ...
a4ef049d-31f8-4828-ac85-485a2657ed64
4
protected void setup() { Object[] args = getArguments(); ContainerController cc =(ContainerController)args[0]; TreeMap<Integer, TreeSet<Integer>> noeuds = (TreeMap<Integer, TreeSet<Integer>>)args[1]; Object[] o1 = new Object[3]; Object[] o2 = new Object[3]; Object[] o3 = new Object[3]; Set<Integer> no...
4a0bd36b-5b8a-43b7-b88f-1b7e7ba8d59b
2
void init() throws FileNotFoundException { writer = new PrintWriter(fileName); for (int p = 0; p < this.parameterNames.length; p++) { writer.print(this.parameterNames[p] + " "); } for (int p = 0; p < this.effNames.length; p++) { writer.print(this.effNames[p] + " "...
c4060f80-2595-416a-9559-1331543edde9
0
public void setLibelle(String libelle) { this.libelle = libelle; }
21c49054-003f-4bd3-94d3-279aa0904a0b
7
public boolean save(DisplayTable table) { Connection conn = null; PreparedStatement st = null; ResultSet rs = null; try { conn = getConnection(); st = conn.prepareStatement(SAVE_TABLE, Statement.RETURN_GENERATED_KEYS); st.setInt(1, table.getId()); ...
9e65c54b-c3d9-4f26-beb4-ffdd964117b4
1
@Test public void setInstanceSupplier() { Function<Class<?>, Object> provider = t -> Mockito.mock(t); Injector.setInstanceSupplier(provider); Object mock = Injector.instantiateModelOrService(Model.class); assertTrue(mock.getClass().getName().contains("ByMockito")); Injector.r...
7a1cbfba-9263-4a9a-88bd-988f28a88334
0
public static void runFrameCreateAlgo(){ frames.runFrameCreateAlgo(); frames.getFrameCreateAlgo().setVisible(true); }
baf82256-e6e8-46ef-838f-a5f5d0206bba
9
public AvaliacaoItem() { this.tablemap = new HashMap<String, Method[]>(); try { Method[] ids = new Method[] { AvaliacaoItem.class.getMethod("getIdAvaliacaoItem", new Class<?>[] {}), AvaliacaoItem.class.getMethod("setIdAvaliacaoItem", new Class<?>[] {this.idAvaliacaoItem.g...
d30ba92d-f265-4f73-8450-b507d2ff3c77
1
Agent dequeue() { if (_size < 1) throw new java.util.NoSuchElementException(); Agent rval = _head.next.agent; _head.next = _head.next.next; _size--; return rval; }
b880000e-88b4-43db-a6fa-b7822b81f04f
6
private static Image getImage(String filename) { // to read from file ImageIcon icon = new ImageIcon(filename); // try to read from URL if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) { try { URL url = new URL(filename); ...
8dfa63ca-fc88-41ae-b8b1-9e4693f79f92
9
public void deleteServices(int serviceToRemove){ Iterator<Service> i = services.iterator(); while(i.hasNext()) { Service nextService = i.next(); switch(serviceToRemove) { case ENGINE_OIL: if(nextService instanceof EngineOil) { i.remove(); cont...
6ddc9161-8e36-4564-85d0-266791f1d4d9
4
public boolean isWithinObject(Point point) { int enemyX = getPixelPosition().getX(); int enemyY = getPixelPosition().getY(); int width = Board.getSquareWidth(); int height = Board.getSquareHeight(); int pointX = point.getX(); int pointY = point.getY(); // if poin...
7c24d1a9-1dbb-4ce9-8bff-03201f821b7b
2
public Grid() { // for(int y = 0; y < getHeight(); y++) { for(int x = 0; x < getWidth(); x++) { array[x][y] = new Tile(); } } }
52accff1-6ab0-4802-8ad5-9c7a87db8335
0
public void automataNoteChange(AutomataNoteEvent e){ setDirty(); }
18b6c308-e238-40a3-8c97-b0938218b36a
2
public void testForFields_time_HSm() { DateTimeFieldType[] fields = new DateTimeFieldType[] { DateTimeFieldType.hourOfDay(), DateTimeFieldType.secondOfMinute(), DateTimeFieldType.millisOfSecond(), }; int[] values = new int[] {10, 30, 40}; L...
7bb8e614-596a-4f74-8546-fda483c97afd
1
public DialogHero(core.Hero h1, core.Hero h2) { super(); hide(); setObjectName("dialog"); QFrame line = new QFrame(); line.setMinimumHeight(1); line.setObjectName("hline"); hero1 = h1; if (h2 == null) { h2 = new core.Hero("Zwolnij jednostki", null); //h2.setUnits(new ArrayList<core...
72e7e33d-f230-4fec-a349-4cf8578a41d7
7
private String getStringFromColor(Color color) { String string = "X"; int rgb = color.getRGB(); if (rgb == Figure.COLOR_FIGURE_I.getRGB()) { string = "R"; } else if (rgb == Figure.COLOR_FIGURE_T.getRGB()) { string = "Y"; } else if (rgb == Figure.COLOR_FIGURE_O.getRGB()) { stri...
a156dc39-907d-4640-9124-4a38f7f4ac95
0
@Override public void initializeService() throws Exception { this.initStations(); this.initSeatTypes(); this.initCarTypes(); this.initTrainNumber(); super.initializeService(); }
79046d42-f03b-4c08-a7f0-0cf85e35e743
1
public static YamlConfiguration toFile() { YamlConfiguration yaml = new YamlConfiguration(); for (Msg msg : values()) { // MISC_NO_PERMISSION will become misc-no-permission String key = msg.name().replace("_","-").toLowerCase(); yaml.set(key, msg.value); } ...
de0b2e91-1262-42d6-a13e-5d3a3cac64aa
1
public boolean isPathValid(File targetDir) { if (targetDir.exists()) { File launcherProfiles = new File(targetDir, "launcher_profiles.json"); return launcherProfiles.exists(); } return false; }
b46c23a4-9e6f-4b0a-98fe-a41691811dbe
1
public void visit_if_acmpeq(final Instruction inst) { if (longBranch) { final Label tmp = method.newLabel(); addOpcode(Opcode.opc_if_acmpne); addBranch(tmp); addOpcode(Opcode.opc_goto_w); addLongBranch((Label) inst.operand()); addLabel(tmp); } else { addOpcode(Opcode.opc_if_acmpeq); addBranc...
a55dc51c-1364-4288-a0e0-96b8954a5427
4
public void actualiza() { switch (direccion) { case 3: { carro.setPosX(carro.getPosX() - 5); break; //se mueve hacia abajo izquierda } case 4: { carro.setPosX(carro.getPosX() + 5); break; //se mueve hacia ...
fe6521dc-3d1d-4a74-a52a-63d6f558d582
6
public boolean getBoolean(int index) throws JSONException { Object object = this.get(index); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String)object).equalsIgnoreCase("false"))) { return false; } else if (object.equals(Boolean....
dd9c1e7a-76a9-46da-a6fd-0b5ee42087b9
8
public String toString(){ StringBuffer sb = new StringBuffer(); switch(type){ case TYPE_VALUE: sb.append("VALUE(").append(value).append(")"); break; case TYPE_LEFT_BRACE: sb.append("LEFT BRACE({)"); break; case TYPE_RIGHT_BRACE: sb.append("RIGHT BRACE(})"); break; case TYPE_LEFT_SQUARE: ...
6caf8f98-908e-43d4-a450-2ab8c8e8fdc5
4
@Override public synchronized int read() throws IOException { if (in == null) { if ((in = nextLine()) == null) { return -1; } } else if (in.available() <= 0) { try { return -1; } finally { in = null; } } return in != null ? in.read() : -1; }
549dfe09-2332-4a3f-844b-feb7d18ce06e
0
public LockManager(String localhost, String memberid) { this.localhost = localhost; this.memberid = memberid; }
a2a31c3b-1f75-4de7-91f0-7ccf7745b469
7
public void update() { // Collision with window's boundaries if(xPos < 0) xPos = 0; if(xPos > GamePanel.WIDTH - 64) xPos = GamePanel.WIDTH - 64; if(yPos < 0) yPos = 0; if(yPos > GamePanel.HEIGHT - 64) yPos = GamePanel.HEIGHT - 64; xPos += xVel; yPos += yVel; currentHappinessLevel -= 0.05; if...
7a1314d3-bbe4-412c-8501-032df065d0ec
9
public void InsertarFicha(int posicion,Ficha fic) { switch (posicion) { case 1:tablero[0][0]=fic; break; case 2:tablero[0][1]=fic; break; case 3:tablero[0][2]=fic; break; case 4:tablero[1][0]=fic; break; case 5:tablero[1]...
f868038e-92a8-4be6-b5a0-f409b8dbc625
7
@Override public EnvironnementAbs run(EnvironnementAbs env) { Random rand =new Random(); int i,j; do{ i = rand.nextInt(3) -1; j = rand.nextInt(3) -1; }while((pos_x+i < 0 || pos_x+i >=env.taille_envi) || (pos_y+j<0 || pos_y+j >= env.taille_envi) || env.grille[pos_x+i][pos_y+j] != null || (i==0 && j==0)); ...
7e35ead4-a643-4814-b5e1-8c48c04c0123
1
public void setName(String name) throws RuntimeException { String oldname = getName(); if (name.equals(oldname)) return; // check this in advance although classNameChanged() below does. classPool.checkNotFrozen(name); ClassFile cf = getClassFile2(); super.set...
301c9e59-c135-4e32-a500-b22234a48ff4
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Event other = (Event) obj; if (eventId.equals(other.eventId)) return false; return true; }
9e371ac2-23fb-4378-bbd5-570021399f52
3
private void showErrorScreen() { Graphics g = getGameComponent().getGraphics(); g.setColor(Color.black); g.fillRect(0, 0, 765, 503); method4(1); if (loadingError) { aBoolean831 = false; g.setFont(new java.awt.Font("Helvetica", 1, 16)); g.setCol...
510c9225-06c9-453d-a23c-69c8b883959f
0
public void fileRenamed(int arg0, String arg1, String arg2, String arg3) { // IGNORE }
7ad8d501-f219-46ca-927a-74ab38071128
7
private void updateVillains() { ArrayList<Villain> deadVillain = new ArrayList<Villain>(); for(int i = 0; i < villains.size(); i++) { Villain v = villains.get(i); v.move(); if(CollisionDetector.isColliding(v, sc)) { if(!sc.isShieldActive()) sc.damaged(v.getStrength()); else s...
c1d8da9e-d31d-4bf4-921a-46878fead08d
9
private static void testColorValueRange(int r, int g, int b, int a) { boolean rangeError = false; String badComponentString = ""; if (a < 0 || a > 255) { rangeError = true; badComponentString = badComponentString + " Alpha"; } if (r < 0 || r > 255) { rangeError = true; badComponentString = badCom...
ff78ddfa-1aff-4c15-9d47-e2b6e4587e38
7
public void preprocess() { PatrolState s1 = new PatrolState(); FollowState s2 = new FollowState(); EatState s3 = new EatState(); Transition s1tos2 = new Transition(s2) { @Override public boolean isValid(Agent a, Scene w) { for (Body b : w) { if ((b != a.body()) && (_targetFilter.filter(b))) { ...
619be924-0242-47a9-96ba-2281908d42f0
0
public void setName(String name) { this.name = name; }
01ed5d5d-ea55-489e-8ed2-adc2df25eca6
7
private void test(String testPath) throws IOException { int hit = 0; int total = 0; BufferedReader scanner = null; try { scanner = new BufferedReader(new FileReader(new File(testPath))); //new Scanner(new File(testPath)); } catch (FileNotFoundException e) { ...
3ebf95ae-720c-4435-925d-52f885b00cda
2
public InnerClassInfo getOuterClassInfo(ClassInfo ci) { if (ci != null) { InnerClassInfo[] outers = ci.getOuterClasses(); if (outers != null) return outers[0]; } return null; }
4da3cdbf-f079-440a-8dca-f5e414a7b5d6
3
public boolean lepes(){ if(szabalyose() && tablanvan() && nemfoglalt()) return true; return false; }
83cc7049-18f4-4766-9b97-769345585421
9
static private int jjMoveStringLiteralDfa8_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(6, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(7, active0); return 8; } switch(curChar) { cas...
11b7556f-3360-4d4c-91c2-7a99a4f20e9c
2
@Override public Map<String, Object> serialize() { Map<String, Object> data = Maps.newHashMap(); try { for (Field f : getClass().getDeclaredFields()) { data.put(f.getName(), f.get(this)); } } catch (IllegalAccessException e) { e.printStackT...
77444c2a-be15-4c9a-8528-896ff404ed82
2
TimelineItemView(Timeline.TimelineItem item) { date = DateView.formatDate(item.getDate()); interval = DateFormatEx.formatDate(item.getDate()); stats = new ArrayList<StatView>(); for (Stat st: item.getStats()) { stats.add(st == null ? null : new StatView(st...
08e94706-16ab-4016-b2d1-f838d19f24ec
2
private void jBtnBorrarVentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnBorrarVentaActionPerformed // TODO add your handling code here: try { jTextFieldFind.setText("Buscar por Empleado"); String sql = "DELETE FROM ventas WHERE idventas = ? "; ...
f02a30d8-1383-43ec-b471-b59279570685
1
private double cosineSimilarity(double[] a, double[] b) throws ClusterException { double dot= this.dotProduct(a, b); double normProduct= this.getNorm(a) * this.getNorm(b); if (normProduct == 0) throw new ClusterException("Can't compute cosine similarity on arrays with all zeros!"); return dot / normPr...
a8fef076-da07-4956-84ea-a17c617fa670
5
public void updatePriority(int priority) { if (this.priority < priority) { this.priority = priority; } if (this.priority == -1 && this.packInfo != null && this.packInfo.isComplete()) { if (this.packInfo.isOfficial()) this.priority = 5000; else...
394b93dd-9c75-4c0b-87ab-fafcf45e39ac
0
public String getValue() { return value; }
cef884bf-2cb9-4974-8788-19a4e1677be7
2
public DatabaseConnection(String propFile){ properties = new ServerProperties(propFile); try { Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException cnfe) { if( debug ) System.out.println("Error in DataBaseconnection(): "+cnfe.getMessage()); } }
21219b4e-1e7d-4a19-ac8d-0975ea7680d3
7
String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){ try { Object o1 = session.getAttribute("UserID"); Object o2 = session.getAttribute("UserRights"); boolean bRedirect = false; ...
a7ccf831-f3a9-42e4-b6d5-9be396cd6000
2
private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed //Cria um novo projeto e seta o ID do projetoque sera excluido Projeto projeto = new Projeto(); int CodProjeto = Integer.parseInt(txtCod.getText()); projeto.setIdProjeto(...