method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e135d96d-7e9c-4662-8eea-83b2580d6b0a
5
public void transition(int direction) { Engine.getCamera().setActive(false); final String map = transitions.get(direction); if (map != null) { Engine.setTransition(new MapChangeTransition( new TransitionAction() { @Override public void execute() { Engine.getCamera().setActive(true); ...
acf25300-0894-4df9-b600-35b25c89235d
0
@SuppressWarnings("deprecation") public String get(Date a) { String str = a.toLocaleString(); return str; }
25b6b85a-7ad9-4af3-8763-408ba76953eb
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; StringKey other = (StringKey) obj; if (m_name == null) { if (other.m_name != null) return false; } else if ...
fba8921a-3d77-4afd-ae60-55dda5ce7e70
0
public void setjLabelTitre(JLabel jLabelTitre) { this.jLabelTitre = jLabelTitre; }
817d124b-2ebd-4dbc-9091-502ed7be4418
8
public void setMemory(int address, byte val, boolean shouldNotify) { boolean processed = false; if (isCPUMapped(address)) { setCPUMappedMemory(address, val); processed = true; } if (_ppu.isWriteMapped(address)) { _ppu.setMappedMemory(address, val); ...
7ef2f989-00cc-464f-985a-f2d96e81f921
6
public void run() { /* * Get the list of all promotions */ facade.getListPromotion(copyListOfAllPromotion); try { this.takerPromotionsList = copyListOfAllPromotion.take(); } catch (InterruptedException e1) { e1.printStackTrace(); } /* * Transfers the list of promotions like BlockingQueue ...
e609f18e-c700-4ac2-aff9-8c76c6daddb3
0
public String getId() { return id; }
a75e6960-026c-49af-88d2-aef74a57f485
6
public static double floor(double x) { long y; if (x != x) { // NaN return x; } if (x >= TWO_POWER_52 || x <= -TWO_POWER_52) { return x; } y = (long) x; if (x < 0 && y != x) { y--; } if (y == 0) { return x * y; } return y; }
94fb4d1a-c282-45fb-a60e-2c56269b7db6
1
public void adminMode(Boolean mode){ if (mode != null){ enableAdminMode = mode; }else{ enableAdminMode = false; } }
df46a824-96cb-4ac5-8930-601e22010453
1
public List findByProperty(String propertyName, Object value) { log.debug("finding Member instance with property: " + propertyName + ", value: " + value); try { String queryString = "from Member as model where model." + propertyName + "= ?"; Query queryObject = getSession().createQuery(queryString); ...
33467679-d28e-4b15-8900-be7c33a16582
6
public double getScopeValue(int x) { switch (x) { case Scope.VAL_IB: return ib; case Scope.VAL_IC: return ic; case Scope.VAL_IE: return ie; case Scope.VAL_VBE: return volts[0] - volts[2]; ...
614dcb6c-7a73-4fbc-bb2f-2da98f704f1b
6
public static void shellSort (int[] array) { if (array == null || array.length <= 1) { return ; } int size = array.length; int i, j, gap; int insertNum; // use the increment sequence n/2, n/4, n/8... for (gap = size / 2; gap >= 1; gap /= 2) { for (i = gap; i < size; i++) { insertNum = array[i]; ...
44a74f40-3c00-455f-bd76-31215024fae2
4
public void setRunning(boolean run){ //if isRunning is false, we want to reset the DL queue if(!run){ //this. queue = new DownloadQueue(this); } if(run && !isRunning){ //Initialize the qProcessors according to SIM_DLS number qProcessors = new DownloadQueueProcessor[SIM_DLS]; for(int i =...
26bbfb9b-fe81-4f52-9d27-02ed9a50b11c
9
@Override protected boolean prereqs(MOB mob, boolean quiet) { if(mob.isInCombat()&&(mob.rangeToTarget()==0)) { if(!quiet) mob.tell(L("You are too close to perform a called shot!")); return false; } final Item w=mob.fetchWieldedItem(); if((w==null)||(!(w instanceof Weapon))) { if(!quiet) ...
5444142c-478d-4278-9c34-3b7dba1d95d3
3
public AddNewItemInventory() { setBounds(500, 500, 400, 150); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0}; gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 1.0, Doubl...
e5574725-ed0d-4e03-8857-259d74fc58d1
0
public void setLongitude(double longitude) { this.longitude = longitude; }
c7ba7739-7a47-4724-b3a3-5f00b4d890d7
8
public static boolean isGray(int c) { int r = (c >> 16) & 0xFF; int g = (c >> 8) & 0xFF; int b = c & 0xFF; if(r < 50 || g < 50 || b < 50) return false; if(r > 240 || g > 240 || b > 240) return false; int diffR = Math.max(Math.abs(r -g), Math.abs(r- b)); int ...
747ab3aa-bc8c-4eea-b9b7-5005dba2891e
5
private static Node buildTrie(int[] freq) { PriorityQueue<Node> pq = new PriorityQueue<Node>(); for (char c = 0; c < R; c++) if (freq[c] > 0) pq.add(new Node(c, freq[c], null, null)); // if only one char if (pq.size() == 1) { if (freq['\0'] == 0) pq.add(new Node('\0', 0, null, null)); else ...
b61df3ef-3182-43f0-91d1-4e242f1feae4
9
public void calcBestPastrLocation() throws GameActionException { if (bestPastrLoc == null) { int MIDX = (rc.getMapWidth() / 2); int MIDY = (rc.getMapHeight() / 2); int[] info; switch (this.HQ_LOCATION) { case TOP: comms.sendSearchCoord...
ea73cbbc-f534-482e-9315-ea3aa3ed01b6
5
public TransactionSet findKItemSubsets(ItemSet itemSet, int k) { TransactionSet allSubsets = new TransactionSet();/*New subset of transactions to return in a TransactionSet*/ int subsetCount = (int) Math.pow(2, itemSet.getItemSet().size());/*index control for loop*/ int itemSetSize = itemSet.getItemSet().size();/...
773453cc-5336-415a-99c2-a272a5b6dd5f
3
@Override public void decode(final ByteBuffer buf, final int available, final StringBuilder log) throws Exception { final int iface = buf.getInt(); if (iface != 0) throw new Exception("Received interface " + iface + " instead of 0"); final short timeout = buf.getShort(); final short co...
73e5a76e-137e-4deb-b416-a3737c70d02c
0
private boolean isMaxAllowedSpaceInUse() { int size = ((Double)getDBStats().get("dataSize")).intValue(); return size >= MAX_ALLOWED_DB_SIZE; }
6db45d88-d6b0-479f-ba9f-bd0b6dbd09d3
1
public synchronized void addRelation(String codigo, RelationOsm r, Long idrel){ if (totalRelations.get(codigo) == null) totalRelations.put(codigo, new ConcurrentHashMap<RelationOsm, Long>()); totalRelations.get(codigo).put(r, idrel); }
f45ff51a-1f27-4b72-afca-95ab809668c0
8
public static ModType get(String type) { switch(type.toUpperCase()) { case "PREFIX": return PREFIX; case "SUFFIX": return SUFFIX; case "INFIX": return INFIX; case "CIRCUMFIX": return CIRUMFIX; case "NEW TRANSLATION": case "NEW_TRANSLATION":...
3f2919b5-c653-4861-bd00-4094b52cc782
0
public final void deOp(String channel, String nick) { this.setMode(channel, "-o " + nick); }
22edc1bd-e6c3-4cac-8051-d689eeb194a0
7
public NodeList extractTitles(String input) throws IOException, CWRCException { List<Title> output = new ArrayList<Title>(); Reader reader = new StringReader(input); int val = 0; StringBuilder builder = new StringBuilder(); Title title = new Title(); // First test the t...
b5a72287-f4da-4b77-bd1f-5c5fe2e47afb
0
public void setBrand(String brand) { this.brand = brand; }
cc118f70-c07c-4efc-8e8c-926ef53a910b
3
private void addNumbersToHistogram(Graphics2D g) { g.setColor(Color.black); g.draw(zeroPercent); // g.drawString(" " + gmin, nLim, gminVert); // g.drawString(" " + gmax, xLim, gmaxVert); g.drawString(" " + emin, 15, frameH - 30); g.drawString(" " + emax, frameW - 100, frameH - 30); if (false) for (Entr...
061d15e5-77a8-48d1-93bb-06d120d99bdd
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserEntity that = (UserEntity) o; if (id != that.id) return false; if (login != null ? !login.equals(that.login) : that.login != null) return f...
0ecd979f-9bb2-4c1a-81ba-1cc7bbb6535b
0
private void sendFinalizedNotification() { JointAppointmentFinalized notification = new JointAppointmentFinalized(this); Notification.add(this.initiatorId, notification); }
be3f1be1-57da-489b-8099-2a59142f1cb9
5
public static String[] match(String s0, String s1) { // invariant: No match occurs with beginning char in s0[0..h-1] for (int h= 0; h <= s0.length() - MIN_MATCH; h= h+1) { String match= s0.substring(h, h+MIN_MATCH); int k= s1.indexOf(match); if (k >= 0) { ...
cbc75612-76d3-4ae4-a948-60dd48ec9a31
6
@Override public void updateGUI() { // GO THROUGH THE VISIBLE BUTTONS TO TRIGGER MOUSE OVERS Iterator<Sprite> buttonsIt = guiButtons.values().iterator(); while (buttonsIt.hasNext()) { Sprite button = buttonsIt.next(); // ARE WE ENTERING A BUTT...
9fd4c873-514b-42d1-b4bd-c8a6368e68c0
8
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException { try { String commandname = request.getParameter("cmd"); Command command = ApplicationController.getInstance().getCommand(commandname); command.execute(request); Gson gson = new Gson(); response...
39a663c4-c404-45bc-83e2-dbbd5bc03452
6
public void geraNumeros(){ Random gerador = new Random(); //gera numero de clientes com uma variacao controlado e um minimo int nClientes = gerador.nextInt(varClientes)+nMinClientes; //variavel soma utilizada para nao estourar o tempo de funcionamento soma = 0; for(int i ...
0eec9c42-ab84-4690-b7a8-92eb38c4fdcf
2
public List<Player> getAllPlayersOnGrid() { final List<Player> players = new ArrayList<Player>(); for (Element e : getElementsOnGrid()) if (e instanceof Player) players.add((Player) e); Collections.sort(players); return players; }
5b82f32d-ed86-4eaf-a920-1da6abba9edb
0
public long getDate() { return date; }
af098af9-3f17-411a-9fb9-ad933053c40d
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...
56909946-a623-4906-a8c2-a4d50095f2e1
4
public List<producto> getListaProductoSolo(){ List<producto> ListaProductoSolo = new LinkedList(); Conexionbd.conexion bd = new Conexionbd.conexion(); try{ bd.conectarBase(); ResultSet rs = bd.sentencia.executeQuery("SELECT * FROM PRODUCTO p,ESPECIFIC...
c100e484-a279-4251-b882-2507dd9b7c00
3
public int getResult(){ if(this.totalPecas>0){ for(int i=new Integer(1);i<=this.totalPecas;i++){ if(!this.pecasText.contains(""+i+"")){ this.pecaPerdida = i; return this.pecaPerdida; }//END IF }//END FOR }//END IF return this.pecaPerdida; }//END FUNCTION
70f49f19-e31c-4599-9938-dd305fdef783
1
void initStatetoForm() { if (this.state != null) { textName.setText(state.getState_Properties().getName()); checkAccept.setSelected(state.getIsFinalState()); checkStart.setSelected(state.getIsStartState()); } }
67d74584-bdd3-4d58-95cf-23961974dadf
9
public HashMap<Integer, ArrayList<SamplePoint>> SpatialTemporalWindowQuery(long midTime, long tRadius, double longitude, double latitude, double sRadius) { // TODO Auto-generated method stub //ArrayList<QueryResultDataStruc> trajPoints=new ArrayList<QueryResultDataStruc>(); HashM...
940c6f2a-6325-443b-b30c-204a3d1736da
4
private void setCodeAndMessage( int code, String m ) throws InvalidDataException { if( m == null ) { m = ""; } // CloseFrame.TLS_ERROR is not allowed to be transfered over the wire if( code == CloseFrame.TLS_ERROR ) { code = CloseFrame.NOCODE; m = ""; } if( code == CloseFrame.NOCODE ) { if( 0 < ...
335cdd08-6901-4db4-82dc-6f5d71b9e8ea
7
public void use(String object) { if (object.equalsIgnoreCase("floor")) { System.out.println("You are already using the floor, by standing on it.\n"); } else if (object.equalsIgnoreCase("wall") || object.equalsIgnoreCase("walls")) { System.out.println("How do you wish to use the w...
0741d360-15fc-4a3b-98d4-4e9453da7275
1
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed if (usuarioLogado.getTipo().equals("Diretor")) { DemissaoForm demissaoForm = new DemissaoForm(usuarioLogado); demissaoForm.setVisible(true); centralizaForm(dem...
2a49becc-a217-4fc3-a404-de003f50b67f
4
@Override public void adjust() { boolean enable = false; Component comp = getFocusOwner(); if (comp instanceof JTextComponent && comp.isEnabled()) { JTextComponent textComp = (JTextComponent) comp; if (textComp.isEditable()) { enable = textComp.getSelectionStart() != textComp.getSelectionEnd(); } ...
b64fd006-ffb7-4d0b-90f9-4aea6f4e613d
9
public Boolean EstaEntre(Date dIni, Date dFi) { return (((dIni.after(dataInici) || dIni.equals(dataInici)) && (dIni.before(dataFi) || dIni.equals(dataFi))) || ((dFi.after(dataInici) || dFi.equals(dataInici)) && (dFi.before(dataFi) || dFi.equals(dataFi))) || (dIni.before(dataInici) && dFi.after(dataFi))); }
70391ba3-a6a5-40e8-b0e7-a1e36c44a605
7
public static SystemDefinition getSystemDefinition(String name) { { SystemDefinition value000 = null; { SystemDefinition s = null; Cons iter000 = Stella.$SYSTEMDEFINITIONS$.theConsList; loop000 : for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) { s = ((SystemDefinition)(iter...
05b96a66-5516-43af-850f-cc4fff34f1fd
0
public void addWorld(World w) { worlds.add(w); }
c4076bdd-88f3-47bd-b30d-1f211a17fba9
8
private JSONObject pve_action(String Path, RestClient.RequestMethod method, Map<String, String> data) throws JSONException, LoginException, IOException { pve_check_login_ticket(); if (!Path.startsWith("/")) Path = "/".concat(Path); RestClient client = new RestClient("https://" + this.pve_hostname + ":8006/a...
9731f0e9-27aa-4649-a32b-63831253ddee
4
private final void buildSymboltable(String code, Node<K> node) { if (node.getSymbol()!=null) { if (code.equals("")) { code += "0"; } this.symbols.put(node.getSymbol(), code); } else { if (node.getLeft()!=null) { buildSymboltable(code + "0", node.getLeft()); } if (node.getRight()!=null) {...
6f6d5d8f-0bc8-49c3-8d14-20651dc54a79
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Score score = (Score) o; if (Double.compare(score.div, div) != 0) return false; if (score1 != score.score1) return false; if (score2 !=...
0e980c59-1cd4-49de-abaa-598cb5fba8ee
5
protected double readDouble(double min, double max) { double result = min - 1; while (result < min || result > max) { try { result = scanner.nextDouble(); if (result > max || result < min) { System.out.println("Wrong input, try again."); ...
33c5a065-2b73-4477-bf7a-87cd82e2cf4f
8
static int isMatch(String s) { Stack<Character> st = new Stack<Character>(); for (int i = 0; i < s.length(); ++i) { if (s.charAt(i) == '(' || s.charAt(i) == '[') { st.push(s.charAt(i)); } else if (s.charAt(i) == ')') ...
97c92d00-a42e-4f3a-a933-9a7c1510327e
6
protected OgexSkin toSkin( DataStructure ds, Map<BaseStructure, Object> index ) { OgexSkin result = new OgexSkin(); for( BaseStructure child : ds ) { if( StructTypes.TRANSFORM.equals(child.getType()) ) { result.setTransform(toTransform((DataStructure)child, index)); ...
fa5d9d89-8132-44b6-b7be-fff8763712be
3
@Override public Class getColumnClass(int column) { Class returnValue; if ((column >= 0) && (column < getColumnCount())) { if (getValueAt(0, column) == null) { return String.class; } returnValue = getValueAt(0, column).getClass(); } else { ...
a233de72-7dee-44ba-ba4c-1faac9ee4c81
7
protected FieldMarshal fieldMarshal(StructInfo info, Field field) { Class<?> fieldType = field.getType(); if (fieldType.isArray()) { boolean isFinal = Modifier.isFinal(field.getModifiers()); if (byte[].class.equals(fieldType)) { if (isFin...
501dd94f-b812-4450-bec6-c3728b4d4da4
7
private <T> ObjectConstructor<T> newDefaultConstructor(Class<? super T> rawType) { try { final Constructor<? super T> constructor = rawType.getDeclaredConstructor(); if (!constructor.isAccessible()) { constructor.setAccessible(true); } return new ObjectConstructor<T>() { @Sup...
6bfdaa86-ca67-4b48-a30e-7ff02587a7fa
8
public boolean add(final Locatable locatable) { NoAddReason reason = getNoAddReason(locatable); if (reason != NoAddReason.NONE) { throw new IllegalStateException("Can not add " + locatable + " to " + toString() + " because " + reason); } Unit unit = (Unit) loc...
642be18f-add0-4f81-9792-52884a48d010
4
public GoPoint getPixelSect(int a, int b) { if (a > 0 && b > 0 && a <= numLines && b <= numLines) { /* Need to do some error checking here */ return new GoPoint(xSects[a-1], ySects[b-1]); } else { System.out.println("Error! Intersection outside bounds."); return null; } }
1c80b69e-03b8-4fc1-90e3-28f061db2b65
3
private int[] calculateExpectedAndStandardDev(int[] platter) { int[] bowl; int total_score = 0; int max_score = -1; int[] samples = new int[SAMPLE_NUM]; for (int i=0; i < SAMPLE_NUM; i++) { bowl = createBowl(platter); int bowl_score = scoreBowl(bowl); ...
be7e0da2-947f-45cc-aab7-3ae2763f5763
0
public String readLabel() { return label; }
922b1fb4-f90d-48ec-a385-3c0c8fac0611
4
public MainWindow() { _frame = new JFrame("MarbleMadnessClone"); _frame.setSize(200, 200); _frame.setUndecorated(true); GraphicsDevice graphicDev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); //if (graphicDev.isFullScreenSupported()) { // graphicDev.setFullScreenWindow(_frame...
113ce516-0086-46f9-be0f-3a5ef3f53614
8
private boolean fillShipByRandom(Random random, int length) { int tryCount = 0; while (tryCount < SHIP_PLACEMENT_MAX_TRYS) { tryCount++; // Choose random position int x1= Math.abs(random.nextInt()) % (SIZE); int y1= Math.abs(random.nextInt(...
ac1eeaaf-8894-475a-a5e4-c3979b2f87bf
5
public float getLightValue(int x, int y) { if(chunkID < 0) { x = 15-x; } if(x < 0 || x >= blocks.length || y < 0 || y >= blocks[0].length) return 0; return lightValues[x][y]; }
0a9b9248-72ef-443b-bd98-998034ac6e42
5
public AbstractSyslogWriter createWriter(){ final Class<? extends AbstractSyslogWriter> clazz = this.syslogConfig.getSyslogWriterClass(); try { AbstractSyslogWriter newWriter = clazz.newInstance(); newWriter.initialize(this); return newWriter; } catch (final InstantiationException e) { if (this.syslo...
61e3ee77-b9f0-4794-a178-6b83703ca512
4
public void enableAudio() { if (audioenabled==true) return; audioenabled=true; for (Enumeration e=channels.keys(); e.hasMoreElements(); ) { String channel = (String)e.nextElement(); String lastclipid=(String)islooping.get(channel); if (lastclipid==null) continue; Hashtable chan = (Hashtable)channels.g...
64f04f1e-21aa-49f0-968f-b7ba6e747e1c
4
private ArrayList<Room> populateRooms() { try{ openDatabase(); }catch(Exception e){} String query = "SELECT * FROM t8005t2 .rooms"; ArrayList<Room> rooms = new ArrayList<Room>(); try { stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { String room...
0c18ce83-bb1a-4627-9555-eb77966d6a1f
6
private void runReadBytes(IndexInput input, int bufferSize, Random r) throws IOException { int pos = 0; // gradually increasing size: for (int size = 1; size < bufferSize * 10; size = size + size / 200 + 1) { checkReadBytes(input, size, pos); pos += size; if (pos >= TEST_FILE_LENGTH...
358b0702-072b-430c-8bca-e1f91d5b11d4
9
public static void main(String[] args) { long[] lastRow = new long[1]; lastRow[0] = 1L; for (int i = 1; i <= SIZE; i++) { if (i%1000 == 0) System.out.println(i); long[] nextRow = new long[i+1]; nextRow[0] = 1; nextRow[nextRow.length-1] = 1; for (int j = 1; j < lastRow.length; j++) nextRo...
557ca03f-22ce-4016-8492-e5adb745fad3
5
public void mover() { Celda celdaAnterior = this.getParticipante().getCeldaActual(); Celda celdaAMoverse = this.celdaAMoverse(); // Si hay tesoro de mi equipo o si esta en el borde o // si no termino el juego, puede hacer el movimiento if(celdaAMoverse != null && !celdaAMoverse.hayTesoroMio(this.getP...
05b6215e-0f81-4110-9847-f557d065b041
2
public Map(int x, int y) { grid = new Tile[y][x]; for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[0].length; j++) { grid[i][j] = new Tile(Color.black); } } }
06aad326-9177-4ab2-8421-7e0deae7c96d
7
private String startSetToString() { StringBuffer FString = new StringBuffer(); boolean didPrint; if (m_starting == null) { return getStartSet(); } for (int i = 0; i < m_starting.length; i++) { didPrint = false; if ((m_hasClass == false) || (m_hasClass == tru...
f3626195-f925-4907-83e6-55dd18662f3b
9
public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException { if(args.length < 1 || !ALLOWED_OPTION.containsKey(args[0])){ System.out.println("Usage \"TwitterWordCountTopology CountingMode\""); System.out.println("Where CountingMode is: "); for(String key: ALLOWED_OPTION....
e7f83dfd-53c0-4599-8ebc-ae1330002331
0
public static float readFloat() { return Float.intBitsToFloat(readInt()); }
2d636562-482f-436e-9b8a-7ea9c4c197d5
8
public static OutputStream translate(byte from, byte to, InputStream inputStream, String outputFileName)throws IOException{ int b; OutputStream outputStream; if(inputStream instanceof ObjectInputStream){ outputStream = new ByteArrayOutputStream(); } else if(inputStream instanceof SequenceInputStream){ ...
80c7cc7d-55e0-4543-8f97-d921439ad7a7
2
private void closeSession() { if (session != null && session.isOpen()) session.close(); }
23fa22e5-f94c-48e7-9f36-1811453fc71c
8
public void move() { if (dir == "UP") { y -= BULLET_SPEED; if (y < 0) visibile = false; } else if (dir == "DOWN") { y += BULLET_SPEED; if (y > y_max) visibile = false; } else if (dir == "LEFT") { x -= BULLET_SPEED; if (x <= 0) visibile = false; } else if (dir == "RIGHT") { ...
f72702e1-61c1-4ba2-bff6-012da33beafe
9
public static final void buyCashItem(SeekableLittleEndianAccessor slea, MapleClient c) { int action = slea.readByte(); if (action == 3) { slea.skip(1); int useNX = slea.readInt(); int snCS = slea.readInt(); CashItemInfo item = CashItemFactory.getItem(snCS)...
b8f94c97-c9ef-4fe8-bf41-a954571bade8
6
public void saveAuto(Boolean yes){ if(lt.getModified()){ File f = fs.getCurrentFile(); if(f != null && f.exists()){ if(yes){ System.out.println("Save this file: " + f.getAbsolutePath()); save(f); }else{ int response = JOptionPane.showConfirmDialog(this, "The file " + f.ge...
0cb1c959-50ae-4f72-ad75-8fab54d7cff7
1
public static DataWorker Instance() { if (dataWorker == null) { dataWorker = Init(); } return dataWorker; }
d28c9b51-0063-410c-a37c-c346e8ecba4e
4
public ConstructionPane(){ super("constructionMenu"); int buttonY = 10; int buttonX = 10; int offset = 0; for (int i = 0; i < allowed.length; i ++){ if ((i + offset) % 8 == 0){ buttonY = (((i + offset) / 8) * (32 + 4)) + 10; } if (GameRegistry.getTile(i).getSubTiles() > 0){ for ...
cf3edea5-8553-458e-8231-c300970b72b4
6
public void updateBoard(GameBoard board) { for (Position position : Position.all()) { PieceButton button = buttons[position.getColumn()][position.getRow()]; Piece piece = board.getPiece(position); if (button.getPiece() != piece) { button.setPiece(piece, !firstUpdate); } else if (piece != null && pi...
21cce75d-aa5d-4f95-8e8d-a949918c5705
2
@FXML private void handleBtnRegisterAction(ActionEvent event) { String id = String.valueOf(System.currentTimeMillis()); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String datetime = format.format(new Date(Long.parseLong(id))); Persist persist = getPersist(...
339ac08d-364e-40f7-bb90-4439c7637b83
8
private void listUsers(CommandArgsIterator args_it) throws IOException { if (args_it.hasNext()) { String chan_arg = args_it.next(); if (!args_it.hasNext() && chan_arg.length() >= 2 && chan_arg.charAt(0) == '#') { String chan_name = chan_arg.substr...
80b00c26-a0db-468b-b79c-6e50cbea5b3c
5
private void findParent(double[] target, KDNode node, int d) { // IF the node would be inserted in the branch "below" this node. if(target[d] < node.values[d]){ if (++d == dimensionCount) { d = 0; } if(node.below == null){ nearestNeighboor = node.values; minDist = distance(node.values, target...
05bd2d48-a4f2-4133-b6fb-75286ed65e77
6
public JTreeNode<T> convertToLinkList(){ JTreeNode<T> left = convertList(rootNode.getLeftNode(), true); while(left.getLeftNode()!=null){ left = left.getLeftNode(); } JTreeNode<T> farLeft = left; if(farLeft!=null){ while(farLeft.getRightNode()!=null){ farLeft = farLeft.getRightNode(); } fa...
99cd06b3-e8ec-4a0b-a433-0fcd1a30d432
8
public static void main(String[] args) { int numerator = 1; int denominator = 1; for (int i = 10; i < 99; i++) { int[] numDigits = Utils.digitsOf(i); for (int j = i + 1; j < 100; j++) { int[] denomDigits = Utils.digitsOf(j); int k1 = 0; ...
e20c4d7b-cd44-4979-8c3e-2a77431d60e8
5
protected void startEventLoop() { Socket sub = connectSubSocket(); connected = true; while (!Thread.currentThread().isInterrupted()) { try { String e = sub.recvStr(); String data = sub.recvStr(); handle(e, data); if (anytimeHandler == null && handlers.isEmpty()) { ...
0a072a5d-a03a-463a-8361-18e51f697c48
6
public int transform(CtClass clazz, int pos, CodeIterator iterator, ConstPool cp) throws BadBytecode { int c = iterator.byteAt(pos); if (c == INVOKEINTERFACE || c == INVOKESPECIAL || c == INVOKESTATIC || c == INVOKEVIRTUAL) { int index = i...
1537f950-8189-483e-93e5-f39f69fc8813
8
private String produceBiomes() { BufferedImage biomesImage = null; if (ioflags.SAVE) biomesImage = new BufferedImage(chunksX * MyzoGEN.DIMENSION_X, chunksY * MyzoGEN.DIMENSION_Y, BufferedImage.TYPE_INT_ARGB); if (loadBiomesPNG()) { for (Tile tile : MyzoGEN.getOutput().getTilesArray().values()) { tile...
7cdf8e46-44b9-48d0-a8ab-ee8ceb3bcf52
3
public boolean isLeftHeld(){ if(isXboxControllerAttached()){ if(xboxController.getLeftStickXAxis()<-0.5){ return true; } } if(left.isHeld()){ return true; } return false; }
7e8347d9-a8fe-493b-a9c3-c814f39570e6
9
public static void BuildMapFile (LinkedList<Node> nList, char[][] map, int n) throws Exception { System.out.println ("Enter the input file name for graph with " + n + " nodes -"); Scanner sIn = new Scanner (System.in); String filename = sIn.nextLine (); BufferedReader bIn = null; int row = -1; ...
d8115676-8744-448c-bfa6-4fc2d2acf59b
3
public void retirerGrincheux(Client client) { List liste = Collections.synchronizedList(listeEvenements); List<Evenement> listecopie = new LinkedList<Evenement>(); listecopie.addAll(liste); for(Evenement e: listecopie){ if(e instanceof EvenementClientGrincheuxRonchonne) { EvenementClientGrincheuxRonc...
2e2c2551-4513-4e06-8c29-a7d2e3fa9bf8
4
private ComplexMatrix straightForwardMultiply(ComplexMatrix mx) { ComplexMatrix res = zeroMatrix(getColSize(), getColSize()); for (int ci = 0; ci < getColSize(); ci++) { for (int ci2 = 0; ci2 < getColSize(); ci2++) { for (int ri = 0; ri < getRowSize(); ri++) { ...
3c8d3737-19a1-4b8c-a968-6ef6f8229f49
6
public static int getCustomBlockAmount(ItemStack item) { if ((item == null) || (!item.hasItemMeta())) return -1; ItemMeta meta = item.getItemMeta(); if ((meta == null) || (!meta.hasDisplayName())) return -1; String title = meta.getDisplayName(); if ((title == null) || (!title.contains(" x "))) retur...
af049c26-51a6-4130-b90a-ff3a14df2648
3
public static List<ProcessedCell> findCells(ImagePlus orig, ImagePlus segmented, String imgName){ ImageProcessor masked = orig.getProcessor(); ImageProcessor threshSeg = segmented.getProcessor(); int width = segmented.getWidth(); int height = segmented.getHeight(); Wand wand = new Wand(threshSeg); List<Proc...
21578481-2849-40fe-b4a0-1fe89437a08e
4
public static Entity staticload(RandomAccessFile loadfile) throws IOException { int loadID = loadfile.readInt(); if (loadID == -1) { return null; } Entity finalEntity = null; @SuppressWarnings("rawtypes") Class entClass = EntityList.getEntity(loadID); ...
8625e294-6e78-4b30-b379-4723e4091d4e
4
public String[] checkAndProcessReturn(int receiptid, int qtyReturned, String upc) throws Exception { int retid = 0; String amount=null; try { PreparedStatement ps = con.prepareStatement( "SELECT purchase_date, card_no, item_price, quantity " + "FROM Purchase P, PurchaseItem PI, Item I " + ...
ae5ee527-2974-4c61-baf9-08089138348c
1
public void visit_aswizzle(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
30e0f36b-bafa-4758-bdf3-85e6e87aadc5
1
public void registerButtonEvents() { for (ILogical logicalObject : menuOptions.getAllLogicalChildren()) { GameButton option = (GameButton) logicalObject; option.enableEvents(); } }