method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
987857a7-f24b-4e0d-99b8-0d26e95d2432
4
private void gameLoop() { long previousTick = System.nanoTime(); long previousUpdate = System.nanoTime(); long nanosecondsPerUpdate = (long) ((float) MathHelper.MILLIARD / (float) updaterate); while (!Display.isCloseRequested() && isRunning) { long currentTime = System.nanoTime(); long deltaTime = curren...
840859b7-5751-414b-92e4-4e7cf5eaa1e0
2
public int[] getAvgColorAsRgba(Point p1, Point p2, Point p3) { Edge[] edges = new Edge[3]; edges[0] = new Edge(p1, p2); edges[1] = new Edge(p2, p3); edges[2] = new Edge(p3, p1); List<Integer> endPoints = new ArrayList(); boolean onRightSide = gatherEndPoints(edges, endPo...
dd0a5514-9a1c-43dc-a15b-ab0e9d8ff524
1
public void testWithField_DateTimeFieldType_int_2() { LocalDateTime test = new LocalDateTime(2004, 6, 9, 10, 20, 30, 40); try { test.withField(null, 6); fail(); } catch (IllegalArgumentException ex) {} }
a42e29ad-61e4-4fe6-864b-e99cb4cdcc09
7
public void clear() { //find out the row/column that has 0, indicate it with boolean set int[][] matrix_clear = new int[row][column]; boolean[] row_with_zero = new boolean[row]; boolean[] column_with_zero = new boolean[column]; for(int i=0; i<row; i++) { for(int j=0; j<column; j++) { if(matrix[i][j]...
ab319517-9d91-4f2e-a933-c94330cc5fcd
8
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); do { line = in.readLine(); if (line == null || line.length() == 0) break; int[] trh = retInts(line); tr...
06cd4db6-878c-4e8c-ad7b-eb15b6494293
2
RoomScheme generateRandomScheme(int days, int classTimes, Subject[] s){ Subject[][] sub = new Subject[days][classTimes]; RoomScheme r; for(int i=0; i<days; i++){ for(int j=0; j<classTimes; j++){ sub[i][j] = s[(int)(Math.random()*(s.length))]; } ...
41202a8f-f696-460f-9879-a51f3341ae4e
7
public int selectFinalLabel( int vectorIndex){ //we can have max 10 labels int[] labelCount = new int[10]; int result = -1; // find the count for each label for(int i=0; i<minKLabels.length; i++){ labelCount[minKLabels[i]]++; } HashSet<Integer> labelsWithHighestCount = new HashSet<Integer>(); ...
7bc15a48-76aa-4774-a1c0-2f20af9bb511
0
public static String cleanUrl(String dirtyUrl) { String result = ""; //dirtyUrl = dirtyUrl.replaceAll("www.", ""); dirtyUrl = dirtyUrl.replaceAll("http://", ""); dirtyUrl = dirtyUrl.replaceAll("https://", ""); result = "http://" + dirtyUrl; // result = "http://www." + dirtyUrl; _logger.debug("Dirty-URL: "...
eb3dd5d6-d171-41b3-bc45-6a8cd7c537e1
2
public void activePlayerDoAction(Action actionToDo) throws InvalidActionException{ actionToDo.doAction(getActivePlayer(), getGrid()); if(actionToDo instanceof EndTurnAction) activePlayerEndTurn(); if (getActivePlayer().getRemainingTurns() <= 0) activePlayerEndTurn(); }
f18eff2d-19e4-43dc-9a8a-02f8d4d9eb15
0
@BeforeClass public static void beforeClass() { System.out.println("Testing PhonewordFinder Started."); _dictionary = new WordReader("/dict4test.txt"); _phonewordFinder = new PhonewordFinder(_dictionary); }
eb64c928-0fbd-4f9d-842a-f2a8c12ced7d
2
public void ensureCapacity(int minCapacity) { int oldCapacity = data.length; if (minCapacity > oldCapacity) { int oldData[] = data; int newCapacity = (oldCapacity * 3)/2 + 1; if (newCapacity < minCapacity) { newCapacity = minCapacity; } data = new int[newCapacity]; System.arraycopy(oldData,...
54711356-fbed-497c-b238-d05694044c68
5
public IrcModeChange(String modes) { char sign = ' '; plus = new ArrayList<>(); minus = new ArrayList<>(); for (char c : modes.toCharArray()) { if (c == '+' || c == '-') { sign = c; continue; } if (sign == '+') ...
a858c37b-2e0b-4147-956c-3d1e4d6307f8
2
public void write(OutStream os) { os.writeU8(bpp); os.writeU8(depth); os.writeU8(bigEndian ? 1 : 0); os.writeU8(trueColour ? 1 : 0); os.writeU16(redMax); os.writeU16(greenMax); os.writeU16(blueMax); os.writeU8(redShift); os.writeU8(greenShift); os.writeU8(blueShift); os.pad(3...
28b2c287-b5ac-4f76-b4ef-3cf8cb016290
3
public Object readSymbol() throws IOException { if (trace >= API_TRACE_DETAILED) { debugNote("About to read symbol name."); } Object response = readObject(); if (!(response instanceof String)) { throw new CycApiException("Expecting a String, got: " + response.getClass() + " for ob...
dd7c9ea7-2573-4379-9a05-43654acafc4e
9
private void makeFlushArray() { _flushArray = new char[0x1fc1]; for (int cn0 = 0; cn0 < RANK_SIZE; cn0++) { for (int cn1 = cn0 + 1; cn1 < RANK_SIZE; cn1++) { for (int cn2 = cn1 + 1; cn2 < RANK_SIZE; cn2++) { for (int cn3 = cn2 + 1; cn3 < RANK_SIZE; cn3++) { for (int cn4 =...
1614638c-2f34-4355-90ec-a7bbdfce326f
7
public static void format(InStream inStream, OutStream outStream,FormatSettings formatSettings) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException { indentString = formatSettings.getIndentString(); char currentSymbol; handlers = formatSettings.getHandlersL...
a02115de-892f-4228-874e-f56bd77ab039
3
private void menu() { String option = ""; while (isRunning) { System.out.println(); System.out .println("Cac tham so khi su dung chuong trinh. Click vao man hinh chon phim can dung"); System.out .println("- Q Ket thuc chuong tring. Khong duoc tat truc tiep phai dung Q de luu du lieu."); Syste...
36559b46-6a51-465d-9b7f-ca8b9ff7bd6a
5
public Set<AndroidMethod> parse() throws IOException{ Set<AndroidMethod> methodList = new HashSet<AndroidMethod>(INITIAL_SET_SIZE); Pattern p = Pattern.compile(regex); Pattern pNoRet = Pattern.compile(regexNoRet); for(String line : this.data){ if (line.isEmpty() || line.startsWith("%")) continue; ...
8910f4d5-bb31-4c33-9af2-a67d96fb58b1
5
private static void processParameters(String[] args) { if (args.length == 0) { showUsage(); System.exit(1); } for (int i = 0; i < args.length; i++) { String opt = args[i]; if (opt.startsWith("--template")) { if ((i + 1) < args.leng...
41470b52-886c-4f94-bb92-a955a1b230ee
9
static void blitscreen_dirty1_vga() { int w, h; /* while (true) {*/ for (int i = 0; i < scrbitmap.height; i++) { System.arraycopy(scrbitmap.line[i].memory, scrbitmap.line[i].offset, back_buffer, i * scrbitmap.width, scrbitmap.width); } { int ...
208eaf9c-5456-4cc2-98da-c60b5ed15a8b
8
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
c32301f4-adc9-47e6-88c5-04fdd577bb6c
8
private String getValue(Integer[] card){ String o = "", k; switch (card[0]){ case 0: o += "\u2660"; break; //Spade case 1: o += "\u2665"; break; //Heart case 2: o += "\u2663"; break; //Club case 3: o += "\u2666"; break; //Diamond } switch (...
0fd719a6-3dd1-4ccf-bfd8-3858bf666161
8
private boolean areRegistrationCredentialsValid(Player player, String retypedPassword) { boolean valid = false; if (player.getFirstName().isEmpty()) { MMessageBox.show(REGISTRATION_FIRST_NAME_EMPTY); this.firstName.setValid(valid); } else if (player.getLastName().isEmpty()) { MMessageBox.show(REGISTRATI...
8883b41e-c4fb-4528-b2a0-32a50ffa9a50
1
@Override public void close() throws ChannelException { if (port != null) { port.removeEventListener(); port.close(); port = null; } inputStream = null; outputStream = null; super.close(); }
c9c94ff6-733d-4ada-9ac7-73e36f6394c2
8
public static void main(String[] args) { System.out.print("Zadej slovo: "); String slovo = VstupString.ctiString(); switch (slovo.toLowerCase().charAt(slovo.length() - 1)) { case 'l': slovo = new String(slovo.toLowerCase());break; case 'u': slovo = new String(slovo.toUpperCase());break; ...
07e7d362-02ea-4c88-b901-830e0e02211a
3
public void addColumn() { DatastoreService datastore = DatastoreServiceFactory .getDatastoreService(); Entity past_string = null; try { past_string = datastore.get(KeyFactory.createKey("past_string", "onlyOne")); } catch (EntityNotFoundException e) { } String[] string_box = ((Text) past_string.g...
15d965e3-a111-4bbb-ad01-9d0eebbf9707
3
protected File setData(String data, String suffix){ //uuid timestamp script UUID gen = UUID.randomUUID(); File script = new File(String.valueOf(gen.toString())+suffix); //duplicate avoidance while(script.exists()){ //try to wait a short random time try { wait((int)(Math.random()*100)); } catch ...
1bff544a-e236-408b-873b-d37fcba335d0
4
private void factor(){ //System.out.println("in factor"); if( is(TK.LPAREN) ) { gcprint("("); scan(); expression(); mustbe(TK.RPAREN); gcprint(")"); } else if( is(TK.ID) ) { rvalue_id(tok.string, tok.lineNumber); ...
1119e182-13d8-4ce9-af7e-102207e307c8
6
@Override public SimpleGraph remove(GraphComponent component) { if(component == null) throw new IllegalArgumentException("given components is null."); if(!contains(component)) lr(this, "component [] not contained", component); if(component instanceof Node) nodes.remove(component); else if(component i...
94dbfd4c-33c7-4bfb-8fd1-e7b94772b6d8
1
public List<String> reverseSortedKeys() { //Returns a List of Strings, sorted based on their corresponding values. List<String> keysList = new ArrayList<String>(); Iterator<IntKeyValuePair> i = getKVPs().iterator(); while(i.hasNext()) { keysList.add(0, i.next().getKey()); } return keysList; }
d6030937-0f7c-42ba-ac24-df2efefbacc2
2
private boolean jj_3R_35() { Token xsp; xsp = jj_scanpos; if (jj_3_19()) { jj_scanpos = xsp; if (jj_3_20()) return true; } return false; }
893166fc-d33f-4da9-abd1-4984c541551b
9
static public int longLength (long value, boolean optimizePositive) { if (!optimizePositive) value = (value << 1) ^ (value >> 63); if (value >>> 7 == 0) return 1; if (value >>> 14 == 0) return 2; if (value >>> 21 == 0) return 3; if (value >>> 28 == 0) return 4; if (value >>> 35 == 0) return 5; if (value >...
fe599c1b-e971-4c86-b808-1eb2a3db2a26
9
public String toString() { StringBuffer text = new StringBuffer(); if (m_t == null) return "Gaussian Processes: No model built yet."; try { text.append("Gaussian Processes\n\n"); text.append("Kernel used:\n " + m_kernel.toString() + "\n\n"); text.append("All values shown based ...
a43d3e0a-4eab-4579-aeea-08e75ee31abb
0
@Transient public Date getFunFechaCambioClave() { return funFechaCambioClave; }
3902394f-ec2f-450a-944f-3835335f8995
5
private void drawRect(int rx1, int ry1, int w, int h, int c, boolean fill) { if (fill) { for (int x = rx1; x < rx1 + w; x++) for (int y = ry1; y < ry1 + h; y++) drawPoint(x, y, c); } else { for (int x = rx1; x < rx1 ...
7063bf1b-a9ec-4047-b218-a46ba1253184
4
public static void main(String[] args) throws IOException { int height = 100; int[][] triangle = new int[height][height]; File file = new File("0067/triangle.txt"); List<String> lines = FileUtils.readLines(file); int y = 0; for (String line : lines) { String[] numbers = line.split(" "); int x = 0; ...
765b5c68-ba2d-4e6d-8e9a-c7ba5851e646
4
private void setSpaceCoords() { int x = WIDTH - 77, y = HEIGHT - 88; int xIncrement = 95, yIncrement = 68; for(int i = 0; i < spaceCoords.length; i++) { spaceCoords[i][0] = x; spaceCoords[i][1] = y; // Bottom row if(i < 10) x -= xIncrement; // Left row else if(i < 20) y -= yIncreme...
aadce9d4-a6d5-4977-b397-9bca64c2eb03
3
public static void filledCircle(double x, double y, double r) { if (r < 0) throw new RuntimeException("circle radius can't be negative"); double xs = scaleX(x); double ys = scaleY(y); double ws = factorX(2*r); double hs = factorY(2*r); if (ws <= 1 && hs <= 1) pixel(x, y);...
60e8653c-4160-42c2-9c64-b558f7e145d9
4
public static void getConnection() { try { logger.info("Connecting with Server ..."); wait = prop.getInt("ThreadSleep_period"); int portNumber = prop.getInt("port_number"); String hostAddress = prop.getString("host_address"); requestSocket = new Socket(hostAddress, portNumber); logger.info("Server i...
e0f6cd18-1cd8-4425-a9cc-3fa6904192a1
1
public JSONArray optJSONArray(int index) { Object o = opt(index); return o instanceof JSONArray ? (JSONArray)o : null; }
a1e3513c-7833-45de-9091-e57abe421b84
8
static SGFProperty fromString(StringBuffer sgf) throws IncorrectFormatException { /* Remove leading whitespace */ if (!Character.isUpperCase(sgf.charAt(0))) { throw new IncorrectFormatException(); } String propIdent = String.valueOf(sgf.charAt(0)); sgf.deleteCha...
cc0525d3-e55a-4618-96af-ce768d32e561
1
private void saveMidi(boolean flag, byte buf[]) { Signlink.midifade = flag ? 1 : 0; Signlink.midisave(buf, buf.length); }
cd53773f-a7de-4376-81d5-50bf147209c0
4
@EventHandler protected void onPlayerDammage(EntityDamageByEntityEvent event) { Entity entity = event.getEntity(); if (entity instanceof Player) { Player player = (Player) entity; ScavDuelsPlayer dPlayer2 = ScavDuels.scavDuelsPlayer.get(player.getName()); if (dPla...
9e4034dc-41e2-474e-be14-f3647e79354c
8
private void drawComponent(Graphics paramGraphics, Component paramComponent, Rectangle paramRectangle) { if (paramComponent.isVisible()) { ImageComponent localImageComponent; if ((paramComponent instanceof ImageComponent)) { localImageComponent = (ImageComponent)paramComponent; ...
d38ef4fe-aa70-4dfa-8a3c-bd33b8b97d79
7
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: CambiarContrasena cambioContr = new CambiarContrasena(); String claveOriginal = jTextField1.getText(); System.ou...
3ebd057f-e5c3-4b89-84f6-c6fdf9c34737
4
private static String getGameLine(HanoiGame game, int i) { Disk currentDisk; StringBuilder stringBuilder = new StringBuilder(); for (int j = 0; j < game.getCurrentSituation().size(); j++) { currentDisk = game.getCurrentSituation().get(j).see(i); stringBuilder.append(HanoiTools.repeat(" ", game.getNumberOfDi...
07dba72f-9c76-411e-a430-328f6af20028
3
public synchronized TestInfo createTest(String userKey, String testName) { TestInfo testInfo = null; if (userKey == null || userKey.trim().isEmpty()) { BmLog.debug("Test cannot be created, userKey is empty"); return null; } String url = this.urlManager.scriptCrea...
6db51113-a286-45a3-8845-cccac21e789e
9
public int compareTo( Object obj ) { if( obj == null ) { return( 1 ); } else if( obj instanceof GenKbSecGroupByUNameIdxKey ) { GenKbSecGroupByUNameIdxKey rhs = (GenKbSecGroupByUNameIdxKey)obj; if( getRequiredClusterId() < rhs.getRequiredClusterId() ) { return( -1 ); } else if( getRequiredCluste...
b4c49090-95da-4809-b4b9-9cb6a5072ef6
7
public void doMagCdf(int first, int last, int date) throws CDFException{ int numOfRecs = last - first; int[] frameGroup = new int[numOfRecs], q = new int[numOfRecs]; long[] epoch = new long[numOfRecs]; float[] magx = new float[numOfRecs], magy = new float[...
5a36cb3a-7845-49b2-a4ff-358ab79d24b8
0
public RemoteCallCountLimitException(String message) { super(message); }
e040e948-3a08-47de-bf4a-24705b748e36
9
void populateTable() { // if there are any data, remove them from the table first while (tableModel.getRowCount() > 0) { tableModel.removeRow(0); } tableModel.setColumnCount(0); int numberOfRows = pointer / 2; Object t[] = new Object[numberOfRows]; for (int i = 0; i < numberOfRows; i++) { t[i] = i...
014a940a-a240-47a5-8428-46641f77030f
5
public Object getValueAt(int row, int col) { Object result = null; if(col==0) result = parts[row].getGateClass().getName(); else if (col==1) { if (parts[row] instanceof CompositeGate) result = COMPOSITE_GATE; else i...
45b9e2be-de54-439a-96c6-45b168c3c728
6
public int login( int id, int password, int type ){ int flag = 0; if( !handler_info.initialize() ){ System.out.println( "LoginServer : failed to initialize personinfo handler" ); return ERROR_DATABASE; } int psd = handler_info.getPassword(id); if( psd == -1 ) flag = ERROR_ID; else if( password != p...
6f6bd340-4dfd-402c-bd79-4c6c69a59462
0
public void close() throws IOException { super.close(); closed = true; }
e9545e85-79ef-4b9d-a3df-893bfb1584e4
0
@Override public Object getValue() { return rawFrameContents; }
ef4e1d6a-2c83-46f4-b4ea-825871a5b3e4
3
@Override public void onEnter() { task = new CountdownTask(getGame().getPlugin(), 30) { @Override protected void onFinish() { getGame().nextState(); } @Override protected void onTick(int tick) { if(tick %5 == 0 |...
b078bb29-789c-43b5-8d2d-c55449de4f09
3
public void robPlayer(RobPlayerInfo victim) { if(presenter.getState().getStatus().equals("Robbing")){ if(victim!=null){ presenter.robPlayer(presenter.getPlayerInfo().getIndex(),victim.getPlayerIndex(), robberSpot); }else{ presenter.robPlayer(presenter.getPlayerInfo().getIndex(), -1, robberSpot); } ...
9317038f-a137-4ce2-9d93-47fdf22cadcd
1
@Override public void deconnect(String nick) { if (timeOut.containsKey(nick)) { timeOut.remove(nick); } }
7cf7615d-1465-4701-9361-82aad1e00bb4
0
public Card(CardType type, int value) { this.type = type; this.value = value; }
cd179636-b21b-4956-b83f-b1e5c1cacbf5
8
public static void main(String[] ops) { try { // Create numeric attributes "length" and "weight" Attribute length = new Attribute("length"); Attribute weight = new Attribute("weight"); // Create date attribute "date" Attribute date = new Attribute("date", "yyyy-MM-dd HH:mm:ss"...
7d052500-32e0-4a06-82f1-4bc8b200abe0
3
public int getLocationId(int x, int y, int z, int worldId) { int locationId = 0; try { connect(); PreparedStatement statement = connection.prepareStatement("SELECT id FROM location WHERE x = ? AND y = ? AND z = ? AND world_id = ?"); statement.setInt(1, x); ...
c9fd5d2f-f514-43fb-b65e-2a2119914628
7
public Departamento selectDepartamentoPorCodigo(String COD_DEPARTAMENTO) throws SQLException { Connection conexao = null; PreparedStatement comando = null; ResultSet resultado = null; Departamento DEP = null; try { conexao = BancoDadosUtil.getConnection(); ...
bcfdf725-1fbd-4d92-93a7-90188390ec6a
4
private boolean areSiblingsSelected(TreePath path) { TreePath parent = path.getParentPath(); if (parent == null) { return true; } Object node = path.getLastPathComponent(); Object parentNode = parent.getLastPathComponent(); int childCount = model.getChildCount(parentNode); for (int i = 0; i < childCou...
0708c1c6-223c-4732-87a6-fe6789a3290d
9
private String Term() { //getting values boolean error = false; if(current.getId().equals("VARNAME")) { String name = current.getLexeme(); nextToken(); if(current.getId().equals("LSBRACKET")) { nextToken(); if(current.getId().equals("VALNUM")) { String index = current.getLexeme(); nextTok...
2f92d3bc-3b0c-4674-bc78-f92441929b0c
7
@Test public void WhenSerializingValidRoutingTable_ExpectResults() throws UnknownHostException { int levels = 2; int levelSize = 2; StringBuilder builder = new StringBuilder(); for (int i = 0; i < levels; i++) { builder.append("0"); } String expectedLoca...
fe38a175-c588-468a-b09e-986b40534ba6
9
public static Long readInt(final IBStream stream) { char ch = stream.getChar(); checkChar(BConst.INT_START, ch); long val = 0; boolean negative = false; boolean leadZero = false; ch = stream.getChar(); if (BConst.SIGN == ch) { negative = true; ...
71632c11-7cad-4402-bae1-a1fa401ec58d
9
private boolean deprojectivizeWithHead(DependencyStructure pdg, DependencyNode node) throws MaltChainedException { boolean success = true, childSuccess = false; int i, childAttempts = 2; DependencyNode child, possibleSyntacticHead; String syntacticHeadDeprel; if (nodeLifted.get(node.getIndex())) { syntacti...
6c0f68c1-b8ea-4031-8cfc-eb6ca725ad54
8
public boolean CompareSuccess(Field f, Object compareValue, String compareFunction) { // switch(String) only in 1.7 if(cfg.compareEqual.equals(compareFunction)) { return f.compare(compareValue); } else if(cfg.compareNotEqual.equals(compareFunction)) { return !f.compare(co...
6aa6ef6d-ef7c-4997-b467-cf898ba4835f
4
public static void shortestPaths(List<Edge>[] edges, int s, long[] prio, int[] pred) { Arrays.fill(pred, -1); Arrays.fill(prio, Long.MAX_VALUE); prio[s] = 0; Queue<QItem> q = new PriorityQueue<QItem>(); q.add(new QItem(0, s)); while (!q.isEmpty()) { QItem cur = q.poll(); if (cur.prio...
72f5bd59-fcca-4ac7-9d74-256427bd57d7
5
public String matchQueryWordToProduct(String oldQuery, HashSet<String> prodWords) { String[] oldQueryArray = oldQuery.split(" "); // System.out.println(oldQuery); StringBuilder sb = new StringBuilder(); for (int i = 0 ; i < oldQueryArray.length; i ++) { if (isNumeric(oldQueryArray[i]) || oldQueryArray[i]....
4dbd787f-86eb-4ab2-a6a7-90732f268d62
3
public void run() { while (s >= 0) { ultimaEscritura(nombre); if (s == 0) { cont--; System.out.println(nombre + " - " + s + " - ultima escritura " + IDanterior); System.out.println("ultima escritura " + nombre + " - " + cont + " Threads activos"); } else { System.o...
e8688358-7230-411a-88de-9a2ae5b606b3
0
@Override public void destroy() { parent = null; oldNode = null; newNode = null; }
59333e86-e698-40b2-b0db-9562bf6aadaa
7
static final public void sum() throws ParseException { term(); label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: case MINUS: ; break; default: jj_la1[1] = jj_gen; break label_1; } switch ((jj_ntk==-1)?jj_ntk():jj_nt...
307a300c-7f03-4d0c-a357-c2064891f206
8
private List<ProductCombination> getValidDeals( List<ProductCombination> allCombinations) { List<ProductCombination> validDeals = new ArrayList<ProductCombination>(); Product prod = null; ProductCombination tempCombo = null; Item item = null; Item desiredItem = null; // An array of boolean flags to s...
2eef0da6-45cf-4146-8aea-a778024f10ea
3
@Override public LoginResponse login(LoginRequest request) throws IOException { //System.out.println(proxyCli.getReadQuorum() + " "+ proxyCli.getWriteQuorum()); for(UserModel user : proxyCli.getUsers()) { if(user.getName().compareTo(request.getUsername()) == 0 && user.getPassword().compareTo(request.getPassword...
cc9617fd-030d-48d5-b74a-78638d2769a6
4
@Override protected Object getColumnValue(StockItem item, int columnIndex) { switch (columnIndex) { case 0: return item.getId(); case 1: return item.getName(); case 2: return item.getPrice(); case 3: return item.getQuantity(); } throw new IllegalArgumentException("Column index out of range");...
5d208bff-9987-4cbe-bd2b-69da79289c51
4
public MyList findOneTileMovesTo(Hexpos end, String player) { // check if goal position is empty if (owner.get(end) != null) return null; // make a list to store the moves MyList moves = new MyList(); // try to find *one* neighbour-step move MyList neighbours = end.neighbours(); // neighbours...
ecd79b64-96f3-4c1b-8d31-381a8e0b9c05
2
@Override public boolean equals( Object o ) { return (o != null && o instanceof URIMatcher) ? toString().equals( o.toString() ) : false; }
47860087-3c69-46a0-bae7-011de976e48b
6
public ThoughtsPopUp(final boolean save) { this.save = save; setMinimumSize(new Dimension(350, 500)); setResizable(false); setLayout(null); JLabel nameLabel = new JLabel("Action Name: "); nameLabel.setBounds(STANDARD_MARGIN_X, STANDARD_MARGIN_Y + 0 * LABEL_HEIGHT, LAB...
cd50a746-226b-4a67-a943-594013a19c38
3
private static Combination<Colors> generateAttemptCombination(int i) { List<Token<Colors>> tokens = new ArrayList<Token<Colors>>(); if (i == 1) { tokens.add(new Token<Colors> (Colors.R)); tokens.add(new Token<Colors> (Colors.O)); tokens.add(new Token<Colors> (Colors.Y)); tokens.ad...
12c179f2-3f4b-41e3-a7e4-74b14a56e1eb
7
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
1601b3ab-df54-476e-a07d-a8d40f85564e
0
public String getEntry(int ix) { return strings[ix]; }
32168e32-0417-450c-8321-9d0a827fb535
7
protected void getJars(List<String> jars, File file) { JarFilter jarFilter = new JarFilter(); DirectoryFilter directoryFilter = new DirectoryFilter(); if (file.exists() && file.isDirectory() && file.isAbsolute()) { String[] jarList = file.list(jarFilter); for (int i = 0; (jarList != null) && (i < jarList.l...
3e95715d-5f51-4b98-ba21-c5788a1e0403
2
public String getMinecraftForumUser(Connection con, String mc_name) { /* Compose query. */ String SQL_QUERY = "SELECT username " + "FROM xf_user " + "INNER JOIN xf_user_field_value " + "ON xf_user.user_id = xf_user_field_value.user_id " + "WHERE xf_user_field_value.field_id=\"minecraftid\" " + "...
0cee5bf8-c85f-431d-bc5e-eaea46c8afda
7
public static boolean hashesEqual (byte[] hash1, byte[] hash2) { if (hash1 == null) return hash2 == null; if (hash2 == null) return false; int targ = 16; if (hash1.length < 16) { if (hash2.length != hash1.length) return false; targ = hash1.length; } else i...
d9f2f3f4-469d-4572-aae4-b599f81386b7
8
public DigraphLayout<V,E> layout(Digraph<V,E> digraph, DigraphLayoutDimensionProvider<V> dimensions, Digraph<V,?> feedback) { if (digraph.getVertexCount() == 0) { return new DigraphLayout<V,E>(Digraphs.<DigraphLayoutNode<V>,DigraphLayoutArc<V,E>>emptyDigraph(), new DigraphLayoutDimension(0, 0)); } DoubledDigra...
5dafc8a9-8089-4a95-a0bb-2422167f3ebd
1
public Object[] getAvailableAnnotations(){ try { return getAnnotations(true); } catch (ClassNotFoundException e) { throw new RuntimeException("Unexpected exception ", e); } }
32b70c6c-0ba7-415d-9e82-3796ecc5b18c
2
@Override Integer deleteEntity(Criteria criteria, AbstractDao dao) throws DaoException { criteria.addParam(DAO_COUNTRY_STATUS, DELETED); Integer res = updateCountry(criteria, dao); List<Country> list = getEntity(criteria, dao); for (Country c : list) { List<City> cities =...
a6582650-bb18-4c03-a863-684407c7858b
2
public static int countLines(File cardfile) { try { LineNumberReader reader = new LineNumberReader(new FileReader(cardfile)); int cnt = 0; while (reader.readLine() != null) {} cnt = reader.getLineNumber(); reader.close(); return cnt; } catch (Exception e) { return 0; } }
59d3751c-16eb-4435-bd4f-4834a7cd858a
8
public void drawPacman(Graphics g) { if (direction == 'u') { if (current > pictureUp.length - 1) { current = 0; } g.drawImage(pictureUp[current], pacmanRow * 20, pacmanCol * 20, 22, 22, maze); } if (direction == 'd') { if (current...
1ffccdde-04aa-42d4-8dc2-f7f81e7f07b2
0
public void PreInit(ContentManager manager, Config cfg) { this.initTextures(manager.getAssetManager()); }
99f2840a-d444-479c-9a63-4660f7877619
5
public static String[] getAllSchoolName(BaseSetting bs) { if (bs == null) { System.out.println("school - BS NULL"); } else { //On initialise la liste des écoles ArrayList<String> list = new ArrayList<>(); try { // //Si la...
6f965900-b8c6-4d50-94b6-888001168656
5
private void validate(SortedMap<Integer, Integer> costByDemandMap){ int previousPrice = MAX_COST + 1; for(int demand:costByDemandMap.keySet()){ if (demand == Integer.MIN_VALUE){ throw new IllegalArgumentException("Demand cannot be Integer.MIN_VALUE (" + Integer.MIN_VALUE + ")"); } if (costByDemandMap.g...
11942ace-9f2e-4928-bde3-23475df6a7b7
5
@Path("/admin/profiles.json") @Produces(MediaType.APPLICATION_JSON) @POST public String insertProfiles( @Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("json") String json ) { if( !checkHostInfo(request.getRemoteHost(), AdminProperties.getHttp_allowed()) ) { ...
34aa54d6-b03c-4b32-ab4f-a2a628670996
7
private static List<String> getInstallationQueue(JSONObject packConfig, String packVersion) { //Get version entries Logger.info("Instances.getInstallationQueue", "Getting entry list..."); JSONArray entriesArray = null; if (packVersion.equalsIgnoreCase("recommended")) { ...
63e8b4e3-e910-4de4-9c27-1eb2508b732d
2
public static boolean buscaCliente(int indice, HashMap<Integer, Clientes> tablaClientes) { boolean encontrado = false; int key; Set<Entry<Integer,Clientes>> s = tablaClientes.entrySet(); Iterator<Entry<Integer, Clientes>> it=s.iterator(); Entry<Integer, Clientes> m = null; while (it.hasNext()) // Bu...
d465e0b1-58f7-4b2f-b199-df931b0a645e
0
public void setLogin(String login) { this.login = login; }
8a6dd496-ff90-4b19-929e-ff4046978023
4
public String asVectorString() { if (this.rows.length != 1) { throw new IllegalArgumentException("I'm not a vector!"); } StringBuilder sb = new StringBuilder(); Node current = this.rows[0]; for (int colIndex = 0; colIndex < this.numCols; colIndex++) { if (current != null && colIndex == curren...
4280cb50-7a0a-4bde-8a91-7a7027604d5f
5
private void reserverSalle() { System.out.println("Liste de vos modules :"); Professeur professeur = (Professeur) this.modeleApplication.getCurrent(); ArrayList<Seance> seances = this.universite.getSeancesParProfesseur(professeur); if (seances.isEmpty()) { System.out...
b1b3e284-d92e-4b68-9fb2-caa777b022e4
5
@Override protected void pick(String name) { //Shoot MOUSEBUTTON if (name.equals(KeyMapper.PLAYER_SHOOT) && ammoManager.getMagazineCount() > 0) { if ((System.currentTimeMillis() - lastPick) > triggerDelay) { lastPick = System.currentTimeMillis(); super.pic...