method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
52215a47-37be-4e07-83b8-7ca516c47c33
2
@Override protected void paintComponent(final Graphics pG) { super.paintComponent(pG); if (placeholder.length() == 0 || getText().length() > 0) { return; } final Graphics2D g = (Graphics2D) pG; g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALU...
5e0c864c-4e4c-40e0-86eb-46c081074c49
2
public HUDMaster(HUDManager hm, Registry rg, int x, int y, int w, int h) { super(hm, rg, x, y, w, h); setImage("HUD/Master/BG"); //inventory slots int slotX, slotY = 0; HUDArea hudArea = null; for (int row = 0; row < INVENTORY_ROWS; row++) { for (int col = 0...
0a3ddb17-5c41-403c-af8e-457215b94622
2
@Override public void onClose(WebSocket socket, int arg1, String arg2, boolean arg3) { Client c = Server.get().getClient(socket); if(c != null) { c.disconnect(); } if(socket != null) { Server.get().removeClient(socket); } }
1cf824c0-810f-4a81-a39a-fe3c326a93dd
3
private static void setup(final Player p) { api.clear(); ItemStack apple = new ItemStackBuilder(Material.APPLE) .setDisplayName(p.isOp() ? (ChatColor.GREEN + "You are op!") : (ChatColor.RED + "You are not op!")) .setLores("Depending if you are OP or not the name will change!", ChatColor.RED + (ChatColor.B...
48431a68-551e-4e5f-a1a7-1cdd2b2ccdb5
9
public boolean executeLocalQuery(String keyRegExp, String valRegExp, String unitTestName) { System.out.println("Executing local query for unit test cast : " + unitTestName); ProcessBuilder pb = null; try { String outputFileName = "unit_tests/" + unitTestName + "/output_local.txt"; File testFile = new Fil...
dce180f0-8df2-4e69-b287-a60da9b94b69
7
public static void startupKifIn() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ((Module...
b5ec07a8-456e-4c93-b319-d18f8f4c4c45
9
public void render(int var1, int var2) { for(int var3 = 0; var3 < this.buttons.size(); ++var3) { Button var10000 = (Button)this.buttons.get(var3); Minecraft var7 = this.minecraft; Button var4 = var10000; if(var10000.visible) { FontRenderer var8 = var7.fontRenderer; ...
a0819cd7-9a66-4a45-9f6d-18c56ec95e99
7
private void addLayers(Element parent, Layers layers) /*throws XMLStreamException*/ { if (layers == null || layers.getSize() == 0) return; //Check if there are non-empty layers boolean foundNonEmptyLayer = false; for (int i=0; i<layers.getSize(); i++) { if (layers.getLayer(i).getSize() != 0) { f...
9713436d-4dd5-4320-9cdd-9db2b07cf2bb
6
@EventHandler public void EndermanRegeneration(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.getEndermanConfig().getDouble("Ender...
0632c9c0-e9d2-4a9d-acdd-c2484287d385
2
public static DurationUnit durationUnitFromValue(int value) { if (value == DurationUnit.DAY.value) return DAY; if (value == DurationUnit.MONTH.value) return MONTH; throw new IllegalArgumentException("不支持的日期单位数值"); }
6779aadb-294b-4020-ab2f-00052337bbc7
5
public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter Re: "); String name1 = reader.readLine(); System.out.print("Enter Im: "); String name2 = reader.readLine(); doub...
b23efe01-c7e0-450c-8af7-13cfeacdab22
1
private Node getPersonsRootNode( GraphDatabaseService graphDb ){ Relationship rel = graphDb.getReferenceNode().getSingleRelationship( REF_PERSONS, Direction.OUTGOING ); if ( rel != null ){ return rel.getEndNode(); } else{ Transaction tx = this.graphDb.beginTx(); ...
35744cf2-4799-4282-a520-bc2ad42b8f46
5
public void update(){ if(Gdx.input.isTouched()){ cam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0)); if(menu.check(touchPoint) == NEW_GAME) { game.setScreen(game_screen); } else if(menu.check(touchPoint) == SETTINGS) { game.s...
0e36753f-32ce-42a8-a517-55a0d87e56f3
9
private boolean isCompatibleWith0(TypeBinding otherType) { if (otherType == this) return true; if (otherType.id == TypeIds.T_JavaLangObject) return true; // equivalence may allow compatibility with array type through wildcard // bound if (this.isEquivalentTo(otherType)) return true; switch (otherType.kind()...
8b9c7b42-377d-44d6-b230-adf7bc18a2b2
9
private void splay(T element) { BinaryNode l, r, t, y; l = r = aux; t = root; aux.left = aux.right = null; while(true) { final int comp = element.compareTo((T)t.key); if (comp < 0) { if (t.left == null) break; if (element.compareTo((T)t.left.key) < 0) { y = t.left; ...
d1060495-c1c0-439e-835f-40b165cb72ea
1
public JPanel addFuncButtons(){ //добавление кнопки Повтор final JButton RedialButton = new JButton("Повтор"); RedialButton.setPreferredSize(new Dimension(180,90)); RedialButton.setFont(ButtonsFont); RedialButton.setEnabled(false); RedialButton.addActionListener(new ActionListener() { public void action...
993651a3-8696-4778-80eb-0ddaf7409527
9
public List<Location> adjacentLocations(Location location) { assert location != null : "Null location passed to adjacentLocations"; // The list of locations to be returned. List<Location> locations = new LinkedList<Location>(); if(location != null) { int row = location.ge...
7b4edbf1-195c-4b8c-96e7-698cdb95372d
8
private void doModify(Task _task, Task t, boolean unredo, LocalDateTime newStartTime, LocalDateTime newEndTime, String newCategory, String newPriority, TaskData taskToModify, LocalDateTime oldStartTime, LocalDateTime oldEndTime, String oldCategory, String oldPriority) { if (newStartTime != null || unredo)...
90f791d2-9512-40aa-a264-02aaa219eedf
7
private Token nextBinSelector(char ch) throws IOException { StringBuilder builder = new StringBuilder(); builder.append(ch); int ich = this.reader.read(); while (ich != -1) { ch = (char)ich; if (Character.isSpaceChar(ch) || Character.isISOControl(ch)) break; if (Character.isLetterOrDigit(ch))...
675e8aaf-7f35-4d7e-867a-1fa5b260c910
1
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // System.out.println(tabla.getSelectedRow()); if(tabla.getSelectedRow()==-1){ JOptionPane.showMessageDialog(null, "No hay cliente seleccionado."); }else{ ...
6ff57f88-0568-4c5b-9220-fb57f2252fe9
1
public boolean EliminarDetallePunto(DetallePunto p){ if (p!=null) { cx.Eliminar(p); return true; }else { return false; } }
b30d8813-571a-49ee-92d9-837c5d3501f9
8
public Transaction openRead(Transaction me) { // don't try read sharing if contention seems high if (me == null) { // restore object if latest writer aborted if (writer.isAborted()) { rVersion.recover(); writer = Transaction.COMMITTED; } return null; } if (me.attempts >...
3c52a047-c522-46ca-b4e6-4aceec577512
6
static public String ALErrorCodeToString(int code) { switch (code) { case AL.AL_NO_ERROR: return "No Error"; case AL.AL_INVALID_NAME: return "Invalid Name"; case AL.AL_INVALID_ENUM: return "Invalid Enum"; case AL.AL_...
07726f9b-5697-42d3-b43b-4c3f855e7886
8
public static Interval fromIntervalNumber(int intervalNumber, boolean preferMajor) throws UnknownIntervalException { for (Interval interval : Interval.values()) { if (interval.intervalNumber != null && interval.intervalNumber == intervalNumber) { if (interval.intervalQual...
b8c68ee1-bc8b-4e06-80c8-81b506f6270d
7
public double weightedVariance_as_Complex_ConjugateCalcn() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } boolean hold2 = Stat.nEffOptionS; if (nEffReset) { if (nEffOptionI) { Stat.nE...
1e8aedd9-c074-4494-9e39-4c2d0b95c1e1
7
public Automato criaEquivalenteMinimizado() { EstadoImpl.reiniciarChave(); // elimina todos os estados inatingiveis this.retiraEstadosInatingiveis(); List<List<Estado>> conjuntoMinimizavel = null; List<List<Estado>> resultadoParcial;// cria S0 com dois conjuntos : nao-finais e f...
d5a7ef5d-3900-4205-851f-57fcccb7f477
2
@Override public void mouseClicked(MouseEvent arg0) { if (arg0.getClickCount() == 2) { if (selectedSquare != null) { stockOverviewPanel.setStock(selectedSquare.getStock()); getOwner().navigateTo(stockOverviewPanel); } } }
83ca987b-3b6b-43c0-9c8a-6a6b4b7f7367
4
private boolean createNewKeyexchange() { if (type == CLIENT) { try { // create new a crypto.createNewRandom(); // calc new A BigInteger A = crypto.calcA(g); // send A sendBytes(A.toByteArray()); // get B byte[] B = readBytes(); // create AES Key crypto.createAESKey(B...
6b740eec-5cd7-44eb-9681-a922228ef6f5
0
public void setFileInformation( String name, int size ) { filename = name; filesize = size; }
a8ff0e3c-152c-417c-8407-cefccd74767c
2
private void parseXMLFile(File tempFile) { try { AFManager.processXML(tempFile); } catch (JAXBException ex) { invalidAFLoaded("Error parsing xml file."); } String error = AFManager.validateAF(); if(!error.isEmpty()){ invalidAF...
66d315e9-0815-44b9-9623-cbd5521e1be0
7
public V get(String row, String column) { if (row == null) { throw new IllegalArgumentException("row cannot be null!"); } if (column == null) { throw new IllegalArgumentException("column cannot be null!"); } for (TableEntry<V> entry : entries) { String r = entry.getRow(); String c = entry.getColu...
eef482d9-ff3c-4d7e-b171-681697880bf3
1
public IndexingCriterion createCriterion(String string) { if (string.equalsIgnoreCase("AboveBelow")) return new AboveBelowCriterion(); return new AboveBelowCriterion(); }
b9d29f84-c2ed-4750-925b-9b2048167bbf
7
@Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) { if (!(e.getMessage() instanceof ChannelBuffer)) return; Object sessionObject = ctx.getAttachment(); if (sessionObject != null && sessionObject instanceof Session) { Session session = (Session) sessionObject; if (session.g...
1fee0c23-92d6-4437-ad0f-01e045791bb3
8
public void backtrack(Node u, Node v, Edge edge, int departureTimeFromU, int arrivalAtV) { //find time at which people can go from u to v int delay = 0; boolean change = true; while(change) { change = false; while(u.getNodeCapacityAtTime().size() < (departureTimeFromU + 1)) u.getNodeCapacityAtT...
51b85244-d965-4669-95ba-61763a7df0a2
3
public void loadMap(String s) { System.out.println("CLASSPATH = " + s); try { final InputStream in = getClass().getResourceAsStream(s); final BufferedReader br = new BufferedReader(new InputStreamReader(in)); mapXRows = Integer.parseInt(br.readLine()); mapYRows = Integer.parseInt(br.readLine()); ...
905a7c52-cd13-45fd-8437-3ac615daa2ee
6
public boolean doT2(FlowBlock succ) { /* * check if this successor has only this block as predecessor. if the * predecessor is not unique, return false. */ if (succ.predecessors.size() != 1 || succ.predecessors.get(0) != this) return false; checkConsistent(); succ.checkConsistent(); if ((GlobalO...
1790c679-138f-4dbb-ab22-110efe512d77
6
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
7977afc2-99ca-4669-923a-2f4a907c830e
0
public void addSpeed(int speed){ this.speed += speed; }
0885dac8-973d-4619-a326-7a033de4da6a
9
public void mousePressed(MouseEvent event) { if (getDrawer().getAutomaton().getEnvironmentFrame() !=null) ((AutomatonEnvironment)getDrawer().getAutomaton().getEnvironmentFrame().getEnvironment()).saveStatus(); else EDebug.print("I cannot preserve what you ask"); initialPointClick.setLocati...
bedc5a2b-e1d0-433a-9538-f37d897e4031
4
public String readit(String pattern) throws InterruptedException, IOException { cnt=0; char lastChar = pattern.charAt(pattern.length() - 1); StringBuffer buffer = new StringBuffer(); char ch = (char) dataIn.read(); while (runner==1) { buffer.append(ch); String msg=buf...
fa0dbad9-e1c1-4b29-871e-b0f973b431c3
6
@SuppressWarnings("unchecked") public List<String> asStringArray(RuleContext ruleContext) { if (ruleContext.getEvents().isDebugEnabled()) { ruleContext.getEvents().debug(" " + TYPE + ".asStringArray: output model path=" + mPath); } Element collection = (Element) ruleContext.getInputModel().s...
4abe897f-f3ad-43b5-b080-00e9ffa4aeea
4
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || obj.getClass() != this.getClass()) { return false; } TurnCoordinate tc = (TurnCoordinate) obj; return x == tc.x && y == tc.y; ...
0024c9f8-cc7b-46a6-9e07-4abb8067dd24
2
protected Object getMeta(Metadatable obj, String key) { List<MetadataValue> meta = obj.getMetadata(key); for (MetadataValue item : meta) { if (item.getOwningPlugin() == this) { return item.value(); } } return null; }
8329ccdd-c31c-41bf-acc9-293350a28e27
2
public boolean Buscar(String Elem){ NodosListaProceso aux= PrimerNodo; boolean result=false; while(aux!=null){ if (aux.nombreProceso.equals(Elem)){ result=true; return result; }else aux=aux.siguiente; } return result; ...
961ca3aa-2bcd-464a-ab40-4c537b28fa06
5
private Tour getTourDuPetit() { Tour petit = t1; int tailleT1,tailleT2,tailleT3; if(t1.getHauteur()>0) tailleT1 = t1.getTour().get(t1.getTour().size()-1).getTaille(); else tailleT1 = nbr+1; if(t1.getHauteur()>0) tailleT2 = t2.getTour().get(t2.getTour().siz...
d2716d71-4da5-451c-88ec-1f8945c286e8
4
private int getUnitCostForUnitType(String unitType){ if (unitType == GameConstants.ARCHER){ return GameConstants.ARCHER_COST; } else if (unitType == GameConstants.LEGION){ return GameConstants.LEGION_COST; } else if (unitType == GameConstants.SETTLER){ return ...
60f0bbc1-2d0e-49d4-a939-d3e5b59fc602
8
private Object makeUpdate(Object o, Connection connection) { StringBuilder query = new StringBuilder(); query.append("UPDATE `" + getTableName(o.getClass()) + "` SET "); Boolean first = true; for (Field objectField : o.getClass().getFields()) { if (Modifier.isVolatile(objectField.getModifiers())) cont...
4ee37994-f67a-43ff-a526-2cb23a839748
6
public boolean equals( Object other ) { if ( _set.equals( other ) ) { return true; // comparing two trove sets } else if ( other instanceof Set ) { Set that = ( Set ) other; if ( that.size() != _set.size() ) { return false; // different sizes, no need ...
9adb8bd9-0295-4c6a-b5d4-a66050e526ab
1
private void renderError(Graphics2D g) { if (ERROR != null) { g.setFont(new Font("TimesRoman", Font.PLAIN, 30)); FontMetrics fontMetrics = g.getFontMetrics(); float xLeft = (float) (CARD_WIDTH + CARD_X_GAP); float x = (getWidth() - xLeft - fontMetrics.stringWidth...
68905168-6106-4bfd-8d2c-f8d088812034
3
@Override public boolean onPointerMove(int mX, int mY, int mDX, int mDY) { if(super.onPointerMove(mX, mY, mDX, mDY)) { return true; } for(ResearchItemButton rib : itemSlots) { if(rib.onPointerMove(mX, mY, mDX, mDY)) { return true; } ...
4b51be8f-669e-4fe4-ab21-b4b254866d53
1
private void DisplayInfo() { JTextPane InfoPane = new JTextPane(); InfoPane.setSize(500, 500); InfoPane.setLocation(10, 10); InfoPane.setEditable(false); InfoPane.setEnabled(false); InfoPane.setText("THIS IS A WARNING"); JButton StartB...
c306ce85-41bc-4c9e-af52-de7452ee49fa
5
private static int search5(Cards[] hands, Cards board, int numhands, int[] wins, int[] ties, Cards remaining) { int total = 0; for (int i = 0; i < remaining.size() - 4; i++) { Card card1 = remaining.get(i); board.add(card1); for (int j = i + 1; j < remaining.size() - ...
1ffe181c-9bc5-4616-a526-238b0f7efd45
7
public static boolean Paser(byte[] in) { List<String> addressList = new ArrayList<String>(); List<String> statusList = new ArrayList<String>(); ParkData data = new ParkData(); myPaser paser = new myPaser(); byte[] msg = ParserDataUtil.getMessage(in); if (msg == null) { return false; } msg = ParserDat...
71beb692-e5cf-42fa-a208-337f838b1f4a
2
public LaplacianDialog(final Panel panel) { setTitle("Laplacian filter"); setBounds(1, 1, 250, 140); Dimension size = getToolkit().getScreenSize(); setLocation(size.width / 3 - getWidth() / 3, size.height / 3 - getHeight() / 3); this.setResizable(false); setLayout(null); JPanel pan = new JPanel(); ...
b186ecaf-74a6-4c50-a792-d3433a184273
6
private Simulator(){ try{ File settingsXML = new File("settings.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); dbFactory.setNamespaceAware(true); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(settingsXML); doc.getDocumentEl...
53c5ee74-5cbc-4c73-9596-17b29e7d2d57
8
@Override public Response upload(UploadRequest request) throws IOException { Mac hmac=null; try { hmac = Mac.getInstance("HmacSHA256"); } catch (NoSuchAlgorithmException e) { System.err.println("NoSuchAlgorithmException (HmacSHA256 not valid): " + e.getMessage()); return new HmacErrorResponse("Integrity...
2297efdc-d799-4b42-b6a8-3ea42ae87305
6
public int read( int lo, int hi ) { BufferedReader input = new BufferedReader( new InputStreamReader(System.in) ); int response = -1; while ( response < lo || response > hi ) { //************Reads input.************************** try { response = Integer.parseInt(input.readLine()); ...
838fff32-4676-4c82-9978-0f54a3868125
2
private static void init() throws FileNotFoundException, IOException { File file = new File("data.gz"); if (WRITE_MODE) { if (file.exists()) // Let's make it hard to overwrite the data. throw new RuntimeException("Please delete " + file.getAbsolutePath()); os = new ObjectOutputStream(new GZIPOutputS...
a193d729-7afa-4484-896f-6e055b42ae0f
6
@Override public String getMethodCallSyntax(String obj, String m, String... args) { int l = args.length; int size = 2 + m.length(); if (obj != null) { size += obj.length() + 1; } if (l > 0) { size += (l - 1) * 2; } for (String arg : args) { size += arg.length(); } StringBuilder sb = new Stri...
23ca7b84-3872-4d2e-bc2c-f30fca692e8d
7
private void get(boolean countersOnly) { try { boolean recent = false; String owner = null; String type = null; System.out.print(" Lookup Key : "); String keyWord = bufReader.readLine(); System.out.print(" Type ...
15431a6b-53df-447a-8d4f-e95a88ebd0c5
9
public void mostrarTodo(){ if (Mina.this!=null){ Mina.this.conmutar(); } if(norte!=null){ norte.conmutar(); } if(noreste!=null){ noreste.conmutar(); } if(este!=null){ este.conmutar(); } if(sureste!=null){ sureste.conmutar(); } if(sur!=null){ sur.conmutar(); } if(suroeste!=nul...
02af0e0a-1f3c-42b0-9323-4a6d39472d23
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 MockTaxon)) { return false; } MockTaxon other = (MockTaxon) object; if ((this.id == null && other.id != null) |...
a72f50f5-32d5-4f19-8af8-736f277ed4f8
8
public static void main(String[] args) { // parse command line arguments for (String arg : args) { if ("-s".equals(arg)){ // skip the login username = "root"; permissions = 0; } } // temporary!!! ...
ff41b910-519e-4a3a-92c0-7dd5a068b787
6
public static void main(String[] args) { // Create Display try { Display.setDisplayMode (new DisplayMode(800, 600)); Display.create (); Display.setTitle("Hello!!"); } catch (LWJGLException ex) { Logger.getLogger(LWJGL_Example1.cl...
21d7bc09-b9cc-4f27-b535-c81272bfeb86
8
public void Update(Ghost ghost, PCPanel panel) { if (Counter < 2) { int x = ghost.getLocation().x; int y = ghost.getLocation().y; int direction = ghost.getDirection(); int move[] = {0,0}; int ms; // Fix SpacesToMove ms =...
c470392d-5ce9-477e-a70d-472d685e5d3b
3
public Vector2 calculate(Vector2 target) { double distToClosest = Double.MAX_VALUE; Vector2 bestHidingSpot = null; Obstacle closest; for(Obstacle curObj : obstacles) { Vector2 hidingSpot = getHidingPosition(curObj.position, curObj.boundingRadius, target); float dist = Vector2.Vec2DistanceSq(h...
2b7e2f6f-44d0-469d-bde7-f4eb1c17b72a
0
public static int getNumberRange() { return 1 << NUMBER_SIZE; }
e4da815d-6f2d-478a-af1b-d55771c480df
7
public void update(int x, int y, boolean b0, boolean b1, boolean b2, boolean onScreen, boolean[] keysDown, String typed) { b0Clicked = !this.b0 && b0; b1Clicked = !this.b1 && b1; b2Clicked = !this.b2 && b2; b0Released = this.b0 && !b0; b1Released = this.b1 && !b1; b2Released = this.b2 && !b2; this.x...
becf09f1-74ba-4c63-83fe-20f367392c89
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Status other = (Status) obj; if (jobs == null) { if (other.jobs != null) ...
6933b371-8731-41fa-b942-75f39744de83
7
public void loadObjects() { File levelFile = load(levelName); try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(levelFile); doc.getDocumentElement().normalize(); NodeList nodes = d...
f8a0ed9f-16f5-41cf-94ab-319427fde523
6
public void findKing(int[][] board, int piece) { for (int i = 0; i < board.length; i++) { for (int j = 0; j < board.length; j++) { if (piece % 2 == 0 && board[i][j] == 11) { x = j; y = i; } ...
eca847c6-ce0e-4c6d-ab4c-2be9e451b01a
7
private boolean viewAccount(int accountID) { boolean contentPaneChanged = false; for (AccountRecord a : AccountRecord.accounts) { if (a.getID() == accountID) { switch (a.getType()) { case AccountRecord.BANK: activeAccount = a; ...
bea5bfb0-a7b9-4c32-8a76-1324cbd3e512
7
@RequestMapping("getClassTree") @ResponseBody public Object getClassTree() { List<Object> colleges = new ArrayList<>(); COLLEGE: for (College college : collegeService.getAll()) { Map<String, Object> c = new HashMap<>(); c.put("collegeId", college.getId()); ...
bc9f307d-ffa5-4763-b48b-c0e9690d0e19
4
Node partition(int x) { Node less = null; Node more = null; Node current = this; while(current != null) { if(current.data < x) { if(less != null) { less.appendToTail(current.data); } else { ...
4d3f2ae7-ef26-4a40-8f1a-dcc1fa5df03d
4
public void CreateSignSQLTables() throws SQLException { sql.initialise(); if(!sql.doesTableExist("BungeeSignType")){ System.out.println("Table 'BungeeSignType' does not exist! Creating table..."); sql.standardQuery("CREATE TABLE BungeeSignType (T_ID int NOT NULL AUTO_INCREMENT, Type VARCHAR(50) NOT NULL U...
6e8dac9f-9a45-476d-8dc7-df7ace401a20
1
public final Instruction[] getSuccs() { if (succs instanceof Instruction) return new Instruction[] { (Instruction) succs }; return (Instruction[]) succs; }
397c2be0-d5dc-4e44-9486-750656eef770
0
private Combination<Colors> generateAttemptCombination10() { List<Token<Colors>> attemptTokens = new ArrayList<Token<Colors>>(); attemptTokens.add(new Token<Colors>(Colors.W)); attemptTokens.add(new Token<Colors>(Colors.W)); attemptTokens.add(new Token<Colors>(Colors.W)); attemptTokens.add(new ...
07441c9a-76ad-48b7-b19d-6be7b610ce80
9
public static boolean hasPathSum(TreeNode root, int sum) { if (null != root && null == root.left && null == root.right && sum == root.val) { return true; } else if (null != root) { if (null != root.left && hasPathSum(root.left, sum - root.val)) { return true; } else if (null != root.right && hasPathSum...
a52a5f22-5890-43bf-b790-593dd31304ff
3
boolean isEmpty() { return (packSizes.isEmpty() && folders.isEmpty() && numUnPackStreamsVector.isEmpty() && files.isEmpty()); }
b75f699c-0acb-48dc-9960-af20425f0274
2
public void onResize() { int ch = max(getHeight() - textH * (component.length + 2), textH); int cw = max(getWidth(), textH); curve = new double[cw]; canvas = new BufferedImage(cw, ch, BufferedImage.TYPE_INT_RGB); graph.setBounds(0, 0, cw, ch); graph.setIcon(new ImageIcon(canvas)); for (int i = 0; i < com...
9dad3326-86df-4b4d-9be2-f8d9e62e06a5
4
@POST @Path("/postGlobicData") public Response postGlobicData( @DefaultValue("2070_test") @QueryParam("componentName") String componentName, @DefaultValue("test") @QueryParam("partitionName") String partitionName, @DefaultValue("cngl1") @QueryParam("password") String password...
bdb67135-d36b-4161-81ac-d8952a086398
3
public float ms_per_frame() // E.B { if (h_vbr == true) { double tpf = h_vbr_time_per_frame[layer()] / frequency(); if ((h_version == MPEG2_LSF) || (h_version == MPEG25_LSF)) tpf /= 2; return ((float) (tpf * 1000)); } else { float ms_per_frame_array[][] = {{8.707483f, 8.0f, 12.0f}, ...
f712b342-3ad0-46a2-ab82-ea7a0c031f47
5
@Override public void deserialize(Buffer buf) { super.deserialize(buf); partyType = buf.readByte(); if (partyType < 0) throw new RuntimeException("Forbidden value on partyType = " + partyType + ", it doesn't respect the following condition : partyType < 0"); fromId = buf....
0c7139f2-6b1b-4dc9-b93a-bc6a4ffab6cd
9
@Override public void add(ITraceEvent event) { if (this.m_requestStartFilter == null) throw new RuntimeException("Must indicate which event marks the 'start' of each 'request'. Use DefaultRequestSeparator.setRequestStartFilter(val)."); if (this.m_requestCompletionFilter == null) throw new RuntimeException(...
10f94f02-1874-4e09-9ce6-6571b375ced2
6
public PossibleConnection engageInsideParagraphs( int i, int j, int firstInParagraph, int positionInParagraph) { /* Inicijalizacija */ // Slucaj spoja mostProbable12.setconnectionCase(12); // Pretpostavimo da je to nemoguc spoj mostProbable12.setProbability(0.0); // Ocistimo listu elemen...
8dafe55e-77be-44f3-a207-fa7238ba7757
2
public String toString() { if (suit == JOKER) { if (value == 1) return "Joker"; else return "Joker #" + value; } else return getValueAsString() + " of " + getSuitAsString(); }
04d58a00-4392-431b-8e84-39609cc0ca7f
5
private void drawFiredBall() { if (firedBall != null && !simplifying) { if (difficulty > 1 && (checkArrayNumber(firedBall.getStrand()) || currentLevel > 3)) bufferGraphics.drawImage(imageMap.get("greyBall"), firedBall.getPosition().x, firedBall.getPosition().y, this); else bufferGraphics.drawImage(firedBall.get...
bf94bb49-cd5e-491e-920e-7ccf57638af3
6
public boolean saveProject(Component parentComponent, NESModelListener listener){ if(projectFileName == null){ return saveAsProject(parentComponent, listener); } File selectedFile = new File(projectFileName); boolean ret = saveProjectToFile(selectedFile); if(ret) { projectFileName = selectedFile.getAb...
d0f4e6f7-0063-41cc-8283-e546d0b19a16
3
public static String inputStream2String(InputStream is, String charset) { BufferedReader reader = null; StringBuilder sb = new StringBuilder(); String line = null; if (null == charset) { charset = "utf-8"; } try { reader = new BufferedReader(new InputStreamReader(is, charset)); while ((line...
506e6079-09b6-4641-ae69-d87a607f7e71
6
@Override public KeySelectorResult select(KeyInfo keyInfo, KeySelector.Purpose purpose, AlgorithmMethod method, XMLCryptoContext context) throws KeySelectorException { for(XMLStructure info : (List<XMLStructure>)keyInfo.getContent()) { if (!(info instanceo...
cdad05de-e0b1-4fe8-8afc-bef046117447
9
private String getTypes(int flags) { String types = ""; if ((flags & CRT_STATEMENT) != 0) types += " CRT_STATEMENT"; if ((flags & CRT_BLOCK) != 0) types += " CRT_BLOCK"; if ((flags & CRT_ASSIGNMENT) != 0) types += " CRT_ASSIGNMENT"; if ((flags & CRT_FLOW_CONT...
74cd02b7-175b-42a3-8e89-29b5281f43f2
5
public void setLabelVisible(String labelName) { switch (labelName){ case "Top": topLabel.setVisible(true); leftLabel.setVisible(false); rightLabel.setVisible(false); centerLabel.setVisible(false); bottomLabel.setVisi...
61bb879a-a14e-414a-91e3-bd5aee26af79
0
public void clear() { synchronized(_queue) { _queue.removeAllElements(); } }
404cd677-5805-4983-ae60-5c5243f568ee
8
@Override public int doEndTag() { JspWriter writer = pageContext.getOut(); Predmet predmet = (Predmet) pageContext.getAttribute("predmet"); Student garant = (Student) pageContext.getAttribute("garant"); if(parameter.equals("id")) { try { writer...
8468a48d-10da-4151-b209-79a032cf9c0c
5
public void getNextPosition(){ if(left){ dx -= moveSpeed; if(dx < -maxSpeed){ dx = -maxSpeed; } } else if(right){ dx += moveSpeed; if(dx > maxSpeed){ dx = maxSpeed; } } if(falling) { dy += fallSpeed; } }
50acc6d4-4aca-4e06-85fc-08e84c9c17b9
1
private void actionDelete(HttpServletRequest request, RequestData rd, Class clazz){ try{ helper.deleteElement(clazz, rd.id); } catch(RuntimeException ex){ request.setAttribute("error", ex.getMessage()); } }
0535c03b-5331-470c-99c9-dc73fa4a9cd5
4
private static void toggleSpriteGroups(Human human, JointSprite sprite) { for (String groupName : ((JointModel) sprite.model()).groupNames()) { boolean valid = "Main Body".equals(groupName) ; final DeviceType DT = human.gear.deviceType() ; if (DT != null && DT.groupName.equals(groupName)) valid = ...
ddcde197-91ce-440f-b6f3-816268d503cb
3
public void performActionForUnitAt( Position p, Game game ){ GameImpl gameImpl = (GameImpl) game; Unit u = game.getUnitAt( p ); if ( u == null ){return;} else if ( u.getTypeString() == GameConstants.SETTLER ){ performSettlerAction( p, gameImpl ); } else if ( u.getTyp...
876e9f79-f7df-49c6-8b72-14c10d678ada
1
public void stop_logging() { for (ConnectionProcessor pipe : pipes) { pipe.stop_logging(); } }
e0785642-4e83-4a3c-bbfe-42bacc5d7a59
3
public String getExtension(File f) { if(f != null) { String filename = f.getName(); int i = filename.lastIndexOf('.'); if(i>0 && i<filename.length()-1) { return filename.substring(i+1).toLowerCase(); }; } return null; }