method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d8474c2e-8185-43cf-9528-3cc637b0dc40
5
public void rotateRight() { Point[] RotationPoints = currentTetromino.GenerateRotateRightPoints( boardSizeX, boardSizeY); Boolean ableToRotate = true; for (int i = 0; i <= 3; i++) { if (tetrisMap[RotationPoints[i].x][RotationPoints[i].y] == 1) { ableToRotate = false; } } if (ableToRotate) { ...
5c8c5a2f-115c-470e-a250-573a40bf61cc
7
public double logDensity(double value) { // Update boundaries if necessary updateBoundariesAndOrWeights(); if (m_Boundaries == null) { return Math.log(Double.MIN_VALUE); } // Find the bin int index = Arrays.binarySearch(m_Boundaries, value); // Is the value outside? if ((index ...
e123c6bf-8f1f-44b5-96d7-c1ea5a3ec006
2
public void visitTryCatchBlock(final Label start, final Label end, final Label handler, final String type) { ++handlerCount; Handler h = new Handler(); h.start = start; h.end = end; h.handler = handler; h.desc = type; h.type = type != null ? cw.newClass(type) : 0; if (lastHandler == null) { firstH...
da55c035-db0f-44d1-bafc-b7bed47b7168
6
* @param n * @return LogicObject */ public static LogicObject getNthDomain(LogicObject relation, int n) { if (Logic.classP(relation)) { return (((n == 0) ? relation : null)); } if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(relation), Logic.SGT_LOGIC_NAMED_DESCRIPTION)) { { Named...
8475e1d8-1ae6-4eed-8161-098450085cea
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Informacao)) { return false; } Informacao other = (Informacao) object; if ((this.codinformacao == null && other...
872f5f10-da7c-4a21-b1ac-b73ce3e92ba1
9
public Object getAttribute(final String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { Object value = null; try { boolean foundAttribute = false; for (final MBeanAttributeInfo mbeanAttr : attributes) { ...
35c0dbb8-60b9-42e3-82a5-1a710a52c838
8
private static boolean foundObjectInImage(String path, String object) { Point[] locations; File folder = new File("images/" + object); Mat source = Imgcodecs.imread(path); if(source.empty()) { System.out.println("[IMAGE_DECODER] Empty source image."); throw new IllegalArgumentExcepti...
ba67064f-5bcb-487b-af70-e7b50486df9d
0
public CheckResultMessage checkTF02(int day) { return checkReport.checkTF02(day); }
e9379859-6463-4414-b021-595600088312
8
public int func_78334_a(StatCrafting par1StatCrafting, StatCrafting par2StatCrafting) { int i = par1StatCrafting.getItemID(); int j = par2StatCrafting.getItemID(); StatBase statbase = null; StatBase statbase1 = null; if (slotStatsBlockGUI.field_77264_j == 2) { ...
aac2e9e3-2fb3-42a4-ae6b-aa12a998e1fb
7
protected void readImage() { ix = readShort(); // (sub)image position & size iy = readShort(); iw = readShort(); ih = readShort(); int packed = read(); lctFlag = (packed & 0x80) != 0; // 1 - local color table flag interlace = (packed & 0x40) != 0; // 2 - interlace flag // 3 - sort flag // 4-5 - reser...
ae7bbbc2-cd70-4b4a-bde2-d3e50e62d2f7
2
private String formatVersion(int currentVersion) { String strCurVer = String.valueOf(currentVersion); if (strCurVer.length() == 1) return "00" + strCurVer; else if (strCurVer.length() == 2) return "0" + strCurVer; return strCurVer; }
1a5fc05b-53e1-4c22-bf0a-81df4368b84d
6
public boolean consumeBoolean() throws ParseException { if (currentToken.equals("true") || currentToken.equals("t") || currentToken.equals("1")) { nextToken(); return true; } else if (currentToken.equals("false") || currentToken.equals("f") || ...
4fa2a917-3731-480a-b053-ef41ef438bde
4
public static int patition(int[] src,int start,int end){ if(src == null || start > end){ return -1; } int index = (start + end) / 2; swap(src,index,end); int small = -1; for(int i=0;i< src.length;i++){ if(src[i] < src[end]){ small++; swap(src,i,small); } } small++; swap(src,small,end)...
07eeec51-f90f-4c0e-b90c-44365e67a47b
4
public ModuleCommand make( String name, BasicType[] params ) throws UnknownCommandException, CommandStringIncompleteException { //return null; if( name == null ) throw new NullPointerException( "Command must not be null." ); if( name.equalsIgnoreCase("HTTP") || name.equalsIgnoreCase("HTT...
02edbb1d-e43f-44cb-acd6-744cda131bba
9
private int getSizeAttackAndArmorClassModifier() { switch (size) { case FINE: return 8; case DIMINUTIVE: return 4; case TINY: return 2; case SMALL: return 1; case MEDIUM: r...
444658ea-5ac3-44b8-84c2-46b1f58235b3
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final PresentationDocument other = (PresentationDocument) obj; if (!Objects.equals(this.name, other.name)) { ...
3add0dca-2beb-4cc3-b788-6f5cad712c7b
4
public boolean isPatternPresent(Tree.Node<String, Integer> parent, int count) { if (parent.getChildren().size() > 0) { if (this.text.length() >= count + 1) { String pattern = this.text.substring(count, count + 1); if (isInChildren(parent.getChildren(), pattern)) { ...
f3ed8d9c-339c-4c4c-90e7-030a868e1f9b
4
@Override public Tile getTile(Tile source, Direction dir) { int x = source.getX(); int y = source.getY(); switch(dir) { case NORTH: y--; break; case SOUTH: y++; break; case EAST: x++; break; case WEST: x--; break; } return tiles[x][y]; }
91feb39f-07eb-47d7-a945-413a2c605673
9
private void processSectionNode(Element node) { String id = node.getAttribute("id"); String level = node.getAttribute("level"); if(hasSectionIdsGenerated() && level.isEmpty()) { throw new IllegalStateException("Section id generation is enabled and node is missing a level info"); } String secti...
8dc0e8ce-f342-4b72-8b21-92dfbc377a8c
6
protected static Ptg calcIferror( Ptg[] operands ) { if( (operands == null) || (operands.length != 2) ) { return new PtgErr( PtgErr.ERROR_VALUE ); } if( !(operands[0] instanceof PtgArray) ) { PtgBool ret = (PtgBool) InformationCalculator.calcIserror( operands ); if( ret.getBooleanValue() ) // it'...
75db2d03-0f4f-4c9d-b7ec-8583a7996575
3
public boolean Salvar(List<ItemVenda> obj, int idVenda){ try{ for(ItemVenda iv : obj){ if(iv.getId() == 0){ PreparedStatement comando1 = conexao .getConexao().prepareStatement("INSERT INTO itens_venda " ...
1bd4e0e8-4fa5-4f2c-8dd5-473ff848832c
5
public void setObject(Object obj) { if(obj instanceof Turma){ this.turma = (obj != null ? (Turma)obj : new Turma()); if(turma.getDisciplina() != null){ setDisciplina(turma.getDisciplina()); } else{ this.cmbDisciplinas.s...
d73c8f84-0353-4847-bdd7-8cbb61a2bbbf
4
public Puzzle solve(Puzzle p) { if (p.isSolved()) { return p; } Guess guess = getNextGuess(p); if (guess == null) { return null; } Puzzle solution = p; for (int value : guess.possibles) { Puzzle newP = p.mutate(guess.index, value); solution = solve(newP); if (solution != null) { break; ...
7e11a7e2-abf4-4f1d-8375-1f6672710d87
6
private void colButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_colButtonActionPerformed Color current = bgColButton.getBackground(); if (evt.getSource() == recordColButton) { current = recordColButton.getBackground(); } else if (evt.getSource() ==...
beae73f3-39b0-404b-9075-807689d5299e
8
public void progress(int delta) { if (this.keyDown[Input.KEY_UP]) { this.centerY--; } if (this.keyDown[Input.KEY_DOWN]) { this.centerY++; } if (this.keyDown[Input.KEY_LEFT]) { this.centerX--; } if (this.keyDown[Input.KEY_RIGHT]) { this.centerX++; } if (this.k...
59298036-f110-469e-a273-3f560239c724
9
private void comandoEnquanto() { // <enquanto> ::= “enquanto” “(“<exp_logica> “)” “{“ <lista_comandos> ”}” ”;” if (!acabouListaTokens()) { System.out.println("tô no enquanto"); nextToken(); if (tipoDoToken[1].equals(" (")) { this.expLogica(); // ...
ff1997a0-31e1-4052-879f-211848dbb427
0
public Tracker(MatlabProxy proxy, MatlabTypeConverter processor){ this.segmentator = new Segmentator(proxy, processor); }
0cc6dc87-80da-4f06-9cbe-32934a7c8fc1
6
private void knightBottomLeftPossibleMove(Piece piece, Position position) { int x1 = position.getPositionX(); int y1 = position.getPositionY(); if((x1 >= 2 && y1 >= 1) && (x1 < maxWidth && y1 < maxHeight)) { if(board.getChessBoardSquare(x1-2, y1-1).getPiece().getPieceType() != board.getBlankPiece().getPi...
ef0154cc-f979-4951-b883-9dc0846d8fa1
4
private double rechne(double ersterSummand, double zweiterSummand, char operator) { double ergebnis; switch (operator) { case '+': ergebnis = ersterSummand + zweiterSummand; break; case '-': ergebnis = ersterSummand - zweiterSummand...
6f0b7aed-3add-4ba9-a35e-302580baca55
8
public void putAll( Map<? extends Long, ? extends Float> map ) { Iterator<? extends Entry<? extends Long,? extends Float>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Long,? extends Float> e = it.next(); this.put( e.getKey(),...
916e82c7-4cce-447a-8136-f16689c18676
4
private Team resultSetToTeam(ResultSet rs) throws SQLException { Team team = new Team(); team.setId(rs.getLong("id")); team.setName(rs.getString("name")); team.setCoach(rs.getString("coach")); switch (rs.getString("status")) { case "REFEREE": team.setS...
672d6143-9929-4f40-8810-c0378133473b
5
@Override public void run() { if (pCheck.validate()) { if (!pCheck.isMcConfirmed() || pCheck.shouldForceUpdate()) { if (pCheck.getXenID() > 0) { if (pCheck.shouldForceUpdate()) { pCheck.rankSync(); pCheck.setMcC...
95bcb23b-a6b3-446a-86c4-f250c032c43b
2
public boolean outOfBound(int colonne, int rangee){ if(colonne > nombreColonne || rangee > nombreRangee){ System.out.println("Cette coordonée ( " + colonne + " , " + rangee + " ) n'est pas dans la table."); return true; } else{ System.out.println("Cette coordo...
2406eede-27ed-4778-9afb-61f9439f78a3
3
private void initUpdateThread() { updateThread = new Thread(new Runnable() { public void run() { long startTime = 0; long delay = 0; long waitTime = 1000 / 60; while (updateThread != null) { startTime = System.currentTimeMillis(); update(); delay = waitTime - (System.currentTimeMilli...
f8922bdf-4028-4cf4-b0e9-7398226c6751
0
public int getScore() { return score; }
178deb88-fe11-4e8a-943e-2c63f1f8aa6b
9
public GraphicalComponents(JFrame frame, List<StrasseComponentDTO> str, List<OrtDTO> orte2) { super(); pmenu.add(newPoint); this.strassen = str; this.orte = orte2; pa = new PaintAction(orte, strassen, pb, frame); newPoint.addActionListener(pa); this.addMouseListener(new MouseAdapter() { public void...
fde50008-6472-4084-8926-fc0062a2d4dd
4
void onArrowRight (int stateMask) { ScrollBar hBar = getHorizontalBar (); if (hBar == null) return; int maximum = hBar.getMaximum (); int clientWidth = clientArea.width; if ((horizontalOffset + clientArea.width) == maximum) return; if (maximum <= clientWidth) return; int newSelection = Math.min (horizontalOffset...
5dc435db-4877-4b93-bf9a-64a249cc899a
5
public boolean removeItem(Item item) { if (item.amount <= 0) { I.say("Removing null item... "+item.amount) ; new Exception().printStackTrace() ; return false ; } // // Check to see if the item already exists- final Item oldItem = itemTable.get(item) ; if (oldItem == null) retu...
26c5083e-3626-44a1-b6e9-31b27dabb1e3
3
public static int getROTDiameter(String certLoc){ int diameter = 0; //instantiate the first certificate, and then loop from there try{ @SuppressWarnings("resource") FileInputStream fis = new FileInputStream(certLoc); ByteArrayInputStream bis = null; byte value[] = new byte[fis.available()]; fis...
f71f1ea2-81e1-44aa-8a06-1422bf88d71e
1
public final boolean togglePause() { if (paused.getAndSet(true)) { paused.getAndSet(false); } synchronized (this) { notify(); } return paused.get(); }
78ba8880-385a-4769-ae76-8063bd0f64a5
4
public Tile getTileAt(Position p) { if ( p.getRow() == 0 && p.getColumn() == 0 ) { return new StubTile(GameConstants.FOREST, 0, 0); } if ( p.getRow() == 1 && p.getColumn() == 0 ) { return new StubTile(GameConstants.HILLS, 1, 0); } return new StubTile(GameConstants.PLAINS, 0, 1); }
46f717a0-de43-4bdf-812b-39efaf225653
8
public void casesATester(Joueur joueurAdverse, Case caseTouchee) { Case case1 = caseTouchee.getAbs() != 0 ? joueurAdverse.getCases().get((caseTouchee.getAbs() - 1) + this._parametre.getNbCaseX() * caseTouchee.getOrd()) : caseTouchee; Case case3 = caseTouchee.getOrd() != 0 ? joueurAdverse.getCases().get(...
c2fc8db8-e55f-4625-9529-c3d530f92b06
3
public DefaultMutableTreeNode populirajProcedure(DefaultMutableTreeNode top, String baza) { try { DatabaseMetaData mp = Konekcija.getKonekcija().getMetaData(); ResultSet rs = mp.getProcedures(baza, null, "%"); int i = 0; while (rs.next()) { DefaultMutableTreeNode cvor = new DefaultMutableTreeN...
c389b416-2729-48d2-b70b-34c43d54f2ef
5
public static void main (String[] args) { //variable declarations int temperature; String activity = new String(); Scanner scan = new Scanner(System.in); //prompts user for temperature System.out.print("What is the current temperature?\t"); temperature = scan.nextInt(); //if temperature is not go...
4b1229f2-f9df-48db-9846-6f798bdc4e46
4
public static void main(String[] args) { ListPhoneBook lp = new ListPhoneBook(); java.util.List<Contact> ls = lp.getListOfPhoneBook(); if(ls == null) { System.out.println("NULL"); } else { System.out.println("withOUT sort"); for(Contact i : ls) { System.out.println(i.getFirstName()); } lp.setSort...
7674bb2e-746d-413c-bc10-ed147d7cdc65
6
public static Stella_Object stellaHashTableLookup(StellaHashTable self, Stella_Object key) { { KvCons[] table = self.theTable; KvCons bucket = null; if (table == null) { return (null); } if (self.equalTestP) { bucket = table[(((key.equalHashCode()) & 0x7FFFFFFF) % (self.size...
20993f62-ad4d-4359-a766-1483da26ca57
1
@Override public Map<String, Object> getBidOfAuction(String auctionId) { Map<String, Object> bidMap = new HashMap<String, Object>(); TypedQuery<Bid> bidQuery = emgr.createNamedQuery("Bid.findBidByAuction", Bid.class); bidQuery.setParameter("auctionId", Integer.parseInt(auctionId)); try { Bid bid = bidQuery....
a0e34377-50ae-42ab-b17d-09953bd842ff
0
public void setX509SerialNumber(BigInteger value) { this.x509SerialNumber = value; }
5d6f8b1b-8d44-4009-9c4f-3a4fa2f15410
0
@Override public boolean isConverted() { // TODO Auto-generated method stub return false; }
ff477966-a274-49e7-b103-bb8bc2c38395
7
public void p_Reg_play_for_Real( LinkedHashMap<String, LinkedHashMap<String, String>> credentials) { autoutil.openBrowser(dataSheet(credentials,"url","url")); autoutil.waitTime(8000); autoutil.clickButton(dataSheet(credentials,"button","sign"),propFile("link")); autoutil.waitTime(3000); for(Entry<String, ...
62a3ab59-fe3f-41e1-8094-65eb1906cdf2
2
private void setActionButtonsEnabled (boolean enable) { variablePanel.setButtonsEnabled(enable); variablePanel.setVariableListEnabled(enable); for (Component component :getJMenuBar().getComponents()) { component.setEnabled(enable); } for (Component component : toolBar.getComponents()) { component.setEna...
a60dc150-12d1-40cf-997d-b4ad311e6475
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...
62a56ea2-0838-4402-84e4-37b58199f6b6
9
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking, tickID)) return false; if(affected != null) { Ability moodA=affected.fetchEffect("Mood"); if(moodA!=null) { if(text().equals("NORMAL")) affected.delEffect(moodA); else if(!moodA.text().equals(text(...
cd39a159-92dd-41ce-8b22-da73cd05576e
9
public boolean send() { try { String encoding = headers.get("Content-Encoding"); boolean isGzipEncoding = (encoding != null) && encoding.equals("gzip"); String contentType = headers.get("Content-Type"); boolean isZipContentType = (contentType != null) && contentType.contains("/zip"); if (isGzipEncoding...
0e4439b9-477e-4804-a807-54891e993202
9
private boolean largestBSTSubtreeHelper(TreeNode root, long[] min, long[] max, int[] result) { if (root == null) return true; int[] leftResult = new int[]{0}; int[] rightResult = new int[]{0}; long[] leftMax = new long[]{Long.MAX_VALUE}, leftMin = new long[]{Long.MIN_VALUE}; long[] rightMax = new long[]{Lo...
1e498b5a-759a-46e8-be91-83b88ce78698
3
public CrawlerConfiguration(final String beginUrl) { if ((beginUrl == null) || (beginUrl.trim().length() == 0)) { throw new IllegalArgumentException("beginUrl cannot be null or empty"); } if (!Pattern.compile("(?s)^http[s]?://.*$").matcher(beginUrl).matches()) { throw new IllegalArgumentException("beginUrl ...
7a689ae2-7b91-492a-9f94-79f377a1d6f7
2
public UploadableFile(AmazonS3 s3, File baseDir, File file, String bucket, String targetDir) { super(file.getAbsolutePath()); this.s3 = s3; this.baseDir = baseDir; this.bucket = bucket; if (targetDir == null) { targetDir = ""; } else if (! targetDir.endsWith...
d64bdb99-0e63-4b76-b65e-f7eeaccc0a2a
5
public void input() { if(gameFocusable) { player.input(); world.input(); hud.input(); } if(Input.isKeyPressed(Input.KEY_ESCAPE)) Main.instance.stop(); if(Input.isKeyPressed(Input.KEY_LCONTROL)) Transform.setProjection(Transform.getFOV() - 40, Window.getWidth(), Window.getHeight(), 0.1f, 100...
e37ee6de-2b14-41ea-9705-07b748faf353
7
public static void main(String[] argv) throws IOException { int i; // parse options for (i = 0; i < argv.length; i++) { if (argv[i].charAt(0) != '-') break; ++i; switch (argv[i - 1].charAt(1)) { case 'b': try { ...
82945cc7-aaec-4493-acd7-584e0b992aca
1
@Override public JSONObject main(Map<String, String> params, Session session) throws Exception { JSONObject rtn = new JSONObject(); rtn.put("rtnCode", this.getRtnCode(200)); JSONArray userJa = new JSONArray(); List<User> aUser = User.list(); for(int i=0; i<aUser.size(); i++) { userJa.put(aUser.get(i).t...
b4d8c8c4-f4b5-46d4-9325-826b77bda499
7
@Test public void TestAcquireAndReleaseSameSize() throws IOException { mapEntryPool = new MapEntryFactoryImpl(testDir, "TestAcquireAndReleaseSameSize"); MapEntry[] entries = new MapEntry[10]; for(int i = 0; i < 10; i++) { entries[i] = mapEntryPool.acquire(1024); } assertTrue(mapEntryPool.getFreeEntr...
946e19ea-bfd3-4113-ae7e-2396b2af710a
9
@Override public void setToCurrent() { for (int i = 0, limit = getPreferenceListSize(); i < limit; i++) { PreferencesGUITreeComponent comp = getPreference(i); Preference pref = comp.getPreference(); if (comp instanceof PreferencesGUITreeTextFieldComponent) { JTextField text = (JTextField) comp.getCo...
b6c11fb1-e2f7-4600-b497-0486688fd5fa
1
public void setAllowIndeterminateResults(boolean b) { final CycSymbol value = b ? CycObjectFactory.t : CycObjectFactory.nil; put(ALLOW_INDETERMINATE_RESULTS, value); }
47b0b7dc-bae3-4ad1-8334-e64fd8a16c7d
9
private static List<Position> calculateRangeCirclePoints(final SatPos pos, double incrementDegrees) { final double radiusKm = pos.getRangeCircleRadiusKm(); final double latitude = pos.latitude; final double longitude = pos.longitude; final double beta = radiusKm / R0; List<Position> result = new ArrayLis...
1aef14fb-c117-4003-a2be-cc20185310d2
6
public Object getValueAt(int row, int column) { if (row >= listData.length) throw new IndexOutOfBoundsException("Table row "+row+" is not valid"); PriceHistory h = listData[row]; Object value; switch (column) { case 0: // Date ...
42cbe7fe-4773-4864-bcb8-73b7e278b962
8
public int getOrbitalNum() { int row = getRow(), col = getCol(); if(col == 1 || col == 2) return 2; else if(col >= 13 && col <= 18) return 6; else if(col >= 3 && col <= 12) return 10; else if(row == 8 || row == 9) return 14; else { System.err.print("getOrbitalNum - Can't find a element ...
fbbbf088-23bf-44e3-ab55-13a31b22bb6c
1
@OnClose public void onClose(Session userSession) throws IOException { chatroomUsers.remove(userSession); Iterator<Session> iterator = chatroomUsers.iterator(); while (iterator.hasNext()) { (iterator.next()).getBasicRemote().sendText(buildJsonUsername()); } }
ad06dc06-eb0b-4c1e-a97c-647c1ef6699f
8
@Override public Object getValueAt(int rowIndex, int columnIndex) { ResultGroup group = resultGroups.get(rowIndex); switch (columnIndex) { case 0: return group.toString(); case 1: return result.getValue(group.minIteration); case 2: return ...
cf68498d-4247-4bd9-b112-16d0226aae7d
4
@Override public boolean equals(Object object) { if (!(object instanceof Vinculo)) { return false; } Vinculo other = (Vinculo) object; return (this.matricula != null && !this.matricula.equals(other.matricula) && this.pessoa!=null && this.pessoa.equals(o...
a6588dd5-5433-414b-ba81-68d40a9dc0d9
5
public MessageR oplus(NodeFunction sender, NodeVariable x, FunctionEvaluator fe, LinkedList<MessageQ> messagelist) { HashMap<NodeVariable, MessageQ> modifierTable = new HashMap<NodeVariable, MessageQ>(); Iterator<MessageQ> iterator = messagelist.iterator(); while (iterator.hasNext()) { ...
729c08dc-02c6-4c93-9108-cef2ed68a181
3
public static final void buyMedicine() { String page = getString("quests/wait"); // <b>Kostet dich <span>43</span> int offset = page.indexOf("h <span>"); if (offset == -1) { // Für <span>43</span> offset = page.indexOf("r <span>"); if (offset == -1) return; } page = page.substring(offset); ...
43c20cdc-8198-4763-ae33-af0418d94bf6
2
public static boolean writeTextFile(Path file, List<String> lines, boolean append) { if ((file == null) || Files.isDirectory(file, LinkOption.NOFOLLOW_LINKS)) { return false; } return FileWriter.writeFile(file, lines, append); }
0227fbeb-b5b3-49c8-973f-9085998f39fa
3
public void createHelpPnl(){ if (help.equalsIgnoreCase("Game/Battle Help")){ createGHelp(); } else if (help.equalsIgnoreCase("Character Help")){ createChHelp(); } else if (help.equalsIgnoreCase("Magic/Item Help")){ createMagItem(); } ...
77b67681-236e-42f9-998a-c76a56fb7d6c
5
public void newfile() { if(!saved) { this.console.setText("<html>New : File not saved"); int choice = JOptionPane.showConfirmDialog(this, "Modifications have been done. Do you want to save ?", "Last Warning", JOptionPane.INFORMATION_MESSAGE, JOptionPane.YES_NO_CANCEL_OPTION); if (choic...
cd4aaacd-ce5f-4f03-9e7b-eb401fc7333c
6
public void write(char[] b, int off, int len) throws IOException { /* Note that setText and append are thread safe! */ if (!initialized) { area.setText(""); initialized = true; } String str = new String(b, off, len); StringBuffer sb = new StringBuffer(len); while (str != null && str.length() >...
ad81edab-58aa-45fc-88f3-4d15b147777b
5
@SuppressWarnings("rawtypes") public static MultiColumnComparator createLongComparator(NumberName[] numberNames, boolean ascending, String defaultString) throws Exception { final String type="long"; if (ascending) { if (defaultString.equals("")) { return new MultiColumnComparator(num...
4d08f722-a9d4-4a0c-87ba-827dfbb95873
8
private Command parse(String userInput) { if (userInput == null) { return null; } StringTokenizer tokenizer = new StringTokenizer(userInput); if (tokenizer.countTokens() == 0) { return null; } CommandName commandName = null; String userNa...
cd8d57f9-0ead-4cb9-a448-8ebaa6e504d0
0
@Override public boolean supportsMoveability() {return false;}
2870cb06-3516-4b10-bd95-8528d131e024
9
public void luckyRoll(Player p){ int n = -1; boolean gauntlet = (p.inventory.contains(Card.gauntlet) || p.inventory.contains(Card.gauntletii)) && !spectralImmune(p); String head = "Lucky Roll"; String textBlock = "You rolled a 7! choose a dice roll to go anywhere you want!"; ArrayList<String> strList = new Ar...
00caf9b8-0b97-4b49-beaa-731147438392
3
public void addCashOffice(CashOffice cashOffice) { if (cashOffice == null) { throw new NullObjectInsertionException("Null CashOffice cannot be added"); } if ( !existCashOffice(cashOffice) && !hasCashOfficeWithSameNumber(cashOffice)) { cashOffices.add(cashOffice); cashOffice.setCinema(this...
aabb8337-ca3a-43b6-afbe-c19bcafcaba0
9
void doWork() { File writeFile = new File(writePath); File readFile = new File(readPath); FileWriter writer = null; try { writer = new FileWriter(writeFile, false); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } FileReader reader = null; try { reader =...
9a94b51c-8969-40b2-a96a-409b2e0fb344
3
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof AIGraph)) return false; AIGraph otherG = (AIGraph) obj; // assumption: both Hashmaps must be equal return otherG.getEdgeMap().equals(this.getEdgeMap()) && otherG.getVerticeMap().equals(this.getVerticeMa...
156a5a7b-3a02-4af9-bbae-75343cfa8cf1
5
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; ...
b0201048-290a-402d-b564-e5f72033ad77
8
@Override public Class<?> loadClass(String name) throws ClassNotFoundException { // no mater what, do not allow certain classes to be loaded by this // class loader. change this as you see fit (and are able to). if (name.startsWith("java.")) { return super.loadClass(name); } else if (name.startsWith(...
13df0a97-21fd-42c5-bdd7-d548d5517598
7
public void actionPerformed (ActionEvent event) { // like simulate method of Assignment 1, double nextStop=t+refreshPeriod; // the arguments are attributes here. double Ek=0,Ep=0; Ball bola; Spring resorte; for (; t<nextStop; t+=delta_t){ Ek=0; Ep=0; for...
3f37474a-f87a-49ae-8a1f-c390e104a584
0
public WumpusGUI(){ game = new Grid(); textViewPanel = new TextViewPanel(game); guiViewPanel = new GUIViewPanel(game); viewContainer = new JTabbedPane(); moveButtonPanel = new MoveButtonPanel(); arrowButtonPanel = new ArrowButtonPanel(); layoutThisFrame(); game.addObserver((Observer) textViewPanel...
79f2abb2-6ee3-4ee7-bb2d-27d18796157a
5
public void paint(Graphics g) { m_fm = g.getFontMetrics(); g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); getBorder().paintBorder(this, g, 0, 0, getWidth(), getHeight()); g.setColor(getForeground()); g.setFont(getFont()); m_insets = getInsets(); int x = m_insets.right; int y = m...
e701fbe4-3501-4cfb-bf59-e2d6d5c204c1
4
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g...
4d2cc1d7-caef-4c5f-a89d-450e26b354e8
4
public static void pprintTree(Tree t, int indent) { if (t != null) { StringBuffer sb = new StringBuffer(indent); if (t.getParent() == null) { System.out.println(sb.toString() + t.getText().toString()); } for (int i = 0; i <...
272b36a6-ecf7-4bc5-bf18-9f632e515f6b
2
private void viewUsers() { AdminService admService = new AdminService(); panelVizualizareUseri = new JPanel(); //listUsers = new JList<>(); listUsers = new JList(new UsersListModel(admService.getUserList())); listUsersPanel = new JScrollPane(listUsers); listUsersPanel.setBounds(10, 10, 320, 500); panelVi...
42bb92c7-4c33-4c54-9379-66dcdac45351
0
public ListIterator(Node<Item> first) { current = first; }
6e1ccf9f-a940-4232-af5e-663e4458b3da
0
public int getMaxV(){ return maxVelocity; }
6179d367-3828-432a-9040-707804fcc732
2
public static int lireEntier(String message) { int i = 0; boolean ok; do { ok = true; try { System.out.print(message); clavier = new Scanner(System.in); i = clavier.nextInt(); } catch (Exception e) { System.out.println("Mauvais format"); ok = false; } } while (!ok); return i; ...
9a9bb07c-e8a5-41bf-8937-afcaa4eb3fbe
8
private void scrapeSearchResults(String site) { ArrayList<AnimeSearchResult> animeList = new ArrayList<AnimeSearchResult>(); try { Document doc = Jsoup.parse(site); if (doc.select("div:containsOwn(No titles that matched your query were found.)").size() == 1) { re...
6590b3bf-1fd1-46da-90da-003272a7d11c
3
public boolean writeStringValue(String key, String valueName, String value) { try { OpenResult openResult = openKey(key, ALL_ACCESS); if (openResult.mSuccess) { if (METHOD_SET_VALUE_EX == null) { METHOD_SET_VALUE_EX = getMethod(mRoot.getClass(), "WindowsRegSetValueEx", int.class, byte[].class, byte[].c...
c08e8ab5-ccdc-4b41-b58c-f1704c8fb75b
3
public TextLine(String text) { if(text.contains("<")) { for(String segment : text.split("<")) { if(!segment.isEmpty()) { segments.add(new TextSegment(segment.split(">")[0], segment.split(">")[1])); } } } else { segments.add(new TextSegment(null, text)); } }
af0e8d55-ed5d-41cf-8712-750656370cfd
1
@Override public void logicUpdate(GameTime gameTime) { for (Entity entity : entityList) { customProcess(entity, gameTime); } }
95a1ef92-6229-4607-a777-6e6f75d336aa
5
@SuppressWarnings ({"unchecked"}) protected final GEntry appendEntry(final GKey key, final GValue value, final boolean verifyLength) { final int hash = this.getKeyHash(key); final Object[] table = this._table_; if (table.length == 0) { this.verifyLength(1); this._size_++; this._table_[0] = this.createEn...
fb7a16cd-a69f-4344-8956-05752a9be616
0
ServerFormatResponce (int id, String name) { this.id = id; this.name = name; }
1f780a8b-1bea-461d-82cb-a4fb2aa4df06
4
@Override public void update() { this.repaint(); if (rp != null && rp.getScore() != null && rp.getLanguage() != null && !rp.isGameOver()) { scoreText.setText(getScoreText()); livesText.setText(getLivesText()); bonusText.setText(getBonus...