method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
da5bfffb-8c28-4c44-acb1-02e1a1972d8c
0
public PhpposPeopleEntity getPeopleEntity(int idPeople){ return (PhpposPeopleEntity) getHibernateTemplate().get(PhpposPeopleEntity.class, idPeople); }
a8861d4c-22bb-4cb9-b7a4-025a1bc1af64
2
public void setNametextZoomedFontcolor(int[] fontcolor) { if ((fontcolor == null) || (fontcolor.length != 4)) { this.nametextZoomedFontColor = UIFontInits.NAMEZOOMED.getColor(); } else { this.nametextZoomedFontColor = fontcolor; } somethingChanged(); }
216a482c-2cfa-46f4-87f6-690111aecf34
3
private void geteof() { if(recno>reccount) { recno = reccount+1; if(Idx!=null) Idx.recno = recno; else if(cdx_file) Cdx.recno = recno; } eof = (recno>reccount); }
53f2c61b-c7c4-4003-9e90-4c2af6bc8418
2
public void sendMessage(Player player) { Long lastTime = lastMessageTimes.get(player); if (lastTime != null && System.currentTimeMillis() - lastTime <= coolDown) return; player.sendMessage(message); lastMessageTimes.put(player, System.currentTimeMillis()); }
685e586e-2357-4a27-a06e-1cfbb9baa395
1
@Test public void testMakePaymentsWithProfile() { Gateway beanstream = new Gateway("v1", 300200578, "4BaD82D9197b4cc4b70a221911eE9f70", // payments API passcode "D97D3BE1EE964A6193D17A571D9FBC80", // profiles API passcode "4e6Ff318bee64EA391609de89aD4CF5d");//...
cc76b120-ed7c-4a63-9ff9-4f79d3eec471
5
private void ValidarCampos() throws Exception{ if(jTextField_Codigo.getText().trim().length() == 0){ throw new Exception("Preencha o campo Código"); } if(jTextField_Nome.getText().trim().length() == 0){ throw new Exception("Preencha o campo Nome"); } if(jT...
9e64a258-26be-4f44-ba6b-291bed19329f
0
public void setjLabelVille(JLabel jLabelVille) { this.jLabelVille = jLabelVille; }
2480a266-7c79-4a80-a5f6-3640ddae3587
7
private int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 40: return jjStopAtPos(0, 10); case 41: return jjStopAtPos(0, 11); case 42: return jjStopAtPos(0, 6); case 43: return jjStopAtPos(0, 8); case 45: return jjStopAtPos(0, 9); ...
7be1a0a1-4254-40be-a3d6-ded47b6de855
5
public static String removeFormatting(String line) { int length = line.length(); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < length; i++) { char ch = line.charAt(i); if (ch == '\u000f' || ch == '\u0002' || ch == '\u001f' || ch == '\u0016') { ...
5bc9de9b-ee60-44be-be20-778d0447da4e
0
public Entradas getEntradasIdEntrada() { return entradasIdEntrada; }
dbffede7-3594-4882-a28b-b44f993c82c9
1
@Override public void mouseClicked(MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) { GuiUtils.navigate(uri); } }
d2b6f139-9d83-4180-9dde-91b3811a3d4f
4
private boolean initTemplateFile() { String location = OnlineUsers.directory+OnlineUsers.flatfileTemplate; if (!new File(location).exists()) { FileWriter writer = null; try { writer = new FileWriter(location); writer.write("#This is the template file for OnlineUsers\r\n"); writer.write("#Replaceme...
f68f1f0b-2c2e-4823-b8ed-7e7e5365681a
0
public int getNewMarkPosition() { return this.newMarkPosition; }
6e73bc6f-446b-4e02-bcea-573fa56e7f66
3
public int put(int key, int n) { int pos, t = 1; while (t < m) { pos = toHash(key, t); if (table[pos] == null) { table[pos] = new HashEntry(key, t); // ???????????????????????????????????????????????????????????????????????????????????? // ...
27519a61-6ffc-40bd-b2af-d60dfd8ecc7b
3
private int getPlayerIDFromUser(String prompt, String[] arrplay) { while(true){ try { String Name = PlayerSelectFrame.choosePlayer(prompt, arrplay); if (Name.equals("NONE")) return 0; return RunFileGame.getPlayerIDFromName(Name); } catch (WrongNameException e) { displayError("FUCK OFF THA...
9f89c0da-e053-43fc-8819-a10afa200fb9
1
@Override public int getNextPage() { return (hasNextPage()) ? this.currPage+1 : this.pages; }
638bcc49-44d5-4f0a-990d-1691b89a4649
9
public void evaluateParticles() { for (Particle particle : particles) { // evaluate all particles and update personal fitnesses double fitness = fitnessEvaluation.evaluate(particle); if (fitness > fitnessThreshold) { particle.updatePersonalBestPosition(fitness); particle.updateGlobalBestPosition(p...
8f7706a1-a866-4303-b6a8-b80c895cc008
8
@Override public boolean onCommand(CommandSender sender, Command command, String lable, String[] args) { sender.sendMessage(ChatColor.RED + "=====[ MonoBoxel v" + master.getDescription().getVersion() + " Info ] ====="); List<String> worldNames = new ArrayList<String>(); for (MultiverseWorld world : mast...
b237c7ae-92a8-4eba-854e-90d39598d8bc
1
public void StartGameServer(String gameName) { if(broadcastServer.running) broadcastServer.stopServer(); broadcastServer.startServer(gameName); }
7aabbeb7-0154-445f-b545-2b620cdb8c84
1
public static void main(String[] args) throws Exception { StaticDynamicUncertaintyWithADIULHSolver solver = new StaticDynamicUncertaintyWithADIULHSolver(); PrintStream filePrintStream = new PrintStream(new File("results/ADI-Cost-Experiment1b.csv")); PrintStream[] printStreams = new PrintStream[2]; printStrea...
a5fe1190-b83d-4498-9a57-f22222f287fd
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...
74d93bd9-3e2c-4eb1-af7f-c33afc79757c
8
@Override public void action() { block(delay); ACLMessage mensagem = agente.receive(); if(mensagem != null){ System.out.println("Recebi mensagem AP"); // Se o protocolo for FIPA CONSTRACT NET if(mensagem.getProtocol().equals(FIPANames.InteractionProtocol.FIPA_CONTRACT_NET)){ // SE for...
9708b18b-9777-4184-8d65-7b363e77b695
5
public boolean comprar(final Precio precioAMejorar){ //comprobamos que tengamos suficientes puntos int aGastar = puntos - precioAMejorar.getActual(); if(aGastar >= 0){ //incrementar nos devolverá la cantidad total que costó // dicha incrementación int...
3cba5856-4657-41e7-95f2-6391c627d7a5
1
public synchronized void updateClients () { for (int i = 0 ; i < flexclients.size () ; i++) { TcpThread currThread = (TcpThread) flexclients.get (i); currThread.ID = i; } }
a298e06a-f8c0-4d96-bf0c-92f07040a33c
3
@Override public boolean authorize(AuthorizationToken token) { if (token.getType().equals(getType())) { if (userExists(token.getId()) && userAccess.get(token.getId())) { return true; } System.out.println("Access denied."); } else { System.out.println("Invalid AuthorizationToken."); } retur...
5f41e628-b16a-47b1-bb47-38206fcee7fb
7
@Override protected void calculateThumbLocation() { // Call superclass method for lower thumb location. super.calculateThumbLocation(); // Adjust upper value to snap to ticks if necessary. if (slider.getSnapToTicks()) { int upperValue = slider.getValue() + slider...
14db55fb-0ea7-4c49-b1d9-1bdf6195574a
7
public Field[] getFields(Class parentClass, boolean isDeclared, String... strings) throws NoSuchFieldException { Field[] fields = new Field[strings.length]; for (int len = 0; len < strings.length; ++len) { String string = strings[len]; if (string != null || string != "") { ...
7bd48e74-2ced-46f2-8a91-4c2d2c604068
4
private static boolean isUpdateAvailable(URI remoteUri, File localFile) { URLConnection conn; try { conn = remoteUri.toURL().openConnection(); } catch (MalformedURLException ex) { //log.error("An exception occurred", ex); return false; } catch (IOException ex) { //log.error("An exception ...
fdb04d8f-bf88-4287-a2f4-25a29158aad9
9
public static Cons mostSpecificRelations(Cons relationrefs, boolean classifyfirstP) { { Cons relations = Stella.NIL; { Stella_Object r = null; Cons iter000 = relationrefs; Cons collect000 = null; for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) { r = iter000.value; ...
e3f86dae-5e55-434d-a89f-650956371e02
6
void put(int key, int value) { int bucket = key % buckets; if(bucket < 0) { bucket = -bucket; } int[] data = content[bucket]; if(data == null) { data = new int[33]; content[bucket] = data; } int off = data[0] * 2 + 1; // eliminate duiplicates if(off == 1 || data[off-2] != key || data[off-1] ...
ac1a1b51-f7a5-480b-a0ae-8498c2401514
4
@Override public void windowClosing(WindowEvent e) { //throw new UnsupportedOperationException("Not supported yet."); if ((this.currentState == State.INITIAL) || (this.currentState == State.PREPARED) || (this.currentState == State.PROCESSED)) { if (JOption...
a37c594f-5343-4c02-8cdc-d3f9b666c4ff
9
public void update() throws MaltChainedException { // Retrieve the address value final AddressValue arg1 = addressFunction1.getAddressValue(); final AddressValue arg2 = addressFunction2.getAddressValue(); try { if (arg1.getAddress() == null || arg2.getAddress() == null) { featureValue.setIndexCode(tabl...
e5c171f3-067f-4f3b-b312-7f2748738792
9
public static Map<String, Object> generateSchema(DateType anno) { // Make sure annotation is valid if (anno == null) { return null; } Map<String, Object> map = new HashMap<String, Object>(); map.put(Field.TYPE.getName(), Type.DATE.getName()); if (! anno.index_name().isEm...
99d355fa-2ae0-4a0c-b5af-219017a3fea5
0
public Dimension getUnit() { return this.unit; }
2f2b3d10-101d-41ec-8fc7-e1b49fb065b9
0
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(buf); return result; }
a7646ed3-4a46-493b-8984-8e458fbe1f98
8
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
2da9708c-c3c5-4dad-a46e-4e857046198e
7
protected Instance mergeInstances(Instance source, Instance dest) { Instances outputFormat = outputFormatPeek(); double[] vals = new double[outputFormat.numAttributes()]; for(int i = 0; i < vals.length; i++) { if ((i != outputFormat.classIndex()) && (m_SelectedCols.isInRange(i))) { if ((sourc...
ef6ceb51-6e12-4642-97a2-75835049110f
4
public void onEnable() { config = new Config(this); debug = config.getDebug(); if (!setupSQL()) { sendErr("SQL could not be setup, EndersGame will disable"); getPluginLoader().disablePlugin(this); return; } int a = 0; int l = 0; send("Setting up arenas and lobbies"); try { ResultSet ls = ...
a5828f5d-afb0-48e1-a526-cde5fa2cb8d5
7
public static List mostSpecificTypes(List types) { if (types.rest() == null) { return (types); } { Cons cursor1 = types.theConsList; Cons cursor2 = null; Stella_Object value1 = null; Stella_Object value2 = null; while (!(cursor1 == Stella.NIL)) { value1 = ((Surrogate)(...
ce1f79bc-4084-4f33-ac92-46dc29feeeb0
4
@Override public int indeksTil(T verdi) { int indeks =-1; Node<T> sjekk = hode; if(verdi==null){ indeks=-1; } else if(sjekk==null){ indeks=-1; } else{ for(int i=0;i<antall;i++){ if(verdi.equals(sjekk.verdi)){...
28328fe5-35a7-4993-9728-d9d0889b25f1
3
private void close() { int result = JOptionPane.showConfirmDialog( this, "Are you sure you want to exit the application?", "Exit Application", JOptionPane.YES_NO_OPTION); if(result == JOptionPane.YES_OPTION) { if(getContentPane() == waitPanel ...
e4922788-1578-4e8a-942a-1ff0e9aa56cb
8
public SolutionType[] decodeSolution(String str) throws DecodeException { SolutionType[] res; int i=0; int beginning = i; while (str.charAt(i) != '>') { i++; } String type = str.substring(beginning, i); i++; beginning = i; if (...
327a4649-507e-4e93-afd3-8eade0cfef78
8
public void registerListener(String itemName, Integer strategy) throws RemoteException, IOException { ser.registerListener(AuctionClient.authCode, this, itemName); if(strategy == 1){ String bidderName = new String(); BufferedReader in = new BufferedReader(new InputStreamReader(Sy...
17cff6ab-29c4-484b-a363-2d8525024700
9
public static String unhtmlentities(String str) { //initialize html translation maps table the first time is called if (htmlentities_map.isEmpty()) { initializeEntitiesTables(); } StringBuffer buf =...
999d6c2e-5fcb-4a90-9515-f312a798f64a
7
public float medium(float x) { if (x <= a) return 0; else if (x > a && x <= b) return (float) (1f / (b - a)) * x - ((float) a / (b - a)); else if (x > b && x <= c) return 1; else if (x > c && x <= d) return (float) (1f / (c - d)) * x + ((float) d / (d - c)); else return 0; }
24c76ce6-d8aa-4ffa-a360-7f80840e668a
4
public boolean readBoolean(String pSection, String pKey, boolean pDefault) { //if the ini file was never loaded from memory, return the default if (buffer == null) {return pDefault;} Parameters params = new Parameters(); //get the value associated with pSection and PKey String valueText = getValu...
7d0d26b9-ecc3-4b8f-a51c-1a8ee98d68b4
1
public void visit_d2i(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
29e3a458-c1a3-4eed-99a5-e58cc2911800
6
private ImageIcon getImageFromValue(Value value, Relay.Direction direction) { //this logic taken from WPILib switch(value) { case kOff: return relayForwardNoReverseNo; case kOn: return relayForwardYesReverseYes; case kForward: ...
a6fa3e36-832b-4abf-a084-90cbc942cb9e
3
public void register(Class<? extends Command> c) { CommandInfo info = c.getAnnotation(CommandInfo.class); if (info == null) return; try { commands.put(info.pattern(), c.newInstance()); } catch (Exception e) { e.printStackTrace(); } }
cf448a68-c49a-4f39-a726-bbd8fae83c80
9
@Override public double calculate(double[] phenome) { double score = 0; double[] me = new double[phenome.length]; double[] you = new double[phenome.length]; for(Individual<?,double[]> individual : population){ System.arraycopy(phenome,0,me,0,me.length); System.arraycopy(individual.getPhenome(),0,you,0,me...
4bb1f421-fe59-4acf-893d-97ed41b95e5e
0
public void setShareKey(String shareKey) { this.shareKey = shareKey; }
8668e599-56a7-4e1a-a116-8cc459380d7b
0
public void setBlock(int x, int y, Block newBlock) { blockSheet[x][y] = newBlock.getBlockID(); }
9b6f9ca5-f625-4643-bebe-3c6c3e2ac144
4
private void configureErrorDocuments() { // Find default ERROR_DOCUMENT settings for( int statusCode = 300; statusCode < 599; statusCode++ ) { // Build key. String ckey = Constants.CKEY_HTTPCONFIG_ERROR_DOCUMENT_BASE.replaceAll( "\\{STATUS_CODE\\}", Integer.toString(statusCode) ); // ...
1e46e706-fcb6-4159-b8a1-176db21fbb97
4
public void run() { ParserGetter kit = new ParserGetter(); HTMLEditorKit.Parser parser = kit.getParser(); while (mon.getNbrTraversed() < 2000) { try { String href = mon.getNext(); URL url = null; if (href.startsWith("mailto")) { s.add(href, true); continue; } else if (href.startsWith...
2c41d74b-9748-4017-9427-ad00f0ce6d08
3
public void setExp(PExp node) { if(this._exp_ != null) { this._exp_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } ...
aad9225f-4b4a-43bd-9683-afabaae1a571
2
public static void main(String[] args) { int i; float inputs06[] = { 20, 22, 21, 24, 24, 23, 25, 26, 20, 24, 26, 26, 25, 27, 28, 27, 29, 27, 25, 24 }; float inputs10[] = { 20, 22, 24, 25, 23, 26, 28, 26, 29, 27...
09ec17f2-56eb-4726-872b-e1e53ff27dc7
5
public void AssignmentSymbolInImageSpace(String symbol){ //功能: //找到激活强度最高的节点,对这个节点的Symbol属性进行赋值 //先找high int high; int imagespacesize=imagespace.size(); high=imagespace.get(0).ActivatedLevel; for(int i=0;i<imagespacesize;i++){ if(imagespace.get(i).ActivatedLevel>high){ high=imagespace.get(i).Act...
7eac045b-8899-4658-8378-2eb8fc2b670b
7
public static void main(String[] args) { while (true) { System.out.print("Enter an id: "); Scanner scanner = new Scanner(System.in); int accountId = scanner.nextInt(); Account account1 = new Account(accountId); if (!account1.isAccountIdValid(accountId)) { System.out.println("The account Id you ente...
7112713e-db04-4eab-9757-5e333b0cbe36
7
private boolean requirementsMetRemove(){ List<Enhancement> el = DDOCharacter.getTree(prestige).getEnhancementList(); int treePointsSpent = DDOCharacter.getTree(prestige).getPointsSpent(); int modTreeSpent = treePointsSpent; for(Enhancement e : el){ if(e.requireAllOf.contains(this.id) && e.tiersTaken >= th...
e2237fc0-c327-4bb2-bc18-83ff97e70b46
5
private int[][] generateSolution(int[][] game, int index) { if (index > 80) return game; int x = index % 9; int y = index / 9; List<Integer> numbers = new ArrayList<Integer>(); for (int i = 1; i <= 9; i++) numbers.add(i); Collections.shuffle(numbers); ...
148a7c67-1b69-4756-ad67-7b638405d6d6
2
public void save() { XStream s = new XStream(); FileOutputStream out; try { out = new FileOutputStream(new File("Player.xml")); s.toXML(this, out); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
6f134cef-7fc5-48fd-a27f-07a468bf4e9d
2
public boolean removeRoom(String name){ if (name.equalsIgnoreCase("main")) return false; ChatServerChatRoom room = chatRooms.remove(name.toLowerCase()); if (room==null) return false; room.close(); //room.dealloc //oh wait no, we can't do that System.out.println("Room kill...
4104d351-2ddf-48ce-aefb-a14a6d1981c5
8
public boolean isLegalMoveOne(int pieceNumber){ if (board.getBoard()[pieceNumber].getPieceType()==1 || board.getBoard()[pieceNumber].getPieceType()==2){ if (board.getBoard()[pieceNumber].getX()==0) return false; } else{ if (board.getBoard()[pieceNumber].getY()==0) return false; } int p...
ea13b678-69e0-4b4f-9cac-fcdffdb8aeb6
3
private void relax(Vortex closestVortex, int pathId, int neighborId) { double dayTravelLength = oergi.getTravelLength(); Corridor corridor = corridors.getCorridor(pathId); if (!corridor.gainPassage(oergi)) { return; } //oergi will make sure that travel length might be infinite double corridorTravel...
5258b116-134f-4815-87ff-10846d782fdd
3
public static void init() throws IOException { gui = new ArrayList<int[]>(); pro = new ArrayList<Thread>(); Twindow = new JFrame(); Twindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); Twindow.setSize(500, 500); Twindow.setTitle("NXT-Projekt - Feld Anzeige - Marcel Link"); info = new JFrame(); info....
b234c5d8-e024-45e7-8bdb-df819893cc09
8
private boolean isFallFromTable(Direction d, Position p) { boolean result = true; switch (d) { case EAST: if (p.getCoordinateX() + 1 < table.getLengthX()) { result = false; } break; case SOUTH: if (p.getCoordinateY() - 1 >= 0) { result = false; } break; case WEST: if (p.getCoordin...
7d269299-9a2e-4ce4-91ea-2a3e29d0f7c4
6
public static Cons simplifyAntecedent(Cons antecedent, Cons outputVariables, List positive, List negative) { { Cons newAntecedent = Stella.NIL; Cons candidate = Stella.NIL; Cons discardedPotentialGenerators = Stella.NIL; int coveredExamples = 0; int previousCoveredExamples = 0; int sco...
8424c2b1-f795-4c31-abec-5affd58a53bb
4
public static void main (String args[]) throws Exception{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer line = new StringTokenizer(reader.readLine()); int n = Integer.parseInt(line.nextToken()); int m = Integer.parseInt(line.nextToken()); IntArray intArray = n...
4226fd2c-e32f-4405-b62a-05b1002f3f3a
5
public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) { if (item instanceof ToolItem) { ToolItem tool = (ToolItem) item; if (tool.type == ToolType.shovel) { if (player.payStamina(4 - tool.level)) { level.setTile(xt, yt, Tile.hole, 0); level.add(new ItemEntit...
ae6b4b97-039e-4c96-8233-5973aab0a26b
8
public static final boolean check(final File f) { if (!f.isDirectory()) { return false; } final String[] list = f.list(); if (list == null) { return false; } for (final String s : list) { if (s.startsWith("drum") && s.endsWith(".drummap.txt")) { for (int i = 4; i < (s.length() - 12); i++) { ...
55b3e62b-e676-4707-a651-c1a06eed906d
4
private String checkName(String s) { if (s.compareTo("") == 0) return ""; if (s.length() > 15) return "Name is too long"; for (int i = 0; i < s.length(); i++) { if (!checkChar(s.charAt(i))) return "Only letters or numbers"; } return null; }
ff808d4e-9723-48d4-a6c7-41079ab10503
0
public void setNombre(String nombre) { this.nombre = nombre; }
c1b4a848-87d5-4281-a0e5-fef25ad6fa7f
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 ...
6e2df81e-6fd1-48af-b72e-5d34662c08e7
0
public int getHeight(){ return height; }
46d59457-6140-48e5-9066-e09292056516
9
@Test(groups = {"create"}) @Parameters({"browser"}) @BeforeClass public void beforeClass(String browser) throws IOException, InterruptedException { if (browser.equals("firefox")) { driver=browserFirefox(); } else if (browser.equals("chrome")) { driver=browserChrome();...
159fb0e5-4f38-4fa2-b05d-1bd49aef4348
6
public void cleanup() { try{ if(select != null) select.close(); if(insert != null) insert.close(); if(delete != null) delete.close(); if(update != null) update.close(); if(getMaxKey != null) getMaxKey.close(); } catch (Exception e) { e.printStackTrace(); } }
7059511f-e1e1-4a56-ac2a-e36261bd1768
0
public int getSuppliercode() { return this.suppliercode; }
1d28e174-5acc-49e4-a189-1bbb3578cb21
6
@Override public List<PastMeeting> getPastMeetingList(Contact contact) { if (!allContacts.contains(contact)) { throw new IllegalArgumentException("Contact does not exist"); } List<PastMeeting> pastMeetingsPerContact = new ArrayList<PastMeeting>(); //all meetings for a con...
6fa31870-453d-4b2e-b324-d8d126254f65
8
public KeyControl(Canvas3D canvas3D) { KeyListener l = new KeyListener() { @Override public void keyTyped(KeyEvent e) { // Ignore } @Override public void keyReleased(KeyEvent e) { // Ignore } @Override public void keyPressed(KeyEvent e) { char key = e.getKeyChar(); ...
10c9d455-2fea-404d-a13b-dc9745468036
4
private boolean mayOverwrite(File file) { if (overwriteMode == Controller.OVERWRITE_ALL_NO) { return false; } if (overwriteMode == Controller.OVERWRITE_ALL_YES) { return true; } overwriteMode = Application.getController().shallOverwriteFile(file); ...
be39f5c6-670c-463c-bb23-9a491f3ec84e
9
public static void main(String[] args) { In in = new In(args[0]); while (true) { int V = in.readInt(); if (V == 0) break; int E = in.readInt(); Digraph G = new Digraph(V); for (int i = 0; i < E; i++) { int v = in.readInt(); int w = in.readInt(); G.addEdge(v, w); } int[] co...
37cad17d-7666-4fca-97b5-cfdef65d81c0
8
private final void method1747(byte byte0, int i, Stream stream) { if (byte0 >= -8) { method1750(-4); } if (i != 1) { if (i != 2) { if (i == 3) { int j = stream.readUByte(); anIntArray4683 = new int[j]; ...
0201e3d1-aa73-49cc-be7b-2c63c91d3634
9
@Override public Set<Map.Entry<String, Object>> entrySet() { return new AbstractSet<Map.Entry<String, Object>>() { @Override public Iterator<Map.Entry<String, Object>> iterator() { return new Iterator<Map.Entry<String, Object>>() { ...
ca5207c5-b9f6-45fa-bde4-3a039426bdb8
2
private double countColumnsBetween(int beginning, int end) { double columns = 0.0; for (RoadGeometry roadGeometry : geometry) { if (road.intervalContainsGeometry(roadGeometry, beginning, end)) { columns = addColumnsFromGeometry(roadGeometry, beginning, end, columns); } } return columns; }
e5bec92c-f376-49fc-9d82-58131e73d6b5
5
@Override public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return filesList.get(rowIndex).getFileName(); case 1: return filesList.get(rowIndex).getLastModificationDate(); case 2: return ...
2dfe5552-b7dd-4a72-82c9-e09bb81f284c
0
public final void setTopic(String channel, String topic) { this.sendRawLine("TOPIC " + channel + " :" + topic); }
fe7bde35-a88c-47be-848a-7ce10487cec8
4
@Override protected void map(Object key, Text value, Context context) throws IOException, InterruptedException { String ref = value.toString().substring(1); String page = downloadPage(new Path(root + ref), context); List<String> refList = new LinkedList<String>(); Matcher matcher ...
a1c7fe43-bdfb-4c48-bad6-0c2b6dff68a9
9
public void recordGameSettings(){ BattleMap bm = map; String a = "BattleMap\n"; a = a.concat(bm.getNumRows() + "," + bm.getNumCols() + "\n"); a=a.concat("Bases\n"); for(Base b : map.getBases()){ a = a.concat("player " + b.getOwnerId() + ": " + b.getLocation().getRow() + "," + b.getLocation().getCol() + ...
1cb5ae5d-dfc6-4fa3-b4ac-1acb928bc983
8
public boolean isSymmetric(TreeNode root) { if(root == null) return true; TreeNode p = root.left; TreeNode q = root.right; if (p == null) return q == null; if (q == null) return p == null; TreeIterator ip = new TreeIt...
0367b12d-d56e-4c32-98fb-1a444d2c518e
6
public void keyPressed(KeyEvent e) { int offset = (e.getKeyCode() == KeyEvent.VK_UP) ? (-7) : ((e.getKeyCode() == KeyEvent.VK_DOWN) ? (+7) : ((e.getKeyCode() == KeyEvent.VK_LEFT) ? (-1) ...
27d16188-ad91-46bf-999a-2336a8cc9013
7
private Value determineValue(final Token token) throws AssemblerSyntaxException { Value value; switch (token.getType()) { case INTEGER: value = Value.valueOf(parseToByte(token)); break; case FLOAT: value = Value.valueOf(parseToFloat...
a58c6270-3986-4b69-9dee-7691a0edfa1b
5
final void ia(short i, short i_626_) { for (int i_627_ = 0; i_627_ < anInt5351; i_627_++) { if (aShortArray5311[i_627_] == i) aShortArray5311[i_627_] = i_626_; } if (aClass6Array5361 != null) { for (int i_628_ = 0; i_628_ < amountPolygons; i_628_++) { Class6 class6 = aClass6Array5361[i_628_]; Class35...
fc64c898-ee44-4bb9-a271-845fbc1b312b
9
public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = Integer.valueOf(scn.nextLine()); for (int tc = 1; tc <= t; tc++) { String line = scn.nextLine(); StringTokenizer st = new StringTokenizer(line); // Combinations ...
1da52ee5-0ee1-4e03-8176-f94c447dd632
8
private void humanAction(HumanCharacter theHumanCharacter,Monster theMonster){ System.out.println("What would you like to do?"); System.out.println("Type 'melee' to use melee attack"); System.out.println("Type 'magic' to use magic attack"); System.out.println("Type 'potion' to use a health, or mana potion."); ...
c8842a00-6ac5-4427-99b4-91150212ea41
9
private static void exportWay(final Way way, final BufferedWriter writer, final boolean force) throws IOException { if (!way.isModified() && !force){ return; } for (Node node : way.getNodes()){ exportNode(node, writer,true); } final StringBuilder stringWay...
3d480e0e-bb79-4c2c-a738-6926adbbe737
3
public static void main(String[] args) { int m1,n1,m2,n2; char again; do{ print("Enter the dimensions of the first matrix: "); n1 = scan.nextInt(); m1 = scan.nextInt(); print("Enter the dimensions of the second matrix: "); n2 = scan.nextInt(); m2 = scan.nextInt(); if(m1 == n2){ dou...
128e2864-b066-4c7b-96e7-16bf675cfc6f
8
protected static Element getModelElement(Document doc, ModelType modelType) throws Exception { NodeList temp = null; Element model = null; switch (modelType) { case REGRESSION_MODEL: temp = doc.getElementsByTagName("RegressionModel"); break; case GENERAL_REGRESSION_MODEL: temp...
f8e22ef9-fc31-4d6b-92ca-6b06f096a00d
4
public static void main(String[] args)throws IOException { double finalAnswer=0; double finalR2=0; double finalPeriod=0; double finalPercDif=0; for(int i = 2;i<=2;i++){ for(int j=6;j<=6;j++){ for(int k=3;k<=3;k++){ doub...
3ec56160-2778-4cc7-b10f-606c412f7ffa
6
public void moveOneFrame() { for (int i = 0; i < speed; i++) { if (direction == NORTH) { move(0, -1); } else if (direction == EAST) { move(1, 0); } else if (direction == SOUTH) { move(0, 1); } else if (direction == WEST) { move(-1, 0); } if (tank.BulletExists()) { bulletControl()...
7e2124e7-c85a-4c4f-b9aa-d153d5aae767
6
protected static void tryOrdinaryActions(Unit unit) { // ========================================================= // Act according to STRATEGY, attack strategic targets, // define proper place for a unit. UnitType unitType = unit.getType(); // GLOBAL ATTACK is active if (StrategyManager.isGlobalAttackAc...