method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a72e3842-640d-41cb-bf58-487085bcf71b
6
public void checkEnemyCollision(ArrayList<Enemy> list){ for(int i=0;i<list.size();i++){ double w=.5*(list.get(i).getCWidth()+getWidth()); double h=.5*(list.get(i).getCHeight()+getHeight()); double dx=list.get(i).getCCenterX()-getCenterX(); double dy=list.get(i).ge...
0516934c-9a18-48d2-b5f6-10d29a9850cf
6
static void testInput() { // otetaan sata ensimmaista, jarjestetaan characterClassin // mukaan, ja piirretaan iso kuva, josta voi tarkistaa, etta // samat numeroa esittavat kuvat tulevat perakkain. Vector<Image> I100 = new Vector<Image>(); for (int i = 0; i < 100; ++i) { ...
7c433ba6-5e34-4d66-aff5-b50138523947
7
@Override public Item getQuestItem(int i) { final int[] num={1}; Environmental E=null; synchronized(questState) { if(questState.worldObjects!=null) E=getQuestThing(PreservedQuestObject.getPOIter(questState.worldObjects),i,CMClass.CMObjectType.ITEM,num); if(E instanceof Item) return (Item)E; i...
418fb29d-1d5a-4e19-bf1a-20d8cee3bc77
8
public void tick() { if(Panel.contains(Main.mse) && !isShowing) { //System.out.println("true"); isShowing = true; checkStrings(); } else if(!Panel.contains(Main.mse) && isShowing) { //System.out.println("false"); isShowing = false; } if(isShowing && x < xMax) { x++; Save.x++; ...
ae6b6353-13d5-4401-bac4-9fa80fabffc8
0
public Piece getRequestedPiece() { return this.requestedPiece; }
47802bd2-2c49-46a2-b934-53e21f739c4c
2
public List<IComponent> getAllComponents(Entity entity) { List<IComponent> componentList = new LinkedList<IComponent>(); // Iterate over each value (which is the map of classes, basically // each possible component) within the system. Then check if there's // is a component of that type that belongs to the ent...
fbe7d559-f342-4c07-b230-8ba437d59325
4
public void enemySpawner(){ int spawnerLoop; int randomDirection; for (spawnerLoop = 0; spawnerLoop < strengthInNumbers; spawnerLoop++){ if (difficulty == EASY || difficulty == NORMAL){ enemiesPresent.add(new Enemy(0, spawnerLoop)); } else{ randomDirection = (int)((100)*Math.random() + 1); if...
3f05f22c-b6d6-4bc7-a845-23ebbdf8379f
3
public boolean changeRoom(String user, String room){ UserAccount account = users.get(user.toLowerCase()); ChatServerChatRoom room2 = chatRooms.get(room); if (account==null || room2 ==null) return false; ChatServerThread thread = account.getThread(); if (thread==null) return false...
b2d2856d-4755-46cc-8c28-25b9cdb8affe
2
public static void setProperty(final Environment env, final Properties properties, final String propertyKey) { String propertyValue = env.getProperty(propertyKey); if (propertyValue != null && !propertyValue.isEmpty()) { properties.put(propertyKey, propertyValue); } }
a82cc074-7d63-43aa-8225-f9a01f743d07
6
private String map(int areaOne, int areaOneForth, int areaOneSixteenth) throws NodeMeaningKeyErrorException { if (areaOne < minOne || areaOne > maxOne) { throw new NodeMeaningKeyErrorException(); } if (areaOneForth < minOneForth || areaOneForth > maxOneForth) { ...
f4cc13bb-4d42-4709-b044-45db5d3d1594
2
@RequestMapping(value = {"/EntidadesBancarias"}, method = RequestMethod.GET) public void readAll(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse) { try { ObjectMapper jackson = new ObjectMapper(); String json = jackson.writeValueAsString(entidadBancariaDAO.fin...
aeb115d5-33d2-4385-838a-2bbc16461654
6
public static void main(String[] args) throws IOException { Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); int[] x = new int[n]; for (int i = 0; i < n; i++) x[i] = s.nextInt(); long[] absurd = new long[n-k+1]; absurd[0] ...
c95c6542-5f34-40aa-b9ec-f72232ff64d9
4
private HandshakeState isFlashEdgeCase( ByteBuffer request ) throws IncompleteHandshakeException { request.mark(); if ( request.limit() > Draft.FLASH_POLICY_REQUEST.length ) { return HandshakeState.NOT_MATCHED; } else if ( request.limit() < Draft.FLASH_POLICY_REQUEST.length ) { throw new IncompleteHa...
db225388-6c15-4ca2-a801-4ee3a0e215f6
5
public static List<Long> binomialSequence(final double prob, final long max) { final List<Long> result = new ArrayList<Long>(); if (prob > 0 && prob < 1.01 && max >= 0) { final Random random = new Random(); final double logQ = Math.log(1 - prob); long current = -1; do { final double rnd = ran...
dd1c89fa-9d50-430f-9b14-33bb616a97fa
2
private void checkExistingSchedule(String sched_id) throws Exception { ScheduleModel sched = DataStore.getSchedule(sched_id); if(sched==null) throw new Exception("Cette rencontre n'existe pas."); else if(sched.isSched_isStart()) throw new Exception("Cette rencontre a déjà commencé."); }
f34e6911-ec72-42dc-a421-7f18845172b4
3
private int getMaxInd(int pos1, int pos2){ if (Math.min(pos1, pos2) >= size) throw new ArrayIndexOutOfBoundsException(String.format( "Invalid data: %d, %d", pos1, pos2)); if (Math.max(pos1, pos2) >= size) return Math.min(pos1, pos2); return heap.get(pos1).compareTo(heap.get(pos2...
e5f9dfca-124d-4ccb-8f02-cc37b8a1b034
2
public Features(int numbFaces, int numbNonFaces){ if((numbFaces == numbNonFaces) && (numbFaces == 0)){ numbFaces = new File(FACES).listFiles().length; numbNonFaces = new File(NONFACES).listFiles().length; } else { this.numbFaces = numbFaces; this.numbNonFaces = numbFaces; } integralFaces = new int[n...
669f0b2e-e2de-4ae9-82fa-0c8d8a6572f5
3
public Configuration getConfigData() { if (this.configData == null) { synchronized (this) { this.configData = new HierarchicalConfiguration(); /** * - Load data from config properties file. * - Overwrite any existing data with the data that is specifie...
8a0ce221-bdaf-4b04-bc78-8ffaa3a96f61
3
public JSONObject putOnce(String key, Object value) throws JSONException { if (key != null && value != null) { if (opt(key) != null) { throw new JSONException("Duplicate key \"" + key + "\""); } put(key, value); } return this; }
a38c56bd-ac1d-4a72-a12c-65f4eb667a84
0
public final void setSite(IServiceProvider value) { privateSite = value; }
4f0c3f43-5c4a-44ba-a5b4-e26855ab0afb
6
private void drawGlyph(byte glyphPixels[], int x, int y, int width, int height, int colour) { int outputPosition = x + y * DrawingArea.width; int outputWidth = DrawingArea.width - width; int inputWidth = 0; int inputPosition = 0; /* * Calculate the height of the glyph. */ if (y < DrawingArea.top...
73964c93-7cab-442e-808f-ab20e1e24edf
2
public boolean playerIsTargetable(Avatar player, Map map) { Line2D line = new Line2D.Float(this.x, this.y, player.getX(), player.getY()); Point2D current; for (Iterator<Point2D> iter = new LineIterator(line); iter.hasNext();) { current = iter.next(); if (map.getleftUptiletype((float) current.getX(), ...
6d8b6b9b-d801-4c76-9ced-e4ba34d13c1b
2
public static void renderRegion(String worldName, CoordXZ coord) { if (!renderEnabled()) return; World world = Bukkit.getWorld(worldName); int y = (world != null) ? world.getMaxHeight() : 255; int x = CoordXZ.regionToBlock(coord.x); int z = CoordXZ.regionToBlock(coord.z); api.triggerRenderOfVolume(worldNa...
86b4ad75-66d6-48e3-a177-153da1358a5f
0
@Test public void canGetWords_whenWordsSharePrefixes() { trie.add("abc"); trie.add("abd"); trie.add("abcd"); assertTrue(trie.contains("abc")); assertTrue(trie.contains("abd")); assertTrue(trie.contains("abcd")); assertFalse(trie.contains("abdc")); }
ca2bfc5c-f838-49b7-b700-20d31dab27c1
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if((affected!=null) &&(affected instanceof MOB) &&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker())) &&(msg.sourceMinor()==CMMsg.TYP_QUIT)) { ...
de949bd1-66ee-4d85-a488-892d5893c47e
3
public void run() { while (!global.quit) { try { client.recvState(state); } catch (SocketTimeoutException e) { } catch (Exception e) { e.printStackTrace(); } } }
45cced32-a061-4934-9260-4a310d78db10
3
public boolean isInside(CPRect rect) { return left >= rect.left && top >= rect.top && right <= rect.right && bottom <= rect.bottom; }
da6d8933-797b-4fec-a564-0d8bd6367b35
0
public int getReliefValveState() { return this.reliefValveState; }
ed23018d-411b-4d71-8e7b-2833caef89b3
2
public void addID(String ID) { if(IDList.size() < MAXCAPACITY) { IDList.add(ID); if( ID.charAt(1) == 'M' ) genderHist.set(0,new Integer(( (Integer)genderHist.get(0) ).intValue()+1) ); else genderHist.set(1,new Integer(( (Integer)genderHist.get(1) ).intValue()+1) ); int gradeHistIndex =...
ade93705-0b6c-4dbc-a0ac-ad58e7ce017b
1
public void stopLogcat() { getLogcat = false; for (int i = 0; i < 500; i++) {} }
0df7ba7e-ed4e-4671-b17f-b559e5ece82d
8
protected NeuralOutputs(Element outputs, MiningSchema miningSchema) throws Exception { m_classAttribute = miningSchema.getMiningSchemaAsInstances().classAttribute(); int vals = (m_classAttribute.isNumeric()) ? 1 : m_classAttribute.numValues(); m_outputNeurons = new String...
29fc45be-5c85-4f5d-9560-0854a4fc8be4
0
public long getTaskCount() { return taskCount; }
c3b84102-f1dc-40d5-b187-5a282d239412
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...
d17c283c-003b-4112-aef7-1d550df4f521
3
public PropagationRuleBase getPropagationRule(){ if (this.panel.btnLPARule.isSelected()) return new LPAPropagationRule(this.clusterer); else if (this.panel.btnLPArRule.isSelected()) return new LPArPropagationRule(this.clusterer); else { double resolut...
cbf5da5c-8c0d-4e6a-b72c-6fb3bb2fa1c9
1
private void print(Vector<SMS> sms) throws SQLiteException{ for (SMS s : sms){ System.out.println("From: "+s.getAddress() + " at: "+DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT).format(s.getDate())+ " with text: "+s.getText()); } }
f1573705-2759-4a43-a5f7-fd9e45257a91
0
public void setContext(Map<String, Object> context) { this.context = context; }
1ab566bb-95c2-411e-bf75-63b16c3c1f6a
7
public void run() { try { serverSocket = new ServerSocket(port); } catch (IOException e1) { e1.printStackTrace(); } System.out.println("server started at port:" + port); while (runflag) { Socket socket = null; try { socket = serverSocket.accept(); ObjectOutputStream oos = new ObjectOutputS...
c5acf45c-47f2-4cfc-88a5-adae6e94a531
5
private void runPatchStatement(DatabaseConnection pDatabaseConnection, PatchRunController pPatchRunController, PatchScript pPatchScript, ScriptExecutable pScriptExecutable, int pSequence) throws ExPromote { //Check the execution is allowed and log the start boolean lRunStatement = pPatchRunControlle...
26c48a90-af38-4f19-b1b4-dc27d11ef018
8
public void RemoveVanillaEntriesInLeveledLists() throws Exception { SPProgressBarPlug.setStatus("RemoveVanillaEntriesInLeveledLists"); List<LeveledEntry> inventoryList; for (LVLI l : SkyProcStarter.patch.getLeveledItems()) { int count = 0; inventoryList = l.getEntries(); ...
63f217e6-ef0e-4a12-b2a7-ef19c0fe817e
7
private List<TableColumn<Object, ?>> getLeaves(TableColumn<Object, ?> root) { List<TableColumn<Object, ?>> columns = new ArrayList<>(); if (root.getColumns().isEmpty()) { //We only want the leaves that are editable. if (root.isEditable()) { columns.add(root); ...
70ea8f47-ba17-4eeb-9cfe-b4038aa75cf3
4
public void linkUserToChannel(String username, long channelId){ if(!users.containsKey(username)) System.out.println("User Service Error - User : " + username + " doesn't exist. Can't join channel : " +channelId); else if(ctrl.getChannel(channelId) == null) System.out.println("User Service Error - Channel : " ...
0e9fdc4d-495f-4210-8437-36ae1edbf986
1
@Override public Date parse(String fromString) { try { return forParsing.parse(fromString); } catch (ParseException e) { e.printStackTrace(); } return null; }
bab42ab1-3e8f-4618-b81d-f04bffba9080
7
@EventHandler public void GhastHeal(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Ghast.Heal.DodgeCh...
4b76747b-5670-4613-bd92-22e63e849b56
8
public static void main(String[] argv) { int counter = 0; String conf = ""; while (++counter < argv.length) { if (argv[counter].equals("--help") || argv[counter].equals("-h")) { __printUsage(); System.exit(0); } else if (argv[counter].equals("--version") || argv[counter].equals("-v")) { __p...
dbe92232-ace2-43bb-ae7d-c689e6c15c4f
5
private static void save() { ObjectOutputStream oos = null; FileOutputStream fos = null; try { fos = new FileOutputStream(FILE); oos = new ObjectOutputStream(fos); oos.writeObject(instance); } catch (Exception ex) { System.err.println("Coul...
a0d42a0b-973f-4e38-bcdc-f2ad48e6dd63
9
@Override public int numberOfAdjacentLivingCells(int x, int y) { Validate.isTrue(x >= 0, "x must be >= 0"); Validate.isTrue(x < this.getWidth(), "x must be less than width of world"); Validate.isTrue(y>=0, "y must be >= 0"); Validate.isTrue(y < this.getHeight(), "y must be less than heigt of world"); int num...
56670c91-eb31-4c40-a91c-a06ded59ffb7
4
@Override public boolean inBoard() { if(((x > -10)&&(x <= Board.WIDTH-10)&&(y > -10)&&(y <= Board.HEIGHT-10))){ return true; } else { return false; } }
763268d3-febf-4e50-ba97-82aabe118953
3
@Override public void addPlayer(User user) { Position position = findNextAvailablePosition(); int teamNum = 1; if(position.equals(Position.East) || position.equals(Position.West)) teamNum = 2; PinochlePlayer p = new PinochlePlayer(position,teamNum,user); if(players.size() <= 3) { players.add(p); } ...
90bb7d27-460d-4d09-a67f-c4255da2714f
2
public ValueType getValue(int place) throws NotExistException { Iterator<ValueType> step = new ListIterator(); if (place <= count) { for (int i = 1; i < place; i++) { step.remove(); } return step.next(); } else { throw new NotExistE...
c94e0054-9ca4-4111-9a91-7a5db29ec482
3
public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return c; }
f84abf80-1fe9-45e6-a6d7-6f0651e399e7
4
@Override public void actionPerformed(ActionEvent e) { Pattern p1 = Pattern.compile("move:(\\d)/(\\d)"); Pattern p2 = Pattern.compile("addPlayer:(\\s)"); Matcher m1 = p1.matcher(e.getActionCommand()); Matcher m2 = p2.matcher(e.getActionCommand()); if(m1.find()) { Piece piece = othello.g...
2436351f-991a-405b-85e5-c597c7293286
4
@Override public JOSObject<?, ?> setValue(JOSObject<?, ?> value) { throw new JOSException("Not Supported!" , this); }
2403f414-1b5d-4e54-9c75-3ac1c32e985b
1
@Override public String getPathEnvironmentVariable() throws IOException, InterruptedException, InvocationTargetException, IllegalAccessException { String value = WinRegistry.readString( WinRegistry.HKEY_CURRENT_USER, //HKEY "Environment", //Key ...
1f571710-ed8e-47b8-8bd5-02d3cd28928d
1
public static void main(String[] args) { int[] array={0,0,0,0}; List<List<Integer>> result = new Sum4().fourSum(array,0); for (int i =0; i < result.size();i++ ) { System.out.println(result.get(i)); } System.out.println("Hello World"); }
be25dd9c-2f4b-4c33-adaa-08d9095f75fb
2
private void paintAllActiveEnemies(Graphics2D g2) { for ( Enemy currentEnemy : board.getAllEnemiesInCurrentWave()) { if (currentEnemy.isActive()) { paintPlacablePixelPosition(currentEnemy, g2); printHealthAboveEnemy(currentEnemy, g2); } } }
edd34f6e-ae6a-48d3-958b-9e6ac0d99e34
8
public void startMovingToTarget(float maxVelocity) { // LET ITS POSITIONG GET UPDATED movingToTarget = true; // CALCULATE THE ANGLE OF THE TRAJECTORY TO THE TARGET float diffX = targetX - x; float diffY = targetY - y; float tanResult = diffY/diffX; fl...
dce561d5-aa3a-4ab6-bb11-de973d369c6c
8
@Override public boolean onCommand(final CommandSender sender, Command command, String label, final String[] args) { if (!sender.hasPermission(command.getPermission())) { sender.sendMessage(Ultrabans.DEFAULT_DENY_MESSAGE); return true; } if (args.length < 1) ...
bf457f5f-2b0c-4517-bf3d-2ca72b10ee53
6
public char nextRequest(int timeout) throws Exception { String requestPath = request(timeout); if (requestPath == null) return 'X'; if (isFileRequest(requestPath)) { replyFile(requestPath); return 'I'; } if (requestPath.equals("play")) return 'P'; if (requestPath.equals("step")) return 'N'; ...
6d1fc2db-c228-4d6f-8780-d491b2199f2b
3
@Override public void onNotify(BTObservableHandlerListener listener, int event, Object o) { if ((CONNECTION_ESTABLISEHD & event)>0){ listener.connEstablished(); } if ((CONNECTION_LOST & event)>0){ listener.connLost(); } if ((RECV & event)>0){ listener.recv((String) o); } }
0c92342c-c68a-444f-8394-72146ed9e342
9
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness())); final URectangle shape = (URectangle) ushape; final double rx = shape.getRx(); final double ry = shape.getRy(); final Shape rect; ...
8b407e21-b509-411f-9e30-09baa159a061
8
public static String complexVariableOption(String prompt, String[] opts, int startValid, Collection<Integer> additionalOpts, char defaultOption){ //do the validation String input; String prefix = Character.isDigit(defaultOption) ? "I" : "C"; String response = prefix ...
87045195-b141-4169-8704-3891508719e7
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if(msg.source()==invoker) return true; if(msg.source()!=affected) return true; if((!msg.sourceMajor(CMMsg.MASK_ALWAYS)) &&((msg.targetMinor()==CMMsg.TYP_STAND)||(msg....
13c23d11-b1f8-4b69-b3fd-1fda75cbbe1e
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Telefone other = (Telefone) obj; if (this.ddd != other.ddd) { return false; } ...
42942547-dcb8-47c5-9193-115845934f4c
5
private void handleWordElement(Attributes atts) { int i; if (page == null || currentLine == null) return; //ID String id = null; if ((i = atts.getIndex(ATTR_id)) >= 0) { id = atts.getValue(i); } //Create word currentWord = currentLine.createWord(id); //Coords if ((i = atts.getIndex(AT...
f00cd655-478f-4ce8-85a5-624bf1d29c0d
2
public void removeHitBox(Entity entity) { for(int i=0; i<this.hitBox.size(); i++) { if(this.hitBox.get(i)[2] == entity) { this.hitBox.remove(i); } } }
4ebe1bc9-ddb1-499a-afca-614d190d82e6
7
final boolean method474(byte i) { anInt891++; if (((ObjectDefinition) this).anIntArray945 == null) { if (((ObjectDefinition) this).anInt887 == -1 && ((ObjectDefinition) this).anIntArray904 == null) return false; return true; } for (int i_0_ = 0; i_0_ < ((ObjectDefinition) this).anIntArray945.length; ...
50cc4bea-df48-447a-bc11-9d4df987e9dc
0
public ForwardingService(InetAddress address, int port) { this.serverPort = port; this.address = address; }
1f474d50-192f-453e-a9b2-85b695cfb22a
4
public FlashScreen(String getColour,boolean fade) { style = fade; if (fade) { transparency = 255; } if (getColour.equals("Black")) { flashScreen.setColor(Color.BLACK); } else if (getColour.equals("White")) { ...
cfdb9556-7bb3-43d0-a466-a546f67d25eb
9
public String[] Evaluate(String in){ Stack<String> S = new Stack<String>(); int index = 0; char c; String res = ""; String t = ""; int i; ArrayList<String> temp = new ArrayList<String>(); while(index < in.length()) { c = in.charAt(index...
f9c186ea-58b5-4450-8644-db784193687b
3
@Override public int compareTo(final Circuit o) { int ret; if (this.getId() == null) { ret = 1; } else if (o == null || o.getId() == null) { ret = -1; } else { ret = this.getId().compareTo(o.getId()); } return ret; }
2fcdc17b-f94a-452f-8c6d-3396a3cfdb88
6
private void createPegboards(BufferedImage source, BeadPallete pallete, float text_size) throws IOException { // Delete already existing temp from the pegboards ArrayList. for(File board: this.board_pattern){ board.delete(); } for(File thumbnail: this.pegboard_thumbnail){ thumbnail.delete(); } ...
10ef5550-1217-4b0e-b11c-89bfbb29b6ce
2
public void reset() { //hay que borrar porque si se pierde, la momia no se va a pintar pero se presenta un gameover IMPORTANTE puntos = 0; momia = null; cobra = null; cobra2 = null; //cont = 0;//contador de tiempo del video al inicio auxLeerNombre = true;// permit...
1de88501-f1e6-4e07-912f-157d946758b6
5
@Override public Task findById(int id) { Task task = null; try { connection = getConnection(); ptmt = connection.prepareStatement(QUERY_SELECT + "WHERE idtask=?;"); resultSet = ptmt.executeQuery(); resultSet.next(); task = new Task(id); ...
22716b35-c97f-4f7f-9fe4-c5bba7b998ae
0
public void setIsReplacement(boolean isReplacement) {this.isReplacement = isReplacement;}
dda4aa70-b55a-4983-b461-685ce66d10f0
8
int getRenderBondOrder(int order) { if ((order & JmolConstants.BOND_SULFUR_MASK) != 0) order &= ~JmolConstants.BOND_SULFUR_MASK; if ((order & JmolConstants.BOND_PARTIAL_MASK) != 0) return order; if ((order & JmolConstants.BOND_COVALENT_MASK) != 0) { if (order == 1 || !showMultipleBonds || modeM...
6ac44a27-8512-47c6-99a3-cbfa9ada0164
8
private void initComponentesAnimacion() { addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mouseClicked(java.awt.event.MouseEvent evt) { formMouseClicked(evt); } private void formMouseClicked(MouseEvent evt) { ...
a18d3242-7411-43ea-a5a4-99989305818f
5
private void startClicked() { if (herob.getUnits().size() < 1 || heror.getUnits().size() < 1) { QMessageBox.warning(gui.WindowStack.getLastInstance(), "Brak jednostek", "Musisz dodać jakąś jednostkę do garnizonu"); return; } herobClone = new core.Hero("", CastleType.HUMAN_CASTLE); herorClone = new co...
7ee87101-04e0-4158-8664-e9705898606c
5
@Override public void execute(TransitionEvent event) throws Exception { if(this.out == null) { this.out = this.bean.getOut(); } if(this.sender == null) { //send(Statics.RX_HELI_ACK); initializeDataSender(); } if(Statics.ACK.equals(event.getIdentifier())) { Object parameter = event.getParame...
bc1951e2-3a4f-4265-b599-77c2f35ddc75
7
public List getDatesWithInboxEntries() { clearResultMetaInformation(); List dates = new ArrayList(); StringBuffer result = new StringBuffer(); GetMethod get = new GetMethod(apiEndpoint + DeliciousConstants.INBOX_DATES); get.setDoAuthentication(true); try { h...
95fac48c-3843-442f-956c-f94a988b1dc2
3
private void analysePASVstring(String input) throws PassivModeException { String substring = input.substring(0, 3); if (substring.equals("227") == true) { // if found message who starts // with 227... System.out.println("Pasmod gefunden"); System.out.println("zu untersuchtender String: "); Sys...
701425ab-2667-402f-af25-5da984d2667e
4
public boolean move(Direction dir) throws GameException { switch(dir) { case TOP: setLocation(getX(), getY()-speed); break; case BOTTOM: setLocation(getX(), getY()+speed); break; case LEFT: setLocation(getX()-speed, getY()); break; case RIGHT: setLocation(getX()+speed, getY()); brea...
d3c4ad08-8b57-4d3a-87b7-717a1e10abaa
6
public static JSGob findMapObjectAbs(String name, int radius, Coord abs) { double min = radius; Gob min_gob = null; synchronized (glob.oc) { for (Gob gob : glob.oc) { double len = gob.position().dist(abs); boolean m = ((name.length() > 0 && gob.resnam...
20118d6f-4faa-4cec-b167-43c80f07d317
8
public void cleanup() { // DEBUG System.out.println( "Attempting to run cleanup." ); if ( out != null ) { try { out.close(); } catch( IOException e ) { System.err.println( "Error: " + playerName + ...
4102213b-107d-4dd4-9f73-34b7f78e16c8
4
public boolean isBalanced(TreeNode head){ if(head==null){ return true; } if(Math.abs(findMaxDistanceToLeaf(head.left)-findMaxDistanceToLeaf(head.right))<=1){ if(isBalanced(head.right) && isBalanced(head.left)){ return true; } } ...
a0c53739-4a75-4007-b28b-e87b26d42125
1
public Sprite.Part.Effect getfx() { if(hp >= 4) return(null); return(fx); }
42c2f3ab-9f8a-4662-9f84-d516aed28a5f
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetc...
9be017db-f646-40a9-981a-7f4bffc839b4
2
@Override public String toString() { int num = this.transactionSet.size(); String transactionSetItems = ""; for (int i = 0; i < num; i++) { String item = this.transactionSet.get(i).getTransaction().toString(); transactionSetItems = transactionSetItems + "T" + i + ": " + item; if (i < num - 1) { tra...
4b8fb5cb-7eae-434c-acd9-dc4294a66fbb
5
private boolean sassenfeld() { double beta = 0; double []betaParcial = new double[this.matriz.linhas]; int i; for(i = 0; i < this.matriz.linhas; i++) { betaParcial[i] = 1; } for(i = 0; i < this.matriz.linhas; i++) { for(int j = 0; j < this.matriz.linhas; j++) { if(i != j) { beta = beta ...
2dba4668-1f19-4978-89ad-52c352b5b358
8
* @param mm * @param dd * @return int */ public static int computeJulianDay(int yyyy, int mm, int dd) { { int jul = 0; int ja = 0; int jy = 0; int jm = 0; if (yyyy == 0) { throw ((StellaException)(StellaException.newStellaException("There is no year zero.").fillInStackTra...
635e0b0a-e7e9-4bb8-8102-895fd626ff34
4
private int minRatioRule(int q) { int p = -1; for (int i = 0; i < M; i++) { if (a[i][q] <= 0) continue; else if (p == -1) p = i; else if ((a[i][M+N] / a[i][q]) < (a[p][M+N] / a[p][q])) p = i; } return p; }
8a24130f-e7ab-4556-9e92-f919268568e3
7
protected void updateFallState(double par1, boolean par3) { if (par3) { if (this.fallDistance > 0.0F) { if (this instanceof EntityLiving) { int var4 = MathHelper.floor_double(this.posX); int var5 = MathHe...
7d720c9a-34fd-4e1c-933c-824a00d4e3df
0
public EditorFrame(){ new JFrame("Database editor"); setSize(WINDOW_SIZE); setLocation((int)(SCREEN_SIZE.getWidth()/2-getWidth()/2), (int)(SCREEN_SIZE.getHeight()/2-getHeight()/2)); setDefaultCloseOperation(DISPOSE_ON_CLOSE); getContentPane().setLayout(null); ...
0a0dd43b-8538-420c-8e5b-a0776e78952e
3
@Override public void checkFunctional() { for (LevelSegment seg : _holes) { Vector4D distance = new Vector4(_ball.getPosition()); distance.substract(seg.getPosition()); distance.setY(0); if (distance.length() < _holeRadius) { _ball.setXScaleSpeed(-1); _ball.setZScaleSpeed(-0.5); } } V...
7739784f-2fea-4f12-8627-d1a095177ed3
9
public void mouseMoved(MouseEvent Event) { boolean needRepaint = false; if (null != this.vertexToDelete) { this.deleteVertex(this.vertexToDelete); this.selectedVertex = null; } if (null != this.movingVertex) { this.selectedVertex = null; th...
a416e8ad-2bb2-499a-bd28-28bbc8d27269
7
public void start() throws IOException { Socket socket = null; PrintWriter out = null; BufferedReader in = null; BufferedReader stdIn = null; System.out.println("Hi! Please provide a command: JOIN, LEAVE, LIST"); try { InetAddress host = InetAddress.getLo...
641519cb-a6ad-4680-b20e-ba7f7eb20fee
9
public static long convertToLong(String addr) throws Exception { String[] octs = addr.split("\\."); if( octs.length != 4 ){ throw new Exception("Invalid address format."); } long octA = Long.parseLong(octs[0]); long octB = Long.parseLong(octs[1]); long octC ...
82148afa-d835-4aed-bbed-33da14bb355b
4
private boolean takeForum(){ // Prend une ressource au forum (si le villageois est sur la bonne case) retourne Vrai s'il a reussit , faux sinon. if (this.curent.objet instanceof Forum){ Forum b ; b = (Forum) this.curent.objet; if (b.al != this.al){ return false; } else{ if (b.delet...
2c719ece-8ba7-451d-b1ed-ce97fd93ee47
2
private void drawGameInformation(Graphics g) { g.setFont(new Font("Times", Font.BOLD, 48)); g.setColor(Color.LIGHT_GRAY); String scoreMessage = " Score: " + userScore; if (noMoreTableCards) { scoreMessage = "No more table cards! " + scoreMessage; } else if (noMoreAvailableMoves) { scoreMessage = "No mo...
6cd93323-75de-452a-b28b-65f7711e5a10
6
public static boolean isWhiteSpace(int c) { switch (c) { case NUL_CHAR: // Null (NULL) case '\t': // Horizontal Tab (HT) case '\n': // Line Feed (LF) case FF_CHAR: // Form Feed (FF) case '\r': // Carriage Return (CR) case ...
e191a3d6-ee8d-41ca-9fd7-c305c7952ecf
1
private void markSubroutines() { BitSet anyvisited = new BitSet(); // First walk the main subroutine and find all those instructions which // can be reached without invoking any JSR at all markSubroutineWalk(mainSubroutine, 0, anyvisited); // Go through the head of each subroutine and find any nodes reachab...