method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b4fd86e7-c522-406e-b761-46386996c510
8
public static int canCompleteCircuit(int[] gas, int[] cost) { if (gas.length != cost.length) return -1; int getgas = 0; int count = 0; int i = 0; int k = 0; for (i = gas.length - 1; i >= 0; i--) { // getgas = 0; // count = 0; getgas = getgas + gas[i] - cost[i]; count++; if (gas[i] - cost...
6ed6e02e-28a0-4b62-b6e9-65a73ae895bf
2
public boolean isSelected() { // try{ // return unselect.isDisplayed(); // }catch(Exception e){ // return false; // } // return (unselect.size()==0); for (ComboboxItem ci : comboItems) { if (ci.isSelected()) return true; } return false; }
a78f63fa-734a-407d-8dfb-d91c8c6f5563
0
public void go(){ b.moveTo(p); }
93386aad-1057-48af-a3ae-3d347c8fd36c
4
public static void aTurn() { if (move.equals(a1.move1.getName())) { System.out.println("\n" + a1.getName() + " uses " + a1.move1.getName() + "!"); // System.out.println(a1.move1.getType().getTypeName() + " " + b1.getType().getTypeName()); b1.hp -= (pAttack.pAttack(a1.move1.getDamage(), a1.getAtt(), b1....
e797ad33-a36c-45e1-8c7b-f543b4a17443
5
private ArrayList<InetAddress> getServerIP() { ArrayList<InetAddress> serverIPs = new ArrayList<InetAddress>(); Properties prop = new Properties(); InputStream input = null; try { input = new FileInputStream("serverIP.properties"); // load a properties file prop.load(input); // get the property valu...
644772df-eb4a-481d-9135-a02f8c673cc5
1
public void uimsg(int id, String msg, Object... args) { Widget wdg; synchronized (this) { wdg = widgets.get(id); } if (wdg != null) { wdg.uimsg(msg.intern(), args); JSBotUtils.OnWidgetUpdate(wdg, id, msg.intern(), args); } else throw (new UIException("Uimsg to non-existent widget " + id, msg, ...
14110894-f670-45d2-8ffb-ba4da3edfeeb
0
public Point3 plus(Point3 p){ return new Point3(this.x + p.x, this.y + p.y, this.z + p.z); }
64f6915d-e506-4e82-bd10-f4230f5a0d51
9
public Map<Integer, RFNode> getInitialList(List<TPoint> pointList, boolean prune) { Map<Integer, RFNode> map = Maps.newHashMap(); for (int i = 0; i < pointList.size(); i++) { RFNode node = new RFNode(i, pointList.get(i), 0); map.put(i, node); } if (!prune) { ...
458b1485-12cb-426c-bee2-58fe87d361b7
8
protected void onApiReady(){ storageDataList=new StorageDataList(storageControler,storageKey); VerticalPanel main=new VerticalPanel(); RootPanel.get().add(main); //ImageBundle use that! //clear.cache.gif sometime,often failed final Image img=new Image("http://www.xucker.jpn.org/test/re...
25b2b9f6-1e51-4d61-94d6-44212f4cebcb
3
public void onEnable(){ this.loadConfig(); this.loadDependencies(); try { Metrics metrics = new Metrics(this); metrics.start(); } catch (IOException e) { this.log("Couldn't connect to http://mcstats.org"); } try { getCommand("xraylookup").setExecutor(new LookupCommand(this)); getComman...
57f27f60-6e39-4434-a7c2-2cafd1a0a14d
5
private Object fetchFieldValue(T t, String accessorMethod, Object actualValue) { try { actualValue = t.getClass().getMethod(accessorMethod).invoke(t); } catch (IllegalArgumentException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (SecurityException e1) { // TODO Auto-gener...
51ab0ce5-ac1f-4f99-851d-2f00a0255ec0
6
protected Integer getTreeHeight(int root,LinkedList<Integer>[] graph,int threshold){ LinkedList<Integer> stack=new LinkedList<Integer>(); boolean[] visited=new boolean[graph.length]; int height=0; stack.push(root); stack.push(-1); visited[root]=true; while (!stack...
46079528-bce0-485f-9376-ed9cc3ae4d92
7
public void setLink(boolean input, int val) throws Exception { m_input = input; if (input) { m_type = PURE_INPUT; } else { m_type = PURE_OUTPUT; } if (val < 0 || (input && val > m_instances.numAttributes()) || (!input && m_instances.classAttribute().isNominal() &...
32390bc4-4892-49c5-9c83-5e5f53358401
8
public void copyDirectory(File srcPath, File dstPath) throws IOException { if (srcPath.isDirectory()) { if (!dstPath.exists()) { dstPath.mkdir(); } String files[] = srcPath.list(); for (int i = 0; i < files.length; i++) { ...
c0e266c0-9bcf-4253-b7f8-165c78465a74
3
public ArrayList<String> getImageNames() { ArrayList<String> imageNames = new ArrayList<String>(); if (DIR.isDirectory()) { for (File f : DIR.listFiles(IMAGE_FILTER)) { BufferedImage img = null; try { img = ImageIO.read(f); ...
fcc11165-902d-4fb5-bf4d-7d3a15b1dff5
5
public void schrijfOpdrachtenNaarBestand(OpdrachtCatalogus opdrachtCatalogus) { File fileWrite = new File("bestanden/opdrachten"); try { // Wegschrijven FileWriter writer = new FileWriter(fileWrite, false); for (int i = 0; i < opdrachtCatalogus.getOpdrachten().size(); i++) { Opdracht opdracht = opdrach...
d08deebe-c30c-4d8f-a311-2f8036b23ddc
4
public void clearEnemy(Enemy e) { for (MapTile[] tileRow : navigationGraph) { for (MapTile tile : tileRow) { if (tile != null && tile.getEnemy() == e) { tile.setEnemy(null); } } } }
0c5ae457-f8d0-4ff6-aa46-3016508f0f3e
1
public void stopRunning() { System.out.println("Audio stopRunning called"); try{isRunning = false; audio.setVisible(false); audio.validate(); } catch(Exception e){} }
7087c9a0-111a-4042-9a0f-dd2a5755e1e4
6
@Override public int compare(Drillable one, Drillable two) { Date date1 = one.getPractice() == null ? null : one.getPractice().getAdded(); Date date2 = two.getPractice() == null ? null : two.getPractice().getAdded(); if (date1 == null && date2 == null) { return 0; } if (date1 == null) { return -1; ...
acd01a1a-b2b6-4293-bfbc-843bec10092c
8
public void renderSheet(int xp, int yp, SpriteSheet sheet, boolean fixed) { if (fixed) { xp -= xOffset; yp -= yOffset; } for (int y = 0; y < sheet.HEIGHT; y++) { int ya = y + yp; for (int x = 0; x < sheet.WIDTH; x++) { int xa = x + xp; if (xa < 0 || xa >= width || ya < 0 || ya >= height) conti...
431ecf6a-f735-45ed-b55b-09041902c3be
6
public boolean equals(Object obj) { if(!(obj instanceof ResultPanelWorkSpace)) return false; ResultPanelWorkSpace sp = (ResultPanelWorkSpace)obj; // non basic checks return sp.findText.equals(findText) && sp.sizeColumns == sizeColumns && sp.expandLobs == expandLobs && sp.fontSize == fontSize ...
817eb948-c0e4-4ad1-830b-cc2d2a52e7f5
6
@Override public void keyPressed(KeyEvent arg0) { boolean status = false; detect = true; if (Screen.done){ detect = false; Screen.restart(); } if (detect){ if (!alreadyPressed(arg0.getKeyChar())){ System.out.println("Key: " + arg0.getKeyChar() + " pressed"); if (KeyChecker.compareLetters(arg...
b22fe88b-c86b-49df-b9d0-3d2d0ceae0d0
5
private void merge(T[] a, int lo, int mid, int hi) { // new aux is created everytime merge is called @SuppressWarnings("unchecked") T[] aux = (T[]) new Comparable[a.length]; // i and j is used to point to the currently processing element in the // first and 2nd half respectively int i = lo, j = mid + 1; ...
8875e587-9fa3-4396-a5c6-ac22710b84eb
3
private static float getMaxArcCost(ZoneGeographique zone) { float maxArcCost = 0; for (Noeud noeud : zone.getNoeuds()) { for (Troncon troncon: noeud.getSortants()) { float cost = troncon.getCost(); maxArcCost = cost > maxArcCost ? cost : maxArcCost; ...
e387b9ef-49ad-4ca4-a600-55e6194b0a58
2
private short receiveData(APDU apdu, byte[] data) { byte[] buffer = apdu.getBuffer(); short lc = (short)(buffer[ISO7816.OFFSET_LC] & 0x00FF); short l; short len; if (lc > 254) { ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); } l = apdu.setIncomingAndR...
77917d17-f20d-49c3-b1a5-7ee1d01b1c9e
7
private void populateQueues() { String sgeRoot = Configuration.getConfig(Configuration.CONFIG_SGE_ROOT); String arch = ""; Process p = null; try { p = Runtime.getRuntime().exec(sgeRoot + "/util/arch"); InputStream is = p.getInputStream(); byte [] buf...
c65a5d05-87d3-4c7a-8034-28de65c14983
1
public void populateWorld(int numMolecules, int numSpecies){ int rand; Molecule nullMolecule = new Molecule(); bucket.add(nullMolecule); for(int i=1; i<numMolecules; i++){ progress("Spawning...", i, numMolecules); rand = (int) (Math.random()*(double)(numSpecies-1)) + 1; ...
c527f323-e853-4f52-888c-928118529694
2
public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print("Enter your integer here: "); int yourInt = s.nextInt(); int fibonacci = 1; int f1 = 1; int f2 = 1; if(yourInt <= 2){ fibonacci = 1; ...
270bffb3-ae8e-48bf-858e-5bd6d2832151
1
public static boolean isPositiveSentiment ( String str ) { if ( positiveHashMap.containsKey(str) ) return true; else return false; }
691e6835-cb1e-43cf-a583-204c4b2ef32b
1
public static MenuHint getInstance(Color bg, String text) { if (MenuHint.instance == null) { MenuHint.instance = new MenuHint(bg, text); } else { comboboxHint.setBackground(bg); comboboxHint.setText(text); } return instance; }
84f31f0e-aac7-4ca7-80c9-fb1724876a8b
3
private boolean inMap(int x, int y) { return x >= 0 && y >= 0 && x < width && y < height; }
f17ba71d-65e6-4a5f-b91c-352cb3653e34
3
private synchronized void createFriendLink( final Map<KeyRegistrationRecord, Set<KeyRegistrationRecord>> topology, final KeyRegistrationRecord a, final KeyRegistrationRecord b, boolean writeToDB ) { Set<KeyRegistrationRecord> a_peers = topology.get(a); Set<KeyRegistrationRecord> b_peers = topology.get(b); a_pe...
5ca7eed3-fb1a-476b-aff9-5703b24c6f3a
4
private void addIfNotNullAndLatestNotSame(TimelineItem item) { if (size() != 0) { if (get(size() - 1).equals(item)) return; } for (Stat st: item.getStats()) { if (st == null) return; } add(item); }
bce152df-6cc5-4591-8155-874201d09f7c
7
private void findExpressionType ( ) { boolean isKeyType = false; for ( int i = 0; i < container.length; i++ ) { String element = Grammer.findExpression ( container[i] ); if ( !"".equals ( element ) ) { if (true == parseType ( element )) ...
306d435b-fee8-414c-8c0c-081e7c93209b
2
public XElement addAttribute( XAttribute attribute ){ if( attribute == null ) throw new NullPointerException( "attribute must not be null" ); if( getAttribute( attribute.getName() ) != null ){ throw new IllegalArgumentException( "attribute '" + attribute.getName() + "' has ...
f8e53160-4b5e-491c-88e4-0fe6b5d74d12
8
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[14]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 7; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
a537d154-5153-4322-a4b3-e6d609813b8a
9
private void generateSite() { int street = 1, step = 0; int[] siteNum = new int[] {0,4,2,2,3,2,3}; // Refer to Vocab.CellTypeName // create 8 streets, 4*((4+6)||(5+5)||(6+4)) int randStMaxNo = 0, randSiteType = 0; for (int i = 0; i < 4; i++) { randStMaxNo = Helper.rand(3) + 4; // create a street for...
217b4486-ad1d-4f6f-a336-c72807f10392
4
@Override public int observed(String sequence) { int count = 0; // Count CHH in this sequence char bases[] = sequence.toUpperCase().toCharArray(); for( int i = 0; i < bases.length - 2; i++ ) if( (bases[i] == 'C') && (bases[i + 1] != 'G') && (bases[i + 2] != 'G') ) count++; return count; }
279a021c-cf04-460d-b687-dbf688e4f052
6
public void loadDrops() { try { int[][][] npcDrops = new int [12000][][]; int[][][] rareDrops2 = new int [12000][][]; int[] itemRarity = new int [12000]; File f = new File("./Data/cfg/NPCDrops.TSM"); Scanner s = new Scanner(f); while (s.hasNextLine()) { String line = s.nextLine(); if (line.s...
fdfd99ac-7efe-4db3-8c63-dd91b9694895
7
private JSONWriter append(String s) throws JSONException { if (s == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write(','); ...
63c602ed-b2cb-4096-9426-3ef7c1e5bd38
9
public static void main(String[] args) { LeMensagensXML leMsgs = new LeMensagensXML(); List<Discussao> discussoes = leMsgs.leituraXML(); int contaReferencias = 0; for(Discussao discussao:(List<Discussao>) discussoes) { try { List<Mensagem> mensagens = TratamentoTextual.executaTratamentosDiscussao(discu...
708cdf9b-2366-435a-bd6e-a61eaab2f71f
1
@Override public double arvo() throws IllegalStateException { if (!super.laskettavatAsetettu()) { throw new IllegalStateException(); } return super.getEtujasen().arvo() * super.getTakajasen().arvo(); }
e6286b8f-c8ef-4402-900d-6e7413070894
9
static public boolean isScalar (Class c) { return c.isPrimitive() || c == String.class || c == Integer.class || c == Boolean.class || c == Float.class || c == Long.class || c == Double.class || c == Short.class || c == Byte.class || c == Character.class; }
65e70b66-5af5-445c-ac4a-15bacc8cdf07
9
public ArrayList<String> restoreIpAddresses2(String s) { // Start typing your Java solution below // DO NOT write main() function ArrayList<String> result = new ArrayList<String>(); if (s.length() < 4 || s.length() > 16) { return result; } for (int i = 1; i <= s.length(); i++) { if (!isValid(s, 0, i))...
62068501-7c85-4831-8589-d69a4ded2002
2
public void closeConnection() { try { if (conn != null) { conn.close(); //DriverManager.getConnection(dbURL + ";shutdown=true"); } } catch (SQLException sqlExcept) { sqlExcep...
49de2427-5138-4f58-85ab-67ec80021894
6
public void addReservation(Reservation res) { Connection con = null; PreparedStatement pstmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnection(dbCon.getDATABASE_URL(), ...
fab43e22-e2ac-49d8-9f6a-17467994576c
6
@Override public void executeTask() { System.out.println(this.getClass().getSimpleName() + " EXECUTING"); if (m_ServerSocket == null) { try { m_ServerSocket = new ServerSocket(PORT); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } do { ...
5af36574-c56c-4cdf-bc4c-73e9bdc736d0
0
public void reset() { view.getThreadRunner().stop(); step = 0; actors.clear(); populate(); // Show the starting state in the view. view.showStatus(step, field); }
40139561-6ca7-48f7-8114-aea6e2d3c2f6
0
public void setSalt(PBKDF2ParameterType.Salt value) { this.salt = value; }
16b47502-e4cb-4b98-b042-f904893276a1
2
public Vector2 getShooterMount(Dimension boardSize) { switch (this) { case LEFT: return new Vector2(1, boardSize.getHeight() / 2); case RIGHT: return new Vector2(boardSize.getWidth() - 1, boardSize.getHeight() / 2); default: throw new IllegalStateException(); } }
aa1f4e01-f53b-4680-b03d-54ea50dcdc11
8
private void doMovement() { // Do minimal risk movement Vector target = state.robotPosition.clone(); Vector bestTarget = state.robotPosition; double angle = 0; double bestRisk = calculateRisk(bestTarget); double enemyDistance = state.robotPosition.distance(getTargetPosition()); // a little dynamic dista...
4133f9d5-528e-478c-bf0a-11bbc4c2758f
6
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
8792aca9-8b24-45e6-9687-c7183e87e422
1
public IncomingListener(IncomingHandler handler) { this.handler = handler; try { sock = new ServerSocket(Config.CHATPORT); } catch (IOException e) { e.printStackTrace(); } start(); }
804b8a19-1ea5-4839-ac0d-99537ca1aab4
3
public int depthOfNode(treeNode node, HashMap<treeNode, Integer> nodesDepth) { count++; if (node == null) return 0; // already calculated. if (nodesDepth.containsKey(node)) return nodesDepth.get(node); int leftDepth = depthOfNode(node.leftLeaf, nodesDepth); int rightDepth = depthOfNode(node.rightLea...
9b9830b8-57b9-4301-bc93-e92db0fb0983
0
public void setId(int id) { this.id = id; }
e0eab854-80b8-4a8c-8704-bd9a78b25211
0
private final static int readInt(InputStream is) throws IOException { byte b[] = read(is, 4); return ((b[0] & 0xFF) << 24) + ((b[1] & 0xFF) << 16) + ((b[2] & 0xFF) << 8) + ((b[3] & 0xFF)); }
96f59f1f-dca1-4629-8f13-50933e6a96e3
3
@Override public Object produceDataset(Map params) throws DatasetProduceException { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); try { ArrayList<bConsulta2> obja = jConsultaWeb.getMediaHoras2( params.get("data_in").toString(), pa...
cafb24c9-802b-4c6f-a178-bd9f03a6bbe3
6
private void renderBoard(Graphics2D g, List<List<Card>> gameBoard) { double x = X_BOARD_OFFSET + CARD_WIDTH * 2 + CARD_X_GAP * 2; double y = Y_BOARD_OFFSET + CARD_HEIGHT / 2; if (gameBoard.size() == 0) { //Game not inited yet return; } for (int i = 0; i ...
28b1bf9d-91a4-4f1f-b6fd-33ed403751ea
9
public int[] battle(int[] attackerResults, int[] defenderResults) { int[] result = new int[6]; result[0]=0; // worked or not result[1]=0; // no of armies attacker lost result[2]=0; // no of armies defender lost result[3]=0; // did you win result[4]=0; // min move result[5]=0; // max move if (gameState...
4fa18df2-7afc-4c4e-9931-8d19c1b7f6a9
2
public void setDifficulty(Difficulty difficulty) { this.difficulty = difficulty; switch (difficulty.getDifficulty()) { case "medium": this.numberOfMines = 40; this.boardWidth = 16; this.boardHeight = boardWidth; break; ...
1c78fe06-59ee-4ca1-987d-9e15cd3e51db
8
private void createOrderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createOrderButtonActionPerformed Date startDate = null; Date endDate = null; if (startDateTextField.getText().length() == 10 && startDateTextField.getText().charAt(2) == '-' && ...
2f390075-c4ed-4582-869b-bb1aefdb6a7b
8
public void setOptions(String[] options) throws Exception { resetOptions(); String positiveIndexString = Utils.getOption('P', options); String maxItemsString = Utils.getOption('I', options); String numRulesString = Utils.getOption('N', options); String minMetricString = Utils.getOption('C', options)...
875f3194-9482-4cbe-bff8-ce9a78113493
7
public static int getSideGrassTexture(IBlockAccess blockAccess, int x, int y, int z, int side) { if (!isBetterGrass()) { return 3; } else { if (isBetterGrassFancy()) { --y; switch (side) { case 2: --z; ...
5501d4b5-ba2f-4efa-a14b-658d283070c5
3
void setFileName(String newName) { fileName = newName; if (new File(fileName).exists()) { exists = true; return; } if (!newName.endsWith(".properties")) { File f2 = new File(newName + ".properties"); if (f2.exists()) { exists = true; fileName = newName + ".properties"; return; } } ...
8e4de927-6f58-4765-b7d5-cfad03a6ea7f
1
@RequestMapping(method = RequestMethod.PUT, value = "{id}") public void finishTask(@PathVariable("id") Integer id, @RequestParam String action) { switch (Action.valueOf(action)) { case FINISH: tasksService.finishById(id); break; } }
0f42ab12-669b-4c74-8cc5-62703c238026
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...
31a45a12-1df0-460c-9565-085c8abad543
2
public static String join(List<? extends Object> os, String seprator) { StringBuilder sb = new StringBuilder(); os.stream().forEach((Object o) -> { sb.append(seprator).append(o.toString()); }); return sb.length() > 0 ? sb.substring(1) : ""; }
20547a8a-76a7-4843-af11-02787b4dc77d
2
public void saveWordList() { ArrayList<String> tempList = new ArrayList<String>(); // Write a new list for (Map.Entry<String, String> entry : wordList.entrySet()) { String thisWord = entry.getKey(); String thisReplace = entry.getValue(); String writeMe = (thisReplace.length() > 0) ? thisWord+":"+th...
9cf343bc-65de-4dbe-b6af-7b5469b6db9d
5
static public String getPrefixScriptPathSuffixString( Map<String, String> paths, String pre, String suf, boolean appendSrcBase, boolean unixStyle) { StringBuilder builder = new StringBuilder(); Iterator it = paths.keySet().iterator(); while (it.hasNext()) { ...
dea5804d-d848-45f3-8840-83e21f53c4ca
0
public String getPrice() { return this.price; }
7506cba9-cb22-4e2f-be1b-b26e2dbb05d5
9
@SuppressWarnings("unchecked") public Object invoke(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (type == Type.FORWARD) { request.getRequestDispatcher(target).forward(request, response); } else if (type == Type.REDIRECT || type == Ty...
05843fe2-d860-4d2b-b41f-f34f85630264
2
private void nameCheck() { if (namer.text().isEmpty()) { namer.setText("Czerwony"); } if (nameb.text().isEmpty()) { nameb.setText("Niebieski"); } }
d99890f4-78a4-4191-a2a0-860ba5520772
0
@Override public void startDocument () {}
40050ef8-af15-4aa6-afd0-e55062f1798f
9
public static void init() { if (initialized) { return; } Method method; try { method = Event.class.getDeclaredMethod("createHiddenHelper"); method.setAccessible(true); eventHelper = (IHiddenEventHelper) method.invoke(null); method.setAccessible(false); method = Bullet.class.getDeclaredMethod...
39254f96-bef0-4aa2-9653-9c072342eced
2
public void toBytecode(DataOutputStream out) throws CannotCompileException, IOException { if (!hasConstructor) try { inheritAllConstructors(); hasConstructor = true; } catch (NotFoundException e) { throw new CannotCo...
d3f2c30c-478b-453a-a799-5f6c51e094cc
8
public static void main(String[] args) { Scanner scan = new Scanner(System.in); String input = scan.nextLine().replaceAll("[\\s+/\\\\()]", "|"); String[] words = input.split("\\|+"); ArrayList<String> correctWords = new ArrayList<String>(); for (String word : words) { ...
0e0149c1-afa4-482c-96a7-f9a4f4e6ad90
8
public UnitController(final GameCore mCore, final String unitName, int xpos, int ypos, final MapState mMap ) throws SlickException { Log.info("Constructing Map Control for unit " + unitName); this.mMap = mMap; this.x = xpos; this.y = ypos; this.unitName = unitName; this.mCore = mCore; Propert...
e74529ef-fd5a-418b-b21c-80893d2a9be1
8
@Override public void run(){ try { home = null; numMsg=test1.getnumMesg(); try { home = new Robot(); } catch (AWTException ex) { Logger.getLogger(ThreadTe...
fad8ac3c-5235-4227-b0d7-aaeb1b988f25
0
public void error(String message) { updateUploadInfo("error"); }
fa4a7b87-6c3e-408a-a229-5bee3d3982b5
6
@Override public void run() { if (Updater.this.url != null) { // Obtain the results of the project's file feed if (Updater.this.read()) { if (Updater.this.versionCheck(Updater.this.versionName)) { if ((Updater.this.v...
d158d195-3e57-4c7e-aa3d-102cd71b7d7d
3
public static List<String> splitFixedText(final List<ColumnMetaData> columnMetaData, final String lineToParse, final boolean preserveLeadingWhitespace, final boolean preserveTrailingWhitespace) { final List<String> splitResult = new ArrayList<String>(); int recPosition = 1; for (fina...
1b3e914b-730c-4ce7-8985-bc47c764ffb5
4
@Override public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_RIGHT) { right = true; } else if(e.getKeyCode() == KeyEvent.VK_LEFT) { left = true; } else if(e.getKeyCode() == KeyEvent.VK_UP) { up = true; } else if(e.getKeyCode() == KeyEvent.VK_DOWN) { down = true; } }
e963c235-e04f-4037-a8ef-33381ee2d078
7
public Token OpcodeIMMIMM() throws ParseException { Token t; switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) { case SBIC: t = jj_consume_token(SBIC); break; case SBIS: t = jj_consume_token(SBIS); break; case BR...
f3fe0111-faa8-4eff-93e1-1b8a3e48f25e
2
private void setTipo(String tipo) { for (int i = 0; i < this.tipos.length; i++) { if (this.tipos[i][0].equals(tipo)) { this.tipo = this.tipos[i][1]; this.tamanho = this.tipos[i][2]; return; } } }
69f8e326-1d36-44c2-9193-aa722ff61200
4
private void insererNoeud(NoeudRN z) { NoeudRN y= null, x= racine; while(x != sentinelle){ y= x; if(z.compareTo(x) == 1) x= x.getGauche(); else x= x.getDroit(); } z.setPere(y); if(y == null){ racine= z; racine.setPere(sentinelle); } else if (z.compareTo(y) == 1) y.setGauche(z); ...
39aee34e-f098-41c4-bd73-66e4e9238b12
7
public static void main(String[] args) { // TODO Auto-generated method stub String currentDirectory = System.getProperty("user.dir"); String singlecountrycsvfile = currentDirectory + "/src/weather/UnitedStates.csv"; Map<String, Integer>allMenMustDie = new HashMap<String, Integer>(); ...
4ff988a7-d26b-4b1f-8237-f718a62b85b0
7
private int findNearestPair(double key, double secondaryKey) { int low = 0; int high = m_NumValues; int middle = 0; while (low < high) { middle = (low + high) / 2; double current = m_CondValues[middle]; if (current == key) { double secondary = m_Values[middle]; if (secondary == sec...
da48d063-4ddc-4ed0-86aa-8402fd018a87
0
public void resume() { ++resume_count; }
2add2dac-365d-416b-94b2-4dda68d4782d
8
public static DataTarget outputDataFrom(final Object object) throws IOException { if (object instanceof DataTarget) return (DataTarget)object; if (object instanceof File) return IO._outputDataFrom_((File)object); if (object instanceof RandomAccessFile) return IO._outputDataFrom_((RandomAccessFile)object); if (o...
232122d7-05a9-4782-a60d-9ffb699f2a36
0
public void setElapsedTime(long elapsedTime) { this.elapsedTime = elapsedTime; }
5465e5a7-2e0e-41cc-b167-f410020fd11e
3
boolean isAttackPlaceVerticallyAboveNotHarming(int position, char[] boardElements, int dimension, int numberOfLinesAbove) { while (numberOfLinesAbove > 0) { if (isPossibleToPlaceOnPreviousLine(elementVerticallyAbove(dimension, position, numberOfLinesAbove)) && isBoardElementAnoth...
d1496409-7f5f-4bd3-ac86-3739ea786452
8
public boolean equals (Professionnel pro) { boolean exists = false; if ((this.getNom().equals(pro.getNom())) && (this.getPrenom().equals(pro.getPrenom())) && (this.getCivilite().equals(pro.getCivilite())) && (this.getAdresse().equals(pro.getAdresse())) && (this.getTelB().equals(pro.getTel...
e441b1ee-b3b4-458d-bed1-f48030c5313d
6
public void update() { Stack<Projectile> removalStack = new Stack<Projectile>(); Stack<Ship> removalStack2 = new Stack<Ship>(); //update ships for (Ship ship : ships) { ship.update(); if(!ship.isAlive()){ removalStack2.add(ship); } ...
0fcde35f-138b-4958-94d0-665239836e1b
2
@Override public void actionPerformed(ActionEvent event) { PrintProxy proxy = getTarget(PrintProxy.class); if (proxy != null) { PrintManager mgr = proxy.getPrintManager(); if (mgr != null) { mgr.pageSetup(proxy); } else { WindowUtils.showError(UIUtilities.getComponentForDialog(proxy), NO_PRINTER_S...
9f2bc6f6-d592-4db3-afcc-fb6b51ae4b94
9
public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int arr[] = new int[10001]; for (int i = 1; i * i <= 10000; i++) arr[i * i] = 1; for (int cont = 1; cont < 4; cont++) for (int i = 1; i <= 10000; i++) if (arr[i] == 1) ...
3837e888-971a-463c-92fd-d7f4f6bbe001
1
* @param rows The rows. * @return <code>true</code> if the contents of the drag can be dropped into this outline. */ protected boolean isRowDragAcceptable(DropTargetDragEvent dtde, Row[] rows) { return rows.length > 0 && mModel.getRows().contains(rows[0]); }
e04ed9e0-35ca-4fd8-ae3d-090b6389fc12
5
private int jjMoveStringLiteralDfa21_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 20); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 20); } switch(curChar) { case 48: return jjMoveStringLiter...
aad3bb3f-2cfd-4046-8740-528e67312e5a
4
private String pasteFromClipboard(){ String result = ""; Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); //odd: the Object param of getContents is not currently used Transferable contents = clipboard.getContents(null); boolean hasTransferableText = ...
2899db57-f46a-4491-83bf-0212e46395da
0
public HTMLViewerDialog() { super(false, false, false, INITIAL_WIDTH, INITIAL_HEIGHT, MINIMUM_WIDTH, MINIMUM_HEIGHT); Outliner.html_viewer = this; }
57fbee12-2f88-4c69-a86b-0ab59ec27050
3
public boolean shouldSwap(final LocalExpr expr) { final UseInformation UI = (UseInformation) useInfoMap.get(expr); if (UI == null) { if (StackOptimizer.DEBUG) { System.err .println("Error in StackOptimizer.onStack: parameter not found in useInfoMap"); } return false; } return (onStack(expr...