method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b5449983-55b6-4173-bf96-e2409438644b
7
public static void Command(CommandSender sender, String[] args) { if(sender.hasPermission("gm.adventure.others")) { Player target = Bukkit.getPlayer(args[1]); if(target != null) { if (target.getGameMode() != GameMode.ADVENTURE) { target.setGameMode(GameMode.ADVENTURE); if(sender instance...
dc7f619f-b7f0-44c1-96aa-d445a4d02e28
9
@Override public boolean tick(Tickable ticking, int tickID) { if((tickID==Tickable.TICKID_MOB)&&(ticking instanceof MOB)) { final MOB mob=(MOB)ticking; if(mob.charStats().getCurrentClass().ID().equals(ID())) { int exp=0; for(final Enumeration<Ability> a=mob.effects();a.hasMoreElements();) { ...
42c427f0-4b5c-426f-a4a7-d4952074311a
7
public Tile(TILE itsID, int mapRelX, int mapRelY, SpriteSheet spritesheet) { //Salvando os dados: id = itsID; posRelToMap = new Vector2f(mapRelX, mapRelY); //Calculando a posição para desenho: colisionRect = new Rectangle((mapRelX * TILE_SIZE), (mapRelY * TILE_SIZE),...
99eaac58-51df-4f5b-bbba-94ed4a34bc89
7
private DisplayMode getBestDisplayMode() { ArrayList modes = new ArrayList(); modes.addAll(Arrays.asList(fullScreenDevice.getDisplayModes())); Collections.sort(modes, new DisplayModeComparator()); DisplayMode bestMode = null; int i = 0; while(bestMode == null) { ...
1555e3a0-90c7-42a3-b99c-81b3d95937fa
4
public String toString() { int endIndex = 0; LinkedElement<?> elem = first; StringBuffer sb = new StringBuffer(); for (int j = 0; j < total; j++) { for (int i = 0; i < endIndex; i++) { elem = elem.getNext(); } sb.append("LinkedList[" + j + "] = " + elem + "\t(finder: " + findElement(j) + ")"); i...
4b7844d1-e150-474e-8833-f41ef488bf32
3
public BoundaryView (BoundaryField.TYPE type,int x, int y) { BufferedImage img = null; try { if(type == BoundaryField.TYPE.HORISONTAL) img = ImageIO.read(new File("src\\jark\\h_board.png")); else if (type == BoundaryField.TYPE.VERTICAL) im...
a5424183-7f2e-4aca-9e51-d2ca9ee775ac
3
public Nodo sucessor(Nodo nodo){ if(nodo.getRight() != null){ return minimo(nodo.getRight()); } else{ Nodo nodoAux = pai(root, nodo.getKey()); while(nodoAux != null && nodoAux.getRight() == nodo){ nodo = nodoAux; nodoAux = pai(r...
c5596acf-336a-4213-862f-c1dc3f21db93
8
public int letterConverter(String letter){ int pos = 0; switch(letter){ case "a": pos=0; break; case "b": pos=1; break; case "c": pos=2; break; case "d": pos=3; break; case "e": pos=4; break; case "f": pos=5; break; case "g": pos=6; break; case "h": pos=7; break; ...
b7806ea2-6c9c-4dd4-83c8-f996f9b41aa5
1
public void addBlockType(StringTokenizer tokens) { int tokenCount = tokens.countTokens(); String[] settings = new String[tokenCount+1]; String line = ""; for (int i = 0; i < tokenCount; i++) { settings[i] = tokens.nextToken(); line += " " + settings[i]; } ...
a3ce6c49-ea52-49f0-9ad6-d2f4bd6eb21d
4
@Override protected void init() { try { // check to see if the user is using a InputStream. This is // here for backwards compatibility if (dataSourceStream != null) { final Reader r = new InputStreamReader(dataSourceStream); setDataSourceR...
d129bd7e-bb65-42c5-ac5c-3539099be0d5
8
public void finishSessionInit(ServerCnxn cnxn, boolean valid) { // register with JMX try { if (valid) { serverCnxnFactory.registerConnection(cnxn); } } catch (Exception e) { LOG.warn("Failed to register with JMX", e); } try...
ab49d810-07e9-4288-b153-93f34b54d0db
5
@Override public void run() { System.out.println("asa1"); byte[] data=new byte[1024]; BufferedOutputStream captureOutputStream = null; try { captureOutputStream=new BufferedOutputStream(socket.getOutputStream()); } catch (IOException ex) { return; ...
83edc735-a3cf-4a1f-abfb-99d2b7893489
3
@Override public void performEvent(SimulationEvent reaction, int times) { if (printToLogInfo) log.info("SIRAmountManager - performEvent reps="+times); eventsJustDone = new ArrayList<>(); for (int i = 0; i < times; i++) { EventDone ev = model.performEvent(reac...
b448704a-8221-42f7-98df-1e6ce1b3babd
3
public void reportToStdOut() { int maxLength = getMaximumStringLength(); StringBuilder reporter = new StringBuilder(); reporter.append(padTo("", maxLength)); for (int x = 0; x < dataSource.getMaxTargetNode(); x++) { reporter.append(padTo(Integer.toString(x), maxLength)); } reporter....
fe69e314-47ee-42fd-88b0-351f1bc01812
9
private void afterChange(MenPoint whereChangeOccured) { boolean newHorizontal = whereChangeOccured.isHorizontalMill() && !this.horizontalMillDetection; boolean newVertical = whereChangeOccured.isVerticalMill() && !this.verticalMillDetection; if (this.newMillsDetectionListener != null && (newHo...
81c331e3-ba07-4a45-9255-51c7467dc18f
3
public Symbole identifier(Entree e){ Region r = new Region(1,1,null); //Recherche de l'entrée if(listeBloc.get(r).containsKey(e)) return listeBloc.get(r).get(e); r = region_actuelle; /*new Region(num_bloc, num_imbrication, region_actuelle.getParent());*/ if(r...
7f44498e-bac7-4155-b424-b6ad2505f978
3
@WebMethod(operationName = "ReadInvoiceInDetail") public ArrayList<InvoiceInDetail> ReadInvoiceInDetail(@WebParam(name = "inv_in_det_id") String inv_in_det_id) { InvoiceInDetail inv_in_det = new InvoiceInDetail(); ArrayList<InvoiceInDetail> inv_in_dets = new ArrayList<InvoiceInDetail>(); ...
d793d133-47d3-4b25-b5a7-8ddc08d93d63
7
private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed Loja lj = new Loja(); if (!(txCodigo.getText().equals("")) || (txCodigo.getText().equals(null))){ lj.setId_loja(Integer.parseInt(txCodigo.getText())); } if...
42985ff4-a393-4da9-a1e7-8926c948604a
1
private int evalState(State s) { if (me.equals("red")) return s.getnRed(); return s.getnBlue(); }
29b3e366-8ffd-460f-944a-c6fac677842b
6
private boolean fundamentalRule() { boolean change = false; for(int i = 0; i < chart.size(); i++) { final Edge e = chart.get(i); if(e.isActive()) { for(int k = 0; k < chart.size(); k++) { final Edge e2 = chart.get(k); if(!e2.isActive() && e.matches(e2)) { fina...
4f24b089-9ac6-4e80-8246-c8e0ce2d33be
9
public CheckUrls(String pPath) { try { BufferedInputStream in = new BufferedInputStream(new FileInputStream(pPath)); StringWriter out = new StringWriter(); int b; while ((b=in.read()) != -1) out.write(b); out.flush(); out.close(); in.close(); ...
2f02431d-5534-40ab-a82e-0e130086d8c3
4
private void textVenceKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textVenceKeyTyped // TODO add your handling code here: if (!Character.isDigit(evt.getKeyChar()) && evt.getKeyChar() !='-' && !Character.isISOControl(evt.getKeyChar())) { Toolkit.getDefaultToolkit()...
0a13993c-664a-4857-8af0-0eaa2119ef3e
2
public JSONArray names() { JSONArray ja = new JSONArray(); Iterator keys = keys(); while (keys.hasNext()) { ja.put(keys.next()); } return ja.length() == 0 ? null : ja; }
9d59bd0e-e1b7-4c90-b5bf-9eb837b403e3
9
@Override protected synchronized Class<?> loadClass(String sClassName, boolean bResolve) throws ClassNotFoundException { logDebug(LogArea.CLASS, "LOADING %s (resolve=%b)", sClassName, bResolve); // Each thread must have THIS class loader set as a context class loader. // This is req...
8cf4389e-37f1-4d7c-944e-3625fd8b382f
1
@Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { activateControllers(); } }
f0e62ded-33ca-4935-85e3-6325d26169fc
5
public static void main(String[] args) { int x, y, r; x = Integer.parseInt(JOptionPane.showInputDialog("Ingrese un Valor Entero para 'X':")); y = Integer.parseInt(JOptionPane.showInputDialog("Ingrese un Valor Entero para 'Y':")); if ((x <= 0) || (x > 255)) { r...
ca540168-ac7c-413f-ad2d-bece13269cdf
4
public static void main(String[] args)throws IOException { double finalAnswer=-99; double finalShortPeriod=0; double finalLongPeriod=0; double finalPercDif=0; double[] PortfolioValue=new double[60*260]; double[] BaseValue=new double[60*260]; double[]...
80094890-cfc3-4153-9cca-3833812891df
9
public void executeCipher(String code) { String extraValue1 = ""; String extraValue2 = ""; if(!specialCipher && cipherInformation.length == 2) { extraValue1 = argument1Input.getText().trim(); } if(!specialCipher && cipherInformation.length == 3) { extraVal...
b3583ec4-5a5c-459b-82d2-c185de4e1f0f
9
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (args.length == 0) { if (player == null) { sender.sendMessage(ChatColor.RED+"This command can o...
5a430718-08f2-435f-b9e3-89f303d206c9
7
private static <E> Map<String, String> updateProperties(Set<Entry<E, E>> updatedProperties) { Map<String, String> modifiedProperties = new TreeMap<String, String>(); if (null == updatedProperties || updatedProperties.size() == 0) return modifiedProperties; for (Entry<E, E> entry : updatedProperties) { String k...
f3875df3-9069-4707-8d10-0f44031b66a5
8
public void actionPerformed(ActionEvent event) { String eventName = event.getActionCommand(); switch (eventName) { case "TicketField": lookupTicket(); break; case "LicenseField": lookupLicense(); break; case "LostTicket": lostTicket(); break; case "PayCash": exitUI.enableFindTick...
b7a4de63-52a8-4667-8305-fd5e8478acfc
9
@Override public void publish(Command command){ Class<? extends Command> type = command.getClass(); List<Object> handlers = eventHandlers.get(command.getClass()); if(handlers == null){ LOG.info("No command handlers declared for command " + type.getName()); return; ...
19579cfb-3972-49fe-b8c5-e9a11f959b3a
4
public boolean moveUnit( Position from, Position to ) { Unit u = unitMap.get( from ); if ( isMovable(u) && isLegalMove( from, to )) { if (isOccupied(to)){ if (unitMap.get( to ).getOwner() != u.getOwner()){ unitAttack( from, to ); no...
18059169-6cec-4f21-a6ae-6aeb4afcd9a3
1
private void updateGraphicalRepresentation() { ArrayList<DrawableParticle> d = new ArrayList<DrawableParticle>(); Color c = Color.ORANGE; for (Particle p : this.p) { d.add(new DrawableParticle((int) p.x, (int) p.y, (int) Math .sqrt(p.mass), c)); } this.pDraw = d;// atomic update }
7708e7fe-1af5-476c-acbf-8b50968243db
4
@Override public int[] getAttributes() { Random r = new Random(); int[] local = {0, 0, 0, 0, 0, 0}; for (int i = 0; i < 6; i++) { int[] rolls = {0, 0, 0, 0}; for (int k = 0; k < 4; k++) { int roll = 1; do { roll = r....
4308bd6d-9d2e-4be9-926f-a5c2a88454a1
5
public boolean inCheck(Board b) { for (Piece p : b.getPieces()) { if(p.isWhite() != this.isWhite() && !(p instanceof King)) { for(PossibleTile move : p.getLazyTiles(b)) { if (checkSameSpace(this, move)) { return true; } } } } return false; }
94d4a555-776a-4e97-aa1f-39c641116692
2
private String writeIndexes() { StringBuilder sb = new StringBuilder(); indexList = table.getIndexList(); for ( IndexNode node : indexList ) { String param = ""; for(Column col : node.getColumnList()){ param += col.getColName() + ", "; } ...
1b375d7a-0518-45d1-91e5-65ace0cf8fa4
3
public static int getTerrainFactor(Game game, Position position) { // cities overrule underlying terrain if ( game.getCityAt(position) != null ) { return 3; } Tile t = game.getTileAt(position); if ( t.getTypeString() == GameConstants.FOREST || t.getTypeString() == GameCon...
219497b8-f582-439e-beb7-2dc73e029ecf
6
private static final boolean isValid(long[] x) { return (x[min] == 0 && PF.ispow2(x[max]) && x[max] > 1 && x[beg] >= x[min] && x[end] <= x[max] && x[end] > x[beg] && x[end] - x[beg] >= 1); }
6fb4bccd-9828-4ae5-b246-48b3a17cf454
2
@Override public void mouseClicked(MouseEvent arg0) { if(screen.paused){ screen.resume(); timer.start(); } else if(screen.gameOver){ screen.gameOver = false; newGame(); } this.requestFocus(); }
4ff462a8-c9f0-4a47-891c-206d3b21d37d
2
public static int minimumLength(String string, Set smaller) { int length = 0; for (int j = 0; j < string.length(); j++) if (!smaller.contains(string.substring(j, j + 1))) length++; return length; }
9d4efed5-b483-481d-8275-fe8589263eca
2
public static void pause() { try { if(currentPlayback != null) { currentPlayback.pause(); } } catch (MediaException e) { System.out.println("Invalid media type."); } }
b4bcd15f-d8eb-4eb1-a64b-90ef0a13ca7b
6
private void evaluate() { Stack mystack = new ListStack(); //maak een nieuwe stack aan StringTokenizer st = new StringTokenizer(invoerString); //breek de string in stukje obv spaties while (st.hasMoreTokens()) //zolang er nog tokens inzitten { String token = st.nextToken(...
34abff92-df15-46e7-ab6f-3d3062c35854
7
@Override public String execute(HttpServletRequest request) throws SQLException, ClassNotFoundException { String tableName = request.getParameter("TableName"); System.out.println(tableName); if (tableName != null && tableName != "") { try { Class.forName("org.h2....
0c730802-a1db-43e3-be63-c15f26d8b857
4
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { /* If what we're displaying isn't an array of values we return the normal renderer*/ if (value.getClass().isArray()) { ...
e4d3cd20-0ec3-479a-a81e-18e29aab5d56
0
@Test public void testCheckAntBrainSyntax() throws Exception { System.out.println("checkAntBrainSyntax"); String antBrainFile = "cleverbrain1.brain"; AntBrain instance = new AntBrain(antBrainFile); boolean expResult = true; boolean result = instance.checkAntBrainSyntax(antBra...
d86b3739-fad0-4a4f-a900-0e9a57a6b7c4
3
@Override public boolean befehlSollAusgefuehrtWerden(ServerKontext kontext, Spieler spieler, Befehl befehl) { // Wenn ein Spieler im gleich Raum ist wie die Katze und 'schauen' ausführt, kriegt er eine gewischt, es sei denn, sie ist satt. if(!_satt && _raum == kontext.getAktuellenRaumZu(spieler) && befehl ...
1d751ead-b460-4e42-94c7-e86b5fc533e8
1
final Object peek() { int size = stack.size(); return size == 0 ? null : stack.get(size - 1); }
447a447d-5163-4cd2-84b1-b6f828d9f8fa
2
public MyImageDisplay(Class cl) throws Exception { super(); this.cl = cl; if (PathedImage.class.isAssignableFrom(cl)) { Field field = cl.getField("file"); this.file = (File) field.get(null); this.image = ImageIO.read(this.file); if (ConectedTexture...
612d36b0-c588-4c39-b9eb-7f69205599a7
6
public final void method480(int i, int j, int k, int l, int i1) { for (int j1 = 0; j1 < anInt1630; j1++) { int k1 = anIntArray1631[j1]; int i2 = anIntArray1632[j1]; int j2 = anIntArray1633[j1]; if (anIntArray1637 == null) { int i3 = anIntArray1640[j1]; Class33 class33 = super.aClass33Array1425[k1]...
36bef38e-95b1-44e1-bfdd-40026a129260
9
public void execute() throws MojoExecutionException { appDb = new AppInitializer(); store = appDb.getDB(); vc = appDb.getVC(); BdbTerminologyStore store = appDb.getDB(); ViewCoordinate vc = appDb.getVC(); memberRefsetCon = appDb.getConcept(memberRefsetUid); annotatedMemberRefsetCon = appDb.getConcept(...
d3408506-c055-46d9-923c-195d9a9dfa5c
6
public <T> List<T> searchObject(Class<T> object, String objectName, String[] caminhos, String[] colunas, String[] propertyNames, Object[] valores) throws Exception { List<T> listObjectReturn; Session sessao = HibernateUtil.getSession(); Criteria consultar = sessao.createCriteria(object, objectName); if...
83b00fc9-1c08-40f6-8d1d-83d713b9eece
4
@SuppressWarnings("CallToThreadDumpStack") private void miEmpresaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miEmpresaActionPerformed if (getCadEmpresa() != null && !cadEmpresa.isVisible()) { deskPane.remove(getCadEmpresa()); setCadEmpresa(null); } ...
7cde96a3-031e-457a-a399-532a1a8e5cc7
3
public IndexDBAccessor(Path file, boolean use) { try { if (!use) createFile(file); final String connectionString = "jdbc:sqlite:" + file.toString(); Class.forName(DRIVER_NAME); connection = DriverManager.getConnection(connectionString); ...
ca63754d-ec11-4cef-aeda-045102a8b51a
9
public void setState(States state) { Log.print(Log.system, "Converting graph to " + state); switch (state) { // ARR_ADJ -> ARR_INC case ARR_INC: convertToArrAdj(); arr_inc = new int[N][M]; clearGraph(States.ARR_INC); int curEdge = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) ...
c4dac43b-3f9d-4ee7-9ccd-2eec584bf6b0
1
public static void showQuickChooser() { if (editor != null) { editor.dispose(); editor = null; } chooser = new QuickChooser(); }
24706a95-9c8c-4481-b044-18e2596aaf35
8
private String scanPlainSpaces () { StringBuilder chunks = new StringBuilder(); int length = 0; while (peek(length) == ' ') length++; String whitespaces = prefixForward(length); // forward(length); char ch = peek(); if (FULL_LINEBR.indexOf(ch) != -1) { String lineBreak = scanLineBreak(); allowSim...
2c35d1d0-801a-4d14-85ce-a7eabbefaa9f
9
public float compareImage(BufferedImage src, BufferedImage comp) { float percent = 1.0f; int amtOfPixels = 0; for (int x = 0; x < src.getWidth(); x++) { for (int y = 0; y < src.getHeight(); y++) { amtOfPixels += src.getRGB(x, y) == 0xff000000?0:1; } } float delta = 1.0f/(src.getWidth() * src.getHeig...
a577a0dc-59b9-410e-8b84-d821c2158799
4
public void proccess(MatrixGraph graph) { if (lastWave == 0) lastWave = System.currentTimeMillis(); waves.get(currentLevel).proccess(graph); System.out.println(currentLevel); if (waves.get(currentLevel).hasEnd()) { if ((System.currentTimeMillis() - lastWave) / 1000 >= 20) { lastWave = System.currentT...
3151c1c7-d1a9-4396-9594-9dd3709c984d
4
public boolean isOnSlot(int wX, int wY, int mouseX, int mouseY){ mouseY = Standards.W_HEIGHT - mouseY - 1; if ((mouseX > wX + x) && (mouseX < wX + x + Standards.TILE_SIZE)){ if ((mouseY > wY + y) && (mouseY < wY + y + Standards.TILE_SIZE)){ return true; } } return false; }
501601da-7c91-46c0-ad5b-9b2342483da1
9
public static String getMouseName(int mouseCode) { switch (mouseCode) { case MOUSE_MOVE_LEFT: return "Mouse Left"; case MOUSE_MOVE_RIGHT: return "Mouse Right"; case MOUSE_MOVE_UP: return "Mouse Up"; case MOUSE_MOVE_DOWN: return "Mouse Down"; case MOUSE...
94c5aa7a-b6e5-43ef-b332-ed1089685250
8
@Override public void cover(ImageBit[][] list) { ImageBit ib = new ImageBit(); for (int i = 0; i < 50; i++) { for (int j = 0; j < 50; j++) { ib = list[i][j]; if (ib.isCovered()) { continue; } Leg...
c27e480e-0b67-420d-b143-576da6480f14
3
public void closeBrace() { if ((Options.outputStyle & Options.BRACE_AT_EOL) != 0) println("}"); else { println("}"); if ((Options.outputStyle & Options.BRACE_FLUSH_LEFT) == 0 && currentIndent > 0) untab(); } }
464633a0-c3b5-4c58-b61f-42e785de7666
8
public static String getMessage(int skill) { switch (skill) { case Skills.AGILITY: return "deftness and precision"; case Skills.CONSTRUCTION: return "buildings and security"; case Skills.COOKING: return "fire and preparation"; case Skills.FISHING: return "life and cultivation"; case Skills.FLETC...
8881bf55-0f42-443f-8778-f31abe3dc685
6
public void request(Object... args) { if (args.length < 2 || args.length > 3) { throw new RuntimeException("the request arguments is error."); } // first argument must be string if (!(args[0] instanceof String)) { throw new RuntimeException("the route of request is error."); } String route = args[0]....
2a9f33c3-ce65-4f0b-8676-1f31388b0b9c
2
public static void ChooseMario () { if (Game.characterChoice == 1) { Game.CharacterOne = "Mario"; Game.CharacterOneHP = CharacterStats.MarioHP; Game.CharacterOneAttack = CharacterStats.MarioAttack; Game.CharacterOneMana = CharacterStats.MarioMana; Game.CharacterOneRegen = CharacterStats.M...
5425f5f3-ea5d-4950-986f-5eb16502bc11
2
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); oContexto.setVista("jsp/mensaje.jsp"); AlumnoBean oAlumnoBean = new AlumnoBean(); AlumnoDao oAlumnoDao = n...
93335d27-c7d6-4487-a179-0bca6d03f166
5
@Override public void buddyChanged(int cid, int cidFrom, String name, int channel, BuddyOperation operation) { final MapleCharacter addChar = server.getPlayerStorage().getCharacterById(cid); if (addChar != null) { final BuddyList buddylist = addChar.getBuddylist(); switch (operation) { case ADDED: ...
ba5a1e81-f597-4ff5-b5a1-61e9d7e69c17
8
private static CatCage getCatCage_GoldStandard(final String identifier, final Cat topCat, final Cat rightCat, final Cat bottomCat, final Cat leftCat) { return new CatCage() { @Override public String getIdentifier() { return identifier; } @Override public Cat getTopCell() { return topC...
2c619a01-5a3b-466d-8880-2c2bf17ef246
7
public static int getBondTypeFromCode(char code) { switch (code) { case CODE_NONE: return TYPE_NONE; case CODE_SINGLE: return TYPE_SINGLE; case CODE_DOUBLE: return TYPE_DOUBLE; case CODE_TRIPLE: return TYPE_TRIPLE; case CODE_AROMATIC: return TYPE_AROMATIC; case ...
b85d7764-c49f-4f8f-8f5c-9bf7cc98cd82
1
public static void StopAllScripts() { synchronized (JSThread.scriptThreads) { for (JSThread jsThread : JSThread.scriptThreads.values()) { jsThread.Stop(); jsThread.interrupt(); } } }
3e1f71ff-2c13-4df2-9f68-9c249e18bdfa
8
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockBreak(BlockBreakEvent event) { Block b = event.getBlock(); if (b.getState() instanceof Sign) { Sign s = (Sign) b.getState(); if (s.getLine(0).toLowerCase().contains("ender's game")) { try { if (Game.getSign(In...
64189f66-567f-464e-a055-050e7af9dc0d
4
public final synchronized String readWord(){ this.inputType = true; this.wordMethod = true; String word=""; if(!this.testFullLineT) this.enterLine(); if(this.fullLine.equals("")){ word=" "; }else ...
d7301bc6-64a2-43c5-ba32-a013b6cb35fb
4
public Piece(int index, int length, byte[] hash){ this.index = index; this.length = length; this.hash = hash; blocks = new HashMap<Integer,Block>(); int count = this.length / MAX_BLOCK_LENGTH; if(this.length % MAX_BLOCK_LENGTH > 0) count++; this.blockOffsets = new int[count]; this.blockLengths ...
f2b9c70e-3737-43e8-b276-abd22c606c85
9
public void dispatchInstructions(boolean leftDown, boolean rightDown) { int width = shape.width(); // int height = shape.height(); if (leftDown) { if (animation != movementLeft) { swapAnimation(movementLeft); } if (x > 0) { x -= movementDistance; } leftOffRight = false; } else if (rightD...
21c3e713-5639-41a4-b31f-a05da52b9066
5
public int init(BinarySearchTree<String,String,String> tree) throws IndexOutOfBoundsException, IOException { Properties prop = new Properties(); InputStream istream = getClass().getClassLoader().getResourceAsStream("com/file/resources/additionalsearchtree.properties"); List<BinaryNode<Stri...
0cf8af65-034e-4dda-a05f-da086da7d159
6
private void jTextField8FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField8FocusLost // TODO add your handling code here: if ((evt.getOppositeComponent()!=jTextField3) && (evt.getOppositeComponent()!=campoFecha1) && (evt.getOppositeComponent()!=campoFecha2)){...
59847634-86fd-4631-9543-76bfd298ca84
1
public void setBaggageMaxWeight(int baggageMaxWeight) throws CarriageException { if (baggageMaxWeight >= 0) { this.baggageMaxWeight = baggageMaxWeight; } else { throw new CarriageException("Maximum baggage weight is under zero"); } }
ee73ad83-e1e3-4445-b9c9-f30adbdc2f08
2
public String getModesAsStr() { String retVal = null; for (TraverseMode m : modes.getModes()) { if (retVal == null) retVal = ""; else retVal += ", "; retVal += m; } return retVal; }
cd64f820-0e5c-489d-ae35-b615147af64d
9
public void processPoint(Coordinate coord, Route route, Integer accum, Integer objective) throws EndException, RouteException { if (!route.contains(coord)) { Route newRoute = new Route(route); newRoute.add(coord); accum += pointValue(coord); if (isLast...
e4668038-1d50-4511-989f-6cfaff34c5af
9
public void paintCallOut(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); xPoints[0] = callout.x; yPoints[0] = callout.y; Rectangle rectangle = getBounds(); int oc = rectangle.outcode(callout.x, callout.y); boolean b = t...
1cb48dcc-a475-4ed2-b9fb-c1d2cad40407
7
public final JPoclASTParser.parametersDecl_return parametersDecl() throws RecognitionException { JPoclASTParser.parametersDecl_return retval = new JPoclASTParser.parametersDecl_return(); retval.start = input.LT(1); TypeTree root_0 = null; Token char_literal45=null; JPoclASTPar...
abaaba56-67a3-4600-acb3-932fe2675c4b
8
static ArrayList<Cow> sortCows1(ArrayList<Cow> cows) { if (cows.size() <= 1) return cows; int mid = cows.size()/2; ArrayList<Cow> cows1 = new ArrayList<Cow>(); ArrayList<Cow> cows2 = new ArrayList<Cow>(); for (int i = 0; i < mid; i++) cows1.add(cows.get(i)); for (int i = mid; i < cows.size(); i++) ...
073c6013-8238-4847-a24b-95988337d483
1
private static String decodePercent(String str) { try { return URLDecoder.decode(str, Text.UTF8_ENCODING); } catch (UnsupportedEncodingException ignored) { // Ignore. Shouldn't be possible. return str; } }
3e22c01d-3285-40f8-8eb0-c2d639921107
3
public void mergeSort (int[] array, int l, int u) { if (u-l < 1) return; if (u-l == 1) insertionSort(array, l, u); int m = (l + u)/2, w = l + u - m; int u1 = w; sort(array, l, m, w); while (w-l > 1) { u1 = m; m ...
9f2df277-d80f-48cc-9950-f851caed2262
6
private SyntaxNode copenFileParseAndCreateAst(final String syntaxFileName) { try { final File syntaxFile = new File(syntaxFileName); final Parser parser = Factory.newParserFromSource(syntaxFile); return parser.parse(); } catch (SyntaxException ex) { getI...
55d2883f-5636-43ce-93e3-cbb3b5cca181
6
private static void getCollectionFrequency(String dirName, Normalizer stemmer) throws IOException { // Création de la table des mots HashMap<String, Integer> hits = new HashMap<String, Integer>(); File dir = new File(dirName); //Normalizer stemmer = new FrenchStemmer(); if (dir.isDirectory()) { // Liste de...
594729ab-8661-44a9-94cb-5b89b60ec378
7
public void nextGeneration(int height, int width) { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { if (shouldRevive(i, j)) { mustRevive.add(cells[i][j]); } else if ((!shouldKeepAlive(i, j)) && cells[i][j].isAlive()) { mustKill.add(cells[i][j]); } } } for (Cell cel...
68e681ed-0a8f-4099-937f-9eac67af8593
6
final void clipDimensions(int i, int i_164_, int i_165_, int i_166_) { anInt8043++; boolean bool = false; if (((NativeToolkit) this).anInt8106 < i) { bool = true; ((NativeToolkit) this).anInt8106 = i; } if ((i_165_ ^ 0xffffffff) > (((NativeToolkit) this).anInt8183 ^ 0xffffffff)) { ((NativeToolk...
e11aedd5-7994-4160-8dea-ab1d125cfacf
1
private ArrayList<String> tokenize(String userRequest) { StringTokenizer st = new StringTokenizer(userRequest); ArrayList<String> list = new ArrayList<>(); while (st.hasMoreElements()) { list.add(st.nextToken()); } return list; }
436bd601-1b0a-42af-aba6-c9e779389d9e
2
public void tick(long delta) { for(int i = 0; i < 64; i++) { for(int j = 0; j < 46; j++) { tileArray[i][j].tick(delta); } } }
c13d16a8-a14e-45f4-ad23-4a73b6a6e37c
3
void setItemFont () { if (!instance.startup) { textNode1.setFont (itemFont); imageNode1.setFont (itemFont); } /* Set the font item's image to match the font of the item. */ Font ft = itemFont; if (ft == null) ft = textNode1.getFont (); TableItem item = colorAndFontTable.getItem(ITEM_FONT); Image old...
8accadfe-3324-4bc1-ae5d-b5d39a76b31c
7
public boolean writeFile(String filePath, byte[] bytes) { final int bufferSize = Integer.MAX_VALUE; OutputStream out = null; File f = new File(filePath); try { if (!f.exists()) f.createNewFile(); out = new BufferedOutputStream(new FileOutputStrea...
fcb3596b-34df-4889-bcd8-4bba27900014
9
public static List parse(String pLine) { final List lSections = new ArrayList(); // True if within word. boolean lInSectionP = false; // Current char char lChar; // Wait for this character before switching back to normal parsing. char lSeparator = ' '; // Part count. int lSectionN...
489abcba-8946-48e9-bf74-785e1ae32784
7
private double calcNiceNumber(final double RANGE, final boolean ROUND) { final double EXPONENT = Math.floor(Math.log10(RANGE)); // exponent of range final double FRACTION = RANGE / Math.pow(10, EXPONENT); // fractional part of range //final double MOD = FRACTION % 0.5; /...
4e7bd6ff-a2bb-496a-9dc8-dd2a05389632
7
@Override public void run() { while (true) { try { ConduitMessage msg = new ConduitMessage(mInput); if ((mUserFilter == null || mUserFilter.equals(msg.getUser())) && (mIDFilter == null || mIDFilter.equals(msg.getID()))) { if (mOnEventThread) { msg.setReceiver(mReceiver); EventQueue.invoke...
a1f3207a-482f-4b74-8b54-fcca686f08ea
3
private void saveFile(String file) { final File folder = this.updateFolder; deleteOldFiles(); if (!folder.exists()) { this.fileIOOrError(folder, folder.mkdir(), true); } downloadFile(); // Check to see if it's a zip file, if it is, unzip it. final Fi...
928b8ae6-0ff8-4af3-bc9a-d4af430ebfde
6
public void testValueCollectionToArray() { int element_count = 20; String[] keys = new String[element_count]; int[] vals = new int[element_count]; TObjectIntMap<String> map = new TObjectIntHashMap<String>( element_count, 0.5f, Integer.MIN_VALUE ); for ( int i = 0...
0fc4a47f-da89-4712-8fac-3efedfbcadb1
2
private ArrayList<Piste> muutaPisteiksi(ArrayList<Integer> koordinaatit) { ArrayList<Piste> pisteet = new ArrayList(); int j = 0; for (int i = 0; i < koordinaatit.size(); i++) { if (i % 2 == 0) { j = koordinaatit.get(i); } else { pisteet.a...
c8b5aa50-0abf-44be-a2f9-7fc324d37117
6
private void internalDequeue(Sim_event ev) { if (ev == null) { return; } try { Integer classTypeInt = (Integer) ev.get_data(); int type = classTypeInt.intValue(); // check whether the class type is correct or not if (type ...