method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
dceab551-ecbf-4ccd-b865-fb7b5dde5823
6
private Response unpack() throws MikrotikApiException { if (line == null) { nextLine(); } switch (line) { case "!re": return unpackRe(); case "!done": return unpackDone(); case "!t...
fda86a08-5f11-4c97-bdb6-1633811cd9a9
3
public void push(Element element) { if (reversed) { reverse(); } if (firstElement != null) { Element tmp = firstElement; while (tmp.getNextElement() != null) { tmp = tmp.getNextElement(); } tmp.setNextElement(element); ...
e3f60675-53d7-43da-a625-1cec36cb766e
8
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed if (rb3.isSelected() || rb4.isSelected()) { try { prefs.flush(); } catch (Exception e) { logger.e...
f4317a2b-359a-4831-ac75-7acea94969be
1
private boolean jj_2_33(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_33(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(32, xla); } }
430f8322-4476-42c3-92d7-23897e4265b5
9
public void parseParameters(String paramstring) throws MaltChainedException { if (paramstring == null) { return; } final String[] argv; String allowedFlags = "sceB"; try { argv = paramstring.split("[_\\p{Blank}]"); } catch (PatternSyntaxException e) { throw new LiblinearException("Could not split t...
9f11bb1b-b53b-44f1-8b0a-7e959177da7d
9
private static void readLanguageProperties(Path languageProperties) { languages = new LinkedList<>(); List<String> tmp = FileUtil.readTextFile(languageProperties); for (String s : tmp) { String[] ar = s.split(SPLIT_EQUAL); if (ar.length == 2) { String n...
00f2d1ba-1a25-4f75-ac08-d692c7873212
8
public void parse() throws Exception { initConfig(); String action = ""; while (!action.equals("ACCEPT")) { Symbol beta1 = beta.pop(); Symbol alpha1 = alpha.peek(); if ( beta==null || alpha==null ) { throw new Exception("ERROR: stack are empty"); } SymbolPair pair = new...
46e26486-ed34-4d9d-b8ec-9d2d55786f7f
6
public boolean validateTileImprovementPlan(TileImprovementPlan tip) { if (tip == null) return false; Tile target = tip.getTarget(); if (target == null) { logger.warning("Removing targetless TileImprovementPlan"); tip.dispose(); return false; } ...
1c3c0268-0390-4132-8840-79099e8eda39
0
public Color getFill() { return fill; }
86107670-624e-4a72-8a84-7c9da1a98954
8
public int calculateDistance(MazeCell A, MazeCell B){ int colOfA = A.get_MazeCellcol(); int rowOfA = A.get_MazeCellrow(); int colOfB = B.get_MazeCellcol(); int rowOfB = B.get_MazeCellrow(); int distanceRows = rowOfB- rowOfA; int distanceCols = colOfB- colOfA; ...
cb9c7576-0a4c-46d3-9f47-5fb1645cb88c
4
@Override public void periodicAddonUpdate() { if(stopwatchRunning) ++stopwatchTime; Iterator<StopwatchTimer> it = timers.iterator(); while ( it.hasNext() ) { StopwatchTimer t = it.next(); if(!t.update()) { it.remove(); stop...
04707618-be28-4e7d-a6a5-d461776c2c2b
2
public boolean isErrorProteinLength() { if (!Config.get().isTreatAllAsProteinCoding() && !isProteinCoding()) return false; cds(); return (cds.length() % 3) != 0; }
92158aaa-1089-4200-9f15-3cabc1a893e4
6
public static void main(String[] args) { List<Apple> inventory = new ArrayList(); Apple apple1 = new Apple(100L, "green"); inventory.add(apple1); Apple apple2 = new Apple(120L, "green"); inventory.add(apple2); Apple apple3 = new Apple(140L, "green"); inventory.ad...
d0f5f9ce-0a8b-4b07-bcaa-439af464e86a
0
public void turboBoost() { controls.turboBoost(); }
1adbc0bb-4b3f-46b3-9519-226bc7a43e94
9
public static final void main(final String[] args) throws Exception { LogManager.getLogManager().reset(); Logger globalLogger = Logger.getLogger(java.util.logging.Logger.GLOBAL_LOGGER_NAME); globalLogger.setLevel(java.util.logging.Level.OFF); if(args.length > 0){ n = Integer.decode(args[0]); } nDel =...
f78a0fe7-69f3-4bbe-ac56-5a80c14b44f9
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ArrayTypeNode other = (ArrayTypeNode) obj; if (node == null) { if (other....
a6b5acb7-c9dd-4c51-820f-67993ab832ca
5
@Override public void run() { synchronized (sync) { if (!gui.isAborted()) { if (guiBuild.getSizeElevatorContainer() > 0) { do { guiBuild.setMoved(true); guiBuild.xPositionExit -= ofset; try { sync.wait(); } catch (InterruptedException e) { logger....
c0aeacee-4389-447b-bd48-ca29e8942c03
8
public static int hg_step3(int step, int[][] mask, int[] colCover) { //What STEP 3 does: //Step 3 works on the mask matrix only. It examines each column and if //the column has a starred zero, then it covers it. If k columns are //covered, where k is min(rowsOfInputtedArray, colsOfInputtedArray),then //we go...
1e0baa75-88c7-4e0a-87a7-c12cb37ecc46
0
@Override public void onDisable() { this.listener.cleanup(); }
44c306e6-f064-4241-a35a-d0e8462cd49a
9
protected int diff_commonOverlap(String text1, String text2) { // Cache the text lengths to prevent multiple calls. int text1_length = text1.length(); int text2_length = text2.length(); // Eliminate the null case. if (text1_length == 0 || text2_length == 0) { return 0; } // Truncate th...
dc10c20b-3676-4936-a184-62acfedb62de
1
private void parseParts() { for(int i = 0; i < this.Cells; i++) { BufferedImage part = this.AnimationSheet.getSubimage((this.StartX + this.CellWidth)* i, this.StartY, this.CellWidth, this.CellHeight); this.AnimationImages.add(part); } }
ba1813a2-e909-4006-9197-2aafc310c9a5
8
public void setControlPanelVisible(boolean b) { if (b) { if (startIcon == null) { startIcon = new StartIcon(Color.WHITE, 32, 32); startIcon.setStroke(moderateStroke); startIcon.setBorderPainted(true); } if (resetIcon == null) { resetIcon = new ResetIcon(Color.WHITE, 32, 32); resetIcon.set...
383b28fa-216e-49a2-a141-c2c3a354308e
7
public Constant newConst(final Object cst) { if (cst instanceof Integer) { int val = ((Integer) cst).intValue(); return newInteger(val); } else if (cst instanceof Float) { float val = ((Float) cst).floatValue(); return newFloat(val); } else if (cst instanceof Long) { long val = ((Long) cst).longVal...
13faa3a2-c302-45bc-9e6a-1277065f4591
6
private boolean collision() { if (game.getRacquet1().getBounds().intersects(getBounds())) { double intersect = getBounds().getCenterY() - (game.getRacquet1().getBounds().getCenterY()-(game.getRacquet1().HEIGHT/2)); if(Math.abs(intersect) < (game.getRacquet1().HEIGHT/3)){ ...
323c8197-e491-49ee-b870-48cd17850e1c
1
@Override public void draw(Graphics2D g) { super.draw(g); if(timer > 0) g.drawImage(fire.getImage(), (int) ((xScreen + xmap) - (width / 2)), (int) ((yScreen + ymap) - (height / 2)), null); }
a36d31a1-262c-4ae9-92e3-3c43bee62a12
5
public static void merge(int[] a, int low, int mid, int high) { int i = low; int j = mid + 1; for(int k = low; k <= high; k++) aux[k] = a[k]; for(int k = low; k <= high ; k++) { if(i > mid) a[k] = aux[j++]; else if(j > high) a[k] = aux[i++]; else if( less(aux[j], aux[i...
c73f561e-68a0-45fe-ab1d-d83a8125849e
0
@Override public void modifiedStateChanged(DocumentEvent e) { calculateEnabledState(e.getDocument()); }
99595954-97d7-449e-a0f1-5ddcf9050109
1
public static void main(String[] args) { Arguments.processArguments(args); if (!Arguments.argumentsValid()) { logger.fatal(Arguments.helpArgs()); return; } logger.info(Arguments.showString()); //String dir = FileHelper.getRootPath(); String filename = Arguments.get(Arguments.fil...
d54a0346-e8ac-4788-8b7d-63622fb10b21
0
public String getPath() { return screenPath; }
c43a0acf-df2c-41ac-b34b-7b24a65f226e
9
private void submitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitActionPerformed if(!stu_prof.isSelected() && !fac_prof.isSelected() && !clr_prof.isSelected()) { JOptionPane.showMessageDialog(this, "Please make a selection"); } else if(stu_prof.isSelected()) { String i= stu_roll.getText(); ...
52573d4a-20c7-4bfa-a304-02ef97c0d1e0
0
private void createRightSidePanel() { tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBounds(0, 0, 1000, 816); createTabPage1(); createTabPage2(); tabbedPane.addTab("Gra", projectTabPane); tabbedPane.addTab("Użytkownicy", userTabPane); rightSidePanel.add(tabbedPane); }
68ed389e-9140-4330-954a-c2a44949a3ab
2
@Override public void execute(VirtualMachine vm) { int i = 0; for (;;) { System.out.print("? "); try { i = Integer.parseInt((new BufferedReader(new InputStreamReader( System.in))).readLine()); } catch (Exceptio...
04411fce-dbcc-4b9f-be80-82a82f51cc2a
5
private float interactionForceGoal(float desiredDistance, float distance, objectType object) { //Attractive force acting on robot float attractive; //Repulsive force acting on the robot float repulsive; //Net force acting on robot float force; swi...
22146873-cddc-43b1-9883-0d68756cf22c
8
private int lookupTargetType(Object column) { // 1.6 doesn't support switch statement with string object String type = typeMap.get(column); int targetType = Types.NULL; if (type.equalsIgnoreCase("uuid")) { targetType = Types.OTHER; } else if (type.equalsIgnoreCase("character varying")) { targetType = Ty...
283912cf-b7ea-4809-b281-4d7d9363f0b4
1
private void printDebug(String str) { if (debugTest) { System.out.println(str); } }
281de2e8-32b3-4523-bf5e-21aac7272726
2
public void setInit(InstructionBlock initBlock) { if (type == POSSFOR) { this.initBlock = initBlock; } else if (type == FOR) { this.initInstr = initBlock.getInstruction(); initBlock.removeBlock(); } }
052ed919-b76f-45bd-8ec3-6f8a060c9cf9
6
public boolean pressUpButton() { Lib.assertTrue(!inElevator && floor < numFloors-1); for (int elevator=0; elevator<numElevators; elevator++) { if (elevators[elevator].doorsOpen && elevators[elevator].direction == ElevatorBank.dirUp && elevators[elevator].floor == floor) return false; ...
10399ba4-e432-4f5f-8962-98d6124aa4aa
5
@Override public void handle(HttpExchange he) throws IOException { String resource = he.getRequestURI().getPath().substring(5); StringBuilder br = new StringBuilder(); String contentType = ""; if (resource.equals("online")) { String onlineUsers = handler.getUsers(); ...
8b6fa197-07bc-4c06-8bc7-3a132f6b935f
0
@Override public String toString() { return "("+x+","+y+","+z+")"; }
6fdac05e-9b71-46b2-b988-c371d509251f
0
public String getClassFieldString() { return classFieldString; }
2724a849-070c-46ab-b9ed-b37a29531b91
7
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking,tickID)) return false; if((affected instanceof MOB) &&(tickID==Tickable.TICKID_MOB) &&(!CMLib.flags().isFalling(affected)) &&(((MOB)affected).riding()==null) &&(((MOB)affected).location()!=null) &&((((MOB)affected).l...
bb4cded8-ac68-45a0-b251-e925df8528ed
8
public String getAllInfo() { //returns all the info of the current student String nameOutput = ""; String gradeOutput; String assignmentOutput = ""; String output; String passingOutput; String gradeVar = ""; String passingVar; Integer assignmentCount = 1; this.grade = this.getGrade(); nameOutput = "...
e2b53f6d-f1a9-4094-badc-275ecc8d03f8
7
@Override public Object evaluate(ArrayList<Context1> pila) throws Exception { StringBuilder output = new StringBuilder(); int conta = 0; while ((Boolean) condicion.evaluate(pila) == true) { conta ++; //This is to avoid infinite loops. if(conta > 100000){ conta = 0; if(stopLoop()) break; ...
c0111b21-81bc-4e73-a629-3addbfcdde24
8
private void checkForNight(final LocalDateTime DATE_TIME) { int hour = DATE_TIME.getHour(); int minute = DATE_TIME.getMinute(); if (0 <= hour && minute >= 0 && hour <= 5 && minute <= 59|| 17 <= hour && minute <= 59 && hour <= 23 && minute <= 59) { getSkinnable().setNightMo...
2a2ed7f3-0f87-44e3-b3f0-9b8c56772207
8
public void initComponents() { drumJList = new javax.swing.JList(); setLayout(new BorderLayout(0, 0)); add(drumScrollPane, BorderLayout.NORTH); DefaultListModel drumModel = new DefaultListModel(); for(Object str: drumNames){ drumModel.addElement(str); ...
9b513cc6-3717-42c9-9fbb-f80fe0ffbb90
9
public void run(){ boolean suspected = false ; // If we have a list of replies from a previous repetition // calculate suspected processes if (started) { for(int i = 0; i <= p.getNo(); i++) { if (i != 0 && i != p.pid) { if (!successfulReplies[i-1] && !suspec...
64b4759f-f25f-4b32-87d5-7a21bc8dfd2d
7
public DoubleAuctionTemplate[] receiveSameTemplates(Template tpl) { String queryString = ""; int i = 0; for (i = 0; i < 9; i++) { Integer min; Integer max; try { min = (Integer) PropertyUtils.getSimpleProperty(tpl, "property" + i + "_min"); max = (Integer) PropertyUtils.getSimpleProperty(tpl, ...
8fd8a51f-1b14-46b4-8aa2-0ef5b01c8d54
4
public static double LinkedListBench(int number) { LinkedList ll = new LinkedList(); long addLastTime = System.currentTimeMillis(); for (int i = 0; i < number; i++) { ll.addLast("" + Math.random()); } addLastTime = System.currentTimeMillis() - addLastTime; ll = new LinkedList(); long addFirstTime = ...
e0eba0d0-db7c-422e-807f-9ae3a6fbec7c
7
private CardPower isThreeOfKind(int[] valueCounts) { int highCard = -1; int kickerCardA = -1; int kickerCardB = -1; for (int i = valueCounts.length - 1; i >= 0; i--) { if (valueCounts[i] == 3) { highCard = i; break; } } if (highCard >= 0) { for (int i = valueCounts.length - 1; i >= 0; i--) ...
1ce8f24b-5a54-423f-b2f0-751343b3816f
8
public static int countAnts(int[] x, int[] y, String direction) { boolean[] ants = new boolean[x.length]; checkIntersect(x, y, ants); char[] dir = direction.toCharArray(); for (int j = 1; j <= 2000; j++) { for (int i = 0; i < x.length; ++i) { int dx = 0; int dy = 0; if (dir[i] == 'E') dx ...
12cfb7a0-1182-463f-b010-d040913776b9
7
public LegendItem getLegendItem(int datasetIndex, int series) { CategoryPlot cp = getPlot(); if (cp == null) { return null; } if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) { CategoryDataset dataset; dataset = cp.getDataset(datasetIn...
ccbdde13-a410-41d2-9609-22c38484b361
3
private void updateTrend(TrendBar bar, Quote quote) { double quotePrice = quote.getPrice(); if (bar.getTimestamp() < 0) { bar.setOpenPrice(quotePrice); bar.setTimestamp(1); } else { bar.setClosePrice(quotePrice); } if (quotePrice < bar.getLowPr...
f9983042-3dfd-4f5a-af6a-b946524d34e5
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 Origem)) { return false; } Origem other = (Origem) object; if ((this.codorigem == null && other.codorigem != nu...
2bb90b13-567c-4f75-be78-f7a4d58ac2d4
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://...
3b5aa2ce-9f43-4f75-9a9d-5ce20c0e783c
2
public int compareTo(Card o) { return getRank().getValue() < o.getRank().getValue() ? 1 : (getRank().getValue() > o.getRank().getValue() ? -1 : 0); }
789809a1-882f-4c4c-970d-0b0688b68577
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...
06eed02d-41cc-4370-838a-6dcfd8dd261a
2
public long getLong(int index) throws JSONException { Object object = this.get(index); try { return object instanceof Number ? ((Number)object).longValue() : Long.parseLong((String)object); } catch (Exception e) { throw new JSONException("J...
2c1b3cf3-5d18-4e40-a910-698127155577
7
protected void eatCombinationTwo() { int yellow = 0; int red = 0; for (Iterator<Plant> it = plants.iterator(); it.hasNext();) { Plant pl = it.next(); if (pl.getType() == Plant.YELLOW_PLANT && yellow < 1) { it.remove(); yellow++; } if (pl.getType() == Plant.RED_PLANT && red < 1) { it.remove...
6cb7aeac-7c74-4601-b329-f102f5bbf26e
9
public void loadPuzzle (String difficulty) { File file; /* Uses if statements to check the difficulty level passed */ if (difficulty.equals("Easy")) { file = new File("easy16x16.txt"); } else if (difficulty.equals("Medium")) { file = new File("medium16x16.txt"); } else if (difficulty.equals(...
8395db9c-3105-484f-b8ea-e8284b46d2cb
6
protected boolean containsTank(int x, int y){ for(Tank t: _enemyTanks){ if(t.getX() == x && t.getY() == y) return true; } for(Tank t: _playerTanks){ if(t.getX() == x && t.getY() == y) return true; } return false; }
1c96d51e-5196-43a4-b2af-ce8d96b01661
1
public void initOperands(int opcount) { operandcount = opcount; subExpressions = new Expression[opcount]; for (int i = 0; i < opcount; i++) { subExpressions[i] = new NopOperator(Type.tUnknown); subExpressions[i].parent = this; } updateSubTypes(); }
3164881a-e7ee-4de3-8db7-95191de48e6f
2
@SuppressWarnings("unchecked") private void checkValidVerifyMove(VerifyMove verifyMove){ /** * Legal Move should be (assume lastMoveId is wId) * Case A: current game is end and role should switch between players * 1 add(new SetTurn(bId)) * 2 add(new Set(GUESSHISTORY, ImmutableList.<String>of()...
10b31e13-540b-4250-9eaa-ead7d473724d
9
public static void main( String[] args ) throws IOException, InterruptedException, ClassNotFoundException { System.out.println("Version 0.2"); int start = 100; int recordByteLength = 10; System.out.println(start - (start % recordByteLength) + recordByteLength); if (args.le...
8a4d053b-5313-44b2-86e3-a9a7cb9d77cd
3
private int getRealisticByteModification(int fileSize, ModificationPart part) { int filePart = fileSize / 3; int multi; switch (part) { case B: multi = 0; break; case E: multi = 2; break; case M: multi = 1; break; default: multi = 2; break; } int byteStart = random.nextInt(f...
29222769-559b-4179-b335-7d3064d27044
5
private boolean checkName(String name){ name = name.toUpperCase(); switch (name){ case "MATUTINA": return true; case "VESPERTINA": return true; case "NOCTURNA": return true; case "PRIMERA": re...
6726ba3e-1322-4d4f-9ceb-0f0557412cf3
8
public void run () { C.Trying=true; CF.movestyle(C.MoveStyle); if (Global.getParameter("userelay",false)) { if (!CF.connectvia(C.Server,C.Port,C.User, S.equals("")?C.Password:S, Global.getParameter("relayserver","localhost"), Global.getParameter("relayport",6971))) { CF.setVisible(false); CF.dispo...
bfe07bc8-dec1-4c1f-a8b1-926414edfe2b
8
public static void main(String[] args) { System.out.println("Bem vindo ao gerenciador de tarefas \n \n"); while (true) { System.out .println("O que deseja fazer ? \n " + "1-Cadastrar nova tarefa \n " + "2-Listar tarefas concluidas \n " + "3-Listar tarefas em aberto \n " + "4-Remo...
0598ee99-7512-4b6a-8bf7-ab2d84e8dc4f
1
public static void main(String[] args) { try { MainWindow window = new MainWindow(); window.open(); } catch (Exception e) { e.printStackTrace(); } }
a1d48d43-83b3-4806-bf77-5ff8a3bcb823
7
@EventHandler public void WitherHeal(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.Heal.Dodge...
6c37dd91-1f8e-432e-b512-4308f70c3209
7
public static boolean ruleCoversExampleP(Cons reverseRule, TrainingExample example) { if (reverseRule == Stella.NIL) { return (true); } { QueryIterator query = null; Cons rule = ((Cons)(Stella_Object.copyConsTree(reverseRule))).reverse(); List vars = ((List)(Logic.getVariablesFromConsPropo...
5354b420-e311-424d-9c0c-d0d9bd732c59
3
private void addChild(Node child) throws NetworkException { children.add(child); for (Iterator<Node> it = children.iterator(); it.hasNext();) { Node have = it.next(); if (have == child) { continue; } if (child.ge...
68d31740-4f9f-499a-bfb7-6e911fde66f1
6
private static String excutePost(String[] urlName, String[] urlAttribute) { String urlParameters = "x=y"; try { for (int i = 0; i< urlName.length; i++){ urlParameters += "&"+urlName[i]+"=" + URLEncoder.encode(urlAttribute[i], "UTF-8"); } } catch (UnsupportedEncodingException e) { WEB_STATUS = 5; ...
ef849038-1d18-47c3-b017-65d4d81272c1
1
public Quaternion getTransformedRot() { Quaternion parentRotation = new Quaternion( 0, 0, 0, 1 ); if ( parent != null ) parentRotation = parent.getTransformedRot(); return parentRotation.mul( rot ); }
789087d1-d073-46d4-80b9-ac80719348a0
2
public void printWeapons() { int size = weapons.getInvSize(); for (int i = 0; i < size; i++) { Weapon indexWeapon = weapons.getWeapon(i); if (indexWeapon != null) { System.out.println(i + ") " + indexWeapon.getName()); } } }
7779bb2d-26ce-410f-824d-79f05b33a590
7
public List<Map<String, Object>> findMoreResult(String sql, List<Object> params) throws SQLException { List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); int index = 1; pstmt = connection.prepareStatement(sql); if (params != null && !params.isEmpty()) { for (int i = 0; i < params.size(...
93716a15-0146-4b26-bb96-38162ca679e4
8
public void tratarMensagem(Socket origem, Object mensagemCrua) { if (mensagemCrua instanceof Integer) { mainframe.updateProgress((int) mensagemCrua); } else if (mensagemCrua instanceof String || mensagemCrua instanceof Mensagem) { Mensagem mensagem = Mensagem.valueOf(mensagemCrua.toString()); switch (m...
9a981c9b-f42c-4e4f-9133-e1b7a6e2b977
6
private void LoadUpTree() { //DefaultTreeModel model = new DefaultTreeModel("root"); DefaultMutableTreeNode root = new DefaultMutableTreeNode(selectedProject) ; DefaultTreeModel treeModel = new DefaultTreeModel(root); DefaultMutableTreeNode elementNode = null; DefaultMutableTreeNode assetN...
bfb8aa64-00db-405a-af94-f9c9f08a9da3
6
public Header readFrame() throws BitstreamException { Header result = null; try { result = readNextFrame(); // E.B, Parse VBR (if any) first frame. if (firstframe == true) { result.parseVBR(frame_bytes); firstframe = false; } } catch (BitstreamException ex) { if ((ex.getErrorCo...
9c424c12-1250-498f-8d2d-6aabc56d33b8
5
public void moveLayer(int from, int to) { if (from < 0 || from >= getLayersNb() || to < 0 || to > getLayersNb() || from == to) { return; } addUndo(new CPUndoMoveLayer(from, to)); moveLayerReal(from, to); }
fc924655-693a-4f1a-a87d-5fc462ed0c95
9
public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage:"); System.out.println(" Type1Decode <filename> <decode-start>"); System.exit(-1); } try { File file = new File(args[0]); if ...
d712d77e-b038-4e15-b3ae-3a34a990f783
9
public static Record getQuizTakenRecordByXMLElem(XMLElement root) { User user = null; Quiz quiz = null; long timeSpan = -1; double score = -1; boolean isFeedback = false; boolean isPractice = false; if (root.attributeMap.containsKey("feedback") && root.attributeMap.get("feedback").equals("true")) isFee...
98de4634-0392-489c-900b-cc622aaa01ed
6
public void createWithDFS(){ //Uses DFS to explore a default labyrinth and creates a solvable labyrinth MazeCell current = getStartCell(),neighbor; int visitedCells = 1,TotalCells = size(); ResetVisits(); current.visit(); if(theStack.isEmpty() == false){ System.out.println("Stack must be emp...
16362ad7-4000-4c58-96cd-39d9ad914db3
0
public void setGoTo(String []goTo) { this.goTo = goTo[0]; }
930efcb9-ae54-4009-9b6c-2aa84a9b0c72
4
public void reorderList2(ListNode head) { // IMPORTANT: Please reset any member data you declared, as // the same Solution instance will be reused for each test case. int l = 0; ListNode p = head; while (p != null) { p = p.next; ++l; } p = head; if (l <= 2){ return ; } ListNode preP = p; ...
25cebcf3-af62-45be-8e16-b14eece7fdac
2
private boolean exclude(MappingConfiguration configuration,String table_name){ EntityMapping entity = configuration.getMappings().get(table_name); if(entity!=null && entity.getType().equalsIgnoreCase(R.entity.type.exclude)){ return true; } return false; }
1aba2ab2-55fa-4935-9176-c07e195beba9
1
public static boolean getMouseDown(int mouseButton) { return getMouse(mouseButton) && !lastMouse[mouseButton]; }
c24152b0-8a67-4db7-9fa8-5d26e38ce8ac
8
private void addToCartMouseClicked(java.awt.event.MouseEvent evt) { // -- {{ What happens when you press the "ADD TO CART" button }} -- String preiid, prequantity; int iid = 0; int quantity = 0; preiid = enterItemUPC.getText(); prequantity = enterItemQuan.getText(); ...
984563f9-9ca4-4f53-ac6a-febefa1291f9
3
public String ask(Tweet question) throws CloneNotSupportedException { String answer = ""; Abo abo = new Abo(this.eleveur); for(SmartCell cell:smartCells) { if (cell.ask(question, abo) != null) answer = answer + cell.ask(question,...
96aae6af-d0f7-4b0b-8d98-13cdd8ca50be
2
public void setSelectionEntry(JLabel entry, mxGraphTransferable t) { JLabel previous = selectedEntry; selectedEntry = entry; if (previous != null) { previous.setBorder(null); previous.setOpaque(false); } if (selectedEntry != null) { selectedEntry.setBorder(ShadowBorder.getSharedInstance()); ...
e2ec7261-0d1c-4562-a3c2-b06945d0b026
4
public boolean eliminar(String pId){ for(Nodo<Rama_Hoja> iterador = _entradasDelArbol.getHead(); iterador != null; iterador = iterador.getSiguiente()) if( iterador.getDato().getIdentificador() == pId) return true; for(Nodo<Rama_Hoja> iterador = _salidasDelArbol.getHead(); ite...
ce0ae009-6a9f-4b3a-9872-fe5652430545
0
public Carte_espion(int date1, int id1, int taille1) { super(date1, id1, taille1); }
452a0fa8-1239-430c-9835-61a6b1b0a823
3
public String[] getAllTags(){ if(countOfTags() == tagList.length) return tagList; LinkedList<String> list = new LinkedList<>(); try { PreparedStatement statement = connection.prepareStatement(GET_ALL_TAGS); ResultSet set = statement.executeQuery(); while(set.next()){ list.add(set.getString("name")...
1f6e0169-89d9-40ff-af24-8bfb057fa8fa
5
@EventHandler public void handleEntityInteractions(EntityDamageByEntityEvent event) { Entity defender = event.getEntity(); Entity damager = event.getDamager(); if (defender instanceof Animals && damager instanceof Player) { Player player = (Player) damager; User user = EdgeCoreAPI.userAPI().getUs...
880eb92d-f9fb-4dff-8256-a444e32f66be
8
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int nSet = Integer.parseInt(line.trim()); for (int...
c763881e-3495-4397-97cf-492eeefb7bdf
2
private JPanel setupUpDownButtonsPanel(final ResourceType resourceType) { this.resourceButtonsMap.put(resourceType, new ArrayList<JButton>()); JPanel upDownButtonsPanel = new JPanel(); upDownButtonsPanel.setLayout(new BoxLayout(upDownButtonsPanel, BoxLayout.X_AXIS)); try { Integer upDownButtonWidth = 20; ...
06e0a683-4105-4685-b563-8f810c71bf23
3
public void showInfo(){ System.out.println("Título: " + titulo); System.out.println("Sinopsis: " + sinopsis); System.out.println("País: " + pais); System.out.println("Duración: " + duracion); System.out.println("Fecha de estreno: " + fecha_estreno.toString()); System.out....
30147d7f-f318-459d-a147-ae5218b400fa
6
public boolean canCastDirectly(Class<?> type) { if (isOf(type)) { return true; } if (type.isPrimitive() && clazz.isPrimitive()) { return Ghost.me(type).openEyes().isPrimitiveNumber() && isPrimitiveNumber(); } try { return Ghost.me(type).openEyes().wrapperClass() == wrapperClass(); } catch (Except...
f5f8cac1-ddba-4f05-a236-308276a7b6dd
5
public boolean removeTile (String tile) { if (isClose || !isOpen) return false; //Retrait de la tuile dans la pioche ouverte si elle existe if (isOpen) { if ( tileList.containsKey(tile)) { tileList.remove(tile); if (tileList.size() == 0) this.setIcon(new ImageIcon(nullPick)); else t...
bdea55dc-2bfd-4e10-a66c-fae6ea0305ca
1
public void free( int frameNo ) throws PagePinnedException { if ( (mgr.frameTable())[frameNo].pin_count() > 1 ) { throw new PagePinnedException (null, "BUFMGR: PAGE_PINNED."); } (mgr.frameTable())[frameNo].unpin(); state_bit[frameNo].state = Available; }
cc80d51c-24a1-428d-ba79-dae3fc90dd82
6
int numOpenSets(Space space) { int num = 0; if (isOpen(board[space.pos[0]], space.piece, 1)) num++; if (isOpen(getColumn(space.pos[1]), space.piece, 1)) num++; if (space.diagID % 2 == 0 && isOpen(topDownDiag(), space.piece, 1)) num++; if (space.diagID % 3 == 0 && isOpen(bottomUpDiag(), space....