method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d2552f58-14f0-45af-bb7f-6240a8dc1d83
3
public void paddleSound(){ try { Clip click = AudioSystem.getClip(); click.open(AudioSystem.getAudioInputStream (Ball.class.getResource("Click.wav"))); click.start(); } catch (LineUnavailableException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Unsupported...
0e2039e3-6fd3-4f24-b432-c6e8340d1ffc
3
private void calculateEnabledState(Document doc) { if (doc != null && doc.isModified() && !doc.getFileName().equals("")) { setEnabled(true); } else { setEnabled(false); } }
9df6fa98-9036-490c-9d9a-a78d0744871e
9
public void setOptions(String [] options) throws Exception { String lowerString = Utils.getOption('L', options); if (lowerString.length() != 0) { setRunLower(Integer.parseInt(lowerString)); } else { setRunLower(1); } String upperString = Utils.getOption('U', options); if (upperStrin...
234d3265-d36e-4609-a71c-23384e8e9299
8
public boolean handleEvent(Object emitter, Object type, Object data) { final Object object = provider.get(); if (object == null) { return true; } final int paramCount = method.getParameterTypes().length; final boolean wasAccessible = method.isAccessible(); m...
ed1a29e6-8f41-4c75-9924-128deba39298
7
@Override public void detect() { // TODO Auto-generated method stub AUnit u = getBoard(); UnitConfiguration unitConfig = u.getConfiguration(); for(Position p:u.getPositionList()){ AUnit t = Game.getInstance().getUnitByID(p.getTargetID()); UnitConfiguration targetConfig = t.getConfiguration(); if(p.ge...
3778e1bc-c85f-4107-9af0-2dc8b9ecd713
7
public TileItem addTileItem(TileItem item) { if (item == null) { return null; } else { for (int index = 0; index < tileItems.size(); index++) { TileItem oldItem = tileItems.get(index); if (item instanceof TileImprovement && oldI...
72ab3e4d-e2ad-48cd-912f-877f6601cf00
0
@Test public void test() throws JAXBException { Row comment = new Row(); comment.postId = "1"; comment.userId = "2"; comment.text = "text"; comment.creationDate = "some date"; JAXBContext context = JAXBContext.newInstance(Row.class); Marshaller...
2de2ff43-7681-4513-bcab-192b71b7f9f7
8
public void run() { PrintStream out = new PrintStream(outFile); DataInputStream in = new DataInputStream(inFile); try { while (!suspending) { String line = in.readLine(); if (line == null) break; if (line.contains(query)) { out.println(line); } // Make grep take longe...
6b820ab0-4c68-4389-bf04-726a5c3883b0
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...
9055892e-1e86-491a-b29b-6654dfafbc0a
5
public void synchronizeCuboidManagement(boolean cuboids, boolean habitats) { try { if (cuboids) for (int i = 1; i <= greatestID(); i++) { synchronizeCuboid(i); } if (habitats) for (int i = 1; i <= greatestID(); i++) { synchronizeHabitat(i); } } catch(Exception e) { e.p...
4261af29-0fee-437f-945e-842c3d611595
7
private Salle calculerSalleCours(Seance seance, Formation formation) { String typeCours = seance.getType(); Salle s = null; if(typeCours.equals("CM")){ s = formation.getSalleCM(); seance.setSalle(s); } if(typeCours.equals("TD")){ s = f...
b1b4a214-7060-4054-aea4-4dec35a64323
7
public Scriptable construct(Context cx, Scriptable scope, Object[] args) { Class<?> classObject = getClassObject(); int modifiers = classObject.getModifiers(); if (! (Modifier.isInterface(modifiers) || Modifier.isAbstract(modifiers))) { MemberBox[] ctors = ...
b7964d3a-80f2-4473-bb6b-4287634dd72f
6
public final Set<String> openZipIn(final stone.util.Path zipFile) { if (!zipFile.exists()) { return null; } final Set<String> entriesRet = new HashSet<>(); try { final ZipFile zip = new ZipFile(zipFile.toFile()); final byte[] content = new byte[16000]; final Enumeration<? extends ZipEntry> entries ...
3645c582-25f5-4656-816b-d15a0251ca30
6
public String toString(String echo) { String response = ""; if ( echo == null ) { response = "<TPTAResponse version=\"" + this.version + "\">\n<entities>"; } else { response = "<TPTAResponse version=\"" + this.version + "\">\n<text lang...
163a9bda-6099-49a4-bd48-a265f7201a24
5
public static boolean isLUHN(String number) { if (number == null) { return false; } number = StringUtils.reverse(number); int total = 0; for (int i = 0; i < number.length(); i++) { int x = 0; if (((i + 1) % 2) == 0) { x = Integer.parseInt(number.substring(i, i + 1)) * 2; if (x >= 10) { ...
f60beb00-7b8d-4222-b19e-53c9d9b6968e
5
public Method findSetMethod(Field field, Class<?> paramType) { if(field == null) return null; if(getFieldDetailStore().isSetMethodPresentFor(field)) { return getFieldDetailStore().setMethodOf(field); } String setterName = createMethodName("set", field.getName()...
9234da8b-bc1f-4c5e-ae7f-57364a2cc08b
7
public static final char[] fixLibPackageTail(char[] packageName) { if(packageName==null || packageName.length<3) return packageName; int length = packageName.length; if( packageName[length-3]=='/' && (packageName[length-2]=='j' || packageName[length-2]=='J') && (packageName[length-1]=='s' || packageName[length...
7967e6d1-1018-4112-8a08-686a39768151
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...
0b154672-004a-4e6e-b215-67feb332fc74
5
public StringSearchAlgorithm getStringSearchAlgorithm(String s) { StringSearchAlgorithm alg = null; if (s.equals(ss_alg_naive)) { alg = new NaiveSearch(); } else if (s.equals(ss_alg_rabin)) { alg = new RabinKarp(); } else if (s.equals(ss_alg_boyer)) { alg = new BoyerMoore(); } else if (s.equal...
564b1335-43e2-449d-81a6-840b4a3e881e
4
@Override public boolean equals(Object object) { boolean result = false; if (object != null && object instanceof House) { result = (this.width == ((House) object).width && this.height == ((House) object).height && this.value == ((House) object).value); } return result; }
bcbc997b-aed3-48a8-a67b-e2b261ab8c30
3
private void createCards() { try { String[] GGdesc = {"Return to Earth and collect $400.", "A pirate has hijacked the Galactic Cannon and shot you! Roll one die to see how far back you must go.", "You've booted out the previous owner are now new owner of the Extrasolar Gateway. All fees go to you."...
aadd929b-7be8-444d-9945-eaad64208e9a
2
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (qName.equals("result")) response.set(callList); if (qName.equals("rowset")) { callGroups = false; calls = false; } super.endElement(uri, localName, qName); }
b9349e73-17c1-4945-958a-932d734508ef
2
public void showAll() { int cols = 0; for (String command : commands.keySet()) { if(cols>=5){ System.out.println(); cols = 0; } System.out.print("▶ " + command + " "); cols++; } System.out.println(); }
2841f3e4-5cc7-46d3-a1e3-6f4ec5768fe4
5
@EventHandler public void onPlayerInteract(PlayerInteractEvent event) { // Respect other plugins if (event.isCancelled()) { return; } if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { RDPlayer rdp = RDPlayers.getPlayer(event.getPlayer().getName()); ...
9b7dffbe-4f12-466f-91e4-dcbc426aeadb
0
public void println(final String txt) { print(txt + "\n"); }
50cd9ebe-1497-4a0f-9692-385b6d7fb229
3
public static void main(String[] args) { long start = System.nanoTime(); int count = 0; for (int n = 1; n <= 100; n++) { for (int r = 1; r <= n; r++) { BigInteger combin = combinatoric(n, r); if (combin.compareTo(BigInteger.valueOf(1000000)) > 0) { count += 1; } } } System.out.println(c...
d645f905-ab77-428f-9ff5-ac2d4782d3e2
0
public Pixel(int x, int y) { this.x = x; this.y = y; }
bfc14558-d9f1-40a4-ac21-735297eebb77
7
public static void act(Unit unit) { UnitType type = unit.getType(); // ============================== // SPECIAL units // Wraith if (type.isWraith()) { TerranWraith.act(unit); } // ============================== // Define place where to be MapPoint point = ArmyRendezvousManager.getFlyersGatheri...
86981163-7def-475f-ab7d-69ded1e3c7c0
2
@Override public void actionPerformed(ActionEvent e) { if (searchText.getText() != null && !searchText.getText().equalsIgnoreCase("")) { table.setListData(handler.getUsers(searchText.getText())); table.repaint(); } else { table.setListData(handler.getUsers()); ...
5d264298-afee-4384-b537-07e004d16751
3
public Event getNextEvent () throws ParserException, TokenizerException { if (peekedEvent != null) { try { return peekedEvent; } finally { peekedEvent = null; } } while (!parseStack.isEmpty()) { Event event = parseStack.remove(0).produce(); if (event != null) { return event; } } ...
a5673522-9f10-4c9c-885e-d06666076741
4
private boolean isOperator(char c){ if(c == '+' || c == '-' || c == '/' || c == '*'){ return true; } return false; }
9b720448-5a4c-4e0b-8525-7c9569575f40
9
public UpgradePlan getUpgradePlan(Integer ver0, Integer ver1) { // Init our bookkeeping data structure int n = versions.size(); PNode[] pnodes = new PNode[n]; Map<Integer,PNode> map = new TreeMap(); int i=0; for (Integer ver : versions) { PNode pn = new PNode(); pn.version = ver; pn.ix = i; pn.d = Inte...
20a5c31d-2138-46ab-b83f-017a885694df
0
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext( "applicationContext.xml"); log.debug(context.getMessage("Company", null, Locale.US)); log.debug(context.getMessage("Company", null, Locale.CHINA)); log.debug(context.getMessage("Company", null, Locale.T...
7fc88852-40f2-4aca-ade5-509ddc0cc43a
4
private static void addJavaLibraryPath(String j3dLibPath) { try { // Although it is not well documented, the java.library.path system property // is a "read-only" property as far as the System.loadLibrary() method is concerned. // This is a reported bug but it was closed by Sun as opposed to getting fi...
9e7a073a-9c70-4ac4-8855-3557271bca44
0
public Point getPanelAnchor(Panel p) { return new Point(((Rectangle) (p.getShape())).x, ((Rectangle) (p.getShape())).y); }
67b2a327-068d-4c7e-9533-e99ac7ea888e
2
public char findFirstDuplicate(){ HashMap<Character, Integer> charList = new HashMap<Character, Integer>(); for(int i=0;i<charArray.length; i++){ if(charList.containsKey(charArray[i])){ System.out.println("memory used: " + charList.size()); return charArray[i]; }else { //index in charList.p...
900a6ad7-5496-4350-97ac-e0831f474811
3
private Runnable createTask() { return new Runnable() { @Override public void run() { while (true) { try { if (lock.tryLock()) { try { System.out.println("locked " + Thread.currentThread().getName()); Thread.sleep(1000); } finally { lock.unlock(); ...
6a93be00-7378-42b1-b14f-f1f6c9473fda
5
@Parameters( { "STLBDataID", "STLBExpVal", "STLDataID", "STLExpVal", "STBCDataID"}) @Test public void test_WidgetSignInWithInvalidSharethisAccount(int STLBDataID, int STLBExpVal, int STLDataID, int STLExpVal, int STBCDataID) { STLaunchBrowser launchBrowser = new STLaunchBrowser(); launchBrowser.stLaunch(STL...
1c22516a-b20e-4951-8e7e-88bc2d147d4b
7
public Object nextContent() throws JSONException { char c; StringBuffer sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new Str...
005f9d45-9b9c-40ba-aa0a-c4e0c29383bb
8
public boolean input(Instance instance) throws Exception { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_NewBatch) { resetQueue(); m_NewBatch = false; } Instance inst = (Instance) instance.copy(); //compute norm of...
13b20ef4-6f95-462c-a59f-c3ce324b3d0a
5
@Override public String readLine() { String ret = null; try { if (m_full || m_remaining > 0) { ret = m_reader.readLine(); if (ret != null && !m_full) { m_remaining--; } } } catch (final IOException e) {} return ret; }
7e0dc2c8-113a-4f0d-8adc-789bf29070b5
3
private static List<String> split(String path) { String[] pathComponents = path.split("/"); List<String> l = new ArrayList<String>(); for (String s : pathComponents) { if (s != null && !s.isEmpty()) { l.add(s); } } return l; }
7af793e0-49cb-4482-8f02-2de8a53e6172
8
@Override public void insertString(int i, String s, AttributeSet attributeset) throws BadLocationException { if (s == null || "".equals(s)) { return; } String s1 = getText(0, i); String s2 = getMatch(s1 + s); int j = (i ...
f28e4e5a-848e-433d-b9f5-80e56097be05
5
public static int getX(RSInterface parent, RSInterface child) { if (parent == null || parent.children == null || child == null) { return -1; } for (int index = 0; index < parent.children.size(); index++) { if (parent.children.get(index) == child.id) { return parent.childX.get(index); } } return -...
2fe5a852-13a9-4159-814a-78d10b633ab8
2
@Test public void testDeleteElement() throws Exception { List<String> list = new List<>(); list.addToEnd("test1", 1); list.addToEnd("test2", 3); for (String current : list) { assertTrue(list.exist(current)); } list.deleteElement("test2"); list.dele...
992ac616-147d-407d-b84f-d9be58ad4f24
3
public boolean kaksiParia(){ int count = 0; for(int i=0; i<4; i++){ if(nopat[i].getValue()==nopat[i+1].getValue()){ count++; i++; } } if(count==2){ return true; } return false; }
2cc0f01c-eb5f-463f-b0d3-20762177b250
5
public static void dumpData(String text, byte[] data, int length) { System.out.println(text); for (int i=0; i<length; i++) { if (i%32 == 0) System.out.print(String.format(" %14X ", i)); else if (i%4 == 0) System.out.print(" "); Syste...
a3f34142-2a22-4eaf-b120-bccf4ad17982
7
public Pokemon chooseBest() { if(team.size() == 0 || otherTeamPossibilities.size() == 0) return null; double topscore = 0; Pokemon top = team.get(0); for(Pokemon poke : team) { System.out.println("Pokemon "+poke.getName()); double pokescore = 0; double speciesscore = 0; double speciescount = 1...
5c3308b2-f127-43d9-a041-ee712831e00d
0
public int getHeight() { return anim.getImage().getHeight(null); }
374543bb-6f25-41f3-97a5-588f122c1fe6
9
private boolean RunAwayFromPredator() { // �������� ������� int speed = 3; // ��������� ���������. int DangerDistance = 100; DangerDistance = DangerDistance * DangerDistance; int min = DangerDistance + 1; int currentDistance; Leo currentLeo; // ������� �� �������. if (!this.isAlive) { return fa...
49c4311f-a899-4e78-96d5-0e6b3672a2cc
4
public void setExecParam(double wallTime, double actualTime) { if (wallTime < 0.0 || actualTime < 0.0 || index_ < 0) { return; } Resource res = resList_.get(index_); res.wallClockTime = wallTime; res.actualCPUTime = actualTime; if (record_) { ...
e6274777-7f96-4aad-9dc2-aba60147c164
8
@Override public void run() { //TODO collect statistics on users for fun: //1. # of standups attended/missed //2. speed of response after called on //3. avg length of standup response? //4. # of out of turn comments //2 ways in: //1. is a poll check and the user spoke //2. is not a poll, timer expi...
5772a229-4a2c-429e-b670-f9160b8e3e4d
3
public void RemoveLine(){ try{ File file = new File(getDataFolder(),"Plates.prop"); BufferedWriter bw = new BufferedWriter(new FileWriter(file, true)); PrintWriter writer = new PrintWriter(file); writer.print(""); writer.close(); for(int i= 0;i<plates.size(); i++){ String world = plates.ge...
2b845843-8d7c-4159-ae13-4c55cdb76cb6
8
public Chunk loadChunk(int par1, int par2) { long var3 = ChunkCoordIntPair.chunkXZ2Int(par1, par2); this.droppedChunksSet.remove(Long.valueOf(var3)); Chunk var5 = (Chunk)this.chunkMap.getValueByKey(var3); if (var5 == null) { int var6 = 1875004; if (p...
b2e2e6c3-15e2-4a0f-8155-7813762d7306
4
private void createPools(Properties props) { Enumeration propNames = props.propertyNames(); while (propNames.hasMoreElements()) { String name = (String) propNames.nextElement(); if (name.endsWith(".url")) { String poolName = name.substring(0, name.lastIndexOf(".")...
ba504b82-c517-4803-8200-e237ca26b3c5
9
public LoginResult prelimChecks(Session session, String login, PlayerLibrary.ThinnerPlayer player) { if(CMSecurity.isBanned(login)) { session.println(L("\n\rYou are unwelcome. No one likes you here. Go away.\n\r\n\r")); session.stopSession(false,false,false); return LoginResult.NO_LOGIN; } if((player...
728842b2-3cc5-48c4-a4fa-9be17aa8c1b1
2
public GameSettingsPanel() { try { JLabel logoLabel = new JLabel(); logoLabel.setIcon(new ImageIcon(ImageLoader.getImage("/tics/logo.png"))); logoLabel.setText("Version 0.1"); logoLabel.setVerticalTextPosition(JLabel.BOTTOM); logoLabel.setHorizontalTextPosition(JLabel.CENTER); super.add(logoLabel); ...
cbd076e0-117e-4157-bfa9-57ada99d8f22
3
public Invaders(int niveau, InvaderFires invaderFires, GameController gc) { invaders = new ArrayList<Invader>(); if (niveau == 1) { for (int i = 10; i < Window.HEIGHT - 50; i += 50) { for (int j = Window.WIDTH - 500; j < Window.WIDTH - 50; j += 70) { invaders.add(new Invader(j, i, this)...
8cee7647-4c7d-4bce-8b11-553312834ca1
5
public static boolean readUserSelectedFile() { if (fileDialog == null) fileDialog = new JFileChooser(); fileDialog.setDialogTitle("Select File for Input"); int option = fileDialog.showOpenDialog(null); if (option != JFileChooser.APPROVE_OPTION) return false; File selected...
26f23087-39a4-418b-a953-aab5215dda24
8
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 fe...
75535f5e-a5f9-4d64-aecf-7f8efcfa83bc
8
@Override public void onEnable() { config = new Config(this); config.loadConfig(); getServer().getPluginManager().registerEvents(new BlockBreakListener(this), this); getServer().getPluginManager().registerEvents(new BlockPlaceListener(this), this); getServer().getPluginManag...
dcf04672-5dcc-4150-a3e1-d75c394156ff
2
public void printGrid() { for (int y = 3; y >= 0; y--) { for (int x = 0; x < 4; x++) { System.out.print(grid[x][y] + " "); } System.out.println(); } }
a14d645a-a553-4532-89bb-6a091681b0c0
6
public void cargarArbol() { r_con.Connection(); int count = 0; int aux = 1; Enumeration e = root1.breadthFirstEnumeration(); while (e.hasMoreElements()) { parent1 = (DefaultMutableTreeNode) e.nextElement(); if (count >= aux) { try { ...
de0e8620-db44-4810-bede-4a1478cbf9d5
4
@Override public int loop() { if(start) { if(task == null || !task.hasNext()) { task = container.iterator(); } else { final Node curr = task.next(); if(curr.activate()) { curr.execute(); } ...
c35f74f5-1d89-4ac3-99a4-d6db879bdd58
4
public void addGhost(Ghost g, int ghostNum){ g.setIsAlive(false, false); if (numOfGhosts == 0){ g.setX(14); g.setY(16); } else if (numOfGhosts == 1){ g.setX(14); g.setY(14); } else if (numOfGhosts == 2){ g.setX(14); g.setY(12); } else if (numOfGhosts == 3){ g.setX(16); g.setY(14)...
3d08afcc-fc58-4c36-89ad-c6845f1f0b93
3
private static StructuredBlock skipFinExitChain(StructuredBlock block) { StructuredBlock pred, result; if (block instanceof ReturnBlock) pred = getPredecessor(block); else pred = block; result = null; while (pred instanceof JsrBlock || getMonitorExitSlot(pred) >= 0) { result = pred; pred = getPre...
137c817f-ca38-4569-8e06-0a339b2e998e
7
public int getNumDay() { if(currentDay==0){ return 1; } if(currentDay==1){ return 2; } if(currentDay==2){ return 3; } if(currentDay==3){ return 4; } if(currentDay==4){ return 5; } if(currentDay==5){ return 6; } if(currentDay==6){ return 0; } else{ return 0; } }
fa4dc629-e97e-4a51-8229-80263c38c63d
7
@SuppressWarnings("unchecked") public Queryable(UnitOfWork uow, String obj, BaseCommand cmd) { uow.open(); TStr = obj; try { if (!ReflectionCache.containsKey(obj)) ReflectionCache.put(obj, Class.forName(obj)); if (!uow.cacheManager.cacheExists(obj)) ...
d98206ce-c4d5-40a6-9e7e-23bb77870ef2
8
public void keyPressed(KeyEvent e) { if (state == MUERTO) { if (e.getKeyCode() == KeyEvent.VK_SPACE) { restart = true; } } else if (state == VIVO && e.getKeyCode() == KeyEvent.VK_SPACE) { if (bird.getPosY() > 0) { salta = true; ...
8af3b8cd-95ff-4127-99ac-36a431ea9497
3
public void setRow(int a, String b){ if(a < x){ String[] tokens = b.split(","); if(tokens.length == y){ for(int i = 0; i < y; i++){ mat[a-1][i] = Integer.parseInt(tokens[i]); } } } }
db68aa6b-99bf-47b5-a028-bc7cca72d5db
2
public Client(Socket socket) { channels = new ArrayList<Channel>(); this.socket = socket; this.websocket = null; if (socket == null) { return; } try { out = socket.getOutputStream(); } catch (IOException e) { } }
276693b1-6972-4912-81ca-92085475617c
5
public void compute() { switch (state) { case STATE_IDLING: idling(); break; case STATE_SEEKING: seeking(); break; case STATE_ATTACKING: attacking(); break; case STATE_RETREATING: retreating(); break; case STATE_DEFENDING: defending(); break; } }
c8d1879e-555c-45c0-805e-452b08ad204e
6
public void update(double deltaTime) { super.update(deltaTime); if(facility1!=null) facility1.update(deltaTime); if(facility2!=null) facility2.update(deltaTime); timePassed+=deltaTime; if(((int)(timePassed/86400)) != timeRounded){ // every new day: timeRounded = (int)(timePassed/86400); for(Map.En...
84e0fcff-60d6-4f94-936f-bde07f6632f8
2
@Override public Iterator<MazeMove> getMoves() { List<MazeMove> moves = new ArrayList<MazeMove>(); for (byte i = 0; i < type.direction; i++) { int[] p = DIRS[i]; int dx = x + p[0]; int dy = y + p[1]; if (type.free( dx, dy )) { moves.add( new MazeMove( i ) ); } } return moves....
379bf9ae-7be6-4500-a965-5306ba9205cb
1
public void mousemove(MouseEvent ev, Coord c) { setmods(ev); mc = c; if (mousegrab == null) root.mousemove(c); else mousegrab.mousemove(wdgxlate(c, mousegrab)); }
e63a9121-00d6-4b70-9168-0a0f04c1313b
7
@Override public boolean equals(Object obj) { SimpleTypeParameter newParam = (SimpleTypeParameter) obj; if (!this.name.equals(newParam.getName())) return false; if (this.value == null && newParam.getValue() != null || this.value != null && newParam.getValue() == null) return false; if (this.value =...
b50a4845-d93d-4914-91d4-85074349f5ec
2
public Group_schedule getGroup_schedule(int id) { Group_schedule gschedule = null; try { PreparedStatement ps = con.prepareStatement("SELECT * FROM group_schedule WHERE id=?"); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); if(rs.next()) { gschedule = getGroup_scheduleFromRS(rs); ...
76f902e3-4fcb-4b42-8679-b53d810991c3
6
public static final IPad getInstance(String pad) { if (pad == null) { return null; } pad = pad.trim(); IPad result = null; if (pad.equalsIgnoreCase(PKCS7_PAD)) { result = new PKCS7(); } else if (pad.equalsIgnoreCase(TBC_PAD)) { result = new TBC(); } ...
2caff20b-a8ce-4da7-9bf2-0bcad4b2ce8a
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)) { ...
dcd27ef8-bd5e-4c6d-88de-537c7387c51f
8
public static List<Map<Object, Object>> bellmanFord(mxAnalysisGraph aGraph, Object startVertex) throws StructuralException { mxGraph graph = aGraph.getGraph(); Object[] vertices = aGraph.getChildVertices(graph.getDefaultParent()); Object[] edges = aGraph.getChildEdges(graph.getDefaultParent()); int vertexNum =...
5090cf2c-18d6-4976-a6a3-1469158204e7
7
@Test public void testVisibilityGraph() { Point[] ps = Arrays.copyOf(aConvex, aConvex.length + 3); ps[ps.length - 3] = p(-4, -2); ps[ps.length - 2] = p(5, 7); ps[ps.length - 1] = p(11, 6); // System.out.println(Arrays.toString(ps)); AdjGraph g = visibilityGraph(ps, new...
f7540735-4571-4745-80e8-9b2ded7920d6
5
public void moveAi(double ballX, double ballY, double ballW, double ballH) { if (ballX >= gameWidth / 2) { if (ballY < y && y >= 2) y -= SPEED; if (ballY > y && y + height <= gameHeight + ballH) y += SPEED; } }
e8867aa8-8bb9-402c-85d4-1b2c057cb820
4
private Character getSolidCharacter(GameDescription gameDescription){ GameAnalyzer gameAnalyzer = new GameAnalyzer(gameDescription); ArrayList<String> solidSprites = gameAnalyzer.getSolidSprites(); int minValue = Integer.MAX_VALUE; Character result = ' '; for(Entry<Character, ArrayList<String>> entry:gameDesc...
4496b61b-6e1d-4e6d-957f-003c0721d87c
1
public String toString() { String string = ""; for (HardwareSetAlternative hsaList : hardwareSetAlternatives) { string += hsaList.toString() + ""; string += " - "; } return string.substring(0, string.length() - 3); }
9b25ac36-0224-410c-8256-cb98fbd9f4c6
2
@Override public void render(float delta) { Gdx.gl.glClearColor(0.56f, 0.165f, 0.1f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (roundController.isGameOver()) { this.game.setScreen(new GameOverScreen(game, heroController.getHero().getTotalScore())); } // TODO: to test the pause if (Gdx.input.isKe...
3b11582b-1fec-4b11-889d-43c682048044
7
public Mage(Grid g, Patch p) { super(g, p); setFriendly(true); setMove(2); setRange(1); setHealth(60); setShield(0); setDamage(35); setMaxHealth(85); try { getStates().add(ImageIO.read(new File("res/Mage/Mage.gif"))); } catch (I...
6b599415-8d62-4124-b2e7-d579551a1a38
0
public String toString() { StringBuffer result = new StringBuffer(); result.append("\n"); result.append("Game is in " + state + "\n"); return result.toString(); }
11f704c4-66eb-4e94-b694-20d13ae28a58
8
@Override public String toString() { String s = ""; String nodeName = domNode.getNodeName(); if ( nodeName.equals("mets:div") ) { Element div = (Element) domNode; s = div.getAttribute("TYPE") + ": " + div.getAttribute("LABEL"); } else if ( nodeName.e...
0fd31bd5-aca1-4cc4-8095-75b95df65773
6
public static double sumatoriaParaCM(boolean x, boolean y, int potenciaX, Punto[] puntos) { double toReturn = 0; if (x && y) { for (Punto punto : puntos) { double tempX = punto.getX(); double tempY = punto.getY(); toReturn += Math.pow(tempX, po...
0c191658-0099-40d0-8b30-0592e79c1ae6
1
public boolean validChosenItemIndex() { return getChosenItemIndex() >= 0 && getChosenItemIndex() < items.size(); }
11d5e81d-859f-4d04-b3e4-0e4d0a82faaa
4
public mxRectangle getBoundingBoxFromGeometry(Object[] cells) { mxRectangle result = null; if (cells != null) { for (int i = 0; i < cells.length; i++) { if (getModel().isVertex(cells[i])) { mxGeometry geo = getCellGeometry(cells[i]); if (result == null) { result = new mxRecta...
69a6439e-1660-44e3-aeac-13710f141cdb
4
public Method findIsMethod(Field field) { if(field == null) return null; if(getFieldDetailStore().isSetMethodPresentFor(field)) { return getFieldDetailStore().setMethodOf(field); } String getterName = createMethodName("is", field.getName()); ...
ea7181d0-cd59-4f6e-b634-b7c8922ecabc
2
public String salvarCategoria() { if (categoria.getCodigo() == null || categoria.getCodigo() == 0) { salvar(); } else { editar(); } return null; }
203f7596-a996-48f6-9965-ce0f9cc1464f
6
public ItemTemplate(String input){ //read the string into a template try { Scanner scan = new Scanner(input); image = scan.next(); name = scan.next().replace('_', ' '); description = scan.next().replace('_', ' '); type = scan.next(); sizeMin = scan.nextInt(); sizeRange = scan.nextInt(); valu...
cfde7566-307f-493d-9df5-9a0e2f9103f9
9
public void update(){ if(x < DownGame.GAME_WIDTH && DownGame.Rjumpl2r == 1){ Rjumpl2r(); } else if(x > 0 && DownGame.Rjumpr2l == 1){ Rjumpr2l(); } if(x > DownGame.GAME_WIDTH/2 && x < DownGame.GAME_WIDTH){ DownGame.StickMan2isOnLeft = false; DownGame.StickMan2isOnRight = false; ...
072c10a4-5aff-48dc-bba9-5fa30f3f3f0d
8
@Override public void launchGame() throws IOException { //Tant que la partie n'est pas finie, que l'on peut encore jouer //et que le nombre de joueur est égal à 2 sendToAllPlayers(":NAMELIST"); for(int i = 0 ; i < players.length; i++) { sendToAllPlayers(":" + players[i].getId() + ":...
8df63993-5fbe-4ae6-9042-af5f4bcceda3
9
public static byte[] permsToByte(Set<PosixFilePermission> perms) { int b1 = 0, b2 = 0; // @formatter:off if (perms.contains(OWNER_READ)) b1= (b1| 1); if (perms.contains(OWNER_WRITE)) b1= (b1| 2); if (perms.contains(OWNER_EXECUTE)) b1= (b1| 4); if (perms.contains(GROUP_READ)) b1= (b1| 8); if (perms.con...
c79872e9-809d-4dc7-a18f-82a8465ef432
3
public int[][] getGrayLevels() { if (image == null) return new int[0][0]; int[][] grayLevels = new int[getHeight()][getWidth()]; for (int i = 0; i < grayLevels.length; i++) for (int j = 0; j < grayLevels[i].length; j++) { int rgb = image...
91a1c756-d6a5-4666-b13f-4c7990363ca6
6
public void magicAttack(Enemy[] e, int c) { if (magicType.equals("fire")) { int damage = (super.getLevel() / 4) + magicLevel + gen.nextInt(5) + 1; e[c].damageTaken(damage); } else if (magicType.equals("blizzard")) { int damage = (super.getLevel() / 4) + magicLevel + gen.nextInt(5) + 1; e[c]....
c2b8abda-504d-4eb1-920d-82d860b8c014
7
public Relation<Production, Pair<Production, Integer>> getItemReduces() { // ignores rejected productions Relation<Production, Pair<Production, Integer>> red = new Relation<Production, Pair<Production, Integer>>(); for (Production p : productions) { if (p.reachable) { for (int i = 0; i < p.getLength(); ++...