method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8d15e702-f6b4-4df9-ac8f-e728767123a4
1
public int getTextureID(){ if(texture != null) { return texture.getTextureID(); } else { System.err.print("RoyalFlush: Texture2D.getTextureID - No texture has been loaded.\n"); return -1; } }
9d907a64-f21a-4011-9384-204b4534e282
8
public void parse(int inID, String inLine) { String[] f = CSVParser.parseLine(inLine); sGTFS_ID = inID; // System.out.println("Parsing: " + getGTFS_ID() + " " + inLine); ArrayList<String> inHeader = _headers.get(inID).get(this.getFilename()); if (inHeader == null || f == null || f.length == 0 || f.le...
fa5d6228-28f5-4ca5-a560-cad2ffc6d35b
9
private void processArguments(String[] arguments) { if(arguments == null || arguments.length == 0) { return; } if(arguments[0].matches("-h|-help")) { // help doHelp(arguments); } if(arguments[0].matches("-v|-version")) { // ve...
c0c99eb2-8590-4047-882f-11981e91f545
7
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (active ? 1231 : 1237); result = prime * result + ((age == null) ? 0 : age.hashCode()); result = prime * result + ((books == null) ? 0 : books.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCod...
50ed0389-b2f8-4bf9-964f-6eb32f830a8a
7
public double[] maxminWRT(String op, NodeVariable x, HashMap<NodeVariable, MessageQ> modifierTable) throws ParameterNotFoundException { //System.out.println("Sto vedendo se la variabile esiste"); int xIndex = this.getParameterPosition(x); //System.out.println("Non ho lanciato l'eccez...
0c1be961-0c68-4abe-b804-4d4e4d4872ef
8
private void loadUserConfig() { UtilAccess utilAccess = workspace.getUtilAccess(); String pathToFile = getConfigPath(); String[][] data; FileInputStream fis; try { fis = new FileInputStream(pathToFile); ObjectInputStream ois = new ObjectInputStream(fis); ...
709bfa2f-2331-4f05-8459-a637b240fafb
8
public ArrayList<Point> checkMove2(Stack<TTTBoard> boards, char player) { ArrayList<Point> winningSpots = new ArrayList<Point>(); ArrayList<TTTBoard> tempArray = new ArrayList<TTTBoard>(); while (!boards.isEmpty()) { TTTBoard aBoard = boards.pop(); ArrayList<Point> spots = aBoard.getEmptySpots(); char tu...
b72ad74a-0981-48eb-8b85-ff90f5c0c7f1
2
public void pay(Player from, Player to, double amount) { Account payer, receiver; payer = getAccount(from); receiver = getAccount(to); if (payer != null && receiver != null) { payer.subtract(amount); createPaymentTransaction(payer, receiver, amount); ...
52383781-2a15-4b74-b548-2d69322eb6a9
7
public void updateStatusAndCursor() { int trueThickness = this.aCanvas.getThickness(lineThickness); switch (this.drawableSelector) { case 1: this.aCanvas.setStatus(" Line is created at [" + this.aMap.get("xi") + "," + this.aMap.get("yi") ...
34f5ee7e-4209-4a7f-9f04-96e5786c1cd2
8
public void print(int mm, int yy) { /** The number of days to leave blank at the start of this month */ int leadGap = 0; System.out.print(months[mm]); // print month and year System.out.print(" "); System.out.print(yy); System.out.println( ); if ...
c77c9bd1-0691-4f5e-a471-7b4d26bd7446
5
public void test_constructor() { BaseDateTimeField field = new PreciseDateTimeField( DateTimeFieldType.secondOfMinute(), ISOChronology.getInstanceUTC().millis(), ISOChronology.getInstanceUTC().hours() ); assertEquals(DateTimeFieldType.secondOfMinute(), field.g...
21e0c451-9272-40d4-abb5-ef80fa53c046
5
private void loadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadButtonActionPerformed // Mettre à jour le document d'après le contenu du textarea setDocumentFromTextArea(); // Sélectionner un fichier List<String> list; String _fileName = ""; ...
7bb4757e-5903-416f-8c13-8c4ff450a6bb
8
protected void setDirection() { if (left) { dx -= moveSpeed; if (dx < -maxSpeed) dx = -maxSpeed; } else if (right) { dx += moveSpeed; if (dx > maxSpeed) dx = maxSpeed; } else { if (dx > 0) { dx -= stopSpeed; ...
47a3e21a-901a-466f-a45c-23ed8c71a4f4
9
public HashMap<Integer, ArrayList<SamplePoint>> SpatialTemporalWindowQuery(long midTime, long tRadius, double longitude, double latitude, double sRadius) { // TODO Auto-generated method stub HashMap<Integer, ArrayList<SamplePoint>> result = new HashMap<>(); int segmentID; fo...
0fa6752d-57ab-4b73-8c3c-8cf92d1f9703
3
public void mouseDragged(MouseEvent e) { int x = e.getX(); int y = e.getY(); if (isDrawing){ System.out.println("Dragging at (" + x + "," + y); if (Math.abs(lastX - x) == 0) { lineUpperX.add(x + 5); lineUpperY.add(y); lineBottomX.add(x - 5); lineBottomY.add(y);...
473dbf61-214a-4473-b448-77596d0c3486
2
@SuppressWarnings ("unchecked" ) @Override public T[] get( ByteBuffer in ) { Integer length = Compress.getIntUnsignedNullable( in ); if (length == null) { return null; } T[] array = (T[])Array.newInstance( componentType, length ); ...
0ea2a659-555c-44e0-9d7b-37b61ff01794
4
private void rotateLeft(Node<K, V> root) { Node<K, V> left = root.left; Node<K, V> pivot = root.right; Node<K, V> pivotLeft = pivot.left; Node<K, V> pivotRight = pivot.right; // move the pivot's left child to the root's right root.right = pivotLeft; if (pivotLeft != null) { pivotLeft....
5047cc60-cbd3-4d03-94c4-7b77c745e70f
5
public SimpleNode interpret(Environment env) { if(this.type.equals("int") || this.type.equals("float")) { return this; } else if (this.type.equals("ident")) { if (env.idList.containsKey(this.name)) { return env.get(this.name); } else { return this; } } else { int children = jj...
6ba75e03-37b4-444b-bb0f-e9c7a2b358f5
4
public static Object createInstanceWithArgs(String className, Object ... args) { try { Class<?>[] arg_types = new Class<?>[args.length]; int I = 0; for (Object arg : args) { arg_types[I] = arg.getClass(); I++; } return ...
36af29e0-dbe2-47af-952b-69c735f1bc6d
4
public double getTotal(){ double total = 0; for(Entry<Product, Double> entry : products.entrySet()){ Product p = entry.getKey(); double quantity = entry.getValue(); if(p.getDiscount() != null) total += p.getDiscount().getDiscountedPrice((p.getPrice())) * quantity; else total += p.getPr...
83e81050-addf-458a-90b7-a0fc9e2a166d
7
protected String generateJavadoc(int index) throws Exception { String result; OptionHandler handler; String optionStr; result = ""; if (index == 0) { if (!canInstantiateClass()) return result; if (!ClassDiscovery.hasInterface(OptionHandler.class, getInstance().getClass...
5320ac31-42e0-4c50-bb91-745fe1be6cab
6
public static void main(String[] args) { final int NMAX = 10; // allocate triangular array int[][] odds = new int[NMAX + 1][]; for (int n = 0; n <= NMAX; n++) odds[n] = new int[n + 1]; // fill triangular array for (int n = 0; n < odds.length; n++) for (int k = ...
321ba94d-5329-4f4e-9263-788bec9cf5b7
3
public synchronized void record(ByteBuffer block, int offset) throws IOException { if (this.data == null || offset == 0) { this.data = ByteBuffer.allocate(this.length); } int pos = block.position(); this.data.position(offset); this.data.put(block); block.position(pos); if (block.remaining() + offse...
07fd6621-047c-46d2-8515-0b1d073a555e
2
private void assignAsMafia(Player player) { if (mafiaCount > 0) { player.setRole(Role.Mafia); mafiaCount--; } else if (villagerCount > 0) { player.setRole(Role.Villager); villagerCount--; } }
66dddaf7-b89d-4f55-a7b4-159e5d02c6ae
8
private void submitRegistration(Participant part) { driver.findElement(By.id("name")).sendKeys(part.getName()); driver.findElement(By.id("email")).sendKeys(part.getEmail()); driver.findElement(By.id("address")).sendKeys(part.getAddress()); driver.findElement(By.id("city")).sendKeys(p...
f81ee194-e6a4-4212-821d-61212f028485
0
public JComboBox getjComboBoxSecteur() { return jComboBoxSecteur; }
0686b68d-663f-4ab9-ae6f-0d15771ec3e7
4
protected Casella posicioCentral() { TaulerHex tauler = partida.getTauler(); for ( int fila = 0; fila < tauler.getMida() / 2; fila++ ) { for ( int columna = 0; columna < tauler.getMida() / 2; columna++ ) { if ( tauler.esMovimentValid( EstatCasella.JUGADOR_A, tauler.getMida() / 2 + fila, tauler.g...
facddbc2-3e9e-4271-b01e-c8d0b44c524f
7
@Override public boolean isMenuComponent(Component c) { // Are we in the MenuItem part of the menu if (c == this) return true; // Are we in the PopupMenu? if (c instanceof JPopupMenu) { JPopupMenu comp = (JPopupMenu) c; if (comp == this.getPopupMen...
f4eb66b5-ab66-4b53-9a12-092b0cef2cc5
1
public float getV2() { if(animation != null) { return animation.getV2(); } return tex.getV2(); }
3fe82aca-2cee-4cc3-9f8e-5ef38fce2227
2
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { System.out.println("before calling :" + method); if(null != args) { for(Object objre: args) { System.out.println(objre); } } Object obj = method.invoke(Proxyobject, args); System.out.println("after c...
68e01453-1859-43ce-b41a-8a31da86a6e7
2
@Override public void keyTyped(KeyEvent e) { keys[e.getKeyCode()] = true; if (e.getKeyChar() == (char)27) { timer.stop(); if (JOptionPane.showConfirmDialog(null, "Juego en progreso\n" + "Desea continuar jugando?", "Pausa", ...
d93ad3c4-7a4a-4cb8-9a32-c9be603102c4
5
public static void kill(Connection con) { try { con.close(); } catch (Exception e) { System.out.println("could not close connection, exception occured: " + e); } System.out.println("Closed connection"); if (driver.equals("org.apache.derby.jdbc.EmbeddedDriver")) { boolean gotSQLExc = false; ...
2aaa1ab0-e6d7-4113-9cc3-efe150e07828
2
private static int convertAttributeToInt(final Attribute attribute) { if (attribute == null) { return 0; } try { return attribute.getIntValue(); } catch (final Exception ignore) { return 0; } }
fc4cd5a4-8644-4611-8823-fcff5a0583b2
9
private static int findByte(int numTry) { int max = (int) possibleKeys.get(0), min = (int) possibleKeys.get(0), index = 0; for (int i = 0; i < possibleKeys.size(); i++) { if ((int) possibleKeys.get(i) > max) { max = (int) possibleKeys.get(i); } if ((int) possibleKeys.get(i) < min) { min = (int) po...
ff64d388-0cbc-4503-bca1-053f38b4ee73
6
public static void makeGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout)parent.getLayout(); } ...
37e38b2c-fad3-4dc7-ac24-52fa154beaf3
5
public boolean relocateSettings() { boolean success = true; try { if (!hsPath.exists()) { hsPath.mkdir(); // Copy old files to new directory. if (getOldChannelStoreFile().exists()) { copyFile(ge...
efe86f05-4908-4966-85cd-344fa6d785d6
6
public void set(double balance) { AccountSetEvent Event = new AccountSetEvent(this.name, balance); iConomy.getBukkitServer().getPluginManager().callEvent(Event); Connection conn = null; PreparedStatement ps = null; try { conn = iConomy.getiCoDatabase().getConnection(); if (this.ban...
7ad7bf76-cb30-41bd-b37f-64c5ac51cebd
4
private void checkVersion( JSONRPCRequest request ) throws JSONRPCException, JSONException { // Check version if( request.getVersion() == null ) throwJSONRPCException( "version is not present." ); if( request.getVersion().isNull() ) throwJSONRPCException( "version is not specified." ); ...
ded2c629-befc-4bae-a3cf-89d912c5c00a
6
private Unit trySwapExpert(Unit expert, List<Unit> others) { GoodsType work = expert.getType().getExpertProduction(); GoodsType oldWork = expert.getWorkType(); for (int i = 0; i < others.size(); i++) { Unit other = others.get(i); if (!other.isPerson()) continue; ...
566460f8-00b2-408d-95fb-5d54b486ffbb
8
private void checkKeys() { if(KeyBoard.typed(KeyEvent.VK_LEFT)){ moveTiles(Direction.LEFT); if(!hasStarted)hasStarted = true; } if(KeyBoard.typed(KeyEvent.VK_RIGHT)){ moveTiles(Direction.RIGHT); if(!hasStarted)hasStarted = true; } if(KeyBoard.typed(KeyEvent.VK_UP)){ moveTiles(Direction.UP); ...
d7e2f469-dfe5-4030-b1cf-cc30cec8bcac
6
public HashMap<String,ArrayList<String>> combineBodyText(ArrayList<String> bodyPieces){ ArrayList<String> bodyText = new ArrayList<String>(); ArrayList<String> bodyPic = new ArrayList<String>(); int i=0,j,k; while(i<bodyPieces.size()){ String textStr = ""; String ...
a7bea9a0-935d-475d-8fcd-a31e0e09fc62
9
private boolean isReservedItemName(String name) { if (ATTRIBUTE_TEXT.equals(name)) { return true; } else if (ATTRIBUTE_CREATED.equals(name)) { return true; } else if (ATTRIBUTE_MODIFIED.equals(name)) { return true; } else if (ATTRIBUTE_TYPE.equals(name)) { return true; } else if (ATTRIBUTE_URL.equ...
fc618374-4001-4b02-a7d6-4d00e2b1e30f
9
@Override public void process(final JCommander jCommander) { Randomizer.setSeed(this.seed); final Environnement env = new Environnement(this.largeur, this.hauteur); final SMA sma = new SMA(env); boolean ok = false; // Ajout des agents poissons for (int i = 0; i < nbPoissons; i++) { ok = false; whil...
c12a00a1-e73f-416a-8fec-a534c2ad9f95
2
public static boolean isTeamRed(int team) { for(int k = 0;k <= 2;k++) { if(redTeams[k] == team) { return true; } } return false; }
7e0c42c1-e47c-4238-aecf-d977de99b5db
3
public void restaurarEscudos(int cant){ for(Escudo escudo : escudos) if(!escudo.isVivo()){//si está muerto escudo.restaurar(); if(--cant <= 0)break; } }
e231a3fa-ad3c-4e8c-895d-82ab766ed82c
7
public void processMsg() { switch (state_) { case RFBSTATE_PROTOCOL_VERSION: processVersionMsg(); break; case RFBSTATE_SECURITY_TYPES: processSecurityTypesMsg(); break; case RFBSTATE_SECURITY: processSecurityMsg(); break; case RFBSTATE_SECURITY_RESULT: processSecurityResult...
585551cf-3fd5-4f03-a920-9b6e408becc2
2
public static void main(String[] args) { ExecutorService executor = Executors.newFixedThreadPool(5); for (int i = 0; i < 10; i++) { Runnable worker = new WorkerThread("" + i); executor.execute(worker); } executor.shutdown(); while (!executor.isTerminated...
71d48fd5-2cd6-4c88-b87b-3a87427e0657
8
public void setTool(int type, int tool, String tstr, int tval){ //(0= state draw, 1 = state fill, 2 = cell draw, 3 = cell fil) switch(type){ case 0: sdt = tool; toolstring[0] = tstr; break; case 1: sft = tool; toolstring[1] = tstr; break; case 2: cdt = tool; toolstring[2] = tstr; break; case 3: cf...
e4125325-6b3e-4c1b-9f49-033c2aeae902
2
public static BufferedImage encodeMessage(BufferedImage img, String inputFilePath) { //foto omzetten naar een byte array byte bImg[] = getBytes(img); // byte gegevensopslaan en uitlezen byte[] block = null; int bLen = 0; try { final File inputFile = n...
8771e6a2-194e-424e-9b5d-de2d74ac0c3f
3
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { RequestDispatcher rd = null; voorraadNaam = req.getParameter("voorraadNaam"); voorraadMin = Integer.parseInt(req.getParameter("voorraadMin")); voorraad = Integer.parseInt(req.getParameter("voorraad"...
6d7ecc9b-15fd-4d5e-9afb-584f57065af6
2
public long getLong(String key) throws JSONException { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object); } catch (Exception e) { throw new JSONException("JSONObject["...
fc8f5d8c-5440-469d-971d-d8ee06062f78
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Room other = (Room) obj; if (building == null) { if (other.building != null) return false; } else if (!building.equals(other.building)) ...
05b2407d-1715-4742-96ee-58f8d271d4da
2
public StockItem getStockItem(int productId) { for (StockItem stockItem : stockList) { if (stockItem.getProduct().getProductID() == productId) { return stockItem; } } System.out.println("Product ID not found!"); return null; }
a1183429-e515-4192-b745-eb9b6eefbf32
8
public static void fermatTwoSquareProblem() { for(long i= 1; i < 1000; i++) { if(isPrimeWeb(BigInteger.valueOf(i))) { allPrimes.add(i); if(allPrimes.size() > 1) allGaps.add(i- allPrimes.get(allPrimes.size()-2)); System.out.print(i+ ", "); if(1 == (i%4)) { long[] twoIntegers= findTwoSquares(i);...
f0166f88-925f-4f57-91f1-3f779eda2e8b
0
public DCPackage receiveDCPackage() { inputAvailable.acquireUninterruptibly(); return inputBuffer.pop(); }
4fae10dc-1778-4334-ac1a-f84d86e9f0fa
9
public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(START_INDEX_FIELD_DESC); oprot.writeI32(this.startIndex); oprot.writeFieldEnd(); oprot.writeFieldBegin(TOTAL_NOTES_FIELD_DESC); oprot.writeI32(this.totalNotes); ...
c98713cb-f0a5-44df-abbf-391f992f53f1
9
public void weightTheGraph(){ // for each edge for (Edge e : this.factorgraph.getEdges()) { try { // weight this edge this.weightTheEdge(e); } catch (ParameterNotFoundException ex) { if (debug>=1) { String dm...
b1abb8ca-3b82-45c5-88cc-52fc07ad1d3d
1
@Override public byte getRightPercent() { int questions = getFinishedQuestions(); return questions > 0 ? (byte) (getRightAnswers() * 100 / questions) : 0; }
513135fc-3fcd-46df-be8c-00cafe671dc8
2
private boolean checkKeys(int a, int b) { if (input.isKeyPressed(a) || input.isKeyPressed(b)) { return true; } return false; }
ff142e19-2268-4019-b3c1-c94475b1bf7d
9
private boolean isCurrentThreadInterrupted(ServerSocket serverSocket) { if (this.currentThread.isInterrupted()) { this.log.info("current Thread is Interrupted"); try { serverSocket.close(); this.log.info("close server Socket: " + serverSocket.toString()); } catch (IOException e) { // TODO Auto-ge...
cb120d29-12e3-4dde-b54c-33c748bf50b3
1
public BigInteger[] nextBigIngtegerArray() throws Exception { String[] line = reader.readLine().trim().split(" "); BigInteger[] out = new BigInteger[line.length]; for (int i = 0; i < line.length; i++) { out[i] = new BigInteger(line[i]); } retur...
f74a56d2-a092-46a2-a48c-451bcf7a824d
2
@Override public void run() { try { accept(new NodeVisitor() { @Override public void visitMethod(ClassNode c, MethodNode m) { m.graph(); } }); for (NodeVisitor visitor : Deobfuscator.TREE_TRANSFORMERS[Deobfuscator.getPhase()]) { accept(visitor); } accept(new NodeVisitor() { @O...
99525a74-a8a2-42ff-84ef-3f4abea05c1a
6
public static void skipMDeleteN(LinkedListNode head, int M, int N) { LinkedListNode curr = head; while (curr != null) { for (int i = 1; i < M; i++) curr = curr.getNext(); if (curr == null) return; ...
6e8414e4-f17a-4f0f-bfd2-ebb84c1871a4
4
public static double cosh(double x) { if (x != x) { return x; } if (x > 20.0) { return exp(x)/2.0; } if (x < -20) { return exp(-x)/2.0; } double hiPrec[] = new double[2]; if (x < 0.0) { x = -x; } exp(x, 0.0, hiPrec); ...
9319874e-8858-4a9f-add6-00ed432c839a
8
private void init(double[] regularLoad, double peakLoad, double offPeakLoad, double relativeHolidayLoad, LinkedList weekendList, LinkedList holidayList, long seed) { this.weekendList_ = weekendList; this.holidayList_ = holidayList; random_ = new Random(seed); ...
0e7c87c3-1354-45d6-8ce1-37121b6a5604
7
public void processEvent(AWTEvent e) { switch (e.getID()) { case WindowEvent.WINDOW_CLOSING: System.exit(0); case MouseEvent.MOUSE_RELEASED: mouseReleased(); break; case MouseEvent.MOUSE_PRESSED: mouseButton = ((MouseEvent) e).getButton(); mousePressed(); case MouseEvent.MOUSE_MOVED: case Mou...
92da39e9-0950-4be6-8a28-0d6df5e590a0
5
public TreeNode findNextNode(TreeNode node){ if(node.right==null){ //if this is to right of parent, with no children, there is no next node if(node.parent==null || node.parent.right == node){ return null; } //if this is to left of parent with no ch...
ad418a60-4490-4794-abe4-0696d27f84fa
7
public int[] GenerateArray(ArrayGeneratorParams agParams) { int[] localArray = new int[agParams.getSize()]; Random rnd = new Random(); switch (agParams.getType()) { case RANDOM: for(int i = 0; i < agParams.getSize(); i++) { ...
acc30ec4-8d9c-4499-a631-d9517e2fda85
4
* @return The value at the specified index. */ public E valueAt(int index) { if (index >= size || index < 0) { return null; } else { Node<E> curr = head; for (int i = 0; i < size; i++) { if (i == index) { return curr.getVa...
159186ce-cb26-4d61-beaa-bb38360d40bc
7
public boolean sendData(Object data) { if (output == null || !socket.isConnected()) { return false; } synchronized (this) { try { output.flush(); output.writeObject(data); output.flush(); //output.reset(); ...
4506267f-61c1-471d-883f-85ade4393408
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Challenge other = (Challenge) obj; if (!Objects.equals(this.name, other.name)) { return false...
56728c68-dbd6-4b55-8f35-1ee5f83d4789
8
public void actionPerformed(ActionEvent event) { toDisplay("User", outgoing.getText()); String id = outgoing.getText().toLowerCase(); if (id.substring(0, 7).equals("connect") && !isConnected) { frame.connectServer(id.substring(8, id.length())); } else if (id.equals("disconnect") && isConnected) { ...
ae729cb5-cb95-43dc-bd4b-5f1b83360b89
2
public static long phi(long n) { long nbPremRelatif = 1; //on compte le `1` for(int i = 2; i < n; i++) { if (Num2.euclideEtendu(n, i)[0] == 1) { nbPremRelatif++; } } return nbPremRelatif; }
18cbdd07-f73c-44f2-84c7-0af41e2d0c96
7
@Override public boolean getIsControl() { init(); if( getIsPrimitiveOperator() ) { return false; } /* TODO: Rework bitAttrIf. It optimizes the calculation of if statements * should not normally be a big deal, but saves the calculation of one of * the result fields if needed.*/ if( b...
81ce098f-898a-4e61-a086-92085508da65
9
@Override public void run() { while (isWriter) { int i; int j; synchronized (this) { if (buffIndex == writeIndex) try { wait(); } catch (InterruptedException _ex) { } if (!isWriter) return; j = writeIndex; if (buffIndex >= writeIndex) i = buffIndex - writeIndex...
07df01af-ab2c-4d22-a825-f3895eb03f81
1
public boolean setElement(int index, E element) { if (indexWithinCapacity(index)) { array[index] = element; return true; } return false; }
562aa465-9f50-46ee-9ffa-a95f78a51850
0
static int load_littleendian(byte[] x, int offset) { return ((int)(x[offset])&0xff) | ((((int)(x[offset + 1])&0xff)) << 8) | ((((int)(x[offset + 2])&0xff)) << 16) | ((((int)(x[offset + 3])&0xff)) << 24); }
28ec9e14-34da-47e9-b38e-8d8982a1d054
0
public static void main(String[] args) { // Working with the Scanner Class Scanner in = new Scanner(System.in); System.out.println("What is your full name?"); String fullName = in.nextLine(); System.out.println("What is your age?"); int age = in.nextInt(); System.out.println("Your full n...
c14a7d55-6a24-449d-bdcd-c06b94034fd2
8
public boolean canMove() { resetIdle(); if(snoozing){ //force mob to wake up wake(); } //can't move if the current action disallows it if(immobileActions.contains(getAction(), true) || frozen) return false; float min = visionRange, d; for(Entity e : discovered){ if(e instanceof Ground ||...
0b770cce-0a05-425a-9378-c7653742e7f0
9
public void building(int camX, int camY, int renW, int renH) { if (Component.isMouseLeft || Component.isMouseRight) { for (int x = (camX / Tile.tileSize); x < (camX / Tile.tileSize) + renW; x++) { for (int y = (camY / Tile.tileSize); y < (camY / Tile.tileSize) + renH; y++) { ...
0f3d044f-964d-4260-824b-bb54a03db294
4
public void update() { if(isOpening) { double time = (double)Time.getTime()/(double)Time.SECOND; if(time < openTime) { float lerpFactor = (float)((time - OpenStartTime) / TIME_TO_OPEN); getTransform().setTranslation(VectorLerp(closePos...
2c4e1769-afd4-437f-b2df-b2b42d4578aa
1
public String toString() { return name + "=" + storedValueAsString + " [" + (normalState ? "Normal" : stateDescription) + "]"; }
1e41023e-08c7-43a9-ab56-152ec6b47185
9
@Override public void run() { Transaction tx = graph.beginTx(); double q = 0.15; // Initialize Iterable<Node> allVertices = GlobalGraphOperations.at(graph).getAllNodes(); int N = 0; int m = 0; for (Node v : allVertices) { N++; if (m < (int) v.getId()) m = (int) v.getId(); } double[]...
76b3cf50-538b-44d0-95a9-96d389f2b919
9
public int search(byte text[], int start, int length) { int textLen = length + start; partial = -1; // assume no partial match if (d == null) return -1; // no pattern compiled, nothing matches. int m = patLen; if (m == 0) return 0; int k, j = 0; int ...
6289fa17-3b47-432d-86e6-1f270c77a60a
1
private void addIconToTrayBar() { try { SystemTray tray = SystemTray.getSystemTray(); tray.add(trayView.getTrayIcon()); } catch (AWTException e1) { JOptionPane.showMessageDialog(chatGui, settings.getLanguage().getLabel("tray_error_description"), settings.getLanguage().getLabel("error_title"),...
3b81958d-8ef3-45fb-b178-3c1022eee5d2
8
@Override public void quickPlay(boolean priority, boolean toStream, boolean toLoop, String sourcename, FilenameURL filenameURL, float x, float y, float z, int attModel, float distOrRoll, boolean temporary) { IntBuffer myBuffer = null; if (!toStream) { ...
a1e2247d-76a4-4a90-8285-d901b58c2bf9
0
public ChatCore() { updtools = UDPTools.getInstance(); settings = Settings.getInstance(); participantList = ParticipantList.getInstance(); chatHistory = ChatHistory.getInstance(); }
782fce8f-1e4a-4182-b14a-2b66b4ca26b6
7
private String sendCommand(Session session, RemoteCommand remoteCommand, boolean showCommand, JTextArea launcherLogWindowTextArea) { StringBuilder commandStderrBuffer = new StringBuilder(); StringBuilder commandStdoutBuffer = new StringBuilder(); try { Channel channel = ...
84d4e2e9-03a0-47f1-8165-10fe89a2ca29
2
public FileType loadFileType(int dId) throws Exception { FileType result = null; String strStatement = "SELECT dFileExtension FROM document AS d WHERE d.dID = " + dId; ResultSet rstResultSet = null; try { rstResultSet = startQuery(strStatement); if (rstResultSet.next()) { String filetype = rstRe...
530a88ed-f074-4b17-a4d8-c7a4876f2891
1
public boolean contensVenda(int id) { try { getVenda(id); return true; } catch (ExceptionGerenteVendas e) { return false; } }
de066210-7ff4-4683-a39c-ba9b425eb8e9
0
public void setBoard (Board board){ field=board; }
25597d7c-19e1-40f1-ad93-e316b2596614
0
public Vector getAgents() { return agents; }
cf7b2a7a-2b65-4ac4-8596-a9368c4f6b20
0
public void setName(int i, String s) { this.names.set(i, s); ((DefaultListModel) Outliner.findReplace.FIND_REPLACE_LIST.getModel()).setElementAt(s,i); }
11ec4258-ec32-49a5-8ca8-125f9f4885ec
9
protected PropertyGeneratorImpl(String[] propertyNames, Class[] propertyClasses, Class[] supportedOpClasses) { if(propertyNames == null || propertyClasses == null || supportedOpClasses == null) { throw new ...
71ce74da-5be0-4af4-8a43-c27ef44d1afb
7
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for(String ln ; (ln=in.readLine())!=null; ){ int n = Integer.parseInt(ln); int[] coins = new int[n]; StringTokenizer st = new StringTokenizer(in.readLine()); for (int i = 0...
59c80d65-db4a-4b2a-b276-02f65699df51
7
private boolean canExit(Phantom phantom) { if (!phantom.isAtHome()) { return true; } boolean canExit = true; for (Phantom ph : phantoms) { if (phantom != ph) { if (ph.getRow() > 10 && ph.getRow() < 13 && ph.getColumn() > 13 && ph.getCo...
eeed88a3-e826-4979-8934-ec3d21ac1309
3
public static StringBuilder getFileResourceContent(String resourceName) { StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader( loadResourceInputStream("files/" + resourceName))); try { String line; for (; (line = br.readLine()) != null;) { sb.append(l...
21da5110-6251-41fe-81da-3a9f26b76db2
7
static void dradb2(int ido,int l1,float[] cc,float[] ch,float[] wa1, int index){ int i,k,t0,t1,t2,t3,t4,t5,t6; float ti2,tr2; t0=l1*ido; t1=0; t2=0; t3=(ido<<1)-1; for(k=0;k<l1;k++){ ch[t1]=cc[t2]+cc[t3+t2]; ch[t1+t0]=cc[t2]-cc[t3+t2]; t2=(t1+=ido)<<1; } if(i...
7a39d323-3fee-44d3-b10f-e538e4772030
0
public int getLilium() { return lilium; }
b6eda488-97b6-4ec7-83c8-7da1f6c5ae4d
6
private void balance(Node<T> currentNode) { int balanceFactor = getBalanceFactor(currentNode); if (balanceFactor > 1) { Node<T> leftChild = currentNode.getLeftChild(); if (getBalanceFactor(leftChild) == -1) { // Left right case // reduce to left left case ...