method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3778b8ff-81ea-4f47-8086-f68306372b9e
9
static final void method3716(boolean bool, int i, boolean bool_11_, int i_12_, IComponentDefinitions[] widgets, int i_13_) { anInt8286++; int i_14_ = 0; if (bool == true) { for (/**/; (widgets.length ^ 0xffffffff) < (i_14_ ^ 0xffffffff); i_14_++) { IComponentDefinitions widget = widgets[i_14_]; if (wid...
785bc732-3838-413d-ad8d-1c8a58cb732b
4
@Override public IDecimal round(final IDecimal decimal, final double layout, final int scale) { final PreciseDecimal pd = (PreciseDecimal) decimal; final int layoutDigits = DPU.getFractionalDigitsCount(layout); final int droppedDigits = pd.getFactor() - (scale + layoutDigits); final int layoutBase = (int) (DPU....
170f28f2-31b8-4e9f-bf60-a416d5d99526
8
@Override public void performOperation(String name, ArgParser args) { String referencePath = null; String inputBAMPath = null; try { referencePath = getRequiredStringArg(args, "-R", "Missing required argument for reference file, use -R"); inputBAMPath = getRequiredStringArg(args, "-B", "Missing required ar...
6791682f-00d7-431f-8d75-c8728ef6d1e0
2
@Override public O_02_MultipleAddressCallInput deserialize(ByteBuf packetPDU) { String npl = Serialization.getString(packetPDU); String rads = Serialization.getString(packetPDU); String oadc = Serialization.getString(packetPDU); String ac = Serialization.getString(packetPDU); char mt = Serialization.getCh...
da084986-3a9d-4637-9717-66bfcdb29ea0
5
public void analyze() { if (GlobalOptions.verboseLevel > 1) GlobalOptions.err.println("Analyze: " + this); String type = getType(); int index = type.indexOf('L'); while (index != -1) { int end = type.indexOf(';', index); Main.getClassBundle().reachableClass( type.substring(index + 1, end).replace...
c6f29535-1b74-469e-8bfe-f8112c78abd7
3
@Override public void actionPerformed(ActionEvent ae) { //Notify all listeners that a comboBox has changed if (ae.getSource().equals(comboBox)) { if (!listeners.isEmpty()) { for (ActionListener thisListener : listeners) { thisListener.actionPerformed(n...
c4b2815f-e00c-4c56-a96e-25b75634e3b0
5
@Override public boolean accept(final File path) { if ((path != null) && path.getName().equalsIgnoreCase( JSocksProxy.CONFIGURATION_XML) && path.isFile()) { return true; } else if ((path != null) && path.isDirectory()) { return true; } return false; }
1d34be8d-356f-48c4-838b-de8bd365948e
5
private void waitForSlaveUpdates( List<Future<ReplicationResult>> replicatedSlaveFutures) { List<ReplicationResult> slaveServers = new ArrayList<ReplicationResult>(); for (Future<ReplicationResult> slaveServer : replicatedSlaveFutures) { try { // block until the future result is available slaveServer...
00c19aca-92ea-463a-aa60-b6c8c26eac89
3
private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) { double[][] inputValues = this.learning.getInputValues(); double[][] outputValues =this.learning.getOutputValues(); currentScenario++; if (currentScenario==inputValues.length){ cu...
0e3dfa75-8c3b-48bd-bf67-0d1ea3359c82
2
public void run(){ try { InputStream inputStream = mainSocket.getInputStream(); ObjectInputStream objectInputStream = new ObjectInputStream(inputStream); OutputStream outputStream = mainSocket.getOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream); Strin...
8f1f55a2-de7a-4365-ac17-9d9bfe37b7fb
0
public void setGraph(Graph g) { this.graph = g; }
5defae0f-fd47-4c76-82e9-839d7dbf1f18
3
public static boolean isUniqueChars(String s){ if(s == null) return false; HashSet<Character> chars = new HashSet<Character>(); for(int i = 0; i < s.length(); i++ ) { if(chars.contains(s.charAt(i))) return false; else chars.add(s.charAt(i)); } return true; }
04c88f7f-6110-4f7b-a30e-ed6d8902454d
0
public boolean isNull(String key) { return JSONObject.NULL.equals(this.opt(key)); }
76042c65-8c64-401f-bcb2-758b2cd8057d
9
public QuaternionPFDPanel() { super(); projection = new LambertAzimutalEqualAreaProjection(); // projection = PerspectiveProjection.GNOMONIC_PROJECTION; orientation = new Quaternion().fromAxis(0, 0, 0, 1); orientation.normalize(); momentum = new Quaternion(0.01, new Vec3d(0, 1, 0)); objects = new Ar...
829c8408-fd09-45be-a1df-4bb9e7aecd8f
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...
7c21b08d-8ae8-4b20-a93c-5009fc3d7e16
2
public static HireFacilityEnumeration fromValue(String v) { for (HireFacilityEnumeration c: HireFacilityEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
75871d93-d3ed-4eeb-9f3c-c1eee1d0745e
3
private RealMatrixExt computeStatisticalSpectrumDescriptor(RealMatrix sonogram, int bandLimit) { double[][] matrixSSD = new double[bandLimit][N_STATISTICAL_DESCRIPTORS]; int nRows = sonogram.getRowDimension(); if (nRows < bandLimit) { // requested number of bands is > than actual # of bands -> ...
74b3fde2-69d2-4bca-b696-f2a5025cf733
3
public static void main(String args[]) { Scanner in = new Scanner(System.in); // game loop while (true) { List<Enemy> enemies = new ArrayList<Enemy>(); int count = in.nextInt(); // The number of current enemy ships within range in.nextLine(); for...
326ca588-fa48-4281-8006-9a018bd4c5de
9
public static Digit fromLong(final long i) { final long x = Math.abs(i) % 10L; return x == 0L ? _0 : x == 1L ? _1 : x == 2L ? _2 : x == 3L ? _3 : x == 4L ? _4 : x == 5L ? _5 : x == 6L ? _6 : ...
253ebfe6-aa8e-45c8-b6da-22e2de9f4677
1
final int getSize(final ClassWriter cw, final byte[] code, final int len, final int maxStack, final int maxLocals) { Attribute attr = this; int size = 0; while (attr != null) { cw.newUTF8(attr.type); size += attr.write(cw, code, len, maxStack, maxLocals).length + 6; attr = attr.next; } return size...
3561304c-66eb-49a9-b7eb-a2f6c5162dde
3
private static int isHappy(String str) { int num; ArrayList<Integer> numbersSeen; num = Integer.parseInt(str); numbersSeen = new ArrayList<Integer>(); while(num != 1) { int q; int r; q = num; r = 0; while(q > 0) //Loop through each digit. { r += q%10 * (q%10); //Add the squares of eac...
7ba935da-49e1-400b-aff7-6abce4e79028
2
public final boolean remove(final K key) { boolean r; if (pruned) { r = removeP(key); } else { r = removeB(key); } if (r) { size--; } return r; }
4638f9ac-96f9-49c8-b2c6-b1e4930840b9
7
public QReadMaze(String filePath, double nonTerminalReward) { try { FileReader f = new FileReader(filePath); BufferedReader b = new BufferedReader(f); Pattern pattern = Pattern.compile("(\\w|[\\+|\\-]\\d+|\\%)"); Matcher matcher; String s = null; Str...
b6bf05b6-8568-4fbb-aaa3-b89d7f24f254
4
private void loadID3v2(InputStream in) { int size = -1; try { // Read ID3v2 header (10 bytes). in.mark(10); size = readID3v2Header(in); header_pos = size; } catch (IOException e) {} finally { try { // Unread ID3v2 header (10 bytes). in.reset(); } catch (IOExcepti...
3b5fde23-ac0b-456f-8727-888c1269a66b
4
public synchronized void beginThreadAccess() { Object requestingUser = Thread.currentThread(); while (true) { if (m_oCurrentUser == null) { m_oCurrentUser = requestingUser; break; } else if (m_oCurrentUser == requestingUser) { brea...
7a506ca4-9043-4b0a-8b80-d43e296e2d17
2
private void Escola_ComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_Escola_ComboBoxItemStateChanged Equipa_ComboBox.removeAllItems(); Escola escola = a.getDAOEscola().get(Escola_ComboBox.getSelectedItem().toString()); if (escola != null) { for (Equipa equipa...
98d02e01-e157-47a6-86b8-3c8a0a1218ea
0
public int getY() { return y; }
2b536cf2-cfd9-4433-a94d-3ebdef42e419
1
protected String decodePercent(String str) { String decoded = null; try { decoded = URLDecoder.decode(str, "UTF8"); } catch (UnsupportedEncodingException ignored) { } return decoded; }
53a134e1-c155-41d7-9b6a-5f687d7707ea
0
public static long read32bitUnsignedInt(RandomAccessFile f) throws IOException { Integer d0,d1,d2,d3; d0=0xff & read_sure(f); d1=0xff & read_sure(f); d2=0xff & read_sure(f); d3=0xff & read_sure(f); return (d0<<24) + (d1<<16) + (d2<<8) + d3; }
83413adb-1ad1-4189-a802-7bda2cf19956
5
public static void main(String[] args) { RollTracker roll = new RollTracker(new DevelopmentList()); ArrayList<Die> dice = new ArrayList<Die>(); for (int i = 0; i < 6; i++) { dice.add(new Die()); } roll.rollDice(dice); System.out.println("Here are the dice rolled:"); for (int i = 0; i < dice.size(); i+...
b2194e62-be1a-4f01-9293-08272f3664fa
0
public Combination<Colors> getAttempt() { return attempt; }
70ef8aab-2b6c-46e6-ae9f-3d4feca3f58d
8
private CacheResult compareVersionKey(CacheDefinition cacheDefinition, CacheResult cacheResult, CacheObject oldItem, Object[] args) { long itemVersion = oldItem.getVersion(); Object cachedItem = oldItem.getCacheObject(); Object[] params; boolean isReturnCollection = cacheDefinition.isReturnCollection(); /...
6e7853bf-ca3a-43fa-a5ae-9eece3c3d01d
5
public void performMovement() { if (this.rover == null) { System.out.println("Please land the rover first"); } else { String[] instructions = this.movementPlanned.toUpperCase().split("(?!^)"); for (String instruction : instructions) { if (instruction.equals("M")) { this.rover...
be6f23ea-108d-4849-9f1a-99a82925878a
8
public Step playPC(){ //CALCOLO MOSSA MIGLIORE blackSteps_Move = new TreeSet<Step>(); blackSteps_Eat = new TreeSet<Step>(); for(int i = 0; i < 8; i++) for(int j = 0; j < 8; j++){ if (!board.getCell(i, j).getColor() && !board.getCell(i, j).isEmpty() && !board.getCell(i, j).getColorPawn()){ ...
93734b67-c0bd-4976-93a4-e96020cf0208
4
private void appendMethod(StringBuilder builder, String className, String methodName) { if (lastClass == null || !lastClass.equals(className) || !lastMethodForClass.containsKey(className) || !lastMethodForClass.get(className).equals(methodName)) { builder.append('\t')...
02115cee-fac1-4b59-9bfd-a6ee5ac5e3a0
7
public void setInstances(Instances inst) { m_Instances = inst; m_ignoreKeyModel.removeAllElements(); String [] attribNames = new String [m_Instances.numAttributes()]; for (int i = 0; i < m_Instances.numAttributes(); i++) { String name = m_Instances.attribute(i).name(); m_ignoreKeyM...
565f2d44-b6e5-48ce-9e53-2d369a62ca42
4
public void createPlayer(KrakenState statePlayer,int typeOfPlayer){ switch (typeOfPlayer) { case 0: player1 = new MachinePlayer(statePlayer,this,KrakenColor.WHITE_PLAYER); player2 = new MachinePlayer(statePlayer,this,KrakenColor.BLACK_PLAYER); break; case 1: player1 = new MachinePlayer(statePlayer,thi...
6d59c50e-60ad-42e4-9981-0aefc96adab0
3
@Override public void validate(Object target, Errors errors) { PriceIncrease pi = (PriceIncrease) target; if (pi == null) { errors.rejectValue("percentage", "error.not-sprcified", null, "value required"); } else { if (pi.getPercentage() > maxPercentage) { ...
a554ca13-b55b-4977-aded-5109d1d0e39c
0
private void initSeatTypes() { this._seatTypes = new SeatType[] { new SeatType(UUID.randomUUID(), "硬座", 1L), new SeatType(UUID.randomUUID(), "软座", 2L), new SeatType(UUID.randomUUID(), "硬卧", 4L), new SeatType(UUID.randomUUID(), "二级软卧", 8L), new SeatType(UUID.randomUUID(), "一级软卧 ", 0x10L) }; }
d3a06d42-89cc-48f6-b12c-b824686f5fdd
1
public JPanel getCommandBtnChangesMenu() { if (!isInitialized()) { IllegalStateException e = new IllegalStateException("Call init first!"); throw e; } return this.commandBtnPanel; }
4dbe1d2f-ebf6-45a9-b37f-74df01df9282
6
@Override public boolean execute(RuleExecutorParam param) { Rule rule = param.getRule(); List<String> values = Util.getValue(param, rule); if (values == null || values.isEmpty()) { return false; } boolean retValue = true; for (String value : values) { String compareValue = rule.getValue(); if (rul...
c4ee29e6-e111-4525-8dbe-d388759e4501
2
public int getHoeveelGoed() { int score = 0; for (GekozenAntwoord gk : _antwoorden) if (gk.isGoed()) score++; return score; }
c9d0a7d8-9a1e-4fd3-9657-7a60b9fec44e
0
public Memory(int speed, Queue []inputBuffers, Queue []outputBuffers) { //passes the constructor values to the base class SwitchingFabric super(speed, inputBuffers, outputBuffers, VERTICALBUSES); //indicate has no memory hasMemory = true; //set the recent bus, because it neve...
ff392abd-55ea-4aa7-992a-1f2dfa5c9a8f
7
private void checkEntities() { for (Entity entity : entityChangeBuffer) { boolean interested = true; boolean contains = entity.getSystemBits().get( world.getSystemId(this.getClass())); BitSet entityComponentBits = entity.getComponentBits(); for (int i = componentBits.nextSetBit(0); i >= 0; i = compo...
79c4387d-088d-4fee-8215-3d4a6a706685
0
public OutConnectionHandler(ObjectOutputStream out) { this.out = out; }
4f9f3922-9225-4f4f-ae27-7d94dba8bfc3
5
public static void vuelcaFicheroAVentas(HashMap<Integer, Ventas> tablaVentas) { String linea; FileReader ficheroVentasRead = null; BufferedReader br = null; StringTokenizer orden = null; int[] arrayLinea = null; Ventas venta = null; arrayLinea = new int[3]; // Guarda los 3 valores de la linea try...
09917cdb-96b9-4956-9958-8e78d8c967ec
9
public static ArrayList<Platform> getPlatformSectors(Rectangle2D r) { ArrayList<Platform> platforms = new ArrayList<Platform>(); Point p = new Point((int) (r.getX() / tileSize), (int) (r.getY() / tileSize)); if(platformMap.containsKey(p)) { platforms.addAll(platformMap.get(p)); } Point p2 = new Point...
3453716f-7d7d-43ca-9cf8-6734091c158d
7
@EventHandler public void onPlayerDropItem(PlayerDropItemEvent event) { if (HyperPVP.getSpectators().containsKey(event.getPlayer().getName()) || HyperPVP.isCycling() && !event.getPlayer().isOp()) { event.setCancelled(true); return; } Item drop = event.getItemDrop(); if (drop.getItemStack().getType() =...
07c508da-a1f1-4cbd-b0eb-e5442f623051
0
@Test public void viewUpdateTest() { propertyChangeSupport.firePropertyChange(MainWindowController.NUMBER_OF_POINTS, 0, 100); assertEquals(view.getNumberOfPointsTextField().getText(), "100"); propertyChangeSupport.firePropertyChange(MainWindowController.INTEGRATION_METHOD, 0, IntegrationMeth...
8cdd182f-3bea-4d96-90d1-bd5800a1da4f
0
public void setRZAxisDeadZone(float zone) { setDeadZone(rzaxis,zone); }
6a3f110a-d60d-4ca8-a5fc-1e3c649a3d35
6
public void render(Screen screen) { // double open = Math.sin(System.currentTimeMillis() % 1000 / 1000.0*Math.PI*2)*0.5+0.5; double open = openness * 0.47; List<Sprite> doorSprites = ((Door) sprites).doorSprites; if (level.getTile(x, y - 1).isWall() && level.getTile(x, y + 1).isWa...
a09061fa-3da0-4041-a342-ff5f5251c834
0
private synchronized void evenIncrement() { i++; Thread.yield(); i++; }
c0ab6494-3c16-4af9-a616-9fd9a1813918
3
public static File createFolder(String currentDir, String folderName) { if (currentDir == null) return null; File newFolder = new File (currentDir + File.separator + folderName); if (newFolder.exists ()) return null; if (newFolder.mkdir ()) return newFolder; return null; }
405a73e1-c9ac-41b2-a9d2-9dc676079dfd
3
@Override public void deleteUser(User user) throws SQLException { Session session=null; try{ session=HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.delete(user); session.getTransaction().commit(); }catch(Exception e){ e.printStackTrace(); }finally{ if(ses...
e91b4bc2-13ab-47c4-8896-4f41c4ea79ff
9
public static ListNode mergeKLists(List<ListNode> lists) { if (lists.size() == 0) return null; ListNode result = null; Boolean complete = false; ListNode head = null; while (!complete) { complete = true; ListNode minNode = null; for (ListNode n : lists) { if (n == null) continue; comp...
c49d8b39-16b9-4e5d-9719-fbfe4ae4c25b
2
public static boolean defaultInteract(EntityType type) { boolean b = false; switch (type) { case OBJ_TREE: break; case OBJ_DOOR_WOOD: b = true; break; } return b; }
41aeccfb-0975-4135-9157-d67880af1619
2
public int getUsersNumber(){ int number=0; String requete= "select count(*) from user"; try { Statement statement = MyConnection.getInstance().createStatement(); ResultSet resultat = statement.executeQuery(requete); while(resultat.next()){ numb...
1f5643f1-8f4c-4bd0-ad6b-6996143e87e1
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...
66c09908-61ce-4b60-8010-87b272a44dc4
5
@Override public SquareMatrix exponentiation(int exponent) { int row = this.getRowsNumber(); for (int i = 0; i < row; i++) { for (int j = 0; j < row; j++) { double sum = 0; for (int k = 0; k < row; k++) { try { sum += this.getElementAt(i + 1, k + 1) * this.getElementAt(k + 1, j + 1)...
dd16a3b4-79f2-4e4c-82a2-dbd232d048b7
6
public static int get(int addr) { if (Util.inRange(addr, 0, 0x00EF)) { // Zero page return mem[addr]; } else if (Util.inRange(addr, 0x00F0, 0x00FF)) { // Function registers return readReg(addr); } else if (Util.inRange(addr, 0x0100, 0x7FFF)) { // Sound RAM return mem[addr]; } else if (Util.inRange(addr...
1e559a20-334b-4327-9043-6eae6d74d611
9
public boolean hasNext() { if (++pos >= bucket.sizes[arrayIndex]) { // end of array, next array pos = 0; do { ++arrayIndex; } while (arrayIndex < bucket.data.length && bucket.sizes[arrayIndex] == 0); if (arrayIndex == bucket.data.length) { // end of bucket, next bucket while ...
667c219b-0b88-4a50-adce-59a1655e7b4c
0
public void setMaxRound(int maxRound) { this.maxRound = maxRound; notifyListeners(); }
939a7021-d19c-4dfc-8f82-ec7e9b177558
3
@Override public Product readObject() throws IOException { Product readObject = null; if (!connectionInStatus) { startInputConnection(); } if (connectionInStatus) { try { readObject = (Product) xmlDecoder.readObject(); } catch (ArrayIndexOutOfBoundsException e) { return null; } } return...
0219aa6a-23ad-4ccf-adf1-4182e4d115ee
2
public BufferedReaderIterator() { try { if ( maxLines != 0 ) { nextline = reader.readLine(); } } catch ( IOException ex ) { throw new IllegalArgumentException( ex ); } }
e77c24d4-e6fb-463a-a712-a2c015acc624
1
private static boolean isItPalindrome(Integer integer) { Integer reversedInt = reverseInt(integer); if (reversedInt.equals(integer)) { return true; } else { return false; } }
d7519119-358e-47ea-8402-1be58e8b9977
4
@Override public void tick(LinkedList<GameObject> object) { if (currentHP <= 0) { t.setDuration(0); // Stops timed event Event.enemyKilled(type); handler.removeObject(this); } x += velX; y += velY; if (falling || jumping) { vel...
d28b8803-6f79-4a05-b0e2-0db795bb8e1b
5
public void writeCompares() { String path = output.toString() + "/" + measurementName + "_comparingOperations.txt"; comparingOperations = new File(path); if (comparingOperations.exists()) { try { fr = new FileReader(path); br = new BufferedReader(fr); StringBuffer buffer = new StringBuffer(...
0c8917cb-eab7-4ff3-a153-48830b4c1bee
9
protected static void drawRoom(ByteChunk chunk, Room[][][] rooms, int floor, boolean topFloor, int x, int z, int roomOffsetX, int roomOffsetZ, int baseY, byte matFloor, byte matWall, byte matRoof) { //TODO I think this function suffers from the North = West problem // which room? Room room = rooms[floor][x][z...
b2926420-ce83-4bbe-be36-e0d77fdd78ce
0
public IconPanel() { this.setPreferredSize(new Dimension(50, 50)); this.setMaximumSize(new Dimension(50, 50)); }
c31ecf61-c454-4481-9461-05f56056f08d
5
public void afficherMenuPrincipal() { scan = scan.reset(); System.out.println("Bienvenue dans votre université !"); System.out.println("Veuillez vous connecter "); do { System.out.print("login : "); String login = scan.nextLine(); System.out.print("mot...
4afc1dca-bf86-4b28-9fb4-0d9e9090717b
0
public void setIdEntrada(Integer idEntrada) { this.idEntrada = idEntrada; }
532aeea3-7992-4a42-994d-8bebdb9e3609
5
private Content createContent(String line, int set) { line = Utils.formatString(line); switch(set){ case Types.VGDL_GAME_DEF: return new GameContent(line); case Types.VGDL_SPRITE_SET: return new SpriteContent(line); // ...
c9404049-68a6-48ed-9e9d-fe7210344102
1
public void visit_ishr(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
345e91fe-48c2-4b8e-957d-068387f7bc05
4
public boolean globalReSearchAction() { TreeItem[] selection = vermilionCascadeNotebook.getTree().getSelection(); if (selection.length == 1 && currentItem == selection[0]) { lastFoundItem = currentItem; return searchAction(); } if (selection.length == 1 && currentItem != selection[0]) { lastFou...
241fe99a-1457-4dea-9b04-0514bbec486d
2
public entity(float x, float y, float width, float height, String texturePath, boolean visible) { this.x = x; this.y = y; total_width = width; total_height = height; this.width = total_width*start.zoom; this.height = total_height*start.zoom; this.visible = visible; try { this.texture = TextureLoader....
ebd5cde4-eeb8-42eb-9529-b423f425a918
3
public void searchLogradouro() { facesContext = FacesContext.getCurrentInstance(); requestContext = RequestContext.getCurrentInstance(); List<Logradouro> listLogradouro; try { logradouro.setLog_bairro_id(this.bairro); listLogradouro = genericDAO.searchObject(Logradouro.class,"...
4ad1377e-600c-47f1-987b-f456b4c65e06
5
static private String toString(Class type) { if (type == Dictionary.class) { return "dictionary"; } else if (type == ZemArray.class) { return "array"; } else if (type == ZemBoolean.class) { return "boolean"; } else if (type == ZemNumber.class) { ...
3f4fc410-1607-4c2b-abb4-12a9d90a5512
1
@Override protected void paintComponent(Graphics gc) { Rectangle bounds = gc.getClipBounds(); if (bounds == null) { bounds = new Rectangle(0, 0, getWidth(), getHeight()); } gc.setColor(getBackground()); gc.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); drawDividers(gc, getLayout(), bounds); ...
72db668b-cc0a-4dd2-825a-5006084d2524
4
int getVotingResult() { int result = 0; for(int i=0; i<committerByRowsList.length;i++) result += committerByRowsList[i]; for(int i=0; i<committerByColumnsList.length;i++) result += committerByColumnsList[i]; for(int i=0; i<committerBySquaresList.length;i++) result += committerBySquaresList[i]...
bfb081ed-f62c-4ce1-9595-ab5f71016922
5
public int popNPCFromCoords(int areaX, int areaY, int x, int y) { int[] wh; NPC npc; for (SpriteEntry e : spriteAreas[areaY][areaX]) { npc = npcs[e.npcID]; wh = spriteGroupDims[npc.sprite]; if ((e.x >= x - wh[0] / 2) && (e.x <= x + wh[0] / 2) && (e.y >= y - wh[1] / 2) && (e.y <= y + wh[1] / 2...
ee48c22e-22fb-42c3-91f5-fedb5974f5f8
9
static protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos...
aa4ea63f-57e5-4160-b470-f07a1d0fddb4
6
public void updateLobby(Map<String, String[]> lobbyGames) { // Keep track of whether the user is currently in a game boolean isAlreadyInGame = false; DefaultTableModel model = (DefaultTableModel) lobby_table.getModel(); // Delete previous data model.setR...
b4030e5f-d3a9-4494-a3d7-afbbca411f6d
7
private void fullFillConditionBeans() throws CorrespondingDimensionNotExistsException { for (ConditionBean conditionBean : conditionBeans) { String dimensionName = conditionBean.getDimensionName(); SortedSet<Dimension> dimensions = fromSchema.getDimensions(); Dime...
21af8ffe-93c9-4ea9-9b8d-7a7cb40b902d
5
private static void printHelper(LinkSetNode n, int indent) { if (n == null) { System.out.print("<empty tree>"); return; } if (n.right != null) { printHelper(n.right, indent + INDENT_STEP); } for (int i = 0; i < indent; i++) System.o...
167ee0be-a6fd-4cae-b8d1-8f43b7e909b1
6
public GPSOffice(String[] args) throws IOException, NotBoundException { // Parse command line arguments if (args.length != 5) { throw new IllegalArgumentException( "Usage: java Start GPSOffice <hostName> <portNumber> <officeName> <X> <Y>"); } hostName = args[0]; portNumber = parseInt(args[1], "portNum...
e55d9364-a37d-464d-ace2-308fd239baf4
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Role other = (Role) obj; if (roleID == null) { if (other.roleID != null) return false; } else if (!roleID.equals(other.roleID)) retur...
6eb34f55-aab0-4006-b4bb-d0dc9a4d39a6
7
public static Hashtable<Long,Boolean> categories() throws SQLException { PreparedStatement s = null; Hashtable<Long,Boolean> table = new Hashtable<Long,Boolean>(); try { currentCon = DriverManager.getConnection(dbName); String query = "SELECT cid FROM products"; s = currentCon.prepareStatement(query); ...
2ee62320-0470-4386-83c4-2710d5ab1561
0
public void setEntradasIdEntrada(Entradas entradasIdEntrada) { this.entradasIdEntrada = entradasIdEntrada; }
a5b0d417-87cb-445b-b7ff-690bd2ecfa90
1
public ImageGenerator(int bitsPerChannel, String fileName, Random rng, Evaluator evaluator, boolean strictFrame) { this.bitsPerChannel = bitsPerChannel; this.fileName = fileName; this.evaluator = evaluator; this.rng = rng; int length = 3 * bitsPerChannel; int shorter...
2a4a5ae9-f9fb-41d8-a39c-4bb21ee86c75
6
private void generateRockOre() { switch (new Random().nextInt(2)) { // Switch a random int, 0 or 1 for a Rock case 0: setHasRock(true); break; case 1: setHasRock(false); break; } if (isHasRock()) { switch (new Random().nextInt(2)) { // Switch a random int, 0 or 1 for Ore case 0: setHasO...
9d81bcf6-cd9d-457d-9fe3-ae2341f9c5d5
0
protected boolean isFinished() { return false; }
7f65a40f-f6c3-495b-b647-82216caa5f41
6
public static <GItem> Iterator<GItem> limitedIterator(final int count, final Iterator<? extends GItem> iterator) throws NullPointerException, IllegalArgumentException { if (count < 0) throw new IllegalArgumentException("count < 0"); if (iterator == null) throw new NullPointerException("iterator = null"); if (co...
d8e1c5e6-ebb1-4db7-81ce-9d7edf42ab2d
3
private void ekskey(byte data[], byte key[]) { int i; int koffp[] = { 0 }, doffp[] = { 0 }; int lr[] = { 0, 0 }; int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) P[i] = P[i] ^ streamtoword(key, koffp); for (i = 0; i < plen; i += 2) { lr[0] ^= streamtoword(data, doffp); lr[1] ^= st...
dc9d3ef3-f618-40f8-bdb2-769074e99f5f
2
public static boolean hasNulls(Pair<?> p) { return p.getFirst() == null || p.getSecond() == null; }
2f282811-76be-44d2-9fd1-b52825fe8163
1
@Test public void testPublish() throws Exception { l1.info("Test Message:1"); l2.info("Test Message:2"); StringBuilder sb = new StringBuilder(); for(int i = 1; i <= 10; i++) { sb.append("Test Line ").append(i).append("!"); sb.append("\n"); } l1.info(sb.toString()+1); l2.info(sb.toString()+2); }
e61982a7-c077-42c6-b9dd-1977582881c9
5
public static Path convertRGBToJPEG(File fileEntry) { try { MediaType type = getFileType(fileEntry); if (type != MediaType.Video && fileEntry.toString().endsWith(".rgb")) { String outputFileName = getFileNameWithoutExtension(fileEntry.toString()) + ".jpg"; File outputFile = new File(outputFileName); ...
06c081f2-9260-4a32-ad09-fbbc46576575
2
public synchronized void releaseConnection(DBConnection dbc) { boolean ok = used.remove(dbc); if (ok) { if (free.size() >= minsize) { dbc.close(); System.out.println("Deleting 1 connection..."); } else { free.add(dbc); ...
2e49d1d3-6c61-44e3-8ead-decb8d76e54c
9
@Override public com.flickr4java.flickr.Response get(String path, Map<String, Object> parameters, String sharedSecret) { OAuthRequest request = new OAuthRequest(Verb.GET, API_HOST + path); for (Map.Entry<String, Object> entry : parameters.entrySet()) { request.addQuerystringParameter(en...
18e14c93-33eb-4a82-861c-a6fa8efb1cdf
5
protected void recursiveBalance(TreeNode currentNode) { setBalance(currentNode); int balance = currentNode.balance; if (balance == -2) { if (height(currentNode.left.left) >= height(currentNode.left.right)) { currentNode = rotateRight(currentNode); } else { currentNode = doubleRotateLeftRight(c...
12c13271-adbe-4bc8-87c3-1bb0cce998eb
7
public void mouseClick(Point p){ if(clicked)return; if(headingLbl.getBounds() == null || helpBtn.getLabel().getBounds() == null){ return; } if(prevGame){ if(loadGameBtn.getLabel().getBounds().contains(p)){ //handler.objects.add(null); handler.objects.remove(this); } }else{ if(new...