method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4bdacb13-d477-4dfa-bf01-0c27e953ae50
6
@SuppressWarnings("unused") public GUI(Ship ship) { //********************************************************** // For Karma - Uncomment the line below to draw gridLines // gridLines=true; //establishes formatting variables to account for full screen gameplay //sets wall size and padding for the gui ...
474543e9-9844-4c4c-8169-d8322825dd1b
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...
7aad36af-ba49-42b2-979f-6a0dcc0c9c54
6
@SuppressWarnings("unchecked") public IsJsonArray(Object... array) { for (Object o : array) { if (o instanceof Matcher) { matchers.add((Matcher<? super JsonNode>) o); } else if (o instanceof Integer) { matchers.add(isJsonInt((Integer) o)); ...
9f473d5f-f878-4ff4-80cc-97624ca5dc75
5
public Calendar getMaxDueDate() { Calendar result = Calendar.getInstance(); Calendar max = null; Calendar toCheck; if (tasks != null && tasks.size() > 0) { for (Task t : tasks) { toCheck = t.getDueDate(); if (max == null || toCheck.compareTo(max) > 0) { max = toCheck; } } res...
18f37c45-e31d-4360-a12e-ef7f6caf105e
6
public int absDistinct ( int[] A ) { LinkedList<Integer> abs = new LinkedList<Integer>(); for (int i = 0; i < A.length; i++){ int abInt = 0; int val = A[i]; if (val < 0){ abInt = val * -1; } else { abInt = A[i]; } boolean found = false; for (int j = 0; j < abs.size() && !found; j++)...
4f6e3c8c-4067-4c48-87a6-2da9a016dbfc
7
private long selectByIndex(final long index) { assert this.borderIndex <= index && index < this.maxNum : "idx: " + index + " i: " + borderIndex + " max: " + maxNum; final long borderElement = replace.containsKey(borderIndex) ? this.replace.get(borderIndex) : borderIndex; final long drawnElement = replace...
3fba02fc-ae9d-427e-bdd5-eea30918186f
1
public void removeElement(Element element) { if (element == null) throw new IllegalArgumentException("Element can't be null!"); elements.remove(element); }
1768dcbc-b65f-43d0-b554-b381a1e4d4b7
0
public int getStanding(){ return standing; }
4e74d528-c7c1-4e01-83b6-ed2f55a686eb
4
@Override public void registerAccount(Account account) throws ServiceException{ if(account.getUsername() != null && !account.getUsername().equals("") && account.getPassword() != null && !account.getPassword().equals("")){ accountDAO.addAccount(account); } else{ throw new ServiceException("用户名,密码,邮箱不能为空"); ...
4747e2e2-694e-43fb-a7e0-4f25d8a3fb20
4
public Nodo procurarChave(int key){ Nodo nodoAux = root; if(nodoAux!= null){ while(nodoAux != null && nodoAux.getKey() != key){ if(key < nodoAux.getKey()){ nodoAux = nodoAux.getLeft(); } else{ no...
1f4b6c10-48fc-4bf0-bdb0-5839ac39a20b
4
public void run() { while(true) { synchronized(errors) { try { errors.wait(); } catch(InterruptedException e) { return; } Report r; while((r = errors.poll()) != null) { try { doreport(r); } catch(Exception e) { status.senderror(e); } } } } ...
2cacdbd4-91d0-4b64-97a8-0d156ce20a40
5
public void checkEndState() { int completed = 0; // Check if the chests are in the goal squares. for (int chestIndex = 0; chestIndex < chests.size(); chestIndex++) { Treasure chest = (Treasure) chests.get(chestIndex); for (int goalIndex = 0; goalIndex < goals.size(); goalIndex++) { Goal goal = go...
6655ed3e-7000-430d-af90-d7885b5ecdba
0
public void showFullNamePopup() { fullName.show(); }
70c7cf6b-606e-4519-9d13-358d8db4d1b8
0
public int compare(Property arg0, Property arg1) { return arg0.getName().compareTo(arg1.getName()); }
73d944fa-a78e-4f53-b38a-744b3cb806e4
0
public TiltToCurrentDistance(double power) { super(power, Distance.NEAR); }
987d56ba-266a-4851-8525-47fa133413b3
1
public double getBestScore() { ArrayList<QuizTakenRecord> records = getAllTopRecord(); if (!records.isEmpty()) return records.get(0).score; else return 0; }
0d025cd1-51bf-4330-85f6-403ac02d8d6b
6
@Override public String toString() { String b = gameCurrentTime + "\n\n"; for (int y=0; y < boardWidth; y++) { for (int x=0; x < boardWidth; x++) b += boardVals[y][x] + (x < boardWidth - 1 ? ", " : "\n"); } b += "\n"; for (int y=0; y < boardWidth; y++) { for (int x=0;...
375edba5-f1fb-47df-a74f-95f739c6c53e
7
public static final boolean isURLEncoded(String str) { if (str==null||"".equals(str)) { return false; } char[] chars = str.toCharArray(); boolean containsPercent = false; for (char c : chars) { if (Character.isWhitespace(c)) { return false; } if (!dontNeedEncoding.get(c)) { return false; ...
79b0a912-7f14-4932-b874-39c6a9ff5cb8
2
public static SpacePort create(int id, AstronomicalObject primary) { PropertyManager pm = new PropertyManager("config.properties"); Random rnd = new Random(); if (primary.getClass() == InhabitedPlanet.class) { return new SpacePort.Builder() .id(id) ...
4e604c88-9888-4b62-b23c-8e8db91fb0ba
4
void print(){ System.out.println("分析 "+filename+" 源程序的结果:"); DecimalFormat decimalFormat = new DecimalFormat("00.00"); System.out.println(String.format("代码行数:%03d, 占%s%%", codeline, decimalFormat.format((float)codeline/(float)totalline*100.0f))); System.out.println(String.format("注释行数:%03d, 占%s%%", comment...
077b45b7-35b8-4008-8921-7ce23136996e
4
public void writeList() { PrintWriter out = null; try { System.out.println("Entering in try statement."); out = new PrintWriter(new FileWriter("OutFile.txt")); for(int i = 0; i < SIZE; i++) out.println("Value at: " + i + " = " + list.get(i)); } catch(ArrayIndexOutOfBoundsException e) { Syst...
c302e339-98fd-4408-960c-aa76e3bf082b
0
public void setText(String text) { this.text = text; }
9d44da42-809c-4552-b4ac-5f5f87c89025
6
public static String doPost(String urlString, Map<String, String> nameValuePairs) throws IOException { URL url = new URL(urlString); URLConnection connection = url.openConnection(); connection.setDoOutput(true); PrintWriter out = new PrintWriter(connection.getOutputStream())...
0f2454c4-f909-4df3-a395-52216bb33c90
6
public String crawlWebSite() { try { URL url = new URL(this.urlStr); InputStream inStr = url.openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader( inStr)); while (((this.line = reader.readLine()) != null) && (this.line.indexOf(this.city) < 0)) {} i...
38e1a2bb-09fc-44cb-8442-609df770df2b
9
public static List<Impacto> listaDeImpactos() { ResultSet tr = null; String select = "SELECT * FROM impactos"; ArrayList<Impacto> listaImpacto = new ArrayList<Impacto>(); Connection conexion = null; Statement statement = null; try { conexion = DataSourceFact...
98abfdcd-0643-4ed2-bbae-f6ff1f504a6d
0
public Integer getIdUsuario() { return idUsuario; }
3dd947f5-b0f0-49f1-9bb6-97dd214074f6
2
private void declareFrameTypes(final int n, final Object[] o) { for (int i = 0; i < n; ++i) { if (o[i] instanceof Label) { declareLabel((Label) o[i]); } } }
fea5be08-471c-4f99-b510-7a9951b44027
7
@Override public <N, T> List<T> getValues(TKey<N, T> key, Enum<?>... qualifiers) { List<T> result = new ArrayList<>(); List<QualifiedValue<?>> values = fields.get(key); if (values != null && values.size() > 0) { for (QualifiedValue<?> value : values) { if (checkQu...
d90d803f-04ac-4a04-96c1-822e55a65955
9
boolean parseKeyFilterRange(Key workKey, ProtoTerm protoTerm) { workKey.clear(); int c = getNonWhiteChar(); back(); if (c == ':') { workKey.append(Key.BEFORE); } else { if (!parseKeySegment(workKey)) return false; } protoT...
11c26ad6-8c76-4a36-9ca6-36814e32db4d
9
public void update2(IUpdateInfo uInfo) { CollisionDetection.checkBroadphase(this, updateList, collisionTree, uInfo); Collection<Manifold> c = Manifold.manifolds.values(); for (Manifold m : c) { for (int i = 0; i < m.size(); i++) { ElasticContact e = ElasticContactSolver.addContact(m.getBodyA(), (DynamicBod...
e352ef0e-d75f-4257-82dd-c116a2494a64
8
public Vector<String> getRecordInfo(Connection conn, String itemID, String mdPrefix) throws ServerException { Statement stmt = null; ResultSet rs = null; Vector<String> result = new Vector<String>(); try { st...
321e72ec-bf3f-41a8-a94e-760ba76b22d7
3
public int divide(int dividend, int divisor) { boolean signA = dividend >= 0, signB = divisor > 0; long num = Math.abs((long) dividend), div = Math.abs((long) divisor), res = 0, curr = 0; // using Long division for (int idx = 31; idx >= 0; idx--) { curr <<= 1; curr |= ((num >> idx) & 1); res = res << ...
1d76e377-79e4-438c-b95a-23b12ee0294f
1
@Override public long getSize(Movie movie, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return -1; }
93afc1f0-9fd9-4e2d-9ad2-23248b101fde
5
public synchronized static String notifyPlayer(String ip, int playerIndex, String msgChat) { String msg = "NOTIFY_PLAYER FAILURE"; Element sender = getPlayerElement(ip, true); if (sender != null) { Element parent = (Element) sender.getParentNode(); Element player = (Element) parent.getElementsByTagName(...
afafd98c-534d-488a-ad84-16d4a969f069
4
public void setMode(int mode) { if (mode != GeneralDestruction.MODE_GAME && mode != GeneralDestruction.MODE_EDITOR) { throw new IllegalArgumentException("Unknown mode flag: " + mode); } if (mode == GeneralDestruction.MODE_GAME) { viewMain.removeAllCanvas3Ds(); viewOrtho1.removeAllCanvas3Ds(); view...
c409209b-8010-4545-ad27-8462ce66fa25
4
@Test public void testMultithreadingOnList() { List<ThreadClass> l = new LinkedList(); for (int i = 0; i < 100; i++) { ThreadClass t = new ThreadClass(chatServer); l.add(t); new Thread(t).start(); } int dauer = 1000; while (dauer > 0) { ...
893f8557-26a2-407e-b8a2-c8901b0f3522
4
public int findChange() { int totalSame = 0; for (int x = 0; x < 4; x++) { for (int y = 0; y < 4; y++) { if (grid[x][y] == next.grid[x][y]) { totalSame++; } } } if (totalSame == 16) return -100; return 0;...
e89fa362-2854-4326-a108-44d1adee4ba8
2
public void join() { // notify all waiting threads that this ThreadPool is no // longer alive synchronized (this) { isAlive = false; notifyAll(); } // wait for all threads to finish Thread[] threads = new Thread[activeCount()]; int count =...
ba12151f-f7e7-40b1-a5fd-afec0c022183
3
@Override public HandshakeState acceptHandshakeAsClient(Handshakedata request, Handshakedata response) throws Exception { if (!request.hasFieldValue("Sec-WebSocket-Key") || !response.hasFieldValue("Sec-WebSocket-Accept")) return HandshakeState.NOT_MATCHED; String seckey_answere = response.getFieldValue(...
645efbd9-585d-4089-be2d-0701df5ffec8
2
MenuBar() { super(); this.setOpaque(false); this.setBorderPainted(true); this.setPreferredSize(new Dimension(mainFrame.getWidth()-logoWidth-80, 50) ); JMenuItem Inventory = new buttonHoverEffect(menuPanel, "Inventory"); JMenuItem Transaction = new buttonHoverEffect(menuPanel, "Transaction"...
239a880b-ed0a-490f-a896-78f2914b6e34
0
public long getQueueLength() { return queueLength; }
9404fe1f-e8bc-4539-86c0-e4adfe4921a2
0
public void setActive(int active) { this.active = active; }
f4ba96fe-6495-4506-a3f5-3ef53e0b32c9
0
protected void end() { Robot.tomahawk.stop(); lightCommand.cancel(); }
279c0b9b-645e-4cb4-946f-f1f0af73ec6c
8
public SplashScreen() { al = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (jProgressBarSplash.getValue() < 100) { jProgressBarSplash.setValue(jProgressBarSplash.getValue() + 1); if (jProgressBa...
dd0e13bd-d82f-437f-830f-b667f1b68e1f
3
private void placeForceFieldGenerators() { while (getElementCoverage(ForceFieldGenerator.class) < COVERAGE) { final Position randomPos = getRandomPosition(); final ForceFieldGenerator forceFieldGen = new ForceFieldGenerator(grid); if (grid.validPosition(randomPos) && canHaveAsElement(randomPos, forceFieldGen...
69cfb5b4-a515-4900-99d7-2ae8529f2d5e
4
private int getTile(int x, int y) { if(x < 0 || x >= tiles.length || y < 0 || y >= tiles[0].length) return 0; return tiles[x][y]; }
f150acfc-e371-477b-afbc-09039432d5ff
0
@Autowired public WebFormController(TravelTripService travelTripService){ this.travelTripService = travelTripService; }
f8eeb7fa-ad62-4b68-882c-98182f9ffed8
7
@Override public synchronized void eventFired(TChannel channel, TEvent event, Object[] args) { System.out.println("LabAgent received event " + event + " on channel " + channel); // Expecting event firing from LabControlPanel on CONTROL_PANEL channel if (channel == TChannel.CONTROL_PANEL) { if (event == TEvent...
fc5e4127-fec3-4383-b05d-51523f035cf0
7
public void command_line() { while (true) { System.out.println("Please input your cmd(input help for info):"); @SuppressWarnings("resource") Scanner sc = new Scanner(System.in); String cmd = sc.nextLine(); switch (cmd) { //5 case "upload": upload_cmd(); continue; case "download": ...
519f846c-2e42-4ff3-ba62-d9dc91f88272
0
public ContaCorrente(int numero, String agencia, Cliente cliente) { this.numero = numero ; this.agencia = agencia ; this.donoDaConta = cliente ; }
1a5459ab-c804-461e-9def-2c73f3a12e8d
2
public int getRobotAmount() { int amount = 0; for (int i = 0; i < this.robotPositions.length; i++) { if (this.robotPositions[i]) { amount++; } } return amount; }
475c5907-9502-41ff-8465-7a7b2b7209d9
0
public void setFourthCorner(Rectangle fourthCorner) { this.fourthCorner = fourthCorner; }
3acff1db-1921-4ddd-ae9a-a8f5d0b8c7f3
4
private void jComment() throws MalformedJsonException{ next(); if (current=='/'){ //Comment 'till the end throw jsonError("unclosed token(s)", true); }else if(current=='*'){ /*Comment like this*/ next(); while(!(current=='*' && next()=='/')){} next(); }else{ //Buggy shit ...
e18719f5-7e25-48d8-8afa-617e5ad94dcd
6
public static Locale getLocale(String lang) { if (lang == null || lang.length() == 0) throw new LocalizationException("Language code cannot be empty"); Locale locale; String[] parts = lang.split("_"); switch (parts.length) { case 2: locale = new Locale(parts...
1b8b2236-6167-4514-a8e0-9e6ef3905acb
4
public ArrayList<Field> getLegalFields(Player player) { ArrayList<Field> legalFields = new ArrayList<Field>(); for (Field field : this.window.board.fields) { if (field.hasPiece()) { Piece piece = field.getPiece(); if (piece.isWhite == player.isWhite) { for (Field legalField : this....
571af7d4-b576-4b58-ba45-81c089ddefd0
2
public Collection<Label> getLabels() throws SQLException { if (labels == null || labels.size() == 0) labels = GetRecords.create().getLabels(number); return labels; }
4e2c3e17-cc94-4953-bc76-11b0dc83c356
9
private BigInteger getNumericValue(final Object data) { if (data == null) { throw new IllegalArgumentException("Cannot convert <null> to numeric"); } if (data instanceof BigInteger) { return (BigInteger) data; } if (data instanceof BigDecimal) { return BigInteger.valueOf(((BigDecim...
fc7e2c6e-cc5c-4674-ace3-149203b60a38
7
private JSONWriter append(String s) throws JSONException { if (s == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write(','); ...
47eaf452-bbfb-4e11-b139-a9a90adc0b0f
4
@Override public void draw(Graphics g){ switch(this){ case START_LEVEL: Animation.START_LEVEL_ANIMATION.draw(g); break; case PLAY_LEVEL: Game.gameField.draw(g); break; case END_LEVEL: //draw the completed level in background Game.gameField.draw(g); Animation.END_LEVEL_ANIMATION.draw(g); ...
bfae1bf4-bb8c-427c-af9d-a0647cae6924
5
@Override public boolean equals(Object object) { if (!(object instanceof Produto)) { return false; } Produto other = (Produto) object; if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) { return fal...
0e3e6ba0-e255-42de-b5b0-df0d63fe62bd
3
public void createJsonTree () throws IOException{ String path = ""; String jsonString; jsonTree = new STRtree(); //create folder try{ new File(saveFolder).mkdirs(); }catch(Exception e){ System.out.println("couldnt create folder: " + e); } //read original json file to get polygons jsonString = Ge...
60e053f6-4b7b-4e4f-b578-c47a944a3e3e
4
@SuppressWarnings("nls") private static final String normalizeNumber(String buffer, boolean localized) { if (buffer == null) { return ""; } buffer = buffer.replaceAll(localized ? LOCALIZED_GROUPING_SEPARATOR : ",", "").trim(); if (buffer.length() > 0 && buffer.charAt(0) == '+') { return buffer.substring(...
61eb0175-4dc0-4319-b566-8574376de2ce
6
public final void lifeLost() { if (!inGameState("InGame") || inGameState("LevelDone") || inGameState("LifeLost") || inGameState("GameOver") ) return; // System.err.println( // "Warning: lifeLost() called from other state than InGame." ); //} clearKey(key_continuegame); removeGameState("StartLevel"); rem...
13f3a99e-6f24-4dbf-86a3-dab2bb7189bb
8
public static String getOCResponseType (String RaveResponseType) { GenUtil.validateString(RaveResponseType); switch (RaveResponseType) { case ModelCV.RAVE_CT_CHECKBOX: return ModelCV.OC_CRF_CV_RESPONSET_CHECKBOX; case ModelCV.RAVE_CT_DATETIME: ...
aab813a5-9b68-4d11-a8ce-727bcc7bb2eb
6
public void executerOpRel() { switch(this.opera.peek()) { case EGAL : Yaka.yvm.iegal();this.opera.pop();break; case DIFF : Yaka.yvm.idiff();this.opera.pop();break; case INFEGAL : Yaka.yvm.iinfegal();this.opera.pop();break; case INF : Yaka.yvm.iinf();this.opera.pop();break; case SUP : Yaka.yvm.isup();this.op...
91818df9-0912-4112-ad67-07745c93127e
6
@Override public void keyPressed(KeyEvent e) { if (e.isControlDown()) { if (e.getKeyCode() == KeyEvent.VK_R) { checkbox[3].setSelected(!checkbox[3].isSelected()); } else if (e.getKeyCode() == KeyEvent.VK_E) { checkbox[2].setSelected(!checkbox[2].isSelected()); } else if (e.getKeyCode() == KeyEvent....
460ad569-a664-4bda-b8fb-6d7478e34a55
3
public void handleComboBoxSelection(){ if((transitionView.getStateComboBox().getSelectedItem() == "ACCEPT") || (transitionView.getStateComboBox().getSelectedItem() == "REJECT")){ transitionView.getSymbolComboBox().setEnabled(false); transitionView.getDirectionComboBox().setEnabled(false)...
21cf0db0-e076-40c9-b993-c8c54296d5d5
5
public void create(int historySize, int keepAddBufferBefore, int matchMaxLen, int keepAddBufferAfter) { if (historySize > kMaxValForNormalize - 256) { return; } _cutValue = 16 + (matchMaxLen >> 1); int windowReservSize = (historySize + keepAddBufferBef...
72e84560-dbbc-4e03-a647-dbb06f157064
8
private static void initLookAndFeel() { String lookAndFeel; if (LOOKANDFEEL != null) { if ("Metal".equals(LOOKANDFEEL)) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } else if ("System".equals(LOOKANDFEEL)) { lookAndFeel = UIMa...
3a531f13-cf6e-40e7-9893-9c1225ec73dc
3
public static Game takeStones(Game game, List<Token> move, boolean aiOnTurn){ if(aiOnTurn){ if(game.getAiStones().get(move.get(0).color()) != null){ game.getAiStones().put( move.get(0).color(), game.getAiStones().get( move.get(0).color() ) + move.size() ); }else{ game.getAiSt...
a09c1542-31eb-43ba-9a23-26b297391c36
2
public static void ChooseLeo () { if (Game.characterChoice == 1) { Game.CharacterOne = "Leo"; Game.CharacterOneHP = CharacterStats.LeoHP; Game.CharacterOneAttack = CharacterStats.LeoAttack; Game.CharacterOneMana = CharacterStats.LeoMana; Game.CharacterOneRegen = CharacterStats.LeoRegen; ...
0061e36b-b685-4178-a080-debb4ff27c3a
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
61b8fa93-f789-4ee2-baf1-acb0a4c0bc48
3
private static String GetNearestNode(Map<String, Double> nodes, Set<String> visitedNodes) { double distance = Double.MAX_VALUE; String nearestNode = null; for (String nodeName : nodes.keySet()) { if (!visitedNodes.contains(nodeName) && nodes.get(nodeName) < distance) { nearestNode = nodeName; distance ...
9d2ae9a3-cc56-4fe6-ae98-a4dcf8903d6d
7
public static void storeLinks(List<String> links, String ticker) throws SQLException { Connection conn = null; PreparedStatement prep = null; String updateSql = "INSERT INTO " + ticker + " (Link, Date) VALUES (?, ?)"; try { File db = new File("C:\\Users\\Sudip\\Documents\\Development\\workspace\\Design Pr...
cfa675c7-2d0b-4711-90de-0f40284d4cdf
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...
b1a43d0c-94a5-415c-853a-bf72cade68d5
7
@Override public void setCombatant(PhysicalAgent other) { final Room R=(owner() instanceof Room)?(Room)owner():CMLib.map().roomLocation(this); if(other == null) clearTacticalMode(); else if(CMLib.flags().isDeepWaterySurfaceRoom(R)) { targetedShip = other; if(R != null) shipCombatRoom = R; if...
f24a1aa3-28e4-45e4-939f-d8097b2db62c
8
protected void setBehaviorAsStateRule(Boolean state) { // set visible if ( stateRule.isVisible() != null ) { affectedWidget.setVisible( !( stateRule.isVisible() ^ state ) ); } // enabled and value setting rules are only valid if not in // Cancel Replace mode if ( cxlReplaceMode && affectedWidget.get...
ecc7745a-955a-44cf-a705-4509d7fec273
0
protected void onFileTransferFinished(DccFileTransfer transfer, Exception e) {}
9c4dab24-f652-4795-a71f-3cea9cb00564
0
@Override public String getTmp() { return convertToString(tmp); }
a931337b-c236-4ce1-aa25-25746dbf5cbe
5
public static void playGame() { System.out.print("PLAY"); processing(); do { deck.add(playerOneHand.get(playerOneHand.size() - 1)); playerOneHand.remove(playerOneHand.size() - 1); if (compareCards()) { randomPlayer(); } deck.add(playerTwoHand.get(playerTwoHand.size() - 1)); playerTw...
8ba8819a-2f52-46c8-a5e4-ffb5af242ab9
6
public HashMap<String,Boolean> getRoles() throws Exception { Connection conn =null; Statement stmt = null; ResultSet rs=null; HashMap<String,Boolean> role = new HashMap<String,Boolean>(); try{ Class.forName("com.mysql.jdbc.Driver"); ...
36c79c0e-2990-49d8-8f17-273f8a9c30e4
7
@Override public String getStat(String code) { if(CMLib.coffeeMaker().getGenItemCodeNum(code)>=0) return CMLib.coffeeMaker().getGenItemStat(this,code); switch(getCodeNum(code)) { case 0: return "" + powerCapacity(); case 1: return "" + activated(); case 2: return "" + powerRemaining(); case ...
36697eab-2822-4fa9-8fd1-583ba1aeef21
5
@Override public void drawPreview(Graphics2D g) {// draws preview to canvas int minX = Math.min(startX, endX); int minY = Math.min(startY, endY); int maxX = Math.max(startX, endX); int maxY = Math.max(startY, endY); int width = maxX - minX; int height = maxY - minY; if (!canvas.getClear()) { canva...
4c326119-5ab0-4b9e-9a00-4240ef36f521
2
Map<String, String> createData(int siteNum) { Map<String, String> data = new HashMap<String, String>(); for (int i = 2; i <= 20; i += 2) { data.put("x" + i, String.valueOf(i * 10)); } if (siteNum % 2 == 0) { data.put("x" + (siteNum - 1), String.valueOf(10 * (siteN...
9081a3fd-a7e1-4fc0-9c91-c758d17600ea
9
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { log.info("WANcostResummingServlet1h Got a GET..."); caches.reload(); link[][] linkArr = new link[caches.lSources.size()][caches.lDestinations.size()]; for (int i = 0; i < caches.lSources.size(); i++) for (int j = ...
ca13f9c8-7061-45ba-a2d9-bc8b9064c712
5
public int compareRegions(RPChromosomeRegion testRegion) { // test if this region is contained by (i.e. subset of) testRegion region if (this.containedIn(testRegion)) return 0; // test if testRegion region is disjoint from above or below else if (this.disjointBelow(tes...
7762889d-bebe-4cdc-bc95-7b05359c8baa
5
public Map<Integer, Integer> getGeneSpans(String text) { Map<Integer, Integer> begin2end = new HashMap<Integer, Integer>(); Annotation document = new Annotation(text); pipeline.annotate(document); List<CoreMap> sentences = document.get(SentencesAnnotation.class); for (CoreMap sentence : sentences) {...
668c8d99-6212-4928-9eb1-50aa3bb21dd7
9
@Override public void update(Observable o, Object arg) { // TODO Auto-generated method stub Schedule sched = model.getBestSchedule(); jTextPane.setText(""); printTxtPane.setText(""); removeBt.clear(); for (int i = 0; i < removeBt.size(); i++) { jTextPane.remove(removeBt.get(i)); System.out.printl...
5038fb43-b12c-4bf4-b0fa-1570e1fa29a0
8
@EventHandler public void onPlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); Block clicked = event.getClickedBlock(); if(event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { if((clicked.getType().equals(Material.WALL_SIGN) || clicked.getTyp...
ee8c7a40-56eb-438b-a491-6dbeeb337f1c
3
public Boolean lookupScripture(Scripture toFind) { if (toFind.getBook().equals(book) && toFind.getChapter() == chapter && lookupVerse(toFind.getStartVerse(), toFind.getEndVerse())) { return true; } return false; }
c5c96804-8252-436a-a768-5c3595a0a4cb
9
public void inspect() { ObjectInspection newentry = new ObjectInspection(this); for(int i=0;i<this.fields.length;i++) { if(verbose) System.out.println(this.getClass().getName()+" inpspecting "+fields[i].getName()+" of "+this.toinspect.getClass().getName()+"."); tr...
8745752b-df81-4bde-94ee-3b29866a3f31
4
@Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && this.isEnabled()) { if (e.getX() > this.getWidth() - 14) { if (dropDownMenu.getComponentCount() > 0) { dropDownMenu.show(this,...
dee12f9b-ebcf-4670-b20c-9e9d2796ac80
4
public void writeDottedList(CycList dottedList) throws IOException { int size = dottedList.getProperListSize(); if (trace == API_TRACE_DETAILED) { Log.current.println("writeDottedList = " + dottedList.toString() + "\n proper elements size " + size); ...
ee9e853e-8c1a-4d18-aad6-cec8dbd139e7
8
public void NextLevel() { if(win == GameStatus.VICTORY) { data.clear(); switch(level.number) { case 1: level = new Level2(); InitLvl(); break; case 2: level = new Level3(); InitLvl(); break; case 3: GameOver(); break; } } else if(lose == GameStatus.DEFEAT) ...
04a77892-fd3c-4745-b0a0-d054d1dfe5eb
9
public PDPM_Report_View(PDPM_UI_Plugin ui, String arg) throws Exception { this.ui = ui; // arg is report file name or Date if(arg.startsWith("rep-")) { // File name rep_file_name = arg; } else { throw new Exception("Report ...
72a9f373-1d0e-4004-b796-c99fc6f098a6
4
public void drawRectangle(MinuetoColor color, int x, int y, int width, int height) { /* Bound check */ if (( x < 0 ) || ( x >= width)) throw new MinuetoOutOfBoundException(x, 0, width); if (( y < 0 ) || ( y >= height)) throw new MinuetoOutOfBoundException(y, 0, height); Color previousColor = this.gra...
d098ae81-602e-4fac-be48-156264e29138
3
protected void load(String fileName) { if (!Gpr.canRead(fileName)) throw new RuntimeException("Cannot read file '" + fileName + "'"); LineFileIterator lfi = new LineFileIterator(fileName); for (String line : lfi) { if (lfi.getLineNum() <= 1) continue; String fields[] = line.split("\t", -1); // Split , don'...
879afc4c-d11c-48e1-b836-39281a443f18
0
public void setMaxGuest(int maxGuest) { this.maxGuest = maxGuest; }
0d41ecd3-8286-481b-9c00-6dc00da5dea4
0
public double getDefenseScore(){ return defenseScore; }
79a9d6ee-c86f-4878-a73b-6b61cb2485da
2
public static boolean isCycDate(Object object) { if (object instanceof CycList) { return parseCycDate((CycList) object, false) != null; } else if (object instanceof CycNaut) { return parseCycDate((CycNaut) object, false) != null; } else { return false; } }