method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
88ec9300-ab87-4ebb-9c4e-1240e5a3fe3f
8
public boolean camposobrigatoriospreenchidos() { if (TfCodFuncionario.getText().equals("") || TfFuncionario.getText().equals("")) { msg.CampoObrigatorioNaoPreenchido(LbNotificacao, "Informe qual funcionário realizou o atendimento nesta venda!"); TfCodFuncionario.grabFocus(); ...
55f3eaea-7b06-4fee-84de-ef087723e5ab
7
void processKeyReleased(KeyEvent e) { getModel().runKeyScript(KeyEvent.KEY_RELEASED, e.getKeyCode()); boolean b = false; switch (e.getKeyCode()) { case KeyEvent.VK_UP: keyPressedCode = keyPressedCode ^ UP_PRESSED; b = true; break; case KeyEvent.VK_DOWN: keyPressedCode = keyPressedCode ^ DOWN_PRESS...
ef3c72fc-1b65-44fd-aed7-e7bf5d4094d7
9
private void initFileActions() { copyToOption.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // Return value will be JFileChooser.AP...
1c966fe3-ded0-4ef7-ba9c-c97070248b32
3
@Override public void run() { BackupFile file = DistributedBackupSystem.fManager.getFileByName(filename); int curChunk=0; if(file != null) { System.out.println("File exists"); for(curChunk=0;curChunk<file.getNumChunks();curChunk++) { try { DistributedBackupSystem.tManager.executeTask(TaskManager.T...
f4f7bd79-abab-4415-9dc9-ddf382d9e4d1
7
@Override public void deserialize(Buffer buf) { houseId = buf.readInt(); if (houseId < 0) throw new RuntimeException("Forbidden value on houseId = " + houseId + ", it doesn't respect the following condition : houseId < 0"); modelId = buf.readShort(); if (modelId < 0) ...
c76d07df-9264-443a-8401-401b7e520ee8
4
public void update() { key.update(); if (key.up) y++; if (key.down) y--; if (key.left) x++; if (key.right) x--; }
508b5e94-dbe5-4af7-a377-082ad218a20f
6
public void printShuffle(Graphics g) { int q = 0; int z = 250; String name = null; //basically the same code, just using the shuffled deck for (int i = 0; i < deck.length; i++) { if (deck[i].cardValue == 1) { name = "A" + deck[i].suit; } else if (deck[i].cardValue == 11) { name = "J" + deck[i...
235ac7c8-7582-4bf6-86a3-10f1a82a3d78
4
public synchronized static void deletePoll(String id, String mail) { try { XStream xstream = new XStream(new DomDriver()); File remFile = new File((String) Server.prop.get("pollFilePath")); Polls[] allPolls = (Polls[]) xstream.fromXML(remFile); List<Polls> retList = new ArrayList<Polls>(Arrays.asList(a...
a2069510-358f-4c4f-8030-ecb20021ca1a
6
protected long toLong(Object value) { long number; if (value instanceof Long) { number = (Long) value; } else if (value instanceof Integer) { number = ((Integer) value).longValue(); } else if (value instanceof Short) { number = ((Short) value).longValu...
3f289e5b-568d-4493-9557-4cbc063baa51
1
public void printList(){ System.out.println("Name: " + this.name + ", Age: " + this.age + ", Illness: " + this.illness); if (nextPatient != patientListStart){ nextPatient.printList(); } }
bd882f3c-79d1-47c2-9b51-489cdb888a49
7
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == btnCreate) { int amount = 0; try { amount = Integer.parseInt(txfAmount.getText().trim()); } catch (NumberFormatException ex) { JOptionPane.showMessageDialog(TraysCDialog.this, "Please enter a valid number f...
0a378eaf-277d-46f1-b51b-f7a97a9f9f32
4
public void delete(T t) { for(ListNode<T> node=head; node!=null&&node.next!=null; node=node.next) { ListNode<T> nextNode = node.next; if(nextNode.value.equals(t)) { if(nextNode == tail) { tail = node; tail.next = null; } else { node.next = node.next.next; } } } }
47af0530-be09-4220-8232-86fb4a57f685
6
@EventHandler(ignoreCancelled = true) public void onSignChange(final SignChangeEvent change) { if (!change.getPlayer().hasPermission("kiosk.create")) return; final Sign state = (Sign) change.getBlock().getState(); for (int i = 0; i < change.getLines().length; i++) state.setLine...
7d2aa49b-ddd5-489f-898c-7edbbc4f7391
7
public static void initCells() throws IOException { GameConverter.cellStrings = new String[48]; GameConverter.cellStrings[0] = "WATER_UPLEFT_UP_UPRIGHT_LEFT_RIGHT_DOWNLEFT_DOWN_DOWNRIGHT"; GameConverter.cellStrings[1] = "WATER_UPLEFT_UP_UPRIGHT_LEFT_RIGHT_DOWNLEFT_DOWN_DOWNRIGHT_SPARKS"; GameConverter.cellStri...
90cbf89e-8a86-4a96-8809-d3108bd818e2
0
public Reserve getPieces() { return pieces; }
bec38ca3-6a04-4b6b-9f8c-8a54ae2d380b
2
public boolean Exist(String Tea_ID, String PassCode) { try { StringBuffer sql = new StringBuffer(); sql.append(" select * from teacher where"); sql.append(" tea_ID='"); sql.append(Tea_ID); sql.append("' && teacher_Passcode='"); sql.append(P...
4db280be-bdd0-4a8c-a855-612d8c24ae10
6
@EventHandler public void SilverfishSpeed(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.getSilverfishConfig().getDouble("Silverfi...
8ff6fdbd-8e1c-4854-b21c-3627ebab065b
3
public static String cmdInterpreter(String[] arg) { try { // String[] cmd = new String[arg.length + 2]; // System.arraycopy(BASH_CMD, 0, cmd, 0, BASH_CMD.length); // System.arraycopy(arg, 0, cmd, BASH_CMD.length, arg.length); for (String str : arg) System.out.print(str + " "); Process p = Runti...
d4a5157f-3a94-4ba4-be58-7b0e3cc2f254
1
public Color getColor() { try { int newR = Integer.parseInt(jTextField1.getText()); int newG = Integer.parseInt(jTextField2.getText()); int newB = Integer.parseInt(jTextField3.getText()); int newA = Integer.parseInt(jTextField4.getText()); r = newR; ...
b724db0b-87fd-44ff-b084-32b483e89fc5
8
@Override public int hashCode() { final int PRIME = 31; int result = super.hashCode(); result = PRIME * result + ((attendees == null) ? 0 : attendees.hashCode()); result = PRIME * result + day; result = PRIME * result + ((description == null) ? 0 : description.hashCode()); result = PRIME * result + endHour...
1855ae49-349d-404a-88f7-7a692bcf25b3
0
public String getToolTip() { return "Undoer - Click anywhere in the editor pane after clicking me."; }
9f44197d-fe63-4554-8bac-ee9d83529307
1
State (String name, int id) throws IllegalArgumentException{ outgoingTransitions = new ArrayList<Transition>(); incomingTransitions = new ArrayList<Transition>(); prop = new State_Properties(); dfsNum = 0; this.id = id; if (name == null) throw new IllegalArgum...
b305bcd7-3c6f-4047-90d7-81894649efce
4
private void checkForAsyncExecutionFailure(List<Future<?>> asyncs) throws ProcessExecutionException { for (Future<?> async : asyncs) { if (!async.isDone()) continue; awaitAsyncExecution(async); } }
96cec53e-bcce-4733-8aac-708aa6b9e432
6
public boolean tierraInvadida() { NaveAlien n1; int x = NUM_FILAS-1, y = NUM_COLUMNAS-1; boolean tierraInvadida = false; boolean continuarComprobando = true; //con comprobar una nave nos llega while(x >= 0 && continuarComprobando) { while(y >= 0 && continuarComprobando) { n1 = listaN...
34214e49-131f-4ba2-b720-d6c3264691bd
0
public void setLocation_id(String location_id) { this.location_id = location_id; setDirty(); }
d021ff24-5918-4aa5-999d-80c62c648db0
0
public static void question3() { /* QUESTION PANEL SETUP */ questionLabel.setText("What is your favourite day of the week?"); questionNumberLabel.setText("3"); /* ANSWERS PANEL SETUP */ //resetting radioButton1.setSelected(false); r...
fd4f9032-04be-4d56-b65f-19425bab798e
0
public boolean isCatched() { return catched; }
ab2f4a08-8e91-4953-9a4d-494d73c9209a
1
public void addValue(String key, String errorMessage) { if(errorMap.get(key) == null){ ArrayList<String> list = new ArrayList<String>(); list.add(errorMessage); errorMap.put(key, list); } else { errorMap.get(key).add(errorMessage); } }
4b2e9638-1b62-49ef-ad00-2375ae19846a
4
private DMemeGrid convertToGridB(Map mp) { DMemeGrid grid = new DMemeGrid(); int rowIdx = 0; int colIdx = 0; Iterator it = mp.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry) it.next(); Map...
d632e817-d642-47e3-84bc-17a8e355b4b7
2
@Override public void startElement(String s, String s1, String elementName, Attributes attributes) throws SAXException { // if current element is book , create new book // clear tmpValue on start of element if (elementName.equalsIgnoreCase("book")) { bookTmp = new Book(); ...
adfdbd88-866a-48f3-bc66-8e053778d21c
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...
aa03564b-81c6-4ea6-a253-1d8f506bd0e6
5
@Test public void depthest21opponent5() { for(int i = 0; i < BIG_INT; i++) { int numPlayers = 6; //assume/require > 1, < 7 Player[] playerList = new Player[numPlayers]; ArrayList<Color> factionList = Faction.allFactions(); playerList[0] = new Player(chooseFaction(factionList), new SimpleAI()); ...
106b90ac-5611-41bc-b327-3ced573642dc
0
@Basic @Column(name = "amount") public double getAmount() { return amount; }
b4e7650b-0588-44b6-b421-bfd537704e2e
4
public Puzzle read(String input) { List<Integer> data = getData(input); switch (data.size()) { case 1: return new Puzzle1(data); case 4: return new Puzzle2(data); case 16: return new Puzzle4(data); case 81: return new Puzzle9(data); default: throw new IllegalArgumentException("Illegal size ...
f1c00539-277d-4200-9443-b0875313ac6c
0
public void setModuleId(String moduleId) { this.moduleId = moduleId; }
8b5c3a55-8220-463d-a7f0-3ef821849aeb
0
public BufferedImage getImage() { return image; }
398ce5a1-d118-4ee5-9539-4d56f5edbb47
5
public SemanticRec gen_assign_cast(SemanticRec left, SemanticRec right) { Type leftType = getTypeFromSR(left); Type rightType = getTypeFromSR(right); SemanticRec returnRec = null; if (leftType == rightType) { //no cast needed returnRec = right; //the ...
fa909e8a-e33a-4278-b9f3-24dae1f515fd
7
public void preCombo(){ currentComboNo--; if(currentComboNo >= 1){ spatial.getControl(LabelControl.class).changeText(comboList()); if(comboNumber == 4){ if(StoredInfo.level < 3){ spatial.getControl(LabelContro...
0259129d-04b4-4209-8742-a2eb95d328bc
1
public static void main(String[] args) { Launcher launcher = new Launcher(); launcher.initializeLogger(); // Couldn't think of anywhere else to put it try { launcher.showWelcomeView(); } catch(Exception ex) { JOptionPane.showConfirmDialog(null, "There was an error!\n" + ex.getMessage(), "Error!", JOp...
56b93975-af03-4b73-8a0d-1e848a479c71
8
private static boolean containsEmbeddedWhitespace(String value) { int state = 0; for (int i = 0, len = value.length(); i < len; i++) switch (value.charAt(i)) { case ' ': case '\t': case '\r': case '\n': if (state == 1) state = 2; break;...
87c038b9-6d57-4054-bf36-e39e9c573656
6
public Ray[][] initializeRays(double x, double y, double z, Screen screen, int xres, int yres){ Vector3D origin = new Vector3D(x,y,z); Ray[][] rays; //<= used as we want neat behaviour on bad exceptions rather than returning say a [50][0] array if (screen ==null || xres <=0 || yres <= 0){rays = new Ray[0][0];} ...
be8534cc-6808-4b79-8828-da621abfefe3
2
private void checkPause() { // double check if (paused) { synchronized (state) { // Actually pausing? if (state.has(Pausing)) { // Pause! state.set(Paused); // Notify all listeners of pause. notifier.proxy().onServicePause(this, interrupt); // Wait for t...
3940ad99-706a-4f45-a3ae-49fc3ef425b7
1
@Test public void WhenAddingCollection_ExpectContainedSizeChange() throws UnknownHostException { int level = localhost_.getHostPath().length(); RoutingTable table = new RoutingTable(); table.setLocalhost(localhost_); Assert.assertTrue(table.levelNumber() == level); ...
6481c3f0-4d94-40c4-b182-50bed4d212f7
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the ...
b4509107-636b-4b98-84f0-4e81aafa49d7
1
@Override public void connectToClient(DiscoveredClient client) { try { new ChatGUI(client); } catch (IOException e) { System.out.println("Failed to connect!"); e.printStackTrace(); } }
8e8fe1e9-8675-431a-953f-9d5dc057a249
0
public boolean isListening() { return listening; }
55b30b32-5c27-4412-af94-e89223ba1590
2
public void desconectar(long target) { for (int i = 0; i < connections.getLength(); i++) { Connection connection = connections.get(i); if (connection.getTarget()==target) { connection.desconectar(); connections.remove(i); XmlToolkit.crearDe...
63987bdb-fe13-48d5-9aa3-09ec2f50908d
0
public StartScreen() { super("Go"); // renames the top of the frame goBackground = new ImageIcon("gopic.png"); // sets the board I made as an image icon JPanel topPane = new JPanel(); // new jpanel topPane.setPreferredSize(new Dimension(500, 565)); // sets the size of the panel add(topPane, BorderLayout...
4712ee7d-2330-47c0-9021-45980fd35af2
9
private void getTilesInBombDir(int x, int y, int xdir, int ydir, List<Tile> tiles){ for(int i = 1; i < 4; ++i){ int xx = x + (i * xdir), yy = y + (i * ydir); if(xx < 0 || xx >= w || yy < 0 || yy >= h) break; Tile t = map[xx][yy]; if(t.type == Tile.CLEAR || t.type == Tile.BREAKABLE) tiles.add(t); if(t.t...
fb925a67-f831-4502-be01-e25be0adc56a
1
@Override public ArrayList<Edge> getEdgeList() { if (isParsed) { return edges; } else { initiateParsing(); return edges; } }
bbb34d46-6a67-44d2-ac56-1d773f0efea4
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...
d983357a-3edd-4962-9dfb-bf84bf0a642a
8
public static int Action(Client joueur) { int tempDette = 0; int choiceInt = -1; boolean wrong = true; boolean quit = true; do { System.out.println("Que voulez vous faire?" + "\n pour dormir tapez 1" + "\n pour appeler le room s...
e2c30516-f26f-418b-83ec-4e6029c46e2e
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 fe...
0caea3fc-a7aa-4c72-8a94-6aafe2e4588f
3
public boolean answer(int answer) { int answerTime = timer.getSeconds(); if (answer == getCurrentCount()) { if (answer >= 17) newTurn(); else addCard(); timer.resetTimer(); timer.startTimer(); scor...
704320ff-f82f-4b1f-a103-5588ca441ae2
2
@Override public boolean isComponent(JsonObject jsonObject) { return jsonObject.get("hidey") != null && jsonObject.get("show-mcr") != null && jsonObject.get("type").getAsString().equals("coord"); }
c993e02a-535a-4f1a-9991-4a1e9cf7f95b
3
public void saveMessage(MessageDTO messageDTO) throws DataProcessingException { MailBox sender = mailBoxDAO.find(messageDTO.getSender()); if (sender == null) { logger.warn("Mailbox with email " + messageDTO.getSender() + " does not exist"); throw new DataProcessingException(ExceptionType.mailBoxDoesNotExist);...
0cbf3575-7025-4cf2-bb60-cf103594c9c8
0
public boolean end() { return i == items.length; }
672f6c8b-c515-4f51-ae9b-937145fdf28b
9
public static TypeType arrayElementTypeFor(ClassData classData) { if (classData == refArrayClassData) { return TypeType.REF; } else if (classData == boolArrayClassData) { return TypeType.BOOLEAN; } else if (classData == byteArrayClassData) { return TypeType.BY...
183a144b-68f0-41b9-8be0-cffc77f5bcdb
3
@Test public void testReceiveTimeout_MessageAlreadyPresent() { try { consumer = new AbstractMessageConsumer(mockTopic) { }; } catch (DestinationClosedException e) { fail("Unexpected exception on constructor"); } assertNotNull(mockTopic.getTopicSubscriber()); try { Message msg = new MockMessage("T...
0b2d0fa0-48f4-48a3-944f-c93880785679
3
public double checkSpeed() { double dx = this.getDeltaX("BALL"); speedX = hitCounter * 0.3; if(dx < 0) { dx = -speedX; } if(dx > 0) { dx = speedX; } if(dx == 0) { dx = 0.3; } return dx; }
4420c307-d56f-44dd-b644-c6f7762b4a4a
4
private <T, R> R convert(ConvertType convertType, TypeConverter<T, R> typeConverter, T source, Class<R> targetClass) { switch (convertType) { case identity: return (R) source; case none: return null; // TODO: later, return default null case converter: return typeConverter.convert(source); case...
458769b4-a0ed-4cde-8c58-a33d35d37aeb
7
@Override public void init() { log("Behave test. Usage : ant test-interactive-behave -Dpath=poly|ellipse|bspline"); log("Current parameter:"+getParam()+":"); Color stage_color = new Color(0xcc, 0xcc, 0xcc, 0xff); Color rect_bg_color = new Color(0x33, 0x22, 0x22, 0xff); Color rect_border_color = new Color(0, ...
9289e0bb-ec58-486e-9280-19dd28899da9
3
private String readString() throws EncodingException { int handle = readInt(); boolean inline = ((handle & 1) != 0); handle = handle >> 1; if (inline) { if (handle == 0) return ""; byte[] data = readBytes(handle); String str; try { str = new String(data, "UTF-8"); } catch (Uns...
d8424da0-4fa2-4c44-8111-f30534ec998b
9
public static Iterable<FileEntry> listFilesRelativeToClass(Class<?> clazz, String subdirectory) throws IOException { ArrayList<FileEntry> list = new ArrayList<FileEntry>(); CodeSource src = clazz.getProtectionDomain().getCodeSource(); if (src == null) { return list; } ...
11838c5d-d368-4da5-b779-982f1be45b45
3
public static boolean reflectGraphicsEnvironmentISHeadlessInstance(Object graphicsEnvironment, boolean defaultReturnIfNoMethod) { try { Class clazz = graphicsEnvironment.getClass(); Method isHeadlessInstanceMethod = clazz.getMethod("isHeadlessInstance", new Class[]{}); if (is...
ed179d6a-3d61-446c-95e3-98a2fc4e0476
0
@Override public Iterator<Term> iterator() { return new BSTIterator<Term>(this); }
d77606e3-edf3-473b-a1b0-55179b1428a3
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> alread...
3112f651-81b5-4cb5-a4a2-5ed542e27ee8
3
public static boolean textureExists(String s) { File f = R2DFileUtility.getResource(s); if(f.exists() && f.isFile() && f.getName().endsWith(".png")) return true; else return false; }
0d2f5f50-fb05-45e5-8ffc-413a44342287
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Trayectoria other = (Trayectoria) obj; if (estacionDestino == null) { if (other.estacionDestino != null) return false; } else if (!estac...
38f1a4d1-114e-4db4-8361-8d0a7cdc24f0
5
public int get_check_info() { int return_val = 0; cur_phoneName = jtext_phone_name.getText().trim(); cur_phoneNum = jtext_phone_number.getText().trim(); cur_phoneAddress= jtext_address.getText().trim(); cur_phoneAddress = cur_phoneAddress.replaceAll("\n", " "); i...
93f991ac-784d-4243-b2fa-28e2119532b4
7
public void printDirectedDegreeDistribution(LinkSet L){ LinkSetNode N; L.initTreeTraversal(); Map<Integer,Integer> inDegree = new HashMap<Integer,Integer>(); Map<Integer,Integer> outDegree = new HashMap<Integer,Integer>(); Set<Integer> nodeSet = new HashSet<Integer>(); ...
87679695-576e-42d6-a8e5-e52b96a632f3
4
public final void write(File xmlFile, ArrayList<Person> firsts, ArrayList<Person> recurrings) throws Exception { DocumentBuilderFactory docFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); doc.setXmlSta...
d90f5e9b-7ca6-468e-9b30-4bd1e0720290
6
public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please, input arithmetic expression: "); String equation = in.nextLine(); int counter = 0; //go:{ for (int i = 0; i < equation.length(); i++) { if (equation.charAt(i) == '(') { counter++; } else if (e...
b2615f20-18a6-4899-95d8-da66a6fe7d8b
2
public static ReservaEstado create(String estado) { ReservaEstado pedidoObject = null; String nomeClasse = "br.com.implementacaoObserverWeb.state." + "PedidoEstado" + estado; Class classe = null; Object object = null; try { classe = Class.forName(nomeClasse); object = classe.newInstance(); } catch...
69776437-00ac-4476-a562-cca83ed447cc
3
public CycList readCycList() throws IOException { int size = readInt(); if (trace == API_TRACE_DETAILED) { debugNote("readCycList.size: " + size); } CycList cycList = new CycList(size); for (int i = 0; i < size; i++) { cycList.add(readObject()); } if (trace == API_T...
ce954c5d-f52f-4dce-90e6-3af7273b8dbc
3
@Override public int compareTo(Ban ban) { // not exactly equal but already exists if (!ban.player.equalsIgnoreCase(this.player)) { if (this.until.after(ban)) { return 1; } else if (this.until.before(ban)) { return -1; } ...
3ed819fb-4fc7-4beb-914e-571b98c4df46
6
private static boolean isPrime( int n ) { if( n == 2 || n == 3 ) return true; if( n == 1 || n % 2 == 0 ) return false; for( int i = 3; i * i <= n; i += 2 ) if( n % i == 0 ) return false; return true; }
104444ce-2529-486e-9179-d7b4de08eadd
4
public static void main (String args[]) { System.out.println("Welcome to the Movie List Application."); System.out.println("There are 100 movies on the list."); Scanner sc = new Scanner(System.in); String choice = "y"; ArrayList<Movie> myListOfMovies = createArrayList(); ...
5a81f2bb-8cbb-458e-877f-2e38f5f5b4be
8
@EventHandler public void onSignClick(PlayerInteractEvent e) { Player p = e.getPlayer(); if (e.getAction()==Action.RIGHT_CLICK_BLOCK||e.getAction()==Action.LEFT_CLICK_BLOCK) { Block b = e.getClickedBlock(); if (b.getType()== Material.SIGN_POST||b.getType()==Material.WALL_SIG...
94cefea1-845b-4ab8-a93e-08971e7dbe8d
0
public String value() { return value; }
01c26bfa-b9d6-4dd8-9f3c-1e7df7c61733
1
public static void main(String[] args) { Utility util = new Utility(); //util.splitWords("[Not a question!] radcombobox in client side"); File indexFile = new File("d:\\hadoop-2.2.0\\etc\\hadoop\\words.txt"); File contentFile = new File("d:\\hadoop-2.2.0\\etc\\hadoop\\content.txt"); Map<String, String> indexM...
1e0b4804-83b3-491f-866b-31f6125752b4
6
public void attaquer(Positions pos) { if (this.plateau.getPlateau()[pos.getLigne()][pos.getColonne()] == EtatDesCases.LIBRE) return; Joueur joueurAttaque; if (this.joueurEnCours == this.joueur1) joueurAttaque = this.joueur2; else joueurAttaque = this.joueur1; Perso persoSurPlateau = joueurAttaque.ge...
819226b9-ed19-465d-9fbe-84e930e8e928
9
public static PDFDecrypter createDecryptor (PDFObject encryptDict, PDFObject documentId, PDFPassword password) throws IOException, EncryptionUnsupportedByPlatformException, EncryptionUnsupportedByProductException, PDFAuthenticationFailureException ...
ce598ce9-1686-4d12-8f65-af74fd32afd3
8
private void processGridletSubmission(Sim_event ev) { if (trace_flag) { System.out.println(super.get_name() + ": received an SUBMIT_GRIDLET event. Clock: " + GridSim.clock()); } /*********** We have to submit: - the gridlet whose id c...
cf10243a-6e2e-4354-a1b1-a50db3557ea9
2
@Test public void exceededCapacityTest() { Student student1 = null; Student student2 = null; try { student1 = familyService.findStudent(1); student2 = familyService.findStudent(2); } catch (InstanceNotFoundException e) { fail("Activity not exists"); } Activity activity = new Activity("Baloncesto...
95522aca-f99b-45f6-a27c-f3e986bab362
3
private void resize() { size = getWidth() < getHeight() ? getWidth() : getHeight(); width = getWidth(); height = getHeight(); if (width > 0 && height > 0) { canvasBkg.setWidth(size); canvasBkg.setHeight(size); canvasFg.setWidth(size); c...
002b3b12-471f-455d-a547-c75354ba00c0
1
@Override public List<Integer> save(List<Tourist> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException { try { return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (Tourist bean) -> { Object[] obj = new Object[6]; obj[0] = be...
21f45952-8946-4310-8b1f-d8ace005687e
1
public Object getElement(int index) { LinkedElement<E> elem = findElement(index); if (elem != null) { return elem.getObj(); } return null; }
5015d15b-64f7-4d43-a6f3-738f4cd77d1d
1
public boolean isUnity() { if (!isEmpty()) return first.next == null; return false; }
c67ee580-7681-4c77-996e-251c2274c96c
8
public void move(){ if(destination != null){ if(location.x != destination.x){ if(Math.abs(location.x - destination.x) <= speed){ location.x = destination.x; } else { location.x += (location.x < destination.x) ? speed : -speed; } } if(location.y != destination.y){ if(Math.abs(locatio...
cbc2045a-7ce7-45bc-881d-4f9dc5ddcae0
3
private void displayPlayAgain(String message) { System.out.println("TicTacToeGameGUI::displayPlayAgain()"); int reply = JOptionPane.showConfirmDialog(null, message, message, JOptionPane.YES_NO_OPTION); if (reply == JOptionPane.YES_OPTION) { m_game = new TicTacToeGame(m_playerOne, m_playe...
538e3abe-5209-4d6c-b70e-3fc5cbda9bad
9
private void loadRIBFromFile(String ribFilename) { try { logger.info("loading RIB from " + ribFilename); FileReader fr = new FileReader(ribFilename); BufferedReader br = new BufferedReader(fr); String str = br.readLine(); int routes_total = 0; int routes_read = 0; while (str != null) { ...
5d3f3205-4af5-4144-bfb7-877dd576e986
6
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
8906f7ba-bfed-4f64-ade8-11b5a40c14cf
6
public static String escape(String string) { char c; String s = string.trim(); StringBuffer sb = new StringBuffer(); int length = s.length(); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c == '+' || c == '%' ...
ae2da925-b2bf-43d9-af2e-722bfeaf217a
5
StringBuffer generateLayoutCode() { StringBuffer code = new StringBuffer(); code.append("\t\tStackLayout stackLayout = new StackLayout ();\n"); if (stackLayout.marginWidth != 0) { code.append("\t\tstackLayout.marginWidth = " + stackLayout.marginWidth + ";\n"); } if (stackLayout.marginHeight != 0) { code...
ad0062c4-cc02-4b43-a068-4bc1ec4ffe4d
8
public BiCliqueGraph findBipartiteComplementAndVertexCoverComplement(HashSet<Integer> maximalCliqueK1, HashSet<Integer> maximalCliqueK2, Graph OrigGraph) { //Take bipartite complement from two maximal cliques and arrange the graph with minimal memory int clique1Size = maximalCliqueK1.size(); int clique2Size = ...
a1f7b149-b638-48ef-ac56-ca257f622507
9
public boolean newJudge(String one, String two) { char[] oneChar = one.toCharArray(); char[] twoChar = two.toCharArray(); if (twoChar.length > oneChar.length + 1) { return false; } for (int i = 0; i < oneChar.length; i++) {// start from c int otherSize = i;// count other char which is not in one bo...
3cf972c6-8f7d-4b21-bab9-2a20736a0233
7
private void updateAllVQ() { int c = movie.getCapacity(); for (int i = 0; i < numberOfAtoms; i++) { try { atom[i].updateVQ(); } catch (Exception e) { atom[i].initializeVQ(c); atom[i].updateVQ(); } } if (obstacles != null && !obstacles.isEmpty()) { RectangularObstacle obs = null; synch...
e1117c38-20cc-4425-99e1-8ae1a43f6b0c
1
public static void main(String[] args) throws FileNotFoundException { Map<Integer, UserPreferences> treeMapUP = new TreeMap<Integer, UserPreferences>(); Map<Integer, ItemPreferences> treeMapIP = new TreeMap<Integer, ItemPreferences>(); readFile(treeMapUP, treeMapIP); System.out.println("Op basis van users\...
042bd866-85fb-413d-8bb0-508101e79400
2
public int getInt(int index) throws JSONException { Object object = this.get(index); try { return object instanceof Number ? ((Number)object).intValue() : Integer.parseInt((String)object); } catch (Exception e) { throw new JSONException("JS...