method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6f7e037f-b9b9-45ae-a7be-239f830c542c
9
public int addFromFile(Entry newEntry, int duplicate) { //1 means add duplicates, 0 means don't, -1 means we don't know yet boolean found = false; //file not already in user's library if (duplicate == 0 || duplicate == -1) { //we don't/don't know about adding duplicates for (int i = 0; i < library.size(); i++...
8657fb61-4ec8-4e5d-8286-115aa2cabdec
7
public String[] someoneElse(boolean place) { try{ driver.get(baseUrl + "/content/lto/2013.html"); //global landing page driver.findElement(By.xpath("/html/body/div[2]/div/div/div/div/div/div/div[3]/ul/li[3]/a")).click(); //Hong Kong landing page - Order Now button driver.findElement(By...
ab3c4b72-4d9f-4e30-8d2f-315aa6eacd0d
3
@Override public final boolean accept(final File file) { if (file.isDirectory()) { return true; } final String name = file.getName(); int end = name.length(); for (int i = 0; i < this.dots; i++) { end = name.lastIndexOf('.', end - 1); if (end < 0) { return false; } } return ending(name.s...
4ae05976-88b6-4a05-8f44-bb505f0921bc
7
private void testHelper_method_nullPosition_shouldFail(MethodToTest method) { final RelativePosition NULL_POSITION = null; switch (method) { case changeMoleculeEnergyLevel: moleculeMediator.changeMoleculeEnergyLevel(validAnchor, NULL_POSITION, VALID_ENERGY_CHANGE_AMOUNT); break; case createMoleculeAtPo...
9f03f9d9-46de-4f9d-a07e-436a3db4cd4d
3
public static File getPropertiesFile(){ File settingsFolder = new File(ProjectMgr.getSettingsPath()); if(!settingsFolder.exists()){ settingsFolder.mkdir(); } File iniFile = new File(ProjectMgr.getSettingsPath(), "settings." + AppMgr.getExtension("settings fil...
a969e006-ff8e-4dbe-b566-e63ac7a6712b
8
public RoomStuff makeRoomStuff(final Room R, final List<Pair<String,String>> fixtures) { final RoomStuff stuff=new RoomStuff(); int x=1; String s=getPairValue(fixtures, "ITEM"+x); while(s!=null) { if(s.length()>0) { final Item I=getItemFromCode(R, s); stuff.items.add(I); } x++; s=getPa...
f88c7408-f567-447c-9b16-26ea547a96a7
5
public boolean cambia (int valore) { try { f2 = new FileWriter("statistiche.txt"); fOUT = new PrintWriter(f2); switch (valore) { case 0: fOUT.print("0;0;0;"); ...
e776be40-3f61-49fd-a925-6653ca917fcc
0
private void writeMsg(FileWriter wr, String msg) throws IOException { System.out.println(msg); wr.write(msg); wr.write('\n'); }
7f303f4a-59fe-4658-a12f-746d8866253c
2
private String userType(String username) { String type = null; ResultSet rs; try { PreparedStatement statement = connection .prepareStatement("SELECT * FROM Users " + "WHERE username = ?"); statement.setString(1, username); rs = statement.executeQuery(); while (rs.next()) { type =...
7cb752ef-1683-4e5c-bc93-54e411eb3120
0
public NoFilter(final ConnectionProcessor proc, final Properties config) { super(proc, config); }
f3660c8c-377a-4af9-ab02-1a063fe2ceab
8
private int getPriority(String operador) { int precedencia = 0; switch(operador){ case "~": precedencia=1; break; case "^": precedencia=2; break; case "v": precedencia=3; break; case Operador.$CONDITIONAL: ...
19fd544c-9bc3-4005-b650-38b91e2a2bf0
0
private void processTerritories() { // TODO Auto-generated method stub }
7a2468dd-942e-472a-b535-0c729d715af2
6
private Card findCardThatBeatsIt(Card card) { Card move = null; int num = -1; for (int i = 0; i < cards.size(); i++) { if (((cards.get(i).getType() > card.getType()) && (cards.get(i).getSuit() == card.getSuit())) || ((cards.get(i).getSuit() == trump) && (card.get...
6b2bfd81-0ba7-4d3b-b0f9-3fc731744822
6
private void makeCircularFieldList(FieldCircularList[] map) throws NoInstanceException { boolean jailField = false; boolean parkingField = false; FieldCircularList prev = map[0]; if(prev instanceof Go) { for(int i = 1; i < map.length; i++) { map[i].add(prev); prev = map[i]; if(map[i] instanceof ...
c0a7e8f6-a90f-43f7-b944-edb35baef27a
5
public void kill(){ sizingState = COLLAPSING; expanded = false; if (!selfKill && owner instanceof Mob) ((Mob)owner).resetState(); Script s = main.currentScript; if(s!=null) if(s.getActiveObject()!=null) if(s.getActiveObject().equals(this)) s.removeActiveObj(); }
88fff549-4329-47bd-912d-57c2dd16febd
1
public String getRoundAsString() { if (round <= MAX_ROUND) { return String.valueOf(round); } else { return "Unzählbar!"; } }
f434b503-3a20-473b-907d-184f0709c797
2
public Builder name(String receivedName) { if (receivedName == null || receivedName.equals("")) { log.warn("Wrong Name. receivedName =", name); throw new IllegalArgumentException("Name must be not null. Received value =" + receivedName); } this.name = ...
cca9ca1f-77dc-4535-b148-9f179ec089fa
9
public void actionPerformed(ActionEvent evt) { // final int[] keycodes = {32, 37, 38, 39, 40 }; cmd = ""; if (leftKey.isPressed()) { cmd += "MOVE:" + gameClientHandler.game.getGameid() + ":" + "37" + "\r\n"; // pg.setLeftPressed(false); } if (upKey.isPressed()) { cmd += "MOVE:" + gameClient...
10e59f28-6f20-4d75-b1b8-25cb669e9eca
6
private void handleInput(SelectionKey key) throws IOException { if (key.isValid()) { // 处理新接入的请求 if (key.isAcceptable()) { ServerSocketChannel ssc = (ServerSocketChannel) key.channel(); SocketChannel sc = ssc.accept(); sc.configureBlocking(false); sc.register(selector, SelectionKey.OP_READ); ...
738dd100-2f25-4899-8791-b8b205b7cd23
3
private static JPanel getPanel() { JPanel p = new JPanel(); p.setLayout(new GridLayout(0, 1, MenuLookAndFeel.getGap(), MenuLookAndFeel.getGap())); String[] saveFiles = SavePath.getSaveFiles(); ButtonGroup group1 = new ButtonGroup(); final MenuToggleButton tb1 = new MenuToggleButton(Translator.getMenuStr...
41e99c7a-225d-4bbe-b4b5-1f5466d6f0a3
5
public int getWidth(String str, double scale) { if (str == null) return 0; str = str.replaceAll("`", ""); int width = -1; if (!str.contains("\r")) width = (int) (scale * str.length() * letterWidth); else { ArrayList<String> lines = new ArrayList<String>(); String[] currentLines = str.split("\r"); ...
ef969974-48c7-4814-a53f-209d713f373f
4
public static int[] columnIndexes(CSTable table, String name) { List<Integer> l = new ArrayList<Integer>(); for (int i = 1; i <= table.getColumnCount(); i++) { if (table.getColumnName(i).startsWith(name)) { l.add(i); } } if (l.isEmpty()) { ...
bf4229bb-e64e-4609-8940-c300d81e9f95
7
@Override public Parameter getParameter(final int parameterIndex) { Parameter parameter; switch (parameterIndex) { case 0: case 1: parameter = super.getParameter(parameterIndex); break; case 2: parameter = sensitivit...
293ae80a-2926-4255-8ca3-5a3c2f30cb89
7
@Override public void paint(Graphics g) { // TODO Auto-generated method stub super.paint(g); Graphics2D g2 = (Graphics2D) g.create(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); double size = Math.min(this.getBounds().getWidth(), this.getBounds().getHeight()); ...
2be9c4ea-0de7-47fc-91d2-7a2f2415fc9e
8
public boolean mobs(MOB mob, List<String> commands) { if(commands.size()<3) { mob.tell(L("You have failed to specify the proper fields.\n\rThe format is PURGE MOB [MOB NAME]\n\r")); mob.location().showOthers(mob,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> flub(s) a powerful spell.")); return false; } String...
913caa60-3e0b-41b7-a6d8-a1e6c97ad1b4
0
public boolean contains(Point point) { return GeoJson.pointInPolygon(coordinates, point); }
e1d99250-8192-4d0f-a1ca-da0b22478cd5
0
public void sortColors(int[] A) { }
dcb8e5c2-a2d7-4c24-b7e1-daa55bc40290
4
public void sort() { Calculator[] cal = (Calculator[]) this.goalMap.values().toArray(new Calculator[0]); for (int i = 0; i < cal.length; i++) { for (int j = 0; j < i; j++) { if (cal[i].getAllThroughTime() > cal[j].getAllThroughTime()) { Calculator tmp = ca...
12f4e733-1439-45d7-ae18-40a8976b2a51
2
public Opcional buscarOpcional(String nome) { for (Opcional o : opcionais) { if (o.getNome().compareToIgnoreCase(nome) == 0) { return o; } } return null; }
6e1dbf99-2ae7-4d5d-ba3b-b19b8a909f9f
4
public String toString() { if(etype!=null) { switch(etype) { case synatax_error: return "Syntax Error!"+msg; case type_error: return "Type Error!"+msg; case runtime_error: return "Runtime Error!"+msg; } } return "no type"; }
6545b56e-3370-48da-af2f-6bbf0ed322f0
0
public SymbolTable getParent() { return parent; }
268fd519-af44-47ab-9146-d9bc92861cd1
1
@Test public void derivative_test1() { try{ double x = 2; Power3CFunction pow = new Power3CFunction(); double result= pow.derivative(x); double exp = 12.0; Assert.assertEquals(exp, result, 0.001); } catch (Exception e) { // TODO Auto-generated catch block fail("Not yet implemented"); } ...
145a62b7-5240-4cba-b6c3-cf844801ad80
3
public static int saveGame(int slot){ // If save slot not selected yet, get user input if(slot==0){ Object[] options = {"1", "2", "3"}; slot = JOptionPane.showOptionDialog(null, "Select your save slot", "Save Slot", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); slot+...
3be14262-e1c4-4072-aaff-0c04982c2559
3
public void calculateNextPosition(Position position, Action action) { if ("L".equals(action.getActionCode())) { position.setOrientation(moveNinetyDegree(position.getOrientation(), Action.LEFT)); } else if ("R".equals(action.getActionCode())) { position.setOrientation(moveNinetyDegree(position.getOrientat...
b3056e77-7170-4230-ae2c-b05c1cff4e96
0
@Override public void windowDeiconified(WindowEvent arg0) { // TODO Auto-generated method stub }
316272d9-ca68-43f9-814e-bba47c6ebe32
5
@Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(e.getActionCommand().equals(StringConstants.SCAN)){ MainFrameManager mainFrameManager = MainFrameManager.getInstance(); String filedir = mainFrameManager.selectFileDirectory(dialog); if(filedir != null){ selec...
617ee0cf-7148-4371-bab4-cae21c9bbc7c
3
@Override public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp) throws Exception { if (st.size() < 2) throw new Exception("SUMA: faltan operandos"); Valor op1 = st.pop(); Valor op2 = st.pop(); if (op1 instanceof Entero && op2 instanceof Entero) { st.push(new Entero(((int) op1.getValor()) + ...
dd7334ce-82e8-4352-8d12-f9cbe1388e31
9
public String lireIntitule(Reader flux) throws Exception { char characterCourant; boolean debutIntitule = false; boolean finIntitule = false; String intitule = ""; characterCourant = (char) flux.read(); while (characterCourant!= 65535 && characterCourant!= -1) { if (characterCourant == '{' && !debutIntit...
d2003178-d9ee-4cd0-a1f0-5f6ee95318b7
7
public static void startupDescriptions() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, (...
c9f0290c-053f-4e79-b50b-5adaff06b8f8
3
public static String degreesUnitIndexToString(int index) { switch (index) { case 0: return "true"; case 1: return "magnetic"; case 2: return "relative"; default: return "true"; } }
9604acb9-5182-4d9d-9f7c-5a38b2c4dc82
9
public void viewCalendar() { if (jCalendar == null) jCalendar = new JPanel(); jCalendar.repaint(); btnDays.removeAll(btnDays); GridLayout gl = new GridLayout(7, 7, 1, 1); jCalendar.setLayout(gl); Calendar c = new GregorianCalendar(Integer.parseInt(textDateYear .getText()), Integer.parseInt(textDateMo...
efeb2021-237b-4af7-9142-14d7a0773ed2
4
public static WhitespaceFreeXMLDoc loadXMLDocument(String xmlFile, String schemaFile) throws InvalidXMLFileFormatException { // FIRST LET'S VALIDATE IT boolean validDoc = validateXMLDoc(xmlFile, schemaFile); if (!validDoc) {...
c73dad2e-266e-47f8-b410-0c2b61842591
7
@SuppressWarnings("resource") @Override public void run() { int count = 0; String insert = "insert into inauthor(paperid,name,inauthors)values(?,?,?)"; try { PreparedStatement statement = sqLconnection.conn .prepareStatement(insert); for (String id : IDS) { List<String> citationIDs = getCitationI...
39bdc827-c983-428c-b7f0-3580606e3f7b
6
public static void main(String[] args) throws NullPointerException { try{ HashSet<String> set = new HashSet<String>();//HashSet set.add("Java"); set.add("C++"); Iterator<String> it=set.iterator(); System.out.println("hashset:"); while(it.hasNext()){ String str=it.next(); System.out.prin...
1257305e-770c-4272-b93c-cf1707991fc9
5
public static Locale parseLocaleString(String localeString) { String[] parts = tokenizeToStringArray(localeString, "_ ", false, false); String language = (parts.length > 0 ? parts[0] : ""); String country = (parts.length > 1 ? parts[1] : ""); validateLocalePart(language); validateLocalePar...
d6e508ee-8c78-4b8f-be3a-7b4fcb76e0cd
8
public void openFile(File file) { isOpeningFile = true; if (file != null) { view.middleTabPane.viewPane.getChildren().clear(); selectionManager.clearSelection(); historyManager.clearHistory(); try { Parent parent = FXMLLoader.load(file.toU...
91dc6d57-f5d1-47ae-87f4-7c2a22565069
8
private void plugHole(int hole) { int index = hole + 1; if (index == keys.length) { index = 0; } while (keys[index] != null) { int targetIndex = getKeyIndex(unmaskNullKey(keys[index])); if (hole < index) { /* * "Normal" case, the index is past the hole and the "bad ran...
6550015c-edf9-4296-800b-262181a5a460
8
public void rotate() { int tempX, tempY; switch (this.currentRotation) { case EAST : for (int i = 0; i < blocks.length; i++) { tempX = blocks[i].getXCoord(); tempY = blocks[i].getYCoord(); blocks[i].setXCoord(tempY);...
7455c01a-4fb8-48b8-855a-b26bbcc4828f
0
public static Map<String, UserOperator> getUserOperators() { return userOperators; }
0d49564e-700c-47d1-8f6e-e7e8fc877c70
7
@SuppressWarnings("resource") private void generate(TreeLogger logger, String template, TemplateGeneratorOptions options) { SourceBuilder<?> context = options.getContext(logger, template); InputStream input; try { if (new File(template).exists()) { input = new FileInputStream(template); ...
b4e8697a-fcbf-4f14-9e19-3d4bfb0d692a
8
public void expandANode(int count) { for(int a = 0; a < (caseSize - 1); a ++) { cost = 15000; if(a == 0) { tour.add(vertices.get(vertexCount)); v1 = tour.get(0); } specifiedEdges = graph.getEdges(v1); Iterator<Edge> myIter = specifiedEdges.iterator(); while(myIter.hasNext()) { ...
d6619758-0337-4b41-8b25-840b1c579a70
3
public static String writeProperties() { System.out.println("Entering writeProperties() in "+ReadProperties.DATE_FORMAT.format(new Date())); String myFolderRoot = "C:\\test\\myfolder"; String otherFolderRoot = "C:\\test\\otherFolder"; File root = new File(myFolderRoot); File oth...
960ae66f-8fe6-4b8b-afe9-b3e13881e1e1
3
void countMarker(String fileName, Marker read) { // Find all intersects Markers regions = snpEffectPredictor.queryDeep(read); // Count total reads countTotalReads++; // Count each marker HashSet<Marker> done = new HashSet<Marker>(); for (Marker m : regions) { // Make sure we count only once each mark...
f1ceb7f3-001f-4c75-bc5b-8960ef77505c
5
public boolean write(aos.apib.OutStream out, aos.apib.Base o) { AuthenticationRequest v = (AuthenticationRequest)o; int i = -1; while ((i = out.nextField(i, this)) >= 0) { switch (i) { case 0: out.putInt(v.id, i, __def.id, this); break; case 3: out.writeBaseClasses(o,...
b5a3c9b8-950f-4972-872f-f7467e4e9acc
4
public String compareRank(Stats previousStats) { if(previousStats == null) return ""; if(previousStats.rank == 0) return ""; double delta = previousStats.getRank() - getRank(); if(delta == 0D) return ""; return "<font color=" + (delta >= 0 ? "green" : "red") + ">(" + getArrow(delta) + NumberFormat.g...
b651ed63-3c93-4d46-9e2f-a36a4b524ddb
9
private DisplayMode findDisplayMode(int width, int height) throws LWJGLException { DisplayMode targetDisplayMode = null; DisplayMode[] modes = Display.getAvailableDisplayModes(); int freq = 0; for (int i=0;i<modes.length;i++) { DisplayMode current = modes[i]; if ((current.getWidth() == width) && (cu...
89a49cbc-7fc5-434a-bb5e-86342179240d
8
final int getRankOf(int CARD1, int CARD2, int CARD3, int CARD4, int CARD5, int CARD6, int CARD7) { long KEY = deckcardsKey[CARD1] + deckcardsKey[CARD2] + deckcardsKey[CARD3] + deckcardsKey[CARD4] + deckcardsKey[CARD5] + deckcardsKey[CARD6] + deckcardsKey[CARD7]; int FLUSH_CHECK_KEY = (int) (KEY & S...
51b0a19a-26f9-4ee5-95cd-8a808b06673b
6
@Override public void actionPerformed(ActionEvent event) { if(event.getSource() == bAddPlayer || event.getSource() == nameTb || event.getSource() == messageTbLeft){ config.setString(nameTb.getText(), messageTbLeft.getText()); updateList(); }else if(event.getSource() == bDeletePlayer){ config.removePlayer(...
ba6e29ff-2ee1-477a-8009-ce4a01dc9984
0
public void loadColumnNames() { columnNames.addElement("Number"); columnNames.addElement("Protocol"); columnNames.addElement("Name"); columnNames.addElement("Description"); }
9734299c-03f7-4f05-89ac-7fb00ce631cf
5
@Override public void valueChanged(ListSelectionEvent e) { imageSlider.icon = (ImageIcon)imageSlider.iconList.getSelectedValue(); try { imageSlider.imgUrl = imageSlider.icon.getDescription(); } catch (Exception e2) { // Maybe set the logo of the company here imageSlider.imgUrl = "http://jimpunk.net/Load...
8bb2fe8a-326c-4e14-ad99-a00872d25a77
2
public static Resource[] usable() { ArrayList<Resource> res = new ArrayList<>(); for (Resource r : values()) if (r.isUsable()) res.add(r); return res.toArray(new Resource[] {}); }
68efe77e-f8e4-4edb-ba51-1b9fa2f234aa
4
public void loadRasPiPlugin(File file) throws PluginException { if (file == null) throw new PluginException("RasPiPlugin cannot be null!"); RasPiPlugin RasPiPlugin = null; try { RasPiPlugin = getRasPiPlugin(file); } catch (Exception e) { RasPiAPI.getLogger().warning("Failed to load file " + file.getNa...
a2102a15-7ba6-4f3f-af79-ec5342f464c5
2
private void copyResource(InputStream resource, File file) { try { OutputStream out = new FileOutputStream(file); int lenght; byte[] buf = new byte[1024]; while ((lenght = resource.read(buf)) > 0) { out.write(buf, 0, lenght); } ...
9089fd5c-35c5-4acc-b892-86a8d4ecc9dc
2
public ArrayList<Klus> getAlleKlussenDB() { ArrayList<Klus> alleKlussenDB = new ArrayList<Klus>(); try { this.leesDatabase(); output = statement.executeQuery("SELECT * FROM klussen WHERE ingepland = 0"); while (output.next()){ int id = output.getInt("id"); String naam = output.getString("naam"); ...
a4de68f1-530e-4450-9e4c-18f7a77e0200
9
protected int decodeKeyword(String str) { if (str.equalsIgnoreCase("ABT")) return ABOUT; if (str.equalsIgnoreCase("CAL")) return CALCULATED; if (str.equalsIgnoreCase("EST")) return ESTIMATED; if (str.equalsIgnoreCase("FROM")) return FROM; if (str.equalsIgnoreCase("TO")) return TO; if (st...
c1a85eb2-50ac-4ce1-b7e1-06ee3b38a413
2
private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitButtonActionPerformed switch (exitButton.getText()){ case "退出": System.exit(0); break; case "返回": newGameButton.setVisible(true); loadGameButton...
32578c2c-539f-458b-b10b-7e449c5d5eb6
0
public static void main(String[] args) { k = 2; System.out.println(fun()); }
96ef0ff3-86b3-4c7b-8927-3a9426bcd243
4
public boolean blocked(UnitMover mover, int x, int y) { // if theres a unit at the location, then it's blocked if (getUnit(x,y) != 0) { return true; } int unit = ((UnitMover) mover).getType(); // planes can move anywhere if (unit == PLANE) { return false; } // tanks can only move across gr...
17a411a0-f83b-4b77-9b28-704d7370a1db
5
private int validateFailImage(int ans, int full_bg_index, int img_grp_index) { final int thread = 3;// 容差值 String full_bg_name = md5Encode(full_bg_index + "").substring(0, 9); String bg_name = md5Encode(img_grp_index + "").substring(10, 19); String answer_decode = ""; // 通过两个字符串奇数和偶数位拼接产生答案位 for (int ...
e81a4533-d3cf-45bd-a534-38379f498bef
2
public void tick() { time++; if (time > 60) { remove(); } xx += xa; yy += ya; zz += za; if (zz < 0) { zz = 0; za *= -0.5; xa *= 0.6; ya *= 0.6; } za -= 0.15; x = (int) xx; y = (int) yy; }
33f4c0cf-63b6-4011-85c4-ea8f89aa9da6
4
public final static void saveFileContents(String filePath, String data) { File file = new File(filePath); // If the file exists, delete it if (file.exists()) file.delete(); FileWriter fileWriter = null; BufferedWriter bufferedWriter = null; try { file.createNewFile(); fileWriter = new FileWriter(fi...
1364d8e5-7683-4d52-8fc3-14fc994f4db3
0
public void register(AnnounceResponseListener listener) { this.listeners.add(listener); }
2cd0cfc7-1664-4780-b274-1080a2cae71e
8
private void jButtonAtualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAtualizarActionPerformed Material material = new Material(); DadoMaterial dadoMaterial = new DadoMaterial(); dadoMaterial.setTitulo(jTextFieldTitulo.getText()); dadoMaterial.setDescrica...
be389ac5-25df-4ec1-84a9-9e872fd2edfd
7
private void drawDraggedObject() { if (draggedObject == null && draggedElement == null) { // Nothing to draw return; } g2d.setColor(draggedColor); // Rectangle if (draggedElement instanceof Transition) { Trans...
60eaaf1f-74bf-4d44-936f-a70fd9cbc755
6
public boolean postMortem(PostMortem pm) { MapKeep that = (MapKeep) pm; if (this.length != that.length) { JSONzip.log(this.length + " <> " + that.length); return false; } for (int i = 0; i < this.length; i += 1) { boolean b; if (this.list[i...
ec425f6a-0a99-4365-a1e7-57ef0914f902
7
static void EscribirCacheCorrespondenciaDirecta(int i, int v) { int Etiqueta = Integer.parseInt(Integer.toBinaryString(0x1000 | i).substring(1).substring(0, 3)); int Palabra = Integer.parseInt(Integer.toBinaryString(0x1000 | i).substring(1).substring(9, 12), 2); int Linea = Integer.parseInt(Int...
876170a2-3b1c-40dc-bd88-48887c87b6e5
5
@Test public void testListarProdutos() { List<Produto> produtos; try { produtos = facade.listarProdutos(); Assert.assertEquals(4, produtos.size()); } catch (FacadeException e) { Assert.fail(e.getMessage()); } try { facade.remover(1); produtos = facade.listarProdutos(); Assert.assertEquals(3...
268ca909-6c64-4cc8-921b-ff775b9c1f5c
3
public void onMessage(String channel, String sender, String login, String hostname, String message) { if (channel.equalsIgnoreCase(DarkIRC.currentChan.name)) { GUIMain.add_line("<" + sender + ">:" + message); } else { for (int i = 0; i < Da...
f042b08f-e532-41c8-996a-e8b2e24e70e0
7
public static void main(String[] args) throws Exception { weka.core.logging.Logger.log(weka.core.logging.Logger.Level.INFO, "Logging started"); LookAndFeel.setLookAndFeel(); try { // uncomment to disable the memory management: //m_Memory.setEnabled(false); m_Viewer = new ArffVie...
e8a99555-c589-409f-ad9e-10d59579b77b
5
public void actionPerformed(ActionEvent arg0) { if (arg0.getActionCommand().equals("CIRCLE")) { circleSelected = true; lineSelected = false; } else if (arg0.getActionCommand().equals("LINE")) { lineSelected = true; circleSelected = false; } else if (arg0.getActionCommand().equals("RED")) { redSele...
3ac98076-5969-4953-8b9d-2cf50ae719ee
4
public static int[] generate_order(String key) { String low_key=key.toLowerCase(); int[] num=new int[key.length()]; int[] ori_num=new int[key.length()]; for(int i=0;i<key.length();i++) { num[i]=low_key.charAt(i)-'a'; ori_num[i]=num[i]; } Arrays.sort(num); int[] result=new in...
2a7f858b-b3cc-4db2-9f4d-38b1150418a5
9
void updateMouse(MouseEvent e,boolean pressed, boolean released, boolean inside) { mousepos = e.getPoint(); mousepos.x = (int)(mousepos.x/el.x_scale_fac); mousepos.y = (int)(mousepos.y/el.y_scale_fac); mouseinside=inside; int button=0; if ((e.getModifiers()&InputEvent.BUTTON1_MASK)!=0) button=1; if ((e.g...
40127978-7c43-44db-92d5-47baa23f9fdf
9
private static String canonicalize(String code, boolean caseSensitive) { if (code == null || code.length() == 0) { return null; } if (caseSensitive) { return code; } // A new instance is assigned to this variable // if modific...
038c74cb-d7cf-4d66-ae47-02d398af4bb1
7
public void add(double value) { totalCount++; if (value < start || value > end) { others++; return; } recentlyAdded = value; // binary search int low = 0; int high = rangeCount - 1; while (low <= high) { int mid = (high + low) >>> 1; if (value <= ranges[mid]) { if (m...
bc7cd3c8-5a7d-449c-b453-0c98b72690c9
5
static Object[][] negate(Object[][] z) { Object[][] ret = new Object[z.length][]; for (int i = 0; i < z.length; i++) { ret[i] = new Object[z[i].length]; for (int j = 0; j < z[i].length; j++) { Object a = z[i][j]; if (a == nu...
67935a80-c5c4-48dc-9e3d-3f96f2650ad0
2
public static ElementField findElement(Sprite sprite) { for (ElementField key : _elements_sprite.keySet()) { if (_elements_sprite.get(key).equals(sprite)) { return key; } } return null; }
78f7a9e7-d2d2-40ad-8e3a-3ba1250feeef
7
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args){ if(label.equalsIgnoreCase("mclans") || label.equalsIgnoreCase("c")){ if(args.length == 0){ displayHelp(sender); }else if(args.length == 2){ if(args[0].equalsIgnoreCase("create")){ if(sender inst...
7be942c2-acab-432d-94b5-774038564269
4
@Override public void excute() throws RserveException, REXPMismatchException, ParseException, Exception { try{ REXP x; c.eval("maTest <- maTesting(TestData, Bests, Bestl, plotUrl)"); boolean checkBuysell = "NA".equals(c.eval("maTest$buysell[1,3]").asString()); ...
a207eaa6-c9bb-48be-8764-161359ff3cdb
5
@EventHandler(priority = EventPriority.NORMAL) public void signChange(SignChangeEvent event) { Player eventPlayer = event.getPlayer(); List<String> classNames = plugin.getConfig().getStringList("classes"); String className = event.getLine(1).trim(); String eventPlayerName = eventPlayer.getName(); boole...
20ab7e85-ea39-47ac-b0de-7359889b6e03
7
public static boolean satisfiesIntervalBoundsP(Stella_Object renamed_Object, Stella_Object value) { { Stella_Object lb = null; boolean strictlowerP = false; Stella_Object ub = null; boolean strictupperP = false; boolean answer = true; { Object [] caller_MV_returnarray = new Object[1];...
76907492-918f-4504-9370-acdfac14832d
4
public void setAssemblyPan(float clipPan) { boolean panAvailable = false; if (clipAssembly[0].isControlSupported(FloatControl.Type.PAN)) { panAvailable = true; } else if (clipAssembly[0].isControlSupported( FloatControl.Type.BALANCE) == false) { throw new ...
81bffcdd-b6ae-4585-9b8b-6f6e927f1c26
9
public final GalaxyXSemanticParser.assignment_operator_return assignment_operator() throws RecognitionException { GalaxyXSemanticParser.assignment_operator_return retval = new GalaxyXSemanticParser.assignment_operator_return(); retval.start = input.LT(1); int assignment_operator_StartIndex = inp...
806d289f-90df-4e45-a982-a170b8da3ea2
1
public void delete(Record persistentInstance) { log.debug("deleting Record instance"); try { Session session = getSession(); Transaction tr = session.beginTransaction(); session.delete(persistentInstance); tr.commit(); session.flush(); session.close(); log.debug("delete successful"); } catch...
29410ba8-1be9-4e79-b31d-7a122e6c8c3a
3
public void testgetShipDetails() { UserIdentifier uid=new UserIdentifier(); // Test with // <name val='THORNBURY-C6RS7'/> // <mmsi val='311168000'/> // <flag val='Bahamas'/> Ship ship=uid.getShipDetails("311168000"); // Check the returns if (ship==null) fail("No ship found !"); else if (ship.getName()...
3fc3051e-eac1-497a-b97e-6490febe2648
2
public String execute(String[] arg) throws InstantiationException, IllegalAccessException, IOException{ File file = new File(ROOT, arg[0]+".bat"); trace = new PrintWriter(file.getCanonicalFile()); String str = ""; while(!runList.isEmpty()){ str += runList.deQueue().run(trace); } trace.flush(); trace.c...
5db7eed0-1569-40aa-9c1a-97904df65f65
1
private static String getFileContents(String filename) throws IOException, FileNotFoundException { File file = new File(filename); StringBuilder contents = new StringBuilder(); BufferedReader input = new BufferedReader(new FileReader(file)); try { String line = ...
badd6d94-11c9-44de-abec-15fbb0c7cced
9
public boolean inSphere(int px, int py, int pz) { px = px - x; py = py - y; pz = pz - z; boolean res = false; if (filled) { if (px * px + py * py + pz * pz < r * r) res = true; } else { int tmp = px * px + py * py + pz * pz; if (tmp < r * r && tmp >= (r - 1) * (r - 1)) res = true; }...
d7fd5c51-f640-474c-ae42-2faf73a95fce
0
public void setjButtonValider(JButton jButtonValider) { this.jButtonValider = jButtonValider; }
4916cab3-2b6c-42e3-99d7-f798edf36571
9
public int compareTo( Object obj ) { if( obj == null ) { return( 1 ); } else if( obj instanceof GenKbContactURLByUNameIdxKey ) { GenKbContactURLByUNameIdxKey rhs = (GenKbContactURLByUNameIdxKey)obj; if( getRequiredContactId() < rhs.getRequiredContactId() ) { return( -1 ); } else if( getRequired...
1fd5c981-1ac8-4ada-80be-674298130133
2
public boolean hasOperandDef(final LocalExpr def) { for (int i = 0; i < operands.size(); i++) { final LocalExpr expr = (LocalExpr) operands.get(i); if (expr.def() == def) { return true; } } return false; }