method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3eb5f200-abf9-40b1-90de-7e2753343a8d
7
private static Query setAttributesToQuery(Query query){ Node node = query.getNode(); if (node instanceof Element && node.getNodeName().equalsIgnoreCase(SQLFileDef.query)) { if (node.hasAttributes()) { // get attributes names and values NamedNodeMap nodeMap = node.getAttributes(); for (int i1 = 0; ...
12e46cd3-d070-4903-ac61-a9f890159bc0
1
private int toInteger(String address) { Matcher matcher = addressPattern.matcher(address); if (matcher.matches()) { return matchAddress(matcher); } else { throw new IllegalArgumentException("Could not parse [" + address + "]"); } }
cd3f61c2-c51e-4987-8734-dc0df9463b27
7
public static void execute(int[] pattern) { int a = 0, b=0, c=0; for (int i = 0; i < pattern.length; i++) { switch (pattern[i]) { case (1): r2 = b; break; case (2): r1 = a; //c = 1; b...
9a8900e5-7982-473a-bfbe-2795bcad5fd0
6
@Override public void ParseIn(Connection Main, Server Environment) { Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom); if (Room == null || !Room.CheckRights(Main.Data, true)) { return; } Player Client = Environment.ClientManager.Get...
7586d8e8-7c8d-4d1c-a9b5-dad9ab51d5b7
4
public static int displayMenu(){ int nOp = Integer.MAX_VALUE; while(true){ String op = guiImpl.requestData( "Menu:\n" + "-Cadastrar:\n" + "----(0) Cliente\n" + "----(1) Produto\n" ...
30a965c3-cdf5-493c-bdd4-0eb557941c4c
0
public void setCtrlPrincipal(CtrlPrincipal ctrlPrincipal) { this.ctrlPrincipal = ctrlPrincipal; }
a0ba3c31-7402-4a75-9ded-25626b3f1d45
6
@EventHandler public void PlayerWeakness(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.getPlayerConfig().getDouble("Player.Weakne...
476d5467-e6e7-48c3-af95-a142dafc3978
2
private int handleP(String value, DoubleMetaphoneResult result, int index) { if (charAt(value, index + 1) == 'H') { result.append('F'); index += 2; } else { result.append('P'); index = contains(value, index...
5d902844-aae7-4347-9414-cacd96b064bd
8
protected String listCatagories(CatalogKind whatKind) { StringBuilder list = new StringBuilder(""); List<CatalogKind> types = new ArrayList<CatalogKind>(); if((whatKind==CatalogKind.OBJECT)||(whatKind==CatalogKind.MOB)) types.add(CatalogKind.MOB); if((whatKind==CatalogKind.OBJECT)||(whatKind==CatalogKind.MO...
7b88d184-1554-4561-b03d-967af03a2a0d
9
public static void multTransA_reorder( RowD1Matrix64F A , D1Matrix64F B , D1Matrix64F C ) { if( C.numCols != 1 ) { throw new MatrixDimensionException("C is not a column vector"); } else if( C.numRows != A.numCols ) { throw new MatrixDimensionException("C is not the expected l...
b2a6c774-df76-49ca-9975-b4bec5445a28
9
public GoalSeeker(Player player) { if (player == null) { throw new NullPointerException("Player is null."); } this.player = player; if (player.isWinner()) { // Special case: we're already at a goal position. path = new Orientation[0]; return; } int w = getBoard().getWidth(); int h = getBoard...
31e8e554-d3a5-482e-a614-5a705c172490
0
public login() { this.info = "performs a login action"; this.addParamConstraint("username"); this.addParamConstraint("password", "the clear password"); this.addRtnCode(201, "user does not exist"); this.addRtnCode(202, "password incorrect"); }
668e6fe2-cd5c-48ea-83f0-e548288e67ac
8
@Override protected void _connectAction_() throws IOException { /* (start). BUGFIX: clean the option info for each connection*/ for (int ii = 0; ii < TelnetOption.MAX_OPTION_VALUE + 1; ii++) { _doResponse[ii] = 0; _willResponse[ii] = 0; _options[ii] = ...
4d2b6f1c-00a6-4754-97ca-b1cffe5b9f81
4
final public CycConstant makeConstantFromGUID(String guidStr) throws ParseException { CycConstant val = null; Guid guid = null; guid = CycObjectFactory.makeGuid(guidStr); val = CycObjectFactory.getCycConstantCacheByGuid(guid); if (val == null) { try { val = new CycConstant(null, guid); ...
eb1aba74-55b0-42cb-875b-23daa7cce808
9
private void decodeHeader(BufferedReader in, Map<String, String> pre, Map<String, String> parms, Map<String, String> headers) throws ResponseException { try { // Read the request line String inLine = in.readLine(); if (inLine == null) { ...
eb6744ee-c619-41da-b728-4bb6d16b8407
8
void checkStringArray(String msg, String[] strs, String[] check) { boolean dontMatch = false; if (strs.length != check.length) { dontMatch = true; } else { for (int i = 0; i < strs.length; i++) { if (!strs[i].equals(check[i])) { dontMatch = true; break; } ...
b28dd97b-fe10-46d0-9f0f-a869b7a13cf5
9
public void loadFromFile() { String fileName = "SavedGame.txt"; try { Scanner scan = new Scanner(new FileReader(new File(fileName))); Card card; String cardInfo; int value, suitIndex, xPos, yPos, cardStackSize; boolean hasBeenGuessed; String input; /* * Stage 11 (8 Marks) */ /* ...
39801675-ea8d-43bd-a5e3-ce6ca617a678
4
public int disconnect() { System.out.println("Disconnecting..."); // disconnect MySQL connection, statement, resultset // --- 5) clean up statement and connection int errorCode = 0; try { if(rset != null){ rset.close(); } if (stmt != null){ stmt.close(); } if(co...
4ab131b8-3d94-4575-9fe4-60f519f6ba74
0
@Override public int compareTo(Man o) { return dna.compareTo(o.dna); }
6da2e4e9-0c13-43d7-b0bd-cbd4968b8f96
3
ArrayList<String> combine2(String digits, HashMap<Integer, ArrayList<String>> map) { ArrayList<String> res = new ArrayList<String>(); if(digits.length() == 0){ res.add(""); return res; } char c = digits.charAt(0); ArrayList<String> sub = combine2(digits.substring(1), map); for (String letter : map.get...
b6eb27a3-f548-4ce3-af36-1b751bee2f91
9
public static int TestSubArray(int[] SubArray, int[] Array) { // if the length of subarray is larger than the one of array, return failure if (SubArray.length > Array.length ) { return -1; } // if either one of arrays are empty , return failure if (Su...
c09e6901-84e2-4135-9dc9-e6aa685aa065
8
public byte[] CreateAnswerPacket(byte[] Qpacket,String adrr){ System.out.println("Le packet QUERY recu"); for(int i = 0;i < Qpacket.length;i++){ if(i%16 == 0){ System.out.println("\r"); } System.out.print(Integer.toHexString(Qpacket[i] & 0xff).toString() + " "); } System.out.println("\r");...
2bbee63c-88a8-4636-b924-1000bd0cdb9f
0
public static String[] getFilesArrayString() { File dir = new File("C:\\Files"); String[] files = dir.list(); return files; }
4c1fdd97-d26c-46ad-ab49-dc73ae476e4f
6
public UserInterface_Bottom(final Game game) { setAlignmentY(Component.TOP_ALIGNMENT); setAlignmentX(Component.LEFT_ALIGNMENT); setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); setFocusable(false); setFocusTraversalKeysEnabled(false); this.game = game; this.setBackground(Color.BLAC...
57acf291-ebcf-4b63-b0db-bc7b8dd829d0
8
public void deleteCalendar(String calendar, String user) { boolean active; String activeBoolean = null; try { String table = "calendars"; String[] fields = {"active", "createdBy"}; String[] fieldsUpdate = {"active"}; crs = qb.selectFrom(fields, table).where("calendar", "=", calendar).executeQuery()...
6b553148-8968-45d8-affe-8a5ed2b54335
6
@Override public void run() { if(fEnd == null) { ArrayList<Lane> lanes = new ArrayList<Lane>(fStart.getStreet().getLanes()); ArrayList<Lane> possibleEndLanes = new ArrayList<Lane>(fStart.getGlobals().getMap().getEndLanes()); possibleEndLanes.removeAll(lanes); ...
b52566eb-db71-4690-a581-ea6c360a773c
7
public static boolean mapsAreIdentical( Map map1, Map map2 ) { if ( map1 == null && map2 == null ){ return( true ); }else if ( map1 == null || map2 == null ){ return( false ); } if ( map1.size() != map2.size()){ return( false ); } ...
a3bc2478-ac9e-494f-9be4-08a891642aea
9
public void arrayStore(Class cls) { if (cls.isPrimitive()) { if (cls == int.class) { assert debug("IASTORE"); mv.visitInsn(IASTORE); } else if (cls == char.class) { assert debug("CASTORE"); mv.visitInsn(CASTORE); } else if (cls == boolean.class) { ...
ffd2e754-6b82-49bb-b48a-5ae8650478b5
5
public void pace(){ if(follow == 0){ if(facingRight || facingLeft()){ walkSideways(); }else if(facingUp || facingDown){ walkVertical(); }//if up or down }//if follow = 0 }
d67b2bc2-5a1d-4977-b02f-a9acf5cbfd12
8
public CompoundPredicate(Element compoundP, MiningSchema miningSchema) throws Exception { // Instances totalStructure = miningSchema.getFieldsAsInstances(); String booleanOpp = compoundP.getAttribute("booleanOperator"); for (BooleanOperator b : BooleanOperator.values()) { if (b....
84535f30-0d35-445b-8e04-98ffa55f0193
8
protected Boolean convertStringToParameterValue(String aValue) { if ( aValue != null ) { String str = (String) aValue; if ( str.equalsIgnoreCase( "true" ) || str.equals( "1" ) || str.equals( BOOLEAN_TRUE ) ) { return new Boolean( true ); } else if ( str.equalsIgnoreCase( "false" ) || str.equals(...
5b172c34-832e-41ed-90dd-a3a0f3455c5d
9
protected void drawItemLabel(Graphics2D g2, XYDataset dataset, int series, int item, XYPlot plot, XYItemLabelGenerator generator, Rectangle2D bar, boolean negative) { if (generator == null) { return; // nothing to do } String label = generator.generateLabel(...
df477edb-c4b4-4a38-86cc-d9406846555f
8
public boolean equals(Object o) { if(o == this) { return true; } else if(o instanceof Map.Entry) { Map.Entry e = (Map.Entry)o; Object k1 = getKey(); Object k2 = e.getKey(); if (k1 == k2 || (k1 != null && k1.equals(k2...
5fb62e8d-8a37-4256-8828-417006cc77cf
2
public void setupPermissions() { PluginDescriptionFile pdfFile = this.getDescription(); Plugin permissions = this.getServer().getPluginManager().getPlugin("Permissions"); if(Roomy.Permissions == null) { if(permissions != null) { Permissions = ((Permissions)permissions).getHandler(); }...
2becfda2-28e0-4592-9d4a-f44b190dc5bd
3
public VariableStack mapStackToLocal(VariableStack stack) { VariableStack newStack; int params = instr.getFreeOperandCount(); if (params > 0) this.stack = stack.peek(params); if (instr.getType() != Type.tVoid) { pushedLocal = new LocalInfo(); pushedLocal.setType(instr.getType()); newStack = stack.p...
94eb0d84-509b-4693-ba0e-320b5f68016f
1
private synchronized void fireDecadeHappened(int i) { for (DecadeListener l : listeners) { l.decadeEvent(i); } }
bb875249-1261-4cb4-a717-c31f00f32f58
1
public String getParameter(String s) { if (Signlink.mainapp != null) { return Signlink.mainapp.getParameter(s); } else { return super.getParameter(s); } }
25df5c79-a69d-4e29-ba39-4f303dbf8b0d
9
public double findMaxBranching(int numberOfNodes, double[][] graph, Collection<SimpleWeightedEdge> mst, DisjointSets partition) { // Clear the list of all edges. edges.clear(); // Clear MST. mst.clear(); // Add feasible edges with their weights to the list. for (int from = 0; from < numberOfNodes; ++from...
49c3fca1-ad1a-4106-a443-c87739ae5a2b
3
String alignmentString(int alignment) { if (alignment == SWT.BEGINNING) return "SWT.BEGINNING"; if (alignment == SWT.CENTER) return "SWT.CENTER"; if (alignment == SWT.END) return "SWT.END"; return "SWT.FILL"; }
9457ee1f-3e9e-424f-be0e-3fc9b77dcbd7
0
public void setFilmId(Long filmId) { this.filmId = filmId; }
fe9431c5-c576-455f-9e6e-0766f0002b53
6
public static Enumeration listRoots() { if (listenRoots == null) initRoots(); if (listenRoots != null) { Vector v = new Vector(); for (int i = 0; i < listenRoots.length; i++) { File rootDir = new File(listenRoots[i]); if ((rootDir != null) && (rootDir.exists())) { v.addElement(listenRoots[...
76965a32-b982-4599-adc7-8af79d2b53ae
1
@Override public Object run() { try { Field field = mClass.getDeclaredField("styleFactory"); boolean accessible = field.isAccessible(); field.setAccessible(true); Object styleFactory = field.get(mLookAndFeel); field.setAccessible(accessible); Object style = getGtkStyle(styleFactory, new JPopupMenu(...
8a8f367e-031d-4ef6-95ce-9045cdd9b518
0
@Basic @Column(name = "LOG_HORA") public int getHora() { return hora; }
3da4dfcd-9d2d-46e8-9ce6-7c2f76697db1
9
public static Keyword trySubgoalStrategiesProof(ControlFrame frame) { { Description description = ControlFrame.extractSubgoalDescriptionOfFrame(frame); boolean reversepolarityP = frame.reversePolarityP; Cons strategies = Stella.NIL; { boolean chooseValue000 = false; if (reversepolarityP)...
c5c5a872-e5c3-4133-9a7b-3275446a7d6d
9
@Override /** * Quand un text field perd le focus * * @param e l'évènement */ public void focusLost(FocusEvent e) { if (e.getComponent() instanceof JTextField) { JTextField temp = (JTextField) e.getComponent(); if (temp.getParent() instanceof IconeSommet) { ...
c692ed47-a137-4d04-afdf-d974e8c8d099
2
private String read(String chunk_uuid) { // TODO Auto-generated method stub FileInputStream fis; try { fis = new FileInputStream(path+chunk_uuid); byte[] buf = new byte[fis.available()];// һոպõĻ fis.read(buf); fis.close(); return new String(buf); } catch (FileNotFoundException e) { // TODO Au...
049c2376-bfd5-4db7-97a8-aaaa44918022
2
protected char charAt(String value, int index) { if (index < 0 || index >= value.length()) { return Character.MIN_VALUE; } return value.charAt(index); }
803f68c5-6b4c-4525-86d3-8396ad03e06a
5
public String getContentOfSelectionAsImageBlock(int x, int y, int height, int width) throws DoenstFitException { //Outside of image if (x > img.getWidth() || y > img.getHeight()) return null; if (height + y > img.getHeight()) height = img.getHeight() - y; if (wi...
e4defd8c-61c0-4b4f-869c-ae97455397f6
1
private static void displayPrescriptions(ResultSet rs)throws SQLException{ StringBuilder bf = new StringBuilder(); while (rs.next()){ bf.append(rs.getInt("presc_id")).append(": "); bf.append(rs.getDate("start_date")).append(", "); bf.append(rs.getDate("this_day")).append(", "); bf.append(rs.getDate("...
b5d4948f-ad46-444d-acde-9c8c978658b2
1
protected void carregaTabelaEnderecos(List<Endereco> lista){ this.modeloTabelaEndereco = new DefaultTableModel(); this.modeloTabelaEndereco.addColumn("Rua"); this.modeloTabelaEndereco.addColumn("Bairro"); this.modeloTabelaEndereco.addColumn("Cep"); this.modeloTabelaEndereco.addCo...
adb34deb-5bfb-4120-8f3a-9b2d47cb530f
1
private ElementStAX createElement() throws ParsingException { StartElement start = lastEvent.asStartElement(); boolean hasChildren = checkForChildren(); if(hasChildren) canStepDown = true; @SuppressWarnings("unchecked") ElementStAX element = new ElementStAX(start.getName(), (Iterator<Attribute>) sta...
18c9a303-81e1-4c9c-a534-fe5c1dffbdcf
0
public boolean f(Object arg) { return kind.isInstance(arg); }
5f04dc9a-4072-4d0d-a4f2-e108ed36e19e
6
@Override public void init(GameContainer gc, final StateBasedGame arg1) throws SlickException { super.init(gc, arg1); this.showDialog("Welcome to the birdsimulator 2.0!\nAt the top you will see the available behaviors and the keys to toggle them, " + "\nplease use them wisely because we recently had some...
bb2133ec-4a26-4024-9d9a-35b990067d3e
6
public void run() { while(! done) { try { if(notifier.mode != 0) System.out.println("Get byte(s)"); /* notifier.serialPort.setDTR(true); notifier.serialPort.setRTS(true); */ byte singleData = (byte)in.read(); ...
9fdcd6c6-7d1b-4f7f-9a76-41b91ca1979f
1
public void testNormalizedStandard_weekDay2() { Period test = new Period(0, 0, Integer.MAX_VALUE, 7, 0, 0, 0, 0); try { test.normalizedStandard(); fail(); } catch (ArithmeticException ex) {} }
717e45fd-6172-4d68-a188-4a51944ba74f
3
public static String cleanCharName(String title, String charName) { for (Matcher m_italic = p_italic.matcher(charName); m_italic.find(); m_italic = p_italic .matcher(charName)) { charName = m_italic.group(1) + "<i><b>" + m_italic.group(2) + "</b></i>" + m_italic.group(3); } for (Matcher m_bold = p_bo...
e106ca9f-91db-4a25-b948-5b3c8f7c54bf
0
public void setAccountId(int accountId) { this.accountId = accountId; }
d4f5ddc6-eb7c-4636-a3a2-55430dde61b3
0
public void setAccountName(String accountName) { this.accountName = accountName; }
01340e72-fccb-4dbd-b8b6-2f4a8309b7cd
5
public void tick() { trySpawn(1); for (int i = 0; i < w * h / 50; i++) { int xt = random.nextInt(w); int yt = random.nextInt(w); getTile(xt, yt).tick(this, xt, yt); } for (int i = 0; i < entities.size(); i++) { Entity e = entities.get(i); int xto = e.x >> 4; int yto = e.y >> 4; e.tick(); ...
881c6759-74f3-49f5-bb11-ce583857be41
5
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((children == null) ? 0 : children.hashCode()); result = prime * result + ((encryptedField == null) ? 0 : encryptedField.hashCode()); result = prime * result + ((miniMe == null) ? 0 : miniMe.hashCode());...
7eefda4d-f9a9-4927-8de1-201bbaa865cd
6
private void darkenMap(int w, int h) { for (int y = 0; y < h + 1; y++) { for (int x = 0; x < w + 1; x++) { if (x <= 8 || y <= 8 || x >= w - 8 || y >= h - 8) { newLevel.getSeen()[x + y * (w + 1)] = true; } } } }
e64fee39-b246-4137-9bcb-ac155277d766
0
public Boolean getFoo() { return foo; }
19ba097f-ccb7-4d92-8844-1581c2f7535c
1
private void createGameTypePanel() { this.gameTypeBox = new JComboBox(new String[] { "Generator", "Scenario" }); this.gameTypeBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (gameTypeBox.getSelectedItem() == "Scenario") { generatorPanel.setVi...
f1e5270d-2c36-4c59-b095-e94ae7c08f6c
4
public Location[] getPieces(Square[][] board, char p) { Location[] pieces = new Location[12]; int count = 0; for (int x = 0; x < 8; x++) { for (int y = 0; y < 8; y++) { if (board[x][y].getPiece() == p) { piec...
709ff460-53aa-4ff5-888e-d7e94a13a40c
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...
29c030e7-8a70-41c3-b81f-bfa4725f507c
7
public void handleDeletedFiles() { Iterator<Path> itrd = deletedFiles.iterator(); Iterator<Path> itrc = null; Iterator<Path> itrm = null; Iterator<RenamedFile> itrr = null; RenamedFile toRename; Path pathm, pathc, pathd; logger.debug("Handle Deleted Files has started."); while(itrd.hasNext()) { p...
c361d7b6-53a8-4029-8626-96a1a417f40f
4
public boolean canBeMultipliedBy(Matrix a) { if (a == null) { return false; } if (this.isJagged || a.isJagged) { return false; } if (this.rowCount == a.columnCount) { return true; } return false; }
6d776d44-db2a-405c-97fa-6b4742f9cb72
4
public static Object getInstanceForName(String name) { Class<?> clazz = getClassForName(name); if (clazz != null) { if (clazz.isEnum()) { // For an enum, use the first constant as the default instance return clazz.getEnumConstants()[0]; } else { try { return clazz.newInstance...
1ea14da2-9f71-4596-87ae-14efae2c910f
0
public int getSourceStart() { return _sourceStart; }
2e8f13b9-6b25-4291-af64-51d87279b02d
3
public boolean onkoTiedostoOikeanmuotoinen(File tiedosto){ kasittelija.setFile(tiedosto); if (!tiedosto.getName().substring(tiedosto.getName().length()-4).equals(".txt")){ return false; //jos tiedosto ei .txt metodi palauttaa false } String luettu = kasittelija.lueTiedostoRiv...
8ab6ef8f-f57d-4795-9405-dbadf1e36a18
8
private void expand(Node node, Board board, boolean needChained) { Checker curChecker; Board pieces; //Copy the board and get the first piece. if (!needChained) { pieces = board.copy(); curChecker = pieces.pop(); //If the move requires a chain we do not copy the board and continue onward. }...
40bed262-d11a-4f4b-a76d-e8cbe1de5775
4
public void mouseClicked(MouseEvent me) { if (cardTreePanel.getCardTree().getPathForLocation(me.getX(), me.getY()) != null) { TreePath selPath = cardTreePanel.getCardTree().getPathForLocation(me.getX(), me.getY()); if (SwingUtilities.isLeftMouseButton(me) && me.getClickCount() == 2) { if (selPath.getPath()....
d9e515f7-5de5-450a-8847-b9d9d8605c72
3
@Override public String execute(SessionRequestContent request) throws ServletLogicException { String page = ConfigurationManager.getProperty("path.page.tour"); try { Criteria criteria = new Criteria(); Tour currTour = (Tour) request.getSessionAttribute(JSP_CURRENT_TOUR); ...
0b23c0c4-a537-432f-b827-352be0bae0dc
0
public int getFirstDay() { return firstDay; }
5cc42e34-0817-40cd-ba9c-3ccd1ee4c8ef
9
@SuppressWarnings("unchecked") private void writeToCell(Cell cell, Col col, Object fieldValueObj) { if (fieldValueObj == null) { cell.setCellValue((String) null); return; } if (col.getConverter() != null) { try { ColumnValueConverter<?, Object> converter = (ColumnValueConverter<?...
0f8b49dd-aec5-4a46-870d-755fabbc9ff5
5
@Test public void removeCompleteBottomRow() { testee = new Board(30, 10) { @Override public void addNewShape(Shape shape) { super.addNewShape(new LShape()); } }; testee.addNewShapeAtRandom(); moveSidewaysThenToBottom(-4); mo...
a6c9c507-8552-48de-bd5b-01dbf15ca773
5
private static AirNowDataTypes parseAirNowDataTypesFile(InputStream is){ try{ BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String curLine; AirNowDataTypes temp = new AirNowDataTypes(); while ((curLine = reader.readLine()) != null){ if (curLine.charAt(0) != '#'){ String[]...
9c2e556b-7d49-44fc-8cce-8a13a0e622b2
0
@Override public void setOp(boolean bln){ throw new UnsupportedOperationException("Not supported yet."); }
e50ecfb5-83c8-4e6d-bd7e-0dcbe695a930
8
private void handleFrame() throws IOException { if(logger.isDebugEnabled()) { logger.debug(">>> Frame read by "+id); } if(frame.getOpCode() == OpCode.CLOSE && status != Status.CLOSING) { sendCloseFrame(); return; } if(frame.getOpCode() == OpCode.PING) { logger.debug(">>> Ping"); outgoingFr...
dacd59be-5aa7-4ab4-8306-823637f81693
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof VertexListObject)) return false; VertexListObject other = (VertexListObject) obj; if (vertex == null) { if (other.vertex != null) return false; } else if (!vertex....
9c5d5d8e-5523-45b6-bce0-55513838f338
0
public void putSymbolTable(String key, Object value) { symbolTable.put(key, value); }
1daecdfb-248c-408b-9ef6-8c6ce7c00e89
8
@Override protected boolean parse(String line, String typeToRead) { String fields[] = line.split("\t"); // Ommit headers if (fields.length <= 6) return false; String type = fields[2]; // Is it the type that we want to read? if (!is(type, typeToRead)) return false; // Parse fields String chromo = fi...
58ac3ed5-6143-4429-934e-f7bfab2f726d
6
@Override @SuppressWarnings("unchecked") public List<Integer> sort(List<Integer> list) { // checking input parameter for null if (list == null) { throw new IllegalArgumentException("ArrayList not specified!"); } // To get a digit we can first divide number with 10^i...
b6ce463a-c179-409c-bd6f-4f601c4816b3
5
public void drawLine(MinuetoColor color, int xStart, int yStart, int xStop, int yStop) { if (color == null) new NullPointerException(); int width = this.width; int height = this.height; /* Bound check */ if (( xStart < 0 ) || ( xStart >= width)) throw new MinuetoOutOfBoundException(xStart, 0, width); ...
e0836c9b-e145-4701-bd2f-72f267259ec7
3
public Node getNodeForId (int Id) { Node testNode = getNodes().get(Id - 1); if (testNode.getId() == Id) return testNode; // Do a sane lookup for (Node node : getNodes()) { if (node.getId() == Id) return node; } return null; }
ff302e19-c398-4bb7-b9bb-3a1dec5037e3
3
public static Resource[] usableNoGold() { ArrayList<Resource> res = new ArrayList<>(); for (Resource r : values()) if (r.isUsable() && r != GOLD) res.add(r); return res.toArray(new Resource[] {}); }
917ef62f-9537-400c-a307-828925365740
7
private static void sort(double[] d, double[][] z) { int l; int k; int j; int i; int ip1; double p; int ii; int n = d.length; /* Sort by eigenvalues (descending) */ for (l = 1; l <= n; l = 3 * l + 1) ; while (l > 2) { l = l / 3;...
10e44cde-2338-432f-8b5f-678dfad7d21d
8
public UpgradePlanSet(ResData rdata, int sysVersion) { this.sysVersion = sysVersion; outer : for (RtResKey rk : rdata.relevant) { System.out.println("Considering upgrade of rk = " + rk); int reqVersion = rk.res.getRequiredVersion(sysVersion); // Look at all existing versions, from highest number to lowest. U...
0f648d2c-f695-46ac-b3ae-bc4913e5a34a
8
@Override public void happens() { Character exp1 = null; ArrayList<Character> players = game.getCharacters(); search: for (int i = 0; i < players.size(); i++){ if(players.get(i).getItemHand().size() > 0){ ArrayList<ItemCard> items = players.get(i).getItemHand(); for (int j = 0; j < items.size(); j++){...
18c4b7f5-f20c-432c-8a53-31645cd25ca0
5
private void performBreaking(SVGOMTextElement text, String[] contentParts) { Document doc = text.getOwnerDocument(); int possibilities = (int) Math.pow(2, contentParts.length - 1); double bestRatioDifference = Float.MAX_VALUE; SVGTSpanElement[] bestLineBreak = null; for (int iter = 0; iter < possibilities; it...
04794a3e-baad-41f0-94ff-826b75fe9241
7
protected List<Offer> addDefaultImages(List<Offer> offers, String path) throws CitysearchException { if (offers != null && !offers.isEmpty()) { List<String> imageList = Utils.getImages(path); if (imageList != null && !imageList.isEmpty()) { ArrayList<Integer> indexList = new ArrayList<Integer>(3); Ra...
d92e594b-e794-40f9-abdd-e1b1d1bad2fa
6
public int[] generateExonBreak(boolean keepFirstHalf, boolean cdsExonsOnly) { List<int []> exonList = cdsExonsOnly ? this.codingExons : this.exons; if(exonList.size() == 0) { throw new RuntimeException("Missing exons: \n"+this.toString()); } Random r = new R...
8078f98e-318b-4ebd-ab8c-6d6bc45b3c7c
6
private void returnStatement_rest() throws Exception { Instruction r = null; // if there is an expression if(scan.sym == Token.ident || scan.sym == Token.num || scan.sym == Token.openparen || scan.sym == Token.call) { if(inMain) { ...
5dc70374-bf84-4206-abd3-fc8fe31422d3
2
public static void render(){ // BLUE BACKGROUND GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.4f, 0.4f, 0.4f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0 , 0); GL11.glVertex2f(Game.SCREEN_WIDTH, 0); GL11.glVertex2f(Game.SCREEN_WIDTH, Game.SCREEN_HEIGHT); GL11.glVertex2f(0, Game.SCREEN_HEIG...
6bae1857-65e3-4ee4-a90a-11ffd42dfc73
9
private void identifikasiKlasifikasiGizi(){ if(this.beratBadanRelative < 90){ this.klasifikasi = "Kurus (Underweight)"; } else if(this.beratBadanRelative >= 90 && this.beratBadanRelative <= 110){ this.klasifikasi = "Normal (Ideal)"; } else if(this.beratBad...
d010da02-300c-4fe3-be1a-e04101bbd0c6
3
@Override public double evaluate(double z) { /* Intervall finden, in dem z liegt */ int interv = (int) ((z - a) / h); /* Intervall [a+interv*h, a+(interv+1)*h] gefunden */ /* Sonderfaelle, wenn z ausserhalb des Eingangsintervalls liegt */ if (interv < 0) return y[0]; if (interv >= n) return y[y.le...
9df1c9a5-2d25-4bba-9058-6f1e5cb69eee
5
public void keyTyped(KeyEvent ev) { if (sondertastenanalyse(ev).length() == 0) { int zeichen = (int) ev.getKeyChar(); if (zeichen != 27 && zeichen != 8 && zeichen != 10 && zeichen != 127) { tastendruckBenachrichtigen("" + ev.getKeyChar()); } } }
03e285f0-9b66-4ee3-a6ea-3f450811c3b4
2
public final Product getProductID(String prodId) { Product product = null; for (Product p : products) { if (prodId.equals(p.getProductID())) { product = p; break; } } return product; }
00bb8e7c-3429-4cbe-ac1f-c5004321c066
7
public static ListNode detectCycle(ListNode head) { ListNode p = head; ListNode q = head; while (null != p && null != q) { p = p.next; q = q.next; if (null == p || null == q) return null; q = q.next; if (null == q) return null; if (p == q) break; } ListNode r = head; while (r ...
0d44018e-c070-4ea9-862b-02a52baaefb2
3
private void paintSelectedPieceAndMoves(Graphics g) { Color tempColor = g.getColor(); if(myGame.chosenPiece!=null) { int x = myGame.chosenPiece.getX(); int y =7- myGame.chosenPiece.getY(); g.setColor(Color.red); g.drawRect(x*myCellSize,y*myCellSize,myCellSize,myCellSize); } if(myGame.possible...