method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
67d2ccac-2b0d-43c6-99fc-6fb1921c7e79
1
public boolean end() { return this.eof && !this.usePrevious; }
cda732fc-a8ef-4b1e-b3b1-a290f3d5ee6e
2
private List<Integer> concatenate(List<Integer> less, int pivot, List<Integer> greater) { List<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < less.size(); i++) { list.add(less.get(i)); } list.add(pivot); for (int i = 0; i < greater.size(); i++) { list.add(greater.get(i)); } ...
0f4482a6-874a-4a38-9a72-6892ece94fc5
9
private void inizializzaVariabili() { controlloreFasiGiocoTest=new ControlloreFasiGioco(5, new MazziereDeterministico(randomSeed), new ControlloreReteServer()); statoDelGiocoTest=controlloreFasiGiocoTest.getStatoDelGioco(); mazziere=controlloreFasiGiocoTest.getMazziere(); mazziere.mischiaCarteMovimento(); maz...
8bf68c61-c3e1-4117-a773-0dc0c7970404
3
public void close() { try { if (fileOutStream != null) { fileOutStream.close(); } if (bufInStream != null) { bufInStream.close(); } fileOutStream = null; bufInStream = null; } catch (IOException e) { e.printStackTrace(); } }
b47b36f7-179a-4fb3-a5d4-228d81339046
4
public synchronized ReservationMessage createReservation(ReservationMessage message) { Reservation reserv = message.getReservation(); ServerReservation sRes = new ServerReservation(reserv); //-------------- FOR DEBUGGING PURPOSES ONLY --------------- visualizer.notifyListeners(this.get_id(), ActionType.I...
400a9b99-86f9-48ea-abbe-3321891b3f20
8
public boolean stem() { int v_1; int v_2; int v_3; int v_4; // (, line 72 // do, line 74 v_1 = cursor; lab0: do { // call mark_regions, line 74 ...
ea454227-847f-4c17-934c-8ae1c0ea8137
0
public static void main(String args[]) { SimpleReplace sr = new SimpleReplace(args); }
821bd9cf-d635-4c67-adba-c5b0b3b9e906
1
public void sayToMe(String say) { try { ByteBuffer bytes = _tokenizer.getBytesForMessage(say); addOutData(bytes); } catch (CharacterCodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
6f5d9569-a6f2-45f7-8963-a35c20ab7bf8
2
public void insert(double key, V value) { HeapNode node = new HeapNode(key, value); heap_size++; int i = heap_size; while (i > 1 && ar[parent(i)].getKey() > key) { ar[i] = ar[parent(i)]; ar[i].setIndex(i); i = parent(i); } ar[i] = node...
22d71050-08d7-4ec7-badd-276521605063
9
private void save() { try { OutputStream output = new FileOutputStream("Data/settings.ser"); OutputStream buffer = new BufferedOutputStream(output); ObjectOutputStream objectOutputStream = new ObjectOutputStream(buffer); objectOutputStrea...
75f0d905-6b3e-429d-b32d-b80d1cd47994
1
private void writeNewLine(Writer writer, int tabLevel) throws IOException { writer.write('\n'); for (int i = 0; i < tabLevel; i++) { writer.write('\t'); } }
98f5ce80-8cb9-42cb-a1b5-55c4055925f1
0
public boolean isAlive() {return alive;}
edd2a7f5-dad8-47fa-b7b2-84827fd52b24
0
public String getMimeType() { return mimeType; }
84991e21-8065-4782-b1e7-37d057165af8
9
@SubscribeEvent public void onBlockBreak(BlockEvent.BreakEvent event) { if (event.block == Blocks.chest) { TileEntity t = event.world.getTileEntity(event.x, event.y, event.z); if (t != null && t instanceof TileEntityChest) { TileEntityChest chest = (TileEntityChest) t; for (int i = 0; i < chest.getSize...
a724965e-3b91-45be-ab16-f4e88590e91c
4
public void draw(Graphics2D graphics) { if (sprite != null) { if (angle != Math.PI / 2 && Preferences.getValue("fancyGraphics") == 1) { double theta = Math.PI / 2 - angle, centerx = rect.x + rect.width / 2, centery = rect.y + rect.height ...
2d7eca3b-d827-4657-8d01-49bd44a01547
7
private static void printFieldsInfo(Object object) throws IllegalArgumentException, IllegalAccessException, SecurityException, NoSuchMethodException, InvocationTargetException { Class<?> actualClass = object.getClass(); while (actualClass != Object.class) { for (Field field : actualClass.getDeclaredFiel...
d2acbde4-2ac6-414f-bcaf-d4ed6e8c1a99
3
@Override public void mouseClicked(MouseEvent e) { int col = panel.getTableHeader().columnAtPoint(e.getPoint()); if (col == 0) { if (!panel.isCellEditable()) { return; } dialog.show(panel); } else if (col == 1) { //System.out.println("sort"); } }
949bb789-612a-44b3-83f0-f1254a13d856
4
public void visitSwitchStmt(final SwitchStmt stmt) { print("switch ("); if (stmt.index() != null) { stmt.index().visit(this); } print(")"); println(" caught by " + stmt.catchTargets()); if ((stmt.values() != null) && (stmt.targets() != null)) { for (int i = 0; i < stmt.values().length; i++) { p...
2dc360a3-3314-4feb-96a5-1c37498322e9
7
public static int numLetters(AlignmentTriplet triplet) { FlaggableCharacterString _p = triplet.getPresented(); FlaggableCharacterString _t = triplet.getTranscript(); FlaggableCharacterString _i = triplet.getInputstream(); IsLetterCondition is = new IsLetterCondition(); int num = 0; for(int i = 0; i < _i.size();...
724019db-ee0b-47cd-98e9-37dd879d3c56
4
void Move_Apply_Physics(float dt) { int i; //Vector3f gravity=new Vector3f(0,0,-0.00980f*dt); //body.pos+=gravity; for(i=0;i<6;++i) { Leg leg=legs[i]; //if(leg.pan_joint.pos .z>0) leg.pan_joint .pos += gravity; //if(leg.knee_joint.pos .z>0) leg.knee_joint .pos += gravity; //if(leg.a...
ce699bd5-7c5b-4aef-8155-b75b897e6d51
0
protected void onOptOut() { }
6f82e7b7-d9a4-4251-8b74-d6db67bf698c
6
public void saveHighScore(int score, String name){ try{ f= new FileWriter("HighScore.txt"); }catch(IOException e){ System.out.println("fail"); } sort(); Integer lowest = 1000; Integer lowestKey = 0; for(int i = 0; i<5; i++){ if(...
8b4dc962-0122-4037-ab23-92f5e79a9d99
1
private final String getLabel(final Label label) { String name = (String) labelNames.get(label); if (name == null) { name = Integer.toString(labelNames.size()); labelNames.put(label, name); } return name; }
239db20d-2402-44b6-96c1-1ae7dd6f9be9
4
public Sprite[] split(int size) { Sprite[] res = new Sprite[(width * height) / (size * size)]; int index = 0; for (int y = 0; y < height; y += size) { for (int x = 0; x < width; x += size) { int[] pixels = new int[size * size]; for (int yy = 0; yy < size; yy++) { int yo = y + yy; for (int xx...
cc6bf0e3-81fa-48aa-87ab-15ab618fc7c2
7
@Override public boolean equals(final Object object) { if (object == this) return true; if (!(object instanceof Pool<?>)) return false; final Pool<?> data = (Pool<?>)object; return Objects.equals(this.type(), data.type()) && Objects.equals(this.field(), data.field()) && Objects.equals(this.owner(), data.owner(...
7508222d-a3e7-492b-b6d8-a088f3a5acf7
2
public double sign(double x){ if (x > 0){ return 1; }else if (x < 0){ return -1; }else{ return 0; } }
04646c52-afdf-4a42-ab42-2e056e8bcccb
8
@Override public AbilityMapping getQualifyingMapping(String ID, boolean checkAll, String abilityID) { if(completeAbleMap.containsKey(ID)) { final Map<String,AbilityMapping> ableMap=completeAbleMap.get(ID); if(ableMap.containsKey(abilityID)) return ableMap.get(abilityID); } if((checkAll)&&(completeAb...
b8c290d1-a839-487c-8820-e73e08c25e07
3
public ListNode swapPairs(ListNode head) { ListNode dummy = new ListNode(0); ListNode p = dummy; dummy.next = head; while(p!= null && p.next != null && p.next.next != null){ ListNode tmp1 = p.next; ListNode tmp2 = p.next.next.next; p.next = tmp1.next; tmp1.next = tmp2; p.next.next = tmp1; p =...
256ec682-08b7-414c-aebe-ee473a55973c
3
@Override protected Void doInBackground() throws Exception { try (Dao dao = Dao.getInstance()) { dao.restoreBackup(sourcePath); } catch (IOException ex) { ErrorMessages.restoreIOExceptionError("RunDatabaseRestore.doInBackground()", ex, sourcePath); } catch (SQLException ex) { ErrorMessages.sqlExceptionE...
405fcbd9-433a-4f0e-8681-0907a56c1446
7
private void resetGame() { System.out.println("RESET GAME"); WordFinder.kill(); boolean noOldAnswer = true; for(int i = 0; i < 15; i++) { for(int k = 0; k < 15; k++) { if (tileColors[i][k].equals(answerColor)) { n...
d25fc48e-8dd0-4376-a479-def9b409bdf9
4
public boolean vertexIsObstructed(Vertex test) { if (src.hasPointBetween(leftAngle, rightAngle, test)) { if (leftDist <= 0 && rightDist <= 0) return true; if (src.getDistance(test) > distanceFromLine(src.getDirection(test)) + 0.01) r...
0262778e-fd95-4906-8b0c-bf0db1825f66
0
public String goToCustomerOrdersList() { // TODO Solo ordini del cliente return "customerOrdersList"; }
363dbb1b-cd32-4745-b31e-11e1796be118
7
public static void main(String[] args) { if (args.length != 1) { try { BufferedReader message = new BufferedReader(new FileReader(new File("bin/help/compiler.txt"))); String line; while ((line=message.readLine()) != null) { System.out.println(line); } System.out.println(""); } cat...
2ef41f7c-983d-4dbf-a42a-2294793137e9
9
public static Object eval(Object obj, Map env) { if (obj == null) return null; if (obj instanceof Number) return obj; if (obj instanceof Boolean) return obj; if (obj instanceof Symbol) { if (!env.containsKey(obj)) throw new RuntimeException("Cannot find symbol " + obj + " in env " + env); ret...
6ee7d41c-679a-48e3-992a-e59d24f70865
5
private void textLaboratorioKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textLaboratorioKeyTyped // TODO add your handling code here: if (!Character.isLetterOrDigit(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && !Character.isWhitespace( evt.getKeyChar()) && evt.getKeyChar...
166f0b0e-552a-4f82-a064-3f0f871ef984
2
public List<Boolean> convert(String hex) { String binVal = new BigInteger(hex, 16).toString(2); String paddedBinVal = ("00000000" + binVal ).substring(binVal.length()); LinkedList<Boolean> ret = new LinkedList<Boolean>(); for (char c : paddedBinVal.toCharArray()) { ret.add(c == '1' ? true : false); } ...
91d632a3-5b71-4315-b7f7-99ceb5db21e9
0
boolean isStopped() { final ReentrantLock l = lock; l.lock(); try { return stopped; } finally { l.unlock(); } }
90208f22-76d5-449a-aa23-4affe40d6a44
4
public void onEnable() { // Load the configuration. new Configuration(this); try { new SQLDatabase(this); if(!(SQLDatabase.isDBSchemaValid() || SQLDatabase.setupTables())) { getLogger().log(Level.SEVERE, "Unable to validate schema or create proper tables." + " Plugin will not load unt...
aaa6b671-ebe4-4960-9442-cb5f0d96db5e
4
public void setPixel(int color, int x, int y) { if (x < 0 || x >= width || y < 0 || y >= height) return; pixels[x + y * width] = color; }
f70181bd-9120-4d95-98a6-a00f64388792
7
synchronized DispData getDisplayData() throws InterruptedException { freeCounterIndex = -1; while (freeCounterIndex < 0) { if (waitNumber > serveNumber) { int i = 0; while (freeCounterIndex < 0 && i < nCounters) { if (freeCounter[i]) { ...
ff77496e-84a7-4a94-bef6-9151a86988e6
3
private boolean checkDuplicate(int vx, int vy){ for(int i=0; i<_X.size(); i++){ if(_X.get(i)==vx){ if(_Y.get(i)==vy){ return false; } } } return true; }
fc3eaa36-6dbc-4a68-a5ac-abb975d45aeb
3
private void btnChangeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChangeActionPerformed if (isEdit) { RoosterProgramma.getInstance().showPanel(new ChAddEmployee(selectedEmployee), this); } else { String input = Utils.showFileChooser("Opslaan", "Medewerke...
37a36bb8-b7f7-4ab7-9aa1-ace02544ae19
6
public void cancelFullnessSchedule(int petSlot) { switch (petSlot) { case 0: if (fullnessSchedule != null) { fullnessSchedule.cancel(false); } break; case 1: if (fullnessSchedule_1 != null) { ...
779f4c46-4c8e-4a6b-8733-c08d9aeeb4f6
0
@Before public void setup() throws Exception { _xpath = XPathHelper.parse(new StringReader(XML)); }
5e3329c3-a3bf-4e13-a0ae-5c80193c0035
3
public void sendFile(String path){ FileInputStream fin = null; try { File transferFile = new File (path); byte [] bytearray = new byte [(int)transferFile.length()]; fin = new FileInputStream(transferFile); BufferedInputStream bin = new BufferedInputStream...
854dcd7a-8906-4662-a7b3-70324e1d3604
3
public String returnUpdateSet() { StringBuilder sb = new StringBuilder(); List<String> list = columnMap.get(this.getClass()); int i = 0; for (String column : list) { if (isNull(column)) continue; if (i++ != 0) sb.append(','); sb.append(column).append("=#{").append(column).append('}'); } r...
c06c0e5d-6eb4-48f4-8934-d3aedb735594
8
public boolean validWhiteMovement(double x1, double y1, double x2, double y2, Square newSquare) { boolean move = false; if( ((x2 == x1) && (y2 == y1 + PAWN_MOVEMENT_RESTRICTION)) && newSquare.getPiece().getPieceType() == "-") { move = true; super.setHasMoved(true); } else if( ((x2 == x1 && (y1 == W...
44a3233d-6e51-49a8-8f24-d56b0a7014a9
8
protected LoginResult charcrFactionDone(final LoginSessionImpl loginObj, final Session session) { final MOB mob=loginObj.mob; executeScript(mob,getLoginScripts().get("FACTIONS")); mob.baseCharStats().getCurrentClass().startCharacter(mob,false,false); CMLib.utensils().outfit(mob,mob.baseCharStats().getCurrentC...
77a3e38d-fabd-4ebf-8ea0-7de0f8229c23
2
public static boolean isCharacterID(int id) { InputSource data; data = Download .getFromHTTPS("https://api.eveonline.com/eve/CharacterInfo.xml.aspx?characterID=" + id); if (data == null) { return false; } if (XMLParser.getID(data).getIS().containsKey(-1)) { return false; } return true;...
a39b0fc2-ec08-4ca4-9a4e-474b0ec6a699
0
@Test public void OneSevenSixZeroYardsEqualOneMile(){ ArithmeticQuantity yards = new ArithmeticQuantity(1760, Distance.YARDS); ArithmeticQuantity miles = new ArithmeticQuantity(1, Distance.MILES); assertEquals(yards, miles); assertEquals(miles, yards); }
21327c89-6547-4ac0-9c7a-7e90cf941e67
1
public HashSet getCompleteLambdaSet(Grammar grammar) { HashSet lambdaSet = getNewLambdaSet(); while (areMoreVariablesToAddToLambdaSet(grammar, lambdaSet)) { String variable = getNewVariableThatBelongsInLambdaSet(grammar, lambdaSet); addVariableToLambdaSet(variable, lambdaSet); } return lambdaSet; }
4bdba5a8-54bd-4485-abdd-798eb59631ae
4
float similarity( Row r ) { float sim = 0.0f; float fullSim = 1.0f/cells.size(); for ( int i=0;i<cells.size();i++ ) { FragList fl1 = cells.get(i); FragList fl2 = r.cells.get(i); if ( fl1.merged&&fl2.merged ) sim += fullSim; ...
54dd93fd-03f6-4ea4-a08e-c317ec479674
6
@Override public void execute(final CommandSender sender, final String command, final String[] args, final boolean realPlayer, final Player player) { if (!realPlayer) { sender.sendMessage(WarValues.MESSAGE_CONSOLE); return; } final Location loc = player.getLocation()...
f4dc9935-2621-49ec-bad8-7012ea5603db
1
public int getRow(String variable) { int row = Arrays.binarySearch(variables, variable); if (row < 0) throw new IllegalArgumentException(variable + " is not a variable!"); return row; }
57547c2f-cbf2-4cd0-bdc7-39f460a89c16
4
private static VoieEnum voieAleatoire() { VoieEnum v = VoieEnum.NORD; switch (random.nextInt(4)) { case 0: v = VoieEnum.NORD; break; case 1: v = VoieEnum.EST; break; case 2: v = VoieEnum.SUD; break; case 3: v = VoieEnum.OUEST; break; } return v; }
4b7ea27e-2d6d-45a5-87ed-f7fd814e77e1
9
public boolean blockingKing(Piece piece, int destX, int destY){ if(!piece.validMove(destX, destY)){ return true; } //need to have this part first, b/c the other ifs might pass if it wants to do an angle move. if(destX != piece.getX() && destY != piece.getY()){ //lazy, just checking every direction inst...
0ce66f7a-8cd4-47be-b2fb-890200cb5872
8
private Pair<Edge, Vertex> getNewEdgeForSpanningTree(Vector<Vertex> vertices) { ArrayList<Edge> tempEdgeArray = new ArrayList<Edge>(); try { while (true) { Edge edge = pq.poll(); if (edge == null) return null; if (!ver...
a32ca51a-e370-4085-a939-33c6f56bc1e1
1
private int readMsgLength(InputStream in) throws IOException { int msgLength = 0; int multiplier = 1; int digit; do { digit = in.read(); msgLength += (digit & 0x7f) * multiplier; multiplier *= 128; } while ((digit & 0x80) > 0); return msgLength; }
3b103760-b4f8-4e0a-b123-262249b56dc1
7
private final void step6() { j = k; if (b[k] == 'e') { int a = m(); if (a > 1 || a == 1 && !cvc(k-1)) k--; } if (b[k] == 'l' && doublec(k) && m() > 1) k--; }
6ac90ffc-6ccd-4a7f-903c-8455079f410d
2
public void applySettings(){ for(UserSetting s : settings){ try{ SettingExecutor.getInstance().perform( s ); } catch (Exception e){ e.printStackTrace(); System.out.println("Error in User Setting: " + s.getId()); } } }
6c3323a3-93d8-47f3-978d-c2565c29ea36
5
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerJoin (PlayerJoinEvent event) { if ( !autoUpdater.isUpToDate() && !autoUpdater.hasDownloaded()) { final String playerName = event.getPlayer().getName(); plugin.getServer().getScheduler() ...
07fc2edb-b5f9-4c4c-a669-3a6c2872db1a
3
public static void main(String[] args) { JFileChooser fileChooser = new JFileChooser(); if (fileChooser.getSelectedFiles().length > 1) { //get all the files in the folder } else if (fileChooser.getSelectedFile().isDirectory()) { //import all the files in the directory ...
4ac595b8-cfe5-496d-8c9f-ac5b338cbac7
3
private static String exec(String ...cmd) { try { ProcessBuilder pb = new ProcessBuilder(cmd); Process process = pb.start(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream stdout = process.getInputStream(); int readByte = std...
31a3d9fe-b8c1-4e83-bf18-964c5e0a7256
9
@Override public boolean doIHaveThisInStock(String name, MOB mob) { final List<Environmental> storeInv=new ConvertingList<ShelfProduct,Environmental>(storeInventory,converter); Environmental item=CMLib.english().fetchEnvironmental(storeInv,name,true); if(item==null) item=CMLib.english().fetchEnvironmental(st...
0c64cb75-b14f-43d4-a34c-f2fbca6c9213
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Route other = (Route) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return fa...
aa5cb41d-0bdc-478f-a3df-9eb62a88b627
6
public static void runJava(final String s2) throws IOException { Thread t = new Thread(){ public void run() { ArrayList<String> imps = IOTools.readFile(new File("help/imports.txt")); String tempStr = ""; for (String s : imps) { tempStr = tempStr + s + " "; } ArrayList<String> funcs = IOTo...
85d8efb6-70af-4c9f-9e1b-0d5cb16e5378
2
@RequestMapping(value = {"/EntidadBancaria/{idEntidad}/SucursalesBancarias"}, method = RequestMethod.GET) public void readSucursalesPorEntidad(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idEntidad") String idEntidad) { try { ObjectMapper jackson = new ...
272eb853-107d-4c97-9a63-580e11cadd82
4
public void accioBotoAccepta() { try { String contrasenya_introduida = new String( contrasenya.getPassword() ); if ( !contrasenya_introduida.equals( new String( confirma_contrasenya.getPassword() ) ) ) { VistaDialeg dialeg = new VistaDialeg(); String[] botons = { "Accepta" }; String valor_sele...
ad2d3020-b2d0-425a-8805-632c7e95a43c
3
private int registerChallenge() { try { String GET_URL = apiUrl + registerUrl+"?gt=" + this.captchaId; if (this.userId != ""){ GET_URL = GET_URL + "&user_id=" + this.userId; this.userId = ""; } gtlog("GET_URL:" + GET_URL); String result_str = readContentFromGet(GET_URL); gtlog("register_resu...
ad3a3a3a-74ff-4c80-a09c-04f77ab3ea7b
3
public void getQ(int questionID){ if(Q_Type == 1) { MCQ_DAO mcq_dao=new MCQ_DAO(); MCQOption_DAO mCQOption_DAO=new MCQOption_DAO(); question=mcq_dao.getModel(questionID); mCQOptions=mCQOption_DAO.getModel(questionID); } if(Q_Type == 2) ...
80fe9e4e-0b16-499b-921c-c5ed96130098
1
private void unstringHashMap(String str) { String[] strArr = str.split(ln); for(String equStr : strArr) { Equivalence equ = new Equivalence(equStr); equivs.put(equ.getPaintID(), equ); } }
63ed761d-5416-4f21-9deb-c4593739f06c
9
public void setParameter(String paramname, int a){ if(paramname == "Age"){ age = a;} if(paramname == "Fade"){fade = a;} if(paramname == "MirrX"){hoodx = a; if(mirror){setLocation(hoodx, hoody);}} if(paramname == "MirrY"){hoody = a;if(mirror){setLocation(hoodx, hoody);}} if(paramname == "InMode"){inmode =...
21b7b27a-8fcf-492b-a1ee-d7d8c0373d42
7
@Override public void repaint(Graphics2D g) { if (hoverArea == null) { hoverArea = getBounds(g, text); } if (font == null) font = g.getFont(); if (height == -1 || width == -1) { Rectangle2D bounds = font.getStringBounds(text, g.getFontRenderContext...
f864333d-3ba7-443c-bf5e-86eec8fef26b
7
@POST @Consumes("application/json") // We expect the newUser to be passed as json info. public CreateUserResult createUser( CreateUserCommand createUserCommand ) { logger.info("Entered createUser()"); // See if we have a record already for the given email. User loadedUser = null ; try { loadedUser = txFind...
32dc0017-f384-4874-b5e6-0919a0e9fa7f
7
public void mouseMoved(MouseEvent e) { currentCursorPosition.setLocation(e.getX(), e.getY()); if(pt.supportReverseTranslation()) { pt.translateToLogicPosition(e.getX(), e.getY()); if((pt.logicX < Configuration.dimX)&& (pt.logicX > 0)&& (pt.logicY < Configuration.dimY)&& (pt.logicY > 0)){...
aaae6f97-5726-457c-bd89-93df6174eab0
4
@Override public void run() { while (true) { final String selectedString = UserInterface.selectPhysics(new ArrayList<>(SELECTABLE_PHYSICS.keySet())); System.out.println(selectedString); if (selectedString == null) { return; } final PlanetMatterPhysics selectedPhysics = SELECTABLE_PHYSICS.get(selec...
accefcbf-7d27-4710-9d4a-951d7e4a4b92
8
private List<DbTableRecord> getRecordsFromDb(Connection dbConnection, DbTableDefinition tableDefinition) { List<DbTableRecord> allRecords = new ArrayList<DbTableRecord>(); DbTableRecord currentRecord = null; try { // Create and execute an SQL statement that returns some data. stmt = dbConnection.createS...
2b1a705e-5a1b-42b4-b1ff-ad8b802a967e
8
@EventHandler public void onPlayerDamage(EntityDamageByEntityEvent event) { if (event.isCancelled()) return; if (!(event.getEntity() instanceof Player)) return; if (!(event.getDamager() instanceof Player)) return; Player player = (Player) event.getEntity(); Player damager = (Player) event.getDama...
664e9907-1c50-4306-9f04-690ff98d9c17
1
@Override public int compareTo(Result arg0) { if(arg0==null) return 0; //else return arg0.size()-this.size() ; // descending by # of results i.e. most results first }
5c87d930-3c79-4d29-a208-d3fa6620bcc8
8
void updateMask() { //Clip the motion to the display window if (xMin + dx < 1) dx = 1 - xMin; if (xMax + dx > Width - 1) dx = Width - 1 - xMax; if (yMin + dy < 1) dy = 1 - yMin; if (yMax + dy > Height - 1) dy = Height - 1 - yMax; //Now update the mask for (int x = 0; x < Width; x++) { for (...
bf1f62fd-f6b4-48c7-9127-362397140750
5
public int Close() { int retcode = DDC_SUCCESS; switch ( fmode ) { case RFM_WRITE: try { file.seek(0); try { byte[] br = new byte[8]; br[0] = (byte) ((riff_header.ckID >>> 24) & 0x000000FF); br[1] = (byte) ((riff_header.ckID >>> 16) & 0x000000FF); b...
5119bc5d-41c0-42e8-bbdc-d331d35087e9
6
public String toString(){ String instruction = ""; String fileContent = ""; if (this.operations==Operations.ENTRY_CREATE){ //file:Size:[File] try { fileContent = this.readFile(this.file); }catch (Exception e){ log.error("Reading file failed for " + e.getMessage()); } instruction = String.fo...
1e61d1be-1561-42ef-9c37-01d6d4b4b8d8
5
static public boolean parsable(String root){ //first check for the subscript and radical sign int i = 0; while(i < root.length() && Util.isSubscript(Character.toString(root.charAt(i)))) i++; //remove the subscript root = root.substring(i,root.length()); //remove the radical sign, making sure not to throw an...
17858950-e566-4100-9263-ee0df48e8bdb
6
@Override public void enable(boolean force) { // Make sure MobManager is enabled if (P.p() == null || !P.p().isEnabled()) { throw new IllegalStateException("MobManager must be enabled to enable the Spawner"); } // Check if the Spawner is already enabled if (this.isEnabled()) { throw new Illeg...
37f8bc1d-ffe7-4a89-a773-3580f1416466
6
public String getSearchResultWord(String search) throws IOException { if (search.isEmpty()) return null; if (this.searchResult == null) setSearchResult(); String result = searchResult.getResult(search); if (result == null) { try { // あいまい検索 result = WikiUtil.getAimaiSearchResult(search); } ...
2eec4fac-6539-49d7-8ac3-e43ad98f9ae6
6
@Override public Tipo validarSemantica() throws Exception { Tipo izq,der; izq=izquierdo.validarSemantica(); der=derecho.validarSemantica(); if (izq instanceof TipoInt){ if (der instanceof TipoInt || der instanceof TipoFloat ){ return izq; } ...
b515cadb-05ba-4b2d-a5f4-de2ebb1213d2
7
public void attemptConnect(connectionInfo x) { //Check if the connection info sent exists if(x==null) return; if(myPartner != null) if(x.getName().equals(myPartner.getName())) return; //Check if the pair is available to connect if(x.getConnection()!=null) if(!name.equals(x.getPrior())...
efae43c1-77f2-46b7-a35b-1cc4985f278f
6
private void handleDraging(MouseEvent e) { int dx = e.getX()+ - lastDragPoint.y; if(dx > 100 && !hasSwitched){ currentMessageIndex++; if(currentMessageIndex > messages.size()-1) currentMessageIndex = 0; hasSwitched = true; } ...
f8278284-3936-4577-a2f2-d2123a51ea4b
0
public int getAge() { return age; }
f50213f8-2009-477b-93df-87802f1183c3
9
private JButton getButtonForColor(CatanColor color) { switch (color) { case BLUE: return btnBlue; case BROWN: return btnBrown; case GREEN: return btnGreen; case ORANGE: return btnOrange; case PUCE: return btnPuce; case PURPLE: return btnPurple; case RED: return btnRed; case WHI...
f22acfec-25fd-4e23-849e-c691e6634c1c
5
public String buscarDocumentoPorTipoNumero(String tipo, String numero) { ArrayList<Compra> geResult= new ArrayList<Compra>(); ArrayList<Compra> dbCompras = tablaCompras(); String result=""; try{ for (int i = 0; i < dbCompras.size() ; i++){ if (db...
96b82ea0-f90b-4368-a3ea-994485e79a6a
5
@Override public void execute(CommandSender sender, String gateName, List<String> args) { this.sender = sender; this.sender = sender; if (gateName == null) { error("No gate given."); reply("Usage: /gate settoll <gatename> <amount>"); } else if (!gateExists(gateName)) { reply("Gate not found: " +...
0384ad90-152c-4df8-9f1a-bff76dc95028
9
private boolean parseHostName(String hostName) { File flie = new File(hostName); if (flie.exists() && flie.isFile()) { try { BufferedReader br = new BufferedReader(new FileReader(flie)); String line; while ((line = br.readLine()) != null) { line = line.trim(); if (line.startsWith("#")) { ...
ce524e5d-16c3-4f05-8a81-cde397af839a
3
public static void main(String[] args) { // TODO code application logic here ArrayList<Integer> Fib; Fib = new ArrayList<Integer>(); Fib.add(1); Fib.add(2); boolean kon = true; int Sum = 2; for (int i = 2; kon; i++) { int z = Fib.get(i - 1) + F...
45aa2ad6-95a1-46fc-b0c2-c3bbf0bda579
5
@Override public boolean update(DataRow parameters, DataRow row) { if(!parameters.getName().equals(row.getName())) { ErrorDialog errorDialog = new ErrorDialog(true, "Nazwy tabel w parameters i row są różne!", "SqlServerLocalDatabaseConnector", "update", "row, parameters"); er...
b2c09db7-73e8-4056-91f9-d2d5b5e24a1e
7
private String[] listOfDependentFolders(File file){ String[] listOfFiles = listOfFileNames(file); String[] listOfFullPaths = new String[listOfFiles.length-1]; for(int i=0;i<listOfFiles.length-1;i++){ for(int x=0;x<i+1;x++){ boolean isLastElement = x==i; boolean isNotLastElement = !isLastElement; ...
79089eee-81e3-48a1-99a4-feded17b1254
9
private void viewInventory() { String[] weapons = player.getInventory().getWeaponTexts(); String[] armour = player.getInventory().getArmourTexts(); String[] foods = player.getInventory().getFoodsTexts(); String[] misc = player.getInventory().getMiscTexts(); int inventoryLength = weapons.length + armour.length...
06a11072-d18f-4ba0-a2c0-2b4780b4fe7b
1
public void update() { if(isRunning) { level.update(); } }
3980da7e-dfd4-4069-a9f9-bfd3de6f46f9
9
private boolean solve(int x, int y) { if (x > 8) return true; if (board[x][y] != '.') { return solve((y == 8 ? (x+1) : x), (y == 8 ? 0 : (y+1))); } else { for (int i = 0; i < 9; i++) { board[x][y] = (char) ('1' + i); if (checkValid(x, y) && solve((y == 8 ? (x+1) : x), (y == 8 ? 0 : (y+1)))) ...
ba20f258-fec6-4fe5-979a-61ae0d37d683
7
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String counterID = request.getParameter("counterID"); String increment = request.getParameter("increment"); boolean doIncrement = true; if (increment == null || "false".equals(increment)) { ...