method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
829f7bc8-b40d-48af-abf3-b35416587df1
9
private void comment() throws IOException { go(4); while ( !isAllRead() && !startsWith("-->") ) { saveCurrent(); go(); } if (startsWith("-->")) { go(3); } if (_saved.length() > 0) { if ( !props.isOmitComments() ) { ...
3d8db25a-517f-407c-ae96-3f01aaebbfb0
0
public CtrlPrincipal getCtrlPrincipal() { return (CtrlPrincipal)ctrlPrincipal; }
18fd6040-6265-4d01-ad95-6a8f2715cd95
5
public void fireMenuEvent(final MenuEvent EVENT) { fireEvent(EVENT); final EventType TYPE = EVENT.getEventType(); final EventHandler<MenuEvent> HANDLER; if (MenuEvent.MENU_OPEN_STARTED == TYPE) { HANDLER = getOnMenuOpenStarted(); } else if (MenuEvent.MENU_OPEN_FINIS...
6a7ff2d2-3f19-44e4-8a4d-7563b369fce9
1
@Override public void componentResized(ComponentEvent e) { int lim = Math.min(getWidth(), getHeight()); if (game.getMapSize() != 0) { int size = lim / game.getMapSize(); game.setPixelSize(size); } }
61cdfb7d-9672-4290-bbac-b7d79c63e6de
3
String change(String sequence, int numChanges, Random rand) { HashSet<Integer> changedPos = new HashSet<Integer>(); char chars[] = sequence.toCharArray(); for( int i = 0; i < numChanges; ) { int pos = rand.nextInt(chars.length); if( !changedPos.contains(pos) ) { // Already changed? int newCode = rand....
b1889f3b-504a-4a87-86a3-e67808da04f8
4
public Image doTonalMappingAlg1(HdrImage hdrImage) { // dane hdr float[] rgb = hdrImage.getHdrData(); double logAvg = 0; double maxLum = 0; float avgLum = 0; // konwersja obrazu hdr do Yxy i wyliczenie maksymalnej, sredniej oraz // średniej logaryticzne...
8188314f-244c-40ee-9113-4f53054f255a
1
public void visitFormalTypeParameter(final String name) { if (!hasFormals) { hasFormals = true; buf.append('<'); } buf.append(name); buf.append(':'); }
5a6eb362-c2d9-4512-a375-43526d9cfe8c
2
public static List<String> getTables(Connection connection){ List<String> table_names = new ArrayList<String>(); try { ResultSet tables = connection.getMetaData().getTables(null,null,null,new String[]{"TABLE"}); while(tables.next()){ table_names.add(tables.getStri...
b073b4d2-ed72-4fba-87df-8013dfa0d0d7
7
public final Object pop() { if (sealed) throw onSeledMutation(); int N = size; --N; Object top; switch (N) { case -1: throw onEmptyStackTopRead(); case 0: top = f0; f0 = null; break; case 1: top = f1; f1 = null; break; case 2: t...
af676496-2d6e-4414-8463-37ae7539e99e
7
public static int jump2(int[] A) { if (null == A || 0 == A.length) return -1; int len = A.length; int step = 0; int low = 0; int high = 0; if (1 == len) return 0; while(low <= high) { ++step; int last = high; for(int i = low; i <= las...
bd4f1c93-3d32-4176-9d9f-1a2f688b07bb
3
public static void precal() { dp = new int[60001]; for (int i = 1; i < dp.length; i++) for (int j = i; j < dp.length; j += i) if (j != i) dp[j] += i; }
75dfd296-22e5-4ebe-9a96-7ec5ef9cc7ae
5
@Override public void onDraw(Graphics G, int viewX, int viewY) { if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300) { G.setColor(radius==0?Color.blue:Color.red); G.drawArc(((int)X-3)-viewX, (int)(Y-3)-viewY, 6, 6, 0, 360); G.drawLine((int)(X-2)-viewX, (int)Y-viewY, (...
e5cf1228-a737-4acd-8cc1-ef1e664a6e3d
3
public void setHSBLeftCorner(Component component) { if (mHSBLeftCorner != component) { if (mHSBLeftCorner != null) { remove(mHSBLeftCorner); } mHSBLeftCorner = component; if (mHSBLeftCorner != null) { add(mHSBLeftCorner); } } }
18063efe-84e6-4aea-a90a-eb52e1670328
3
private ConnectionSingleton() { try { _conLog = new ConnectionLogic(this, new Socket(Constants.ELM327_IP_ADDRESS, Constants.ELM327_IP_PORT)); _conLog.init(); } catch (UnknownHostException e) { // TODO Log 4 J } catch (IOException e) { // TODO Log 4 J } catch (ELMException e) { // TODO Log 4 J }...
54eadaed-0f17-466f-a10f-ef399dc312e5
3
private int jjMoveStringLiteralDfa15_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 14); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 14); } switch(curChar) { case 49: return jjMoveStringLiter...
a7e098e7-c7b0-470e-9359-fefe906d9722
8
@Override public void doGet( HttpServletRequest req, HttpServletResponse res ) throws IOException { logger.info( "get" ); String prefix = (String) req.getAttribute( "prefix" ); String path = (String) req.getAttribute( "path" ); String query = (String) req.getAttribute( "query" ); Store store = (Store) re...
a9edae32-f329-4b53-9155-48cae70fb079
9
protected void resizeSwimlane(Object swimlane, double w, double h, boolean parentHorizontal) { mxIGraphModel model = getGraph().getModel(); model.beginUpdate(); try { boolean horizontal = this.isCellHorizontal(swimlane); if (!this.isSwimlaneIgnored(swimlane)) { mxGeometry geo = model.getGeome...
d6121548-f498-4b6b-8fd5-0aba306a1ed1
8
public String[] getOptions() { String [] options = new String [11]; int current = 0; if (!getResultsetKeyColumns().getRanges().equals("")) { options[current++] = "-G"; options[current++] = getResultsetKeyColumns().getRanges(); } if (!getDatasetKeyColumns().getRanges().equals("")) { ...
5830f032-590c-4c59-8d9b-27493cea14d2
2
private void btnDevolverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDevolverActionPerformed Prestamos us = (Prestamos) jTable1.getModel().getValueAt( jTable1.getSelectedRow(), 4 ); PrestamosCRUD pres = new PrestamosCRUD(MyConnection.getConnection()); ...
3a023c8b-dcb7-4668-a024-f37875222acf
1
public int countNumbersWithUniqueDigits(int n) { if(n>10) n=10; return aux[n]; }
8589d496-a12a-437e-9caf-9146ebc25946
7
@EventHandler(priority = EventPriority.LOWEST) public void onCraftItem(CraftItemEvent event) { if (!(event.getWhoClicked() instanceof Player) || event.isCancelled()) { return; } Player player = (Player) event.getWhoClicked(); ShapelessRepairRecipe recipe = plugin.getRepa...
945b9b3b-aa01-4616-aae9-4854d5693991
6
private String parseValueForCompile() { try { String strStore = readScriptForCompile(); //functions: if (strStore.equals("+")) return ("+ "+parseValueForCompile()+parseValueForCompile()); if (strStore.equals("-")) return ("- "+parseValueForCompile()+parseValueForCompile()); if (strStore.equa...
3d4419f7-06b8-490f-af45-e1d2bb90353b
6
@Override public void run() { while (ticker != null) { long now = System.currentTimeMillis(); float delta = (now - last) / 1000.0f; last = now; for (int i = 0; i < observers.size(); i++) { /* hack - when paused still tick t...
876564a1-b933-4523-b753-8eb254ffd727
1
public void setMaxWaitTimeMillis(int maxWaitMillis) throws CarException { if (maxWaitMillis < 0) { throw new CarException("Wait time is under zero"); } this.maxWaitTimeMillis = maxWaitMillis; }
0e132b0d-36f4-4672-a6f2-065c0e33b862
9
public static void main(String[] args) { // The default port int port_number=20000; String host="localhost"; if (args.length < 2) { System.out.println("Usage: java MultiThreadChatClient \n"+ "Now using host="+host+", port_number="+port_number); } else { host=args[0]; port_number=Integer...
d0c96231-3b53-4979-b4da-9366904869e7
8
private ObjectInfo(Class<?> clazz) { this.clazz = clazz; if( clazz.isPrimitive() || CharSequence.class.isAssignableFrom(clazz) || Boolean.class.isAssignableFrom(clazz) || Number.class.isAssignableFrom(clazz) ){ this.type = ObjectType.SIMPLE; }else if(clazz.isArray()||Iterable.c...
a400954a-2c2d-47e8-968b-25d49baab6ca
1
@SuppressWarnings("unchecked") public void addQustionToDB() { String questionStr = (String) question; String answerStr = getConcatedString((ArrayList<String>) answer); // add to database try { String statement = new String("INSERT INTO " + DBTable + " (quizid, position, question, answer, score, answer...
81dee31c-a316-4dde-93fc-ae4d0add55cf
1
private void compute_pcm_samples9(Obuffer buffer) { final float[] vp = actual_v; //int inc = v_inc; final float[] tmpOut = _tmpOut; int dvp =0; // fat chance of having this loop unroll for( int i=0; i<32; i++) { final float[] dp = d16[i]; float pcm_sample; pcm_sample = (float)(((vp[9 + ...
36091197-6db9-4d5f-994b-0f00d1ed886c
8
public MyCurve getCubicCurve2D() { MyCurve result = new MyCurve(new CubicCurve2D.Double(start.getX(), start.getY(), start.getX(), start.getY(), end.getX(), end.getY(), end.getX(), end.getY())); if (result.intersects(forbiddenRect) || result.intersects(forbiddenCurves)) { final Set<Point2D.Double> all = new H...
5935ce53-221f-4318-9d71-a32f97488d53
2
public static EncumbranceEnumeration fromValue(String v) { for (EncumbranceEnumeration c: EncumbranceEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
7a23ce85-3dcd-4615-ad24-83ed4510740c
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...
a782e8c1-7b2c-4e02-96bd-ea0adfab3c4d
6
@Override public QueryResult updateQuery(Query q) { Statement st = null; if(!q.isParsed()) { q.parse(); } try { st = con.createStatement(); st.executeUpdate(q.getParsedQuery()); }catch (SQLException e) { plugin.getLogger().log(Level.SEVERE, " Could not execute query!"); if(this.dbg) { ...
c2c351b7-e0f2-4ac3-b1c9-cb86f92d4559
2
public static boolean anyKeyPress() { for (int i = 0; i < NUM_KEYS; i++) if (keyState[i]) return true; return false; }
bf8cf263-86ee-439f-8517-9c38e1e22556
4
private void showSelectedMenuItem(CommandSender sender) { Sign sign = null; try { sign = (Sign) this.block.getState(); } catch (ClassCastException e) { Logger.getLogger("Minecraft.ActionMenu").severe("Tried to show a SignActionMenu on a non-sign block."); e.pr...
43c23880-357c-4981-9566-a0dfd4664ef2
3
public static boolean isPrime_v0 (int num) { if ( num == 1 ) return true; for (int i=2 ; i <= Math.sqrt(num); ++i) { if ( num % i ==0 ) { return false; } } return true; }
3c45395c-ddbd-4ba2-8fec-3033b361c430
3
boolean validate() { errorMessage.setVisible(false); errorMessage.setText(""); if (!validateRequirement(txtBarCode, "バーコード")) { return false; } if (!validateRequirement(txtItemName, "商品名")) { return false; } if (!validateRequirement(txtP...
b33b66c1-1e63-41fa-aa5e-4f07753be9a6
3
public char nextClean() throws JSONException { for (;;) { char c = this.next(); if (c == 0 || c > ' ') { return c; } } }
3c34500a-9101-4eee-9d98-a6390fd4a3fc
0
public JobSchedulerBuilder withTriggerName( String triggerName ) { this.triggerName = triggerName; return this; }
da338ac5-0e73-4bf7-9ca7-81d256c365c7
9
private void render(final Element el) throws Exception { Renderer renderer = RendererFactory.createRenderer(el, ctx); boolean abreAspas = el.attributeValue("abreAspas") != null; boolean fechaAspas = el.attributeValue("fechaAspas") != null; String notaAlteracao = el.attributeValue("nota...
80b6df4d-2743-45d1-9944-8a2869a725ec
0
public void swapColor() { this.playerThisInstance = this.getOppositePlayer(this.playerThisInstance); }
83eaf70c-6f9d-47ab-8fa6-0fa419d1ae28
7
protected void parse(NormalizedEvent nevent) { Map<String, FidDef> dictionary = _appContext.getDictionary(); for (int i = 0; i < _fields.length; i++) { String fieldName = _fields[i]; if (fieldName.equals("_SYMB_")) { _record.put(fieldName, ...
bc9bfe5a-07f5-450f-8d20-c909c0872ccc
8
public ListNode deleteDuplicates(ListNode head) { if (head == null || head.next == null) { return head; } ListNode h = head, guard = new ListNode(0); guard.next = head; while (h.next != null) { if (h.val == h.next.val) { h = h.next; } else { if (guard.next != h) { if (guard.next == hea...
d89ff932-983d-47ca-9ae9-b09e11c20a4e
3
private String[][] arraysForTransition(TMTransition transition) { String[][] s = new String[machine.tapes()][3]; for (int i = machine.tapes() - 1; i >= 0; i--) { s[i][0] = transition.getRead(i); s[i][1] = transition.getWrite(i); if (s[i][0].equals(TMTransition.BLANK)) s[i][0] = ""; if (s[i][1].equal...
c929b539-c058-4afc-aacc-065ad6468c5d
6
public void run() { this.running = true; try { this.startGame(); } catch (Exception var11) { var11.printStackTrace(); this.onMinecraftCrash(new UnexpectedThrowable("Failed to start game", var11)); return; } ...
cf17302c-36d1-4728-93b7-aa3688e7052b
1
static public boolean load_database(String name) { try { FileInputStream file = new FileInputStream(name.hashCode() + ".db"); GZIPInputStream gzis = new GZIPInputStream(file); try (ObjectInputStream ois = new ObjectInputStream(gzis)) { TreeSet<CButton> setButtons = (TreeSet<CBu...
10feb771-89a1-4f63-a6c2-d912e9daa438
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Tuple2 tuple2 = (Tuple2) o; if (item != null ? !item.equals(tuple2.item) : tuple2.item != null) return false; if (item2 != null ? !item2.equals...
b291a30c-3114-483d-90fb-3f1ec50ddbfc
6
@SuppressWarnings("WeakerAccess") public void executeNew() { if(instance.hasChanged()) { int i = JOptionPane.showInternalConfirmDialog(newFile, "Do you want to save your changes before starting a New one?", "Do you consider saving?", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if(i != JOpti...
9a4352a5-e15e-4d1a-ba04-92221bb0aea1
3
public void run() { while(active) { try { byte[] requestEncrypted = (byte[]) input.readObject(); String requestDecrypted = encryption.decrypt(requestEncrypted); System.out.println("Request: " + requestDecrypted); String reply = serverSwitch.giantSwitchMethod(requestDecrypted); System.out.pri...
02888886-6ac9-49b6-abfe-5b811fc10981
1
public void send(Socket client) throws IOException { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(client.getOutputStream())); Iterator<String> it = response.iterator(); while (it.hasNext()) writer.write(it.next()); writer.write("\n"+content); writer.flush(); }
775f5539-3281-4a88-9795-1012fb1fcaaa
7
public void close() { if (closed) { return; } FileLockRemainedException fileLockException = null; if (process != null) { try { killFirefoxProcess(); } catch (FileLockRemainedException flre) { fileLockException = flre; } } if (customProfileDir != null) { ...
8ca2afa4-5e0a-4a44-90e2-50069d7c4db2
6
public void getPage(final URLResponseHandler handler){ MCApi.getScheduler().scheduleAsynchrounousTask(new Runnable(){ public void run() { BufferedReader br = null; try { URLConnection connection = null; switch(connectionType){ case GET: connection = getGETConnection(); case POST: ...
de530c7d-bd40-41bb-a36a-ae7167261dc3
0
@Test public void testNum2wordWithPunctuation() { List<String> wordList = _phonewordFinder.num2words("2255.63"); assertNotNull(wordList); assertTrue(wordList.size() > 0); }
32d8b57d-b9bc-4d60-affd-ad7e0809a970
8
private static int getWordAverageLength(String problemStatement){ int result = 0; int index = 0; int wordCount = 0; int wordLength = 0; while (true){ if (index >= problemStatement.length()){ break; } int currentWordLength = 0; while (index < problemStatement.length() && !isSeparator(problemSta...
ab4af768-d37b-4432-97b8-c26b30707132
1
public List<Integer> getFoodIDs() { Map<String, Object> foodIdStrings = sheepFeedPlugin.getConfig().getConfigurationSection("sheepfood").getValues(false); List<Integer> foodIDs = new ArrayList<Integer>(); Iterator<String> foodIdStrIter = foodIdStrings.keySet().iterator(); while ( foodIdStrIter.hasNext() ) { ...
f54f1410-6dc0-4c66-9e34-59dcad71fb95
5
@Override public void initResources() { playfield = new PlayField(); // Создание спрайт групп ballGroup = new SpriteGroup("Balls"); brickGroup = new SpriteGroup("Bricks"); playfield.addGroup(ballGroup); playfield.addGroup(brickGroup); ...
a4832fb5-0bc1-403f-bfe3-4d627dc369d7
1
private void build() { // Icon this.icon = Toolkit.getDefaultToolkit().getImage( DroidKeyGen.class.getResource( "/res/key.png" ) ); // Actions this.onExit = new AbstractAction( "onExit" ) { @Override public void actionPerfo...
0c673a4a-e7ad-4627-b717-6f471f30e7f3
3
public void removeLast() { ListElement tmp = head; if (head == null) { return; } if (head.rest() == null) { head = null; size--; return; } while (tmp.rest().rest() != null) { tmp = tmp.rest(); } tmp.el2 = null; size--; }
a6d56591-15fd-4fac-8d53-46f990179776
8
private void knightMove(Point currentPoint, Piece currentPiece) { addToMovesLocal(currentPoint, currentPiece); Point targetPoint = pieceMove(currentPoint, 2, 1); if (isOpenOrEnemy(targetPoint, currentPiece.getColor())) { addToMovesTo(targetPoint, currentPiece, currentPoint); } targetPoint = pieceMove(curre...
fc9a2de5-a320-4a12-b3fc-37cbc53c0361
7
@Override public void read(Object destination, int minLoc, int type, Stream s) { int count = ((Number) counter.get(s)).intValue() + extra; Object[][] ret = new Object[repeats.length][count]; for (int i = 0; i < count; ++i) { for (int j = 0; j < repeats.length; ++j) { if (repeats[j] != null) { ret[j][...
a5736165-d578-4a6f-b0a7-85f0dbb6d78b
9
public String getValueType(SnmpValue v) throws SnmpValueException { if (v instanceof SnmpInteger) { return "INT32"; } else if (v instanceof SnmpOctetStr) { return "OCT-STR"; } else if (v instanceof SnmpIpAddress) { return "IP-ADDR"; } else if (v instan...
70f9633b-b402-44f4-b7a1-745790416442
4
public static void main(String args[]) { double integral = 0; double sum = 0; double[] Xi = new double[2 * m + 1]; Xi[0] = xi; double[] Yi = new double[2 * n + 1]; Yi[0] = yi; for (int i = 1; i <= 2 * n; i++) { Xi[i] = Xi[i - 1] + hx; } ...
de7b1107-d1d9-41e0-9e03-839b5c54f351
2
public List<positionNode> getPosition() { ArrayList<positionNode> position = new ArrayList<positionNode>(); NodeList positionNodes = node.getChildNodes(); for (int i = 0; i < positionNodes.getLength(); i++) { Node node = positionNodes.item(i); ...
9f2e5685-ee0f-4cbf-b7e1-ef1a5a1535af
3
private void resaveParamsSaveTour(SessionRequestContent request) { String invalidTourDate = request.getParameter(JSP_TOUR_INVALID_DATE); if(invalidTourDate != null) { request.setSessionAttribute(JSP_TOUR_INVALID_DATE, invalidTourDate); } String currDepartDate = request.getPar...
82fbbfab-0fad-4269-b914-19a4c795f633
8
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { TagAction ta = TAG_ACTIONS.get(localName); if (ta != null) { ta.beforeStart(this, localName); } try { if (inIgnorableElement == 0) { /***************************************/ Htm...
6a993fd1-bfe0-44b0-90d9-5543ec1bed64
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 Artist)) { return false; } Artist other = (Artist) object; if ((this.artistid == null && other.artistid != null...
8c8225d5-7b99-4ce6-9538-515303957230
1
@Test public void testUniqueIdValues() { List<Short> retrievedIdValues = new ArrayList<Short>(); for (Manufacturer application : Manufacturer.values()) { assertTrue(application.getId() + " already exists",!retrievedIdValues.contains(application.getId())); retrievedIdValues.add(application.getId()); }...
479ca908-54fb-48b8-aeb8-bda6ab875322
5
public TerrainGen(int minSize, float typeNoise, Object... gradient) { this.mapSize = checkMapSize(minSize) ; this.typeNoise = Visit.clamp(typeNoise, 0, 1) ; this.sectorGridSize = mapSize / World.SECTOR_SIZE ; // // Here, we verify amd compile the gradient of habitat proportions. final Batch <Ha...
0a1bed48-3e3a-47bd-98f0-3ce154ccfffc
7
@Override public void Write(IOClient p, Server server) { PacketPrepareEvent event = new PacketPrepareEvent(p, this, server); server.getEventSystem().callEvent(event); if (event.isCancelled()) return; Player player; if (p instanceof Player) { player = (Player)p; } else return; try { byte[] l...
79861050-ce0b-42d3-8e08-7695576da31f
3
public synchronized void service() { while ( input == null ) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } if (input % 2 == 0) { result = "even"; } else { result = "odd"; } notify(); input = null; }
91579d49-10ed-4c1f-99ae-7cbab2e6acd0
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 Executive)) { return false; } Executive other = (Executive) object; if ((this.executiveID == null && other.exec...
3c7d69ae-eb9a-42c0-83dc-da4a224665c3
8
@EventHandler public void onPlayerInteract(PlayerInteractEvent event){ if(event.getClickedBlock() != null){ /* Check if the right clicked block is a bookshelf */ if(event.getClickedBlock().getType().compareTo(Material.BOOKSHELF) == 0 && event.getAction().compareTo(Action.RIGHT_...
28a93dfa-9949-4a9a-a69a-3ae2bb8c4cf8
6
@Override public boolean checkReception(Reception reception) { if (reception == null) { throw new IllegalArgumentException("Reception argument cannot be null"); } Date toIssueDate = reception.getToIssueDate(); if (toIssueDate == null) {// если время принятия не задано - не удовлетворяет return false;...
3520f626-28a3-4371-9fc0-686c9a167026
1
synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { __typeCode = pgrid.service.corba.repair.RepairIssueHelper.type (); __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (pgrid.se...
04adfb3a-586f-47e8-bbfb-9d31f9e7783e
7
public static int evalRPN(String[] tokens) { List<String> signs = new ArrayList<String>(); for (int i = 0; i < tokens.length; i++) { if (isOperator(tokens[i])) { int len = signs.size(); if (len < 2) { return 0; } Integer oprand1 = Integer.parse...
3a62fd6e-d14f-4064-8cbf-8fe6c20260de
6
@Override public String toString() { return "AdminRoleEntity [" + (id != null ? "id=" + id + ", " : "") + (role != null ? "role=" + role + ", " : "") + (getId() != null ? "getId()=" + getId() + ", " : "") + (getRole() != null ? "getRole()=" + getRole() + ", " : "") + (getClass() != null ? "getCla...
d13ec8f9-112b-4bf1-80cb-36377eec6b15
0
private void showCell(int x, int y) { System.out.print("[" + field[x][y] + "]"); }
dbce804b-3a14-43aa-8a81-ba2b6dc21abe
2
public static Object fromByteArray(byte[] array){ try{ ByteArrayInputStream bis = new ByteArrayInputStream(array); ObjectInput in = null; in = new ObjectInputStream(bis); Object o = in.readObject(); try{ bis.close(); in.close(); }catch(Exception e){System.out.println("A Memory Leak Has Happ...
68598710-02bd-4e94-8f30-c68d89e6a2e1
3
public static List<Element> childsTags(Element element, String tag) { NodeList nl = element.getChildNodes(); ArrayList<Element> ret = new ArrayList<Element>(); if (nl != null) { int length = nl.getLength(); for (int i = 0; i < length; i++) { if (tag.equals((nl.item(i)).getNodeName())) { ...
93d26eb5-c7b1-4fed-962c-655cc220789f
3
public void searchProcedimento() { facesContext = FacesContext.getCurrentInstance(); List<DescricaoExames> listDescricaoExames; try { listDescricaoExames = genericDAO.searchObject(DescricaoExames.class,"procedimentos", null, null, new String[]{"des_codigoProcedimento", "d...
29a86021-3884-4c1e-b4fd-574108b7bece
8
@Override public boolean dispatchKeyEvent(final KeyEvent e) { if (e.getID() == KeyEvent.KEY_RELEASED) { if (e.getKeyCode() == 113) { final DefaultList tab = (DefaultList) Main.this.tabbedCButton1.getSelectedComponent(); if (tab != null) { ...
1418d113-4656-40c6-a6a8-6982faf7246e
1
public static final int getFontHeight(Font font) { int height = HEIGHT_MAP.get(font); if (height == 0) { FontMetrics fm = Fonts.getFontMetrics(font); // Don't use fm.getHeight(), as the PC adds too much dead space height = fm.getAscent() + fm.getDescent(); HEIGHT_MAP.put(font, height); } return heig...
f873ba58-9290-47f4-9201-485a160c8406
2
public static void main(String[] args) { InMemoryAuctionService imas = new InMemoryAuctionService(); Auction a = new Auction(12, "pizza", 5); Auction a1 = new Auction(33, "something", 8); System.out.println(a.toString()); System.out.println("The auction object was printed out."); System.out.println(a.equals...
afa5c79a-9ffb-4bbc-adb5-65e9b43c5310
3
public static JSONObject toJSONObject(String string) throws JSONException { String name; JSONObject jo = new JSONObject(); Object value; JSONTokener x = new JSONTokener(string); jo.put("name", x.nextTo('=')); x.next('='); jo.put("value", x.next...
fd5e4a42-712c-43e0-9fda-ca2d3baf152f
1
@Test public void exceptionThrownIfFormDataSocialBudgetItemsListIsNull() { when(budgetFormData.getSocialBudgetItemsList()).thenReturn(null); try { budget.buildBudget(budgetFormData); fail("SocialBudgetItemsList is null."); } catch (Exception e) { System....
20d917b7-a8a4-4f53-802b-3eac91f17a05
5
public static Entity getEntityOnLocation(Point location, Team entityTeam) throws EntityNotFound { if (entityTeam == Team.EVIL) { for (Entity enemy : enemies) { if (enemy.getLocation().equals(location)) { return enemy; } } } else { if (HeroInfo.INSTANCE.isHeroAlive() && HeroInfo.INSTANCE.getHer...
40ca011d-b964-433c-a19b-07a50a297167
0
public void setValue(byte[] value) { this.value = value; }
9bd3e0d1-ea3b-435c-849f-8fa11bd1bed8
3
private void shiftBy(int number) { E[] temparr = (E[]) new Object[array.length + number]; int srcPos = (number > 0) ? 0 : number; int destPos = (number > 0) ? number : 0; int length = (number > 0) ? array.length : array.length - number; System.arraycopy(array, srcPos, temparr, de...
dc564fe2-aeff-4ccb-8e9f-43121a748104
6
public static void addPay() { if(Time.d == 4 && Time.h == 16 && Time.mi == 1) { Console.outputMessage("Payday", "MoneyManager"); Player.money = new IntTag("Money", Player.money.getValue() + pay.getValue()); } if(Time.d == 1 && Time.h == 16 && Time.mi == 1) { Console.outputMessage("Payday", "MoneyManager"...
4c4e1f71-f16f-4514-a50d-28b955e0fbbe
7
private void validateMove(HantoPieceType pieceType, PieceCoordinate from, PieceCoordinate to) throws HantoException { if (from != null) { // Can only place new pieces throw new HantoException("Can't move pieces in Alpha Hanto. Only place new pieces."); } // If the given pieceType is not a Butterfly, thro...
728100fe-6fb6-483d-b6b9-e86b4b8b00b1
5
private void ajouterPerso(int perso) { switch(perso) { case 0: Humain h = new Humain("Humain", epe1, tav1); nbHum++; tabPerso.add(h); break; case 1: Elfe e = new Elfe("Elfe", arc1, for1); nbElf++; ...
45dcbc88-868e-4154-a684-843e70fcdbb5
9
public void nextFrame() { switch (frames) { case 2: if (count == 0) currentImg = img1; if (count == 1) currentImg = img2; count++; if (count > frames) count = 0; break; case 3: if (count == 0) currentImg = img1; if (count == 1) currentImg = img2; if (count == 2) currentImg = img3; count...
e336867a-b02e-43e4-be0c-00eeab4057af
5
public static void theEnd(int winnerIndex) { for (int i = 0; i < playerCount ; i++) { Player player = Players.get(i); int[] games = player.getWinLoses(); int[][] rolls = player.getDistrRolls(); int[] max = {0,0}; //Face, Count int[] min = {0,1000}; //F...
c5b50b33-f694-48bf-8b44-dea62d733d14
4
public boolean isDef() { if (parent instanceof Assign) { final DefExpr[] defs = ((Assign) parent).defs(); if (defs != null) { for (int i = 0; i < defs.length; i++) { if (defs[i] == this) { return true; } } } } return false; }
dbf99a6d-905d-4ecd-a5a7-b67be23dc9e2
5
@Test public void CITest () { userInput.add("hi"); userInput.add("meng meng"); userInput.add("can you inform me about the canteen"); userInput.add("i want to eat at canteen adenauerring"); userInput.add("what is at line four"); runMainActivityWithoutConsoleOutput(userInput); userInput.add("i want t...
3a2fe800-48db-4b36-95ce-3d1f6111c0e7
3
@Override public void buy(Command cmd) { cmd.execute(); if(Storage.getInstance().getRevenue() < 10000.0) { restaurant.setState(restaurant.getBadstate()); }else if(Storage.getInstance().getRevenue() >= 10000.0 && Storage.getInstance().getRevenue() < 20000.0) { restaurant.setState(restaurant.getNormalst...
e170b9ed-b81a-46ec-be51-7a3555c64c30
7
public void printBoard(){ char c = ' '; for (int i = 0; i < BOARDSIZE; i++){ for (int j = 0; j < BOARDSIZE; j++){ switch(board[i][j]){ case -2: c = 'B'; break; case -1: c = 'b'; break; case 0: c = ' '; break; case 1: c = 'r'; break; case 2: c =...
2d7b3c16-fbf2-4383-8e27-a7a9777c2feb
9
public void playSound(int intSFX,int intLocX, int intLocY) { int i, i2, i3; DuskObject objStore; Entity thnStore; i=0; intLocX = intLocX-VIEW_RANGE; intLocY = intLocY-VIEW_RANGE; if (intLocX<0) { i = -1*(intLocX); } i2=0; if (intLocY<0) { i2 = -1*(intLo...
39ba5d79-d22a-4829-84a8-1938b82b9788
6
public boolean equals(Object o2) { if (o2!=null && o2 instanceof IconGroup) { IconGroup ig2 = (IconGroup)o2; if (ig2.getName().equals(getName()) && separateLargeIcons==ig2.hasSeparateLargeIcons()) { if (separateLargeIcons) { if (!largeIconSubDir.equals(ig2.largeIconSubDir)) return false; ...
05bdcbf7-7be2-4682-9be8-e707fc85918d
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Bruch bruch = (Bruch) o; if (ganze != bruch.ganze) return false; if (nenner != bruch.nenner) re...
50f494c6-901e-4658-97e3-f6c9c9777fb8
2
private static String getActualPassword(String name) { String actualPassword = null; try { Statement statement = DbConnection.connection().createStatement(); ResultSet rs = statement.executeQuery("select password from Users where username='" + name + "';"); while (rs.next()) actualPass...