method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3719fbad-6765-403c-971f-07741215da4b
8
protected int partition(double[] array, int[] index, int l, int r, final int indexStart) { double pivot = array[(l + r) / 2]; int help; while (l < r) { while ((array[l] < pivot) && (l < r)) { l++; } while ((array[r] > pivot) && (l < r)) { r--;...
51f28b0b-bf32-4032-a622-2f09d53c39e4
3
public String getGeraGMP() throws SQLException, ClassNotFoundException { String sts = new String(); Connection conPol = conMgr.getConnection("PD"); if (conPol == null) { throw new SQLException("Numero Maximo de Conexoes Atingida!"); } try { Statement stmt ...
accfc6f3-dba0-4aba-9f49-6efd2b20cd8c
0
public ArrayList<String> getRoomId() { return this.roomId; }
051ad11e-0c0c-4dcd-92a9-503cdd459d9a
5
public synchronized static void newBorn(List<Ant> ants, Ant father, Ant mather) { int randomNumX = rand.nextInt(terrainWidth); int randomNumY = rand.nextInt(terrainHeight); if (father.getInteligence() && mather.getInteligence()) { Inteligence ant = new Inteligence(getMaxId(ants) + 1, father.getId(), ma...
be658ef5-2244-4354-a640-9e4a7373c90a
8
public void gen_opt_sim_negate(SemanticRec opSign, SemanticRec term) { if (opSign != null && term != null) { Type termType = getTypeFromSR(term); String op = opSign.getDatum(0); switch (termType) { case INTEGER: switch (op)...
f68fedea-41fc-44e1-b90a-71d17294357e
2
private void addLinks(ObjectStack oStack, Node rep, Node linker) { if(!rep.equals(linker)) { addLinkStatement(rep.getRepresentation(), linker.getRepresentation()); } List<Node> supers = oStack.getSupers(rep); for (Node sup : supers) { // recurse addLinks(oStack, sup,linker); } }
04047bc2-63d8-4268-8127-37ce256df650
3
@EventHandler public void onPlayerQuit(PlayerQuitEvent event) { KaramPlayer player = m_plugin.playerManager.addOrGetPlayer(event.getPlayer()); if (player != null) { if (!player.isAllowedToLeave()) { m_plugin.log(Level.INFO, "All hope is lost for %...
3a62feab-557e-4169-9dce-4b4443d63f25
3
@Override public void deserialize(Buffer buf) { barType = buf.readByte(); if (barType < 0) throw new RuntimeException("Forbidden value on barType = " + barType + ", it doesn't respect the following condition : barType < 0"); slot = buf.readInt(); if (slot < 0 || slot > 99...
3ac83873-eb76-493a-bf1e-06004a001f5f
6
public void render(Graphics2D g) { g.translate(c.getXOffset(), c.getYOffset()); w.render(g); for (int i = 0; i < particles.size(); i++) { if (new Rectangle(particles.get(i).x, particles.get(i).y, 5, 5).intersects(new Rectangle((int) (-c.getXOffset() - 64), (int) (-c.getYOffset() - 64), 448 * 2 + 128, 360 * 2 +...
4132b683-0ffb-496d-8245-b8055116f1d6
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...
79907b80-b9e4-4d8b-aeb9-2a0815768330
9
static boolean esPosible(int inicio[],int cantInicio,long jugado,int cantJug) { boolean[][] tab=new boolean[100][100]; int x=50,y=50; tab[x][y]=true; for(int i=0;i<cantInicio;i++) { int p=inicio[i]; x+=jug[p][0]; y+=jug[p][1]; tab[x][y]=true; } for(int i=0;i<cantJug;i++) { int p=abs((int)(jug...
f1d812fc-09d9-4113-8fc4-7736925f0bcc
4
@Override public void prepareInternal(int skips, boolean assumeOnSkip) { if(moves.length == 0) return; if(!assumeOnSkip) { for(int i=0;i<moves.length-1;i++) if(!moves[i].execute()) throw new RuntimeException("execution of move "+i+" failed"); } moves[moves.length-1].prepareInternal(skips, assume...
dd1f194c-b654-4bcb-a4bb-6daec29c203a
7
public String reverse(String s) { String reversed = ""; String[] parsed = s.split(" "); if(parsed.length == 0) { return ""; } for(int i = parsed.length-1 ; i> -1; i--) { if(parsed[i].compareTo("") != 0) //if not null { reversed = reversed.concat(parsed[i]); if(i!= 0) ...
ccb98b56-22be-4f94-9fd6-801a38e7248b
3
private void openMenuItem_actionPerformed(ActionEvent event) { JFileChooser fileChooser = createFileChooser(); fileChooser.showOpenDialog(this); File file = fileChooser.getSelectedFile(); if (file.exists()) { defaultDirectory = fileChooser.getCurrentDirectory(); t...
078dd61b-4a17-4fea-88b5-9beca3cd4518
1
public String qualifier() { Assert.isTrue(desc.charAt(0) == Type.CLASS_CHAR, "No qualifier for " + desc); final int index = desc.lastIndexOf('/'); if (index >= 0) { return desc.substring(1, index); } return desc.substring(1, desc.lastIndexOf(';')); }
d745dfbe-ec9a-447c-9c7b-e685b95dac1f
0
@Override public String getDesc() { return "ThrowVenomKnife"; }
c72bbcf8-40ed-4883-a09c-20ead2e7bd8b
6
void addPage(int pageIndex) { int size = pages.size(); if(size == 0) { pages.add(new Integer(pageIndex)); } // Even, so last entry is end of range else if((size % 2) == 0) { Integer end = (Integer) pages.get(size-1); // Continuing the existing ...
74327572-33c4-4ced-8f30-5440092a4658
3
public static void main(String[] args) { final Cv cvUtilisateur = objectFactory.createCv(); final IdentiteType identiteTypeUtilisateur = objectFactory.createIdentiteType(); final AdresseType adresseTypeUtilisateur = objectFactory.createAdresseType(); final FonctionType fonctionTypeUtilis...
2103156c-b9e1-450f-8dbf-adc0b1aa7141
9
private void parseTimeControls(String key, int value) { // Java seriously needs to support Strings in switch statements (Java 1.7!) if (key.equals("movetime")) { timeControls |= TC_MOVETIME; moveTime = value; } else if (key.equals("depth")) { timeControls...
10c8e364-fa40-4e5b-8e11-84f71f67c0f8
5
@Override public void handle(HttpExchange exchange) throws IOException { System.out.println("In Save Game handler."); String responseMessage = ""; if(exchange.getRequestMethod().toLowerCase().equals("post")) { exchange.getResponseHeaders().set("Content-Type", "appliction/json"); BufferedReader in...
dac1d315-6531-4346-b416-d2ac61c8a612
9
public float[] computeOutput(float[] input) { // проверки if (input == null || input.length != size) throw new IllegalArgumentException(); // найдем победителя int winner = 0; for (int i = 1; i < size; i++) if (input[i] > input[winner]) winner = i; // готови...
1bc1e36c-72af-4e3f-b5db-3693b3b08463
6
void addGuiComponent(String fieldname) { String fieldguiname = (String)fieldguinames.get(fieldname)+" "; String fieldtype = (String)fieldtypes.get(fieldname); Object fieldval = fieldvalues.get(fieldname); JPanel subpanel = new JPanel(new GridLayout(1,2)); subpanel.setBackground(bgcolor); mainpanel.add(subp...
deb048c6-1b38-4e1a-82c8-a260f8a7011e
4
public static List<ShoppingCartInfo> getEventOrders(int eventId) throws HibernateException { List<ShoppingCartInfo> shoppingCartInfoList = null; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try { // Begin unit of work session.beginTransaction(); Calendar calendar = new Gre...
7b9f8e21-8de8-4822-8348-bc0bc9ea626e
2
public void increment(int by) { // if given value is negative, we have to decrement if (by < 0) { decrement(Math.abs(by)); return; } // cut off full overflows by %= (range + 1); // check if we would still overflow int space_up = max - value; if (by > space_up) { // we check how big overflow i...
ffab453d-0c7f-4327-8be6-694681c06de5
9
public String matt2browser(){ /*[["Vasya"],["Mon","Tue","Wen","Thu"],["20.09","21.09","22.09","23.09"] ,["10:00","10:30","11:00","11:30","12:00"] ,[[0,1,0,0],[1,0,0,1],[0,0,1,1],[0,0,0,1] ,[1,1,0,1]]]*/ //getting this view for browser. StringBuffer daysStr=null; String name=data.getName(); Date startDate=data...
46b39be2-7171-4800-b67d-eab695734120
7
public int solution(int X, int Y, int K, int A[], int B[]) { n = A.length+1; a = new Integer[n]; b = new Integer[n]; for(int i=0; i<n; i++){ a[i] = i<n-1 ? A[i] : X; a[i] -= i>0 ? A[i-1] : 0; b[i] = i<n-1 ? B[i] : Y; b[i] -= i>0 ? B[i-1] : ...
1b83fdb9-37ba-49ab-aa26-e28b1c40caf3
6
@Override public boolean deleteChild(Expression<?> n) { if (!(n instanceof BinaryArithmeticOperator)) { return false; } if (children.get(0).equals(n))//left { children.set(0, ((Expression<?>) (n.randomChild()))); } else if (children.get(1).equals(n))//...
2e9e4b71-2190-4518-93c9-ec62469d2216
1
private static boolean getMouseUp(int mouseButton) { return !getMouse(mouseButton) && lastMouse[mouseButton]; }
aaec81ea-9781-4de4-9b85-33e73e38e44e
8
private void initPanelGameLayout() { GroupLayout PGL = new GroupLayout(zPanelGame); zPanelGame.setLayout(PGL); int PrefSize = GroupLayout.PREFERRED_SIZE, DefaSize = -1; ComponentPlacement RelaComp = LayoutStyle.ComponentPlacement.RELATED; SequentialGroup [] PGLHQ = new Sequential...
9ac03486-21c0-4317-8f4e-8dae777a1deb
7
public void statusUpdate(int updateMessageType, String extraInfo) { String message = "Parsing status update: "; switch (updateMessageType) { case ParserStatusMessage.PARSING_STARTED: message += "Parsing has started. Parsing library file \"" + extraInfo + "\"."; break; case ParserStatusMessage.PARSI...
e8361f64-5a4f-4f49-aa51-9b1cd5217918
1
@Test public void branchInstrInvalidOpcodeTest() { //To test instruction is not created with illegal opcode for format try { instr = new BranchInstr(Opcode.ADD, 0); } catch (IllegalStateException e) { System.out.println(e.getMessage()); } assertNull(instr); //instr should still be null if creation has...
260c2274-806c-4dfb-85cd-106a34632794
5
private static void newTopscore() throws FileNotFoundException { String initials = ""; while(initials.equals("")) // Re-show the window until the user types something initials = dialogInput(); int rank = 0; for (int i=0; i<topscore_length;i++) { if (topScores[i] > moves) { rank = i; break; } ...
ebe44b93-ccd8-425b-b23c-554bcf691c41
7
@Override public void mouseDragged(MouseEvent me) { this.drag = true; hp.mx = me.getX(); hp.my = me.getY(); int x = me.getX() / scale; int y = me.getY() / scale; hp.setDrag(new Vector3f(x, y, 0)); Color c = null; if(SwingUtilities.isRightMouseButton(me)) { c = bg; } else if(SwingUtilit...
d9ad238f-2fb9-4126-a0bf-6ba311ee824d
4
public static void UpperType(){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedStatement stmnt ...
7fd98fd0-0a1d-468e-88e1-d72f6a56dd62
7
public int findNearestABondIndex(int x, int y) { ABonds abonds = ((ExtendedFrameRenderer) repaintManager.frameRenderer).abonds; if (abonds == null) return -1; int n = 0; synchronized (abonds.getLock()) { n = abonds.count(); } if (n <= 0) return -1; initHighlightTriangle(); Triangles triangles =...
e6e72a23-9a41-4f45-a83c-01273512e7ca
7
public void calcSequences(BigLong2ShortHashMap hm, String fastaFP) throws FileNotFoundException { int freqThreshold = supergraphFreq.get(); int lenThreshold = sequenceLen.get(); int kValue = k.get(); banKmers(hm, freqThreshold, kValue); int sequenceId = 0; ArrayList<In...
283f8ae6-9aac-435c-9620-b87c6a4ae7eb
4
public void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chancesToSpawn, int minY, int maxY) { // int maxPossY = minY + (maxY - 1); assert maxY > minY : "The maximum Y must be greater than the Minimum Y"; assert maxX > 0 ...
3f3daafd-1353-4151-9919-7f97f210007a
3
public static void main(String[] args) throws IOException { int portNo = 9090; try { if (args.length == 1) { portNo = Integer.parseInt(args[0]); } } catch (Exception e) { System.err.println("Invalid port number!"); System.exit(1); ...
13d7213b-9cc0-4a09-b514-feb39664993e
6
public UserVO getStudent(UserVO userVO) throws LibraryManagementException { ConnectionFactory connectionFactory = new ConnectionFactory(); Connection connection; try { connection = connectionFactory.getConnection(); } catch (LibraryManagementException e) { throw e; } ResultSet resultSet = null; P...
8461e76b-baf0-46df-9609-6ef2529739cd
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); if (string...
37e6807e-683c-4527-8486-526908b58d7c
3
public static synchronized ValidatedHandshakeResponse validate(HandshakeRequestEvent handshakeRequestEvent, Channel c) { ValidatedHandshakeResponse vhr = null; short errCode = matchVersionAndKey(handshakeRequestEvent.getVersion(), handshakeRequestEvent.getAccessKey()); if(errCode != ValidatedHa...
8b86c989-d4a8-485a-bd7f-ee85a417234d
7
public void actionPerformed(ActionEvent ae) { if(ae.getSource() == loginPanel.getLoginButton()) { String szUsername = loginPanel.getUsernameField(); String szPasscode = loginPanel.getPasscodeField(); if(!(szUsername.isEmpty() || szPasscode.isEmpty())) { try ...
d76123c4-7e13-44ff-befe-e4bd1cf799d4
9
private static List<Exprent> extractParameters(List<PooledConstant> bootstrapArguments, InvocationExprent expr) { List<Exprent> parameters = expr.getLstParameters(); if (bootstrapArguments != null) { PooledConstant constant = bootstrapArguments.get(0); if (constant.type == CodeConstants.CONSTANT_Str...
a74859e3-a6cc-47fa-a5da-d348b9507d34
8
private void reactOnNextButton() { _nextButtonWasClicked++; // nextButton will be enabled after something was dropped, so this will // be called after something was dropped if (_nextButtonWasClicked == 1) { setCoverArtDropMode(); } else if (_nextButtonWasClicked >= 2) { // now finally we have gotten the...
6b109793-6c44-4a27-ac40-51fd33d6ea86
9
@Override public ArrayList<Position> getPossibleMoves() { possibleMoves = new ArrayList<Position>(); for (Move move : moves) { int newX = getPosition().getX() + move.getX(); int newY = getPosition().getY() + move.getY(); newX = newX + move.getX(); if (newX < 0 || 7 < newX) continue; i...
be9cd5b7-8356-40ad-a6e3-1519d2d602f4
6
static protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = ...
4357222e-a643-4f1c-92aa-b565bed4df77
4
@Override public void saveTrace(String filename) { try { BufferedWriter writer = new BufferedWriter(new FileWriter(filename)); for (AgentState s : state){ if (s instanceof DirtBasedAgentState){ DirtBasedAgentState b = (DirtBasedAgentState)s; int dist [] = b.getDistances(); int type[] = b.ge...
b52b9900-960a-41e7-8107-49db06a300f6
0
@XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "EncryptionProperty") public JAXBElement<EncryptionPropertyType> createEncryptionProperty(EncryptionPropertyType value) { return new JAXBElement<EncryptionPropertyType>(_EncryptionProperty_QNAME, EncryptionPropertyType.class, null, valu...
9fb8c30f-c819-49e4-88d5-9af2d59dd9a4
7
final void delete(int index) { if (!isNominal() && !isString() && !isRelationValued()) throw new IllegalArgumentException("Can only remove value of " + "nominal, string or relation-" + " valued attribute!"); else { ...
a7b0cf6f-ad3c-4161-afe3-3b118541247b
4
public boolean delete(Word t){ Node temp; Node ptr = findNode(t); if(ptr == null) return false; if(ptr.left() == null){ ptr.setData(ptr.right().data()); ptr.setRight(ptr.right().right()); ptr.setLeft(ptr.right().left()); return true; } else if(ptr.right() == null){ ptr.setData(ptr.left().d...
c93b8947-dabe-456f-9bcf-8dc82d7e0585
8
protected void processPath() { while (activeNode.getxCoord() != endX || activeNode.getyCoord() != endY && !openNodes.isEmpty()) { checkOpenNodes(); activeNode.mapPiece.togglePath(); pathNodes.add(activeNode); if (activeNode.getxCoord() == endX && activeNode.getyCoord() == endY) { } else { ...
d840fb49-253c-4646-874a-05c493eda465
7
public static void createDelFile(String genomeName, String outFile, double prob) throws IOException { Config config = new Config(genomeName, Gpr.HOME + "/snpEff/" + Config.DEFAULT_CONFIG_FILE); config.loadSnpEffectPredictor(); Random rand = new Random(20140129); StringBuilder out = new StringBuilder(); int ...
205bdeb6-40eb-42c8-9a21-aff8bd6e7f33
7
public static void modify(ConcordiaMembers concordiaMember){ boolean correctInput = false; Scanner myKey = new Scanner(System.in); do{ System.out.println("Press 1 to modify Name\nPress 2 to modify Concordia ID\nPress 3 to modify Status and other Attributes"); int option = myKey.nextInt(); switch(option){ c...
9f32ebe3-44d7-45bf-8131-c8c273f7da98
3
private int[] getColumnStartingPositions(String line) { int[] columns = new int[34]; boolean skipBlanks = true; int j = 0; for (int i = 0; i < line.length(); i++) { char ch = line.charAt(i); if (ch == ' ') { if (!skipBlanks) { ...
462efbfa-2294-4ee7-8b15-0aaf4471daf4
4
public void init(int mode, byte[] key, byte[] iv) throws Exception{ byte[] tmp; if(key.length>bsize){ tmp=new byte[bsize]; System.arraycopy(key, 0, tmp, 0, tmp.length); key=tmp; } try{ cipher=javax.crypto.Cipher.getInstance("RC4"); SecretKeySpec _key = new SecretKeySpec(key...
4b1af8dc-6db4-4367-8c17-b87c12fce35b
0
@Override public void paint(Graphics g) { String romText = "Rom: Punkte: "; String karText = "Karthago: Punkte: "; lblNewLabel.setText("Aktueller Spieler: " + spiel.getAktuellerSpieler().toString()); brett.repaint(); super.paint(g); /*rom.setText(romText + brett.getGraph().getScore(Owne...
12c33710-705a-4969-a90e-123565dbdb42
1
@SuppressWarnings("static-access") @Override public String execute(String[] arg)throws ClassNotFoundException, IOException{ long pid = System.currentTimeMillis() % 100000; if(runList != null){ process = new Process(arg, process.IDLE, pid); runList.enQueue(process); }else return "ERROR: Batch not create...
fa0f8307-227b-43ee-b6e9-62fd05b9c0fb
4
private void handleGetConstants(TACMessage msg) { // The status code will be NOT_SUPPORTED and the message will contain // no other fields if the server did not support this command // => does not need to check it while (msg.nextTag()) { if (msg.isTag("gameLength")) { int len = msg.getValueAsInt(...
b66d2b75-fbee-4932-9514-af7174784104
0
public String getWorkPosition() { return WorkPosition; }
169b4391-08a8-4cf8-a78d-50d9fb421345
1
public static final FileWatcherService getInstance(List<String> watchedFiles, EventBus eventBus) { if(INSTANCE==null) { INSTANCE = new FileWatcherService(watchedFiles,eventBus); } return INSTANCE; }
37e50d6a-2e2b-4c45-9d07-49b973966af7
9
public void generateGameGraph(Game g){ if (isGameOver(g)){ return; } for (Node n : g.getNodes()){ for (Node m : g.getNodes()){ List<Face> common = getCommonFaces(n, m, g); if (!(common.isEmpty())){ for (Face f : common){ for (List<Boundary> b : getBoundaryPowerSet(f.getBoundaries())){ ...
9455b600-4e3c-4198-999d-603abe69c839
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...
26189776-bb94-4fe9-9a8d-512d302e72a1
7
@Override protected void controlUpdate(float tpf) { if(((Node)spatial).getChild("Ninja") != null){ CharAnimationControl cac = ((Node)spatial).getChild("Ninja").getControl(CharAnimationControl.class); MeleeControl mc = spatial.getControl(MeleeControl.class); i...
109fc381-355a-46ae-9577-a99820e64243
9
public Member(String display, boolean isMethod, boolean manageModifier) { this.hasUrl = new UrlBuilder(null, ModeUrl.ANYWHERE).getUrl(display) != null; final Pattern pstart = MyPattern.cmpile("^(" + UrlBuilder.getRegexp() + ")([^\\[\\]]+)$"); final Matcher mstart = pstart.matcher(display); if (mstart.matches()...
dbcbe2c4-28c1-4b99-b230-72256742d964
9
public static BaseImage biCubicSmooth(BaseImage img, int width, int height) { if(width > img.getWidth() || height > img.getHeight()) { throw new IllegalStateException("Both width and height must be less then the current image!!"); } int scaleFactor = 7; BaseImage nimg = img; BaseImage resized...
96c1b02c-e28e-4836-9821-1ffc220fa3ad
3
public void cambiarPosicionJugado2(){ for(int x=0;x<8;x++){ for(int y=0;y<8;y++){ if(pd.mapa_jugador2[x][y].equals(codigo)) pd.mapa_jugador2[x][y]=""; } } int x=rd.nextInt(0)+7; int y=rd.nextInt(0)+7; cam...
685e0a68-11b4-477e-ab51-0a5f1250e349
8
private static void logHierarchy(String prefix, ClassLoader classLoader) { if (!isDiagnosticsEnabled()) { return; } ClassLoader systemClassLoader; if (classLoader != null) { final String classLoaderString = classLoader.toString(); logDiagnostic(prefix ...
40eefb42-cb69-42bb-a708-3a2d2de2609d
0
@Override public boolean isWebDriverType(String type) { return StringUtils.equalsIgnoreCase("firefox", type); }
5ee3ac71-8431-45a4-b55f-397651fffd63
9
public int handvalue(int hou, int han) { if (han == -2) { return 16000; } else if (han >= 15 || han == -1) { return 8000; } else if (han >= 13) { return 6000; } else if (han >= 10) { return 4000; } else if (han >= 8) { return 3000; } else if (han >= 7) return 2000; e...
5ffd963e-e3d5-4320-b7c6-ac988fd61fda
6
@Override public Node streetQuery(String streetNameA, String streetNameB) throws IOException { // System.out.println("Calling streetQuery."); Node node = null; String input = null; try { StringBuilder sb = new StringBuilder("streetQuery\n"); sb.append(ProtocolParser.encodeString(streetNameA)); sb.a...
fadde3b9-7891-46db-aa0d-33f8a3a20393
4
final int addVertex(int x, int y, int z) { for (int i1 = 0; i1 < vertexCount; i1++) { if (verticesX[i1] == x && y == verticesY[i1] && verticesZ[i1] == z) { return i1; } } verticesX[vertexCount] = x; verticesY[vertexCount] = y; verticesZ[vertexCount] = z; maxVertex = 1 + vertexCount; return vert...
5e4153ae-a1fa-4b52-8147-c16d84ec346c
3
private void processAddMasterFile(Sim_event ev) { if (ev == null) { return; } Object[] pack = (Object[]) ev.get_data(); if (pack == null) { return; } File file = (File) pack[0]; // get the file file.setMasterCopy(true); // set the file in...
12a835c9-2b0c-4c2a-9974-e6be59d9d1e3
4
@Override public void processChangeRoom() { System.out.println("Current Room:" + getCurrentRoom().getName()); int iNumMonsters = getCurrentRoom().getNumLivingBeings()-1; System.out.println("Number of monsters in current website: "+iNumMonsters+"."); if (iNumMonsters > 0) System.out.println("Monsters:"); ...
8559e8db-531d-4b5d-8367-1121c84fdf3d
7
public static <T1, T2> List<TestCase<?, ?>> createByParams(String format, T1 expected, T2[] params) { List<TestCase<?, ?>> cases = new ArrayList<TestCase<?, ?>>(); for(T2 param : params) cases.add(new TestCase<T1, T2>(format, expected, param)); return cases; }
e09e9d84-9233-4df5-8543-b017eff13b7d
7
@EventHandler public void WitherWither(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.getZombieConfig().getDouble("Wither.Wither.D...
b2ae6b95-5094-4339-81a5-ac982c7e1c98
9
@Override public void set(Object target, Object value) { if (staticBase != null) target = staticBase; if (type == int.class) unsafe.putInt(target, offset, (Integer) value); else if (type == short.class) unsafe.putShort(target, offset, (Short) value); else if (type == long.class) unsafe.putLong(tar...
0ee323ef-a2ed-4ccb-90c6-8ecab8cf9db3
6
@EventHandler public void EnderDragonFireResistance(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.getEnderDragonConfig().getDoubl...
a52bd5a6-4c27-43ad-9e8f-a4eca4956977
7
public static boolean deletePerson(String userid) { ResultSet rs = null; Connection con = null; PreparedStatement ps = null; boolean result = true; try { String sql = "DELETE FROM PERSON WHERE userid=(?)"; con = ConnectionPool.getConnectionFromPool(); ps = con.prepareStatement(sql); ps.setString...
cd0a31da-df11-421c-ace3-793f9d361230
0
@Override public boolean isSearched(String url) { return false; }
691f9f99-2339-46a9-802c-99e24dec8ee8
2
public String version() throws BITalinoException { try { socket.write(7); ByteBuffer buffer = ByteBuffer.allocate(30); // read until '\n' arrives byte b = 0; while ((char) (b = (byte) socket.getInputStream().read()) != '\n') buffer.put(...
aad3e9b8-8068-4794-ae50-0881ddcf2a06
7
public void sincronizaArticulos(){ // TRAIGO EL ID POS PhpposAppConfigEntity appConfig = getAppConfig("id_pos"); // PREGUNTAR SI EL ID POS ESTA CONFIGURADO if (appConfig != null){ int idPos = Integer.parseInt(appConfig.getValue()); logger.info("****>>> idPos = " + idPos); // TRAIGO...
7fea743e-4e86-472d-b0bf-a4adf00fa87e
8
public static void visitFilesRecursively(FileVisitor visitor, File directory, String filePattern, String directoryPattern, boolean recursively) { if (!directory.isDirectory()) directory = directory.getParentFile(); if (!directory.getName().matches(directoryPattern)) return; visitor.visitDirectory(directory); fi...
b331fb67-7c58-4133-9e3f-46751e94ed6b
5
private void saveBookingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBookingButtonActionPerformed boolean commitSuccess; if (!newBookingModel.isEmpty()) { int reply = jOptionPane.showConfirmDialog(this, "Are you sure you want to save?", "Save?", jOptionPane.YE...
fa8b6864-e2f0-41d4-9613-e212b0d2ca0e
7
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (active(request)) //if there is an active user { if (request.getRequestURI().equals(request.getContextPath() + "/blabs")) //if there is no string after blabs/ { //current user b...
d58128ae-47d0-4fe6-b272-1ec850299349
8
boolean putPiece(int p, int row, int col) { // пробуем вставить паззл на доску, возвращает True если подходит if (board.getColor(row,col) != null) return false; for (int i = 1; i < 8; i += 2) { if (row+pieces[p][i] < 0 || row+pieces[p][i] >= rows || col+pieces[p][i+1] < 0 || c...
3a95b246-1d4a-476d-b25d-47ca01c64775
0
public void setPrice(String price) { this.price = price; }
42716d37-e6bd-4245-af55-edb4953cd31c
9
private TypeHolder _eraseTypeVariables(Map<String, TypeHolder> variable2Holder, Set<String> visitedVariables, TypeHolder typeHolder) { if (typeHolder.getRawClass() == null) { if (variable2Holder.containsKey(typeHolder.getName())) { TypeHolder th = variable2Holder.get(typeHolder.getName()); WildcardBound...
ade9f963-0b8c-471b-be10-ebd96a5ca25f
3
public void run() { rsSet=getResultSet(cur, limit); String insert="insert into idf(term,docnum,idf)values(?,?,?)"; int no=0; try { PreparedStatement statement=sqLconnection.conn.prepareStatement(insert); while(rsSet.next()) { String term=rsSet.getString("term"); int count=gettermCount(term); ...
0d5da8e9-c085-40a4-a3db-86610c5523bb
8
private void finaliseRelations() { if (tempRelations == null) return; PageLayout layout = page.getLayout(); Relations relations = layout.getRelations(); if (relations == null) return; for (int i=0; i<tempRelations.size(); i++) { List<String> rel = tempRelations.get(i); if (rel != null && rel...
f9617a18-168a-48f6-b53a-f71a711e96d6
8
public String convert(String s, int nRows) { if (s == null || "".equals(s) || nRows == 1) return s; StringBuffer sb = new StringBuffer(); for (int i = 0; i < nRows; i++) { int j = i; boolean odd = false; while (j < s.length()) { sb.append(s.charAt(j)); if (i == 0 || i == nRows - 1) { j +...
73aa4bea-be18-4dbf-9c40-b93248fc1b8b
2
public final void modifyHealth(int toInflict) { health= health + toInflict; if(health > 100) { health = 100; } else if(health < 0) { health = 0; //uh oh } }
5fc9ebdc-c64a-456e-b37c-243951b7a6f5
8
public static void main(String[] args) throws Exception { if (args.length < 1) { System.err.println("Usage: java " + SSLJioClient.class.getName() + " URL [n] [delay]"); System.err.println("\tURL: The url of the service to test."); System.err.println("\tn: The number of clien...
b3cfaa95-6579-41e0-8868-99be2ce10803
5
public int zmq_sendiov (SocketBase s_, byte[][] a_, int count_, int flags_) { if (s_ == null || !s_.check_tag ()) { throw new IllegalStateException(); } int rc = 0; Msg msg; for (int i = 0; i < count_; ++i) { msg = new Msg(a_[i]); i...
48d15822-e786-4cf5-a566-226b3263460d
0
public BeerResponse(BeerReadOnly delegate) { this.delegate = delegate; }
407aae0f-2e22-4ad3-8da4-b8f65b83fb59
2
@Override public ResultSet query(String query) { //Connection connection = null; Statement statement = null; ResultSet result = null/*new JdbcRowSetImpl()*/; try { //connection = open(); //if (checkConnection()) statement = this.connection.createStatement(); result = statement.executeQuery("S...
0ab7c340-8bdf-46b4-93ff-86f7f52943d0
2
public void setShortMessageFontcolor(int[] fontcolor) { if ((fontcolor == null) || (fontcolor.length != 4)) { this.shortMessageFontColor = UIFontInits.SHORTMESSAGE.getColor(); } else { this.shortMessageFontColor = fontcolor; } somethingChanged(); }
ee01b20a-4492-4701-a262-ae57e75bc399
5
private void waitForConnections() { while (true) { try { acceptConnection(); } catch (SocketTimeoutException e) { if (stopWaiting) { try { serverSocket.close(); } catch (IOException e1) { ...
472074ff-25ed-40b7-b8d8-7695778babb3
4
public static boolean updateEventStatus(int eventId, int userId, int statusCode) throws HibernateException { boolean isUpdateEventStatusSuccessful = false; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try { // Begin unit of work session.beginTransaction(); // update event ...
2dde7f11-24bb-408a-83ae-494f133d1c05
1
public void stopall() { synchronized(clients) { for(TestClient c : clients) c.stop(); } }
5027e3cd-8318-461c-9212-4cae74250b84
0
public String toString() { return description(); }