method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1acc683a-1ae5-475a-b076-9c36c741597f
1
public synchronized void connect() throws SQLException { if (connection == null) connection = DriverManager.getConnection(jdbcUrl, username, password); }
f0a88b45-e6b0-4f91-bc1a-85be7cab15d5
3
private int nextBid(int currentBid) { // Loop for all of our bid values. for (int i = 0; i < LEGAL_BID_VALUES.length; i++) { // If we found the bid if (LEGAL_BID_VALUES[i] == currentBid) { // If it's the last bid, return -1. if (LEGAL_BID_VALUES[i] == LEGAL_BID_VALUES[LEGAL_BID_VALUES.length - 1]) ...
55d98e9e-ba9f-4a89-b71e-ea71687afdbf
1
@Override public void write(String filename, Solution output) { //On met en parametre que le nom du fichier, l'extension est obligatoirement txt pour un fichier texte final String chemin = "./"+filename+".txt"; //On creer notre nouveau fichier objet final File fichier =new File(chemin); ...
91ba8968-ed0f-45c7-818b-09e22bafe936
2
@SuppressWarnings("deprecation") public void testFactoryFieldDifference2() throws Throwable { YearMonthDay ymd = new YearMonthDay(2005, 4, 9); try { Period.fieldDifference(ymd, (ReadablePartial) null); fail(); } catch (IllegalArgumentException ex) {} try { ...
ec7a5ba8-5f43-43fc-9240-a702280f00ed
6
@Override public void actionPerformed(ActionEvent e) { boolean selection = false; DocUtils.buttonDoClick(e); wordProcessor.area1.requestFocus(); String text = wordProcessor.area1.getSelectedText(); int start = 0, length = 0; if (text != null) { selection = true; start = wordProcessor.area1.getSele...
6415fc09-4734-4495-b996-903a6a36973b
4
@Override public void paint(Graphics graphics){ if (image==null) return; super.paint(graphics); graphics.drawImage(getBitmap(), offset, 0, null); if (offset==0){ return; } if (offset<0) { graphics.drawImage(getBufferedImage((SwingBi...
b07b4e41-6a3a-4086-affd-e135702f2a52
6
public String getLNDString(int position, boolean showAllHex) { byte[] LND = null; String LNDString = ""; String contactName = ""; try { worker.getResponse(worker.select(DatabaseOfEF.DF_TELECOM.getFID())); LND = worker.readRecord(position, worker.getResponse(worker...
1526b108-e0f8-4e3b-92d7-219b8ad59c16
3
public static List<Element> insertionSort(List<Element> list) { int i, j, temp, size = list.size(); for (i = 1; i < size; i++) { j = i; while (j > 0 && list.get(j).getValue() < list.get(j - 1).getValue()) { Collections.swap(list, j, j - 1); // U...
0441cdd5-3c84-449d-9ee0-f5669698fb0e
9
private void checkOut() { String orderNum = ""; boolean isUnique = false; Statement st = null; ResultSet rs = null; ResultSet rs1 = null; Random generator = new Random(); while (isUnique == false) { int randInt = generator.nextInt(999999); orderNum = Integer.toString(randInt); String checkUnique = "s...
33957fec-2d9c-46bd-a109-6e351a976f4d
1
private boolean jj_3_59() { if (jj_3R_75()) return true; return false; }
01edff1d-ca68-4b8c-a97f-bab110b559a7
2
public static EquipmentStatusEnumeration fromValue(String v) { for (EquipmentStatusEnumeration c: EquipmentStatusEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
496b971a-408b-44ed-8e99-5e137207ec99
8
public static void main(String[] args){ LinkedList<String> list = new LinkedList<>(); list.add("aaa"); list.add("bbb"); list.add("ccc"); list.add("ddd"); list.add("eee"); list.add("fff"); list.add("ggg"); list.add("hhh"); list.add("iii"); ListIterator<String> itr; for (itr = list.listI...
f237409d-c3bb-4d18-8d4e-f762d1ad8774
0
public String getName() { return name; }
7157c298-2787-4684-99ca-a690d55b4b59
1
static void setAccessible(final AccessibleObject ao, final boolean accessible) { if (System.getSecurityManager() == null) ao.setAccessible(accessible); else { AccessController.doPrivileged(new PrivilegedAction() { public Object run() ...
d1f83f7b-2799-4bd6-b07f-7f4a90ad2fb9
4
public void help(CommandSender sender, String[] args) { // get page name from aguments String name = convertArgsToPageName(args); // replace - with space String userFriendlyName = name.replace("-", " "); // check existance if(!config.hasPage(name)) { // send configured error message String msg = ...
71c00e55-8bfc-45f3-abad-7920b68e402b
5
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_SPACE) { fire(); } if (key == KeyEvent.VK_A) { dx = -1; } if (key == KeyEvent.VK_D) { dx = 1; } if ...
b5d74991-03f1-42d8-99f8-39d988f4f711
0
@Override public String toString() { String str = "========== " +forme.getNom() +" ==========\n" +frame.toString() +'\n' +forme.toString(); return str; }
92f60694-7568-49ee-b645-c71cd8233de6
6
@SuppressWarnings({"ToArrayCallWithZeroLengthArrayArgument"}) public void testKeySet() { int element_count = 20; String[] keys = new String[element_count]; int[] vals = new int[element_count]; TObjectIntMap<String> map = new TObjectIntHashMap<String>(); for ( int i = 0; i < ...
fd808fac-9bd5-4193-8e22-e3597e780a11
0
default void log(String str){ System.out.println("I1 logging::"+str); }
7dbabe79-8e48-42f5-98aa-03d573e157a9
0
void increaseLeftScore(int score) { setLeftScore(getLeftScore() + score); }
8db499f1-4ac5-4a27-a76b-eca1e28998c8
8
public static boolean useDefconsmethodP(MethodSlot method) { if ((!method.methodFunctionP) && ((List)(Stella.$CURRENT_STELLA_FEATURES$.get())).membP(Stella.KWD_USE_COMMON_LISP_CONSES)) { { Surrogate testValue000 = method.slotOwner; if (testValue000 == Stella.SGT_STELLA_CONS) { retur...
b404a366-fa3a-431c-bf16-f5c3f3960ceb
3
public void visualiserModele(){ System.out.println("Controleur::visualiserModele()") ; System.out.println("") ; System.out.println("------------------ Locations ----------------------------") ; for(Location location : this.modele.getLocations()){ System.out.println(location) ; } System.out.println("-----...
b63e31e4-dd26-4928-b3b5-cf731692f818
0
public String getLast() { return last; }
c9a12a01-3503-42f3-9a94-00388238c827
0
public YamlManager(PermWriter project) { this.project = project; }
d6274051-6bb4-41ab-b0b2-a17a25be9350
2
public Nose(Ship parent){ this.parent = parent; xorigin = parent.getX(); yorigin = parent.getY(); engine1X = parent.engine1.engine.get(0).x; engine2X = parent.engine2.engine.get(0).x; engineTopY = parent.engine1.engine.get(0).y; double lengthPoints = parent.speed; double radiusPoints = (pare...
f0bfb7a0-a4be-4a20-9f07-8a62a83e1c00
4
private static JPanel getPanel(MainModel mainModel){ JPanel p = new JPanel(); ScoreModel h = mainModel.getScoreModel(); p.setLayout(new GridLayout(0, 1, 0, resources.MenuLookAndFeel.getGap())); if (h.existsNoScore()){ JLabel l = new JLabel(Translator.getMenuString("noScoreExplain")); l.setFont(resou...
01d70f5a-0d80-42ad-8fe2-5e1d8e4df63d
9
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; int times = 1; StringBuilder br = new StringBuilder(); while ((line = in.readLine()) != null) { if (line.equals("0")) break; n = Integer.parseInt(li...
04dab5ac-c46d-45c0-9386-6fd77631ea83
7
@Override public void caseADeclRepitaDefinicaoComando(ADeclRepitaDefinicaoComando node) { inADeclRepitaDefinicaoComando(node); if(node.getRepita() != null) { node.getRepita().apply(this); } if(node.getComando() != null) { node.getComando()....
041a2bd3-0470-4d12-ae9e-a8ce37d5c8c9
5
public void getList(int rep) { String tempQuery = ""; if(rep == 0) { tempQuery = DEFAULT_QUERY; } else if(rep == 1) { String searchText = searchBox.getText().toUpperCase(); tempQuery = "select * from member where lastname like '"+...
d1d9d86f-2153-4287-a9d3-d832d94289f8
2
public Class getTypeClass() throws ClassNotFoundException { if (clazz != null) return Class.forName(clazz.getName()); else if (ifaces.length > 0) return Class.forName(ifaces[0].getName()); else return Class.forName("java.lang.Object"); }
b3d2d08c-b639-400b-8d87-4fb8ae83013e
4
private void handleTouchEvent(final TouchEvent TOUCH_EVENT) { final Object SRC = TOUCH_EVENT.getSource(); final EventType TYPE = TOUCH_EVENT.getEventType(); if (SRC.equals(targetIndicator)) { if (TouchEvent.TOUCH_PRESSED == TYPE) { value.setText(String.format(Loca...
2efbc289-6a0c-46ae-9cdc-c68ab4bd6c6e
3
void draw(BufferedImage toDraw, int width, int height) { if (image == null || image.getWidth() != width || image.getHeight() != height) { image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); graphics = image.createGraphics(); } graphics.drawImage(toDraw, 0, 0, null); }
7bc86c2b-dac8-43ca-9c10-68c33fba9798
4
public String Datos(String Radio) throws SQLException { String Recorrer = ""; ResultSet Rs = null; if (Radio.equals("Profesores")) { Recorrer += "<select name=\"identificacion\" id=\"ConProEsT\">"; Rs = Pres.traerProfesor(); while (Rs.next()) { ...
ebcc6545-ac46-405d-8ee9-be976af333f1
0
public PartB() { System.out.println("PartB builded"); }
c468ec43-47ba-4cd5-9aff-8d807b387b4f
1
public void notifyListeners(Matter matter, double processedTime) { for (final HitGroundListener listener : listeners) { listener.hitGround(matter, processedTime); } }
64a30087-bd99-460c-a8c8-f7ecb7ab2af4
9
static ArrayList<String> dijkstra(AdjacencyList graph, String source, String destination) { ArrayList<String> selectedNodes = new ArrayList<>(); graph.get(source).dist = 0; graph.get(source).linked = true; selectedNodes.add(source); while (graph.size() != selectedNodes.size())...
fae747d8-f189-4707-a77d-6837f5ff3704
4
public void updateChatLog() { while (chatLog.size() > 20 && chatLog.get(0).getTime() > 8000) chatLog.remove(0); while (chatLog.size() > 10 && chatLog.get(0).getTime() > 18000) chatLog.remove(0); }
94af2b4d-66e8-4fbf-a245-128adf0b41c4
9
private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_...
32732fa1-96d1-4cff-99e1-704e2ec47914
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...
1e6114cc-99fe-4237-8d42-bc6de79a2619
3
@Test public void getTiles(){ Tile[][] tiles = new Tile[10][10]; for (int x = 0; x < tiles.length; x++){ for(int y = 0; y < tiles[0].length; y++){ tiles[x][y] = new Tile(new Position(x, y), 0); } } World w = new World(tiles); Tile[][] testTiles= w.getTiles(); assertTrue(testTiles.length ...
863beced-b21c-4904-a121-25883ac32c51
6
public int getdist(int T, int[] a) { long x = 0; long y = 0; int d = 0; for(int j = 0;j < T;j++){ for(int i = 0;i < a.length;i++){ switch(d){ case 0: y = y + a[i]; break; case 1: x = x + a[i]; break; case 2: y = y - a[i]; break; case 3: x = x - a[i]; break; } d += a[i]; d = d ...
704c5da8-e876-4b8b-893d-1a95c7f11976
2
public static void main(String[] args) { try { SAXBuilder saxBuilder = new SAXBuilder(); File file = new File("D:\\Java SE\\src\\xml\\jdom\\file.xml"); Document document = (Document)saxBuilder.build(file); Element node = document.getRootElement(); Elemen...
124f8645-5a17-42f6-807c-d576fb0150b0
7
public void update(){ switch(mainModel.getState()){ case INITIALIZED: //initialized so switch states mainModel.setState(State.MENU); break; case MENU: mainModel.update(); mainView.update(); break; case LOAD: //TODO finish load //load the game then start it mainView.update(); ...
cf3e817b-efb1-4c18-9f41-2bd78f124a49
5
public LinkedHashMap<Integer, Compra> cargarCompraTexto(String nombreFichero) { LinkedHashMap<Integer, Compra> compras = new LinkedHashMap<>(); Compra c; FileInputStream fis = null; ObjectInputStream ois = null; try { fis = new FileInputStream(nombreFichero); ...
d424f8fe-536f-4ca0-914d-0526f953fa75
7
public static boolean jolly(int[] v){ boolean jolly = true; if(v.length==1) return jolly; else{ int contador = 0; for( int i = 0; i < v.length; ++i ){ if((i+1)< v.lengt...
62969d4e-f791-4e92-8cb5-cbd4f3bb538b
6
private UserToken doVerifyUserToken(String token) { if (token == null) { return null; } try { UserToken userToken = dataStore.getUserToken(token); if (userToken != null && userToken.created != null && userToken.loggedOut == null) { //length of ...
3536c36b-e8f4-4caf-88d9-4086561ac2c7
7
JClass parseTypeName() throws ClassNotFoundException { int start = idx; if(s.charAt(idx)=='?') { // wildcard idx++; ws(); String head = s.substring(idx); if(head.startsWith("extends")) { idx+=7; ...
758d0933-b403-4e44-b88f-5eea60cfe2d4
8
public void CellFit(final float w, final float h, final String txt, final Borders border, final Position ln, final Alignment align, final boolean fill, final int link, final ScaleMode scale, final boolean force) throws IOException { // Get string width float str_width = this.getStringWidth(txt); // Calc...
3a9b6015-0ca2-47ce-9f98-1ba059e5b1db
1
private void createPlayer(int playerCount) { player = new Player [playerCount]; for ( int i = 0; i < playerCount; i++ ) { player[i] = new Player(); } }
92da9b18-9934-4f74-9434-70b1706bf47e
6
@Override public Object registeringGUI() { long prodId; Calendar initDate = Calendar.getInstance(), finalDate = Calendar.getInstance(); while(true){ try{ prodId = Long.parseLong(guiImpl.requestData("ID do produto:")); bre...
7e79ed90-82b6-4924-ab78-59343147452e
6
public static ArrayList<Carta> parse(Scanner sc) throws IOException{ ArrayList<Carta> cartas = new ArrayList<Carta>(); String entrada = sc.next(); //Excepcion si no hay 10 caracteres en la linea if(entrada.length() != 10){ throw new IOException("Numero...
0fa41046-9288-46c6-9bee-3e25f2e1211c
3
private void setKey(byte[] keyBytes) { workingKey = keyBytes; x = 0; y = 0; if(engineState == null) { engineState = new byte[STATE_LENGTH]; } //reset the state of the engine for(int i = 0; i < STATE_LENGTH; i++) { engin...
286808c3-2853-471b-bef1-9e2126180bf0
6
private Expression designator(boolean acceptAddressOf) throws RequiredTokenException { enterRule(NonTerminal.DESIGNATOR); Token dereferencedToken = emitTerminal(require(Token.Kind.IDENTIFIER)); Symbol dereferencedSymbol = null; try { dereferencedSymbol = resolveSymbol(dereferencedToken); } catch (Un...
130e8c7a-5129-4fc8-936a-2344674ae85d
0
@Basic @Column(name = "FES_ESTADO") public String getFesEstado() { return fesEstado; }
eb3510b0-48ef-4c33-82cd-d020d6202d5a
3
public int readWord() throws IOException { int read1 = in.read(); if(read1 == -1) return -1; int read2 = in.read(); if(read2 == -1) throw new IOException("EOF in middle of 16 bit word"); if(littleEndian) { return (read2 << 8) | read1; ...
11822cd0-2c9e-46ec-8d9d-90fb86fafa31
3
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (available ? 1231 : 1237); result = prime * result + ((color == null) ? 0 : color.hashCode()); result = prime * result + (moveable ? 1231 : 1237); result = prime * result + xPos; result = prime * result + yP...
27f18f1a-3cd3-4751-b636-d88d171dbff5
0
void dispose() throws HoHumException { throw new HoHumException(); }
ab9be86e-dd15-41c0-8377-81fe310d43ec
3
public void trieTableur() { //on boucle pour toutes les autres lignes du tableur pour décaler à chaque fois un caractère abc --> cab --> bca for(int i=1 ; i < TAILLEMOT ; i++) { tableurNonTrie.add(i, new ArrayList<Character>(tableurNonTrie.get(i-1))); carac =...
c13d9baa-5b84-4eb5-a00b-e94a75e3cdc7
6
@Override public boolean containsAddressPara(){ for (int i = 0; i < paras.size(); i++) { if (paras.get(i).equals("$sender") || paras.get(i).equals("$recipient")) return true; } for (int i = 0; i < generateParas.size(); i++) { if (generateParas.get(i).equals("$sender") || generateParas.get(i).equals("$r...
70df5091-4110-44bf-adba-90502746b920
0
@XmlTransient public Collection<Sintoma> getSintomaCollection() { return sintomaCollection; }
5076c617-4bdf-440c-8cef-47975cdd29e5
9
@Override public String process(HttpServletRequest request) throws MissingRequiredParameter { ResultSet resultSet = null; //String result = null; JSONArray result = new JSONArray(); //String result; try { // Get Connection and Statement connection = dataSource.getConnection(); statement = conne...
f68e87ec-f27a-400c-9f44-5715bd1007be
2
@Test public void jsonTransformEquality() throws InvalidJSONException, JSONException { Cible c1 = new Cible("c1", new Position(40.123,41.456), CibleType.WATER); Cible c2; c2 = new Cible(c1.toJSON()); assertTrue((c1.getUniqueID() == c2.getUniqueID()) && ((c1.getPosition().getLatitude() == c2.getPosition().ge...
31fe845b-6da0-4b33-afbc-5cb4097b8679
0
public void putAll(Map m) { touch(m.keySet()); map.putAll(m); }//putAll
ee835ba8-d3b4-4af8-93a0-eb4b6dbcd77f
2
@Override public void init(GameContainer gc) { try { _spriteSheet = new SpriteSheet("res/sprites/player.png", 32, 32); _animation = new Animation[4]; _animation[Direction.NORTH] = new Animation(_spriteSheet, 0, 0, 2, 0, true, 200, true); _animation[Direction.EAST] = new Animation(_spriteSheet, 0, 3,...
8cd39c1e-dd85-4365-adf9-db879fa7e19f
3
public static NanoPost createNanoPost(String postText, byte[] parentHash, File postAttach) { //postText = escapeJson(postText); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); NanoPostAttach att = null; String postJso...
dae92f04-5e0a-4d63-a987-39892c699bad
2
*/ protected void setPosition(Point plantP) { p = (Point) plantP.clone(); if (p.getX() >= Grid.BOUND_MAX_X - 20) { p.x = Grid.BOUND_MAX_X - 20; } if (p.getY() >= Grid.BOUND_MAX_Y - 20) { p.y = Grid.BOUND_MAX_Y - 20; } }
a7905a6b-9f3f-4775-a255-0c1be1cda5d5
7
private PDFObject readName(ByteBuffer buf) throws IOException { // we've already read the / that begins the name. // all we have to check for is #hh hex notations. StringBuffer sb = new StringBuffer(); int c; while (isRegularCharacter(c = buf.get())) { if (c < '!' && ...
9c0634a3-f82c-4768-8907-ce8e6d054d18
1
private void fillUsedPictures() { //лист под каждую тему List<Integer> animalsList = new ArrayList<Integer>(); List<Integer> carsList = new ArrayList<Integer>(); List<Integer> musicList = new ArrayList<Integer>(); //добавление картинок в виде их номеров for (int i = 0; i ...
a4343625-01b6-422a-930f-a4d86f841430
6
public void draw(Graphics2D g2) { g2.drawImage(background, 0, 0, GamePanel.WIDTH, GamePanel.HEIGHT, null); g2.drawImage(coin, GamePanel.WIDTH - coin.getWidth() - 90, 18, coin.getWidth(), coin.getHeight(), null); g2.setFont(new Font("LCD", 2, 50)); g2.drawString(PlayerData.playerData.getName(), 80, 49); g2.dra...
80c888a1-e4e7-4f7e-bb13-61b2d7567813
3
public void load(String fileName) { try { InputStream file = new FileInputStream(fileName); InputStream buffer = new BufferedInputStream(file); ObjectInput input = new ObjectInputStream(buffer); GameData gd = (GameData) input.readObject(); input.close(); buffer.close(); file.close(); ...
40205d58-005a-4cf7-bb90-8f77d6d9b29f
8
public int compare(String[] ssc1, String[] ssc2) { for (int idx:indicesOfKeys) { String str1 = ssc1[idx]; String str2 = ssc2[idx]; if (str1 == null && str2 == null) { continue; } else if (str1 != null && str2 == null) { return -1; } else if (str1 == null && str2 != null) { return 1; } el...
240f8d54-f564-4f6b-b4a0-dddff20e2375
3
public void build() { progress += 4; if(progress % 500 == 0 && progress != 0) { if(progress <= 3500) { sind ++; this.sprite = Images.stonepost.getSubimage(sind * 64, 0, 64, 64); } } }
89927a34-6e1b-47f4-936e-f5913346342c
0
@Override public void actionPerformed(ActionEvent e) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); final int thisyear = cal.get(Calendar.YEAR); cal.set((Integer) year.getSelectedItem(), (Integer) month.getSelectedItem() - 1, (Integer) day.getSelectedItem()); java.sql.Date date = n...
7bce18ce-1d6f-4113-9821-38c7638cbc22
1
final public void Empty_statement() throws ParseException { /*@bgen(jjtree) Empty_statement */ SimpleNode jjtn000 = new SimpleNode(JJTEMPTY_STATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { jj_consume_token(SEMICOLON...
bd5d9d23-6a54-4eae-9c08-947e2a9642be
1
public static Map<String, String> map(String... params) { Map<String, String> result = new HashMap<String, String>(); for(String param: params) { String[] kvs = param.split("->"); String key = rmvPrePostSc(StringUtils.trim(kvs[0])); String val = rmvPrePostSc(StringUtils.trim(kvs[1])); result.put(key, va...
4d64f321-71cb-4c40-a7d9-770a2c375183
5
public boolean checkGoal(State state) { for (int k = 0; k < state.getData().size(); k++) { for(int m = 0; m < state.getData().get(k).size(); m++) { if (state.getData().get(k).get(m).equals("$") || state.getData().get(k).get(m).equals(".")) { return false; } } } endTime = System.nanoTime(); ...
3100c487-3e3a-4b0f-9e31-6136f148cbfd
3
public AbstractView getView(Class<? extends AbstractView> clazz) { for (AbstractView view : registeredViews) { if (clazz.isInstance(view)) { return view; } } return null; }
1a85e8bc-57a8-4790-afbd-5673c6c8cb39
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...
292dd942-0685-4ea0-a842-7d0c6515b2f7
5
private static State mergeStates(Set<State> original, DataMerger merger) { List<String> names = new ArrayList<String>(original.size()); for (State s : original) names.add(s.name); Collections.sort(names); StringBuilder name = new StringBuilder(); for (String n : names) name.append(n + "|"); State ne...
32e7f29a-0e7e-4356-8cbe-b324ac09fdd9
4
@Override public String toString() { String result = "Subject: " + this.getSubject() + " Description: " + this.getDescription() + " Priority: " + this.getPriority() + " AuthorID: " + this.getAuthor() + " ExpirateDate: " + this.getExpirationDate...
5c51f393-cb0c-4e07-9490-f99866b41738
1
public static void Move(){ UserInteractions.PrintSeparator('-'); System.out.println("\t\tBLACK's TURN"); UserInteractions.PrintSeparator('-'); if (owner.equals(Owner.HUMAN)){ Human.makeNextBlackMoves(); } ...
2f5eb343-ea75-406e-b88f-3b55ec02fd76
1
public boolean isEven(int num) { if (num % 2 == 0) return true; else return false; }
080f3c49-346a-412f-bf5a-0c169f652cf0
6
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
75589bc3-a56f-42a1-9b33-e547aad4f6fb
5
public static void disposeImages() { // dispose loaded images { for (Image image : m_imageMap.values()) { image.dispose(); } m_imageMap.clear(); } // dispose decorated images for (int i = 0; i < m_decoratedImageMap.length; i++) { Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decora...
10bf8f07-f497-4f00-a39d-9efaa989972d
4
public BendTrajectory(Lane lane) { fLane = lane; fStartX = lane.getStart().getPosition().getX(); fEndX = lane.getEnd().getPosition().getX(); fStartY = lane.getStart().getPosition().getY(); fEndY = lane.getEnd().getPosition().getY(); double x = fStartX; double y = fEndY; if (fStartX > fEndX && fLane.ge...
0d9a714e-bdc6-40cc-9c9a-46f214ed7ed7
9
protected void runTests(boolean weighted, boolean multiInstance, boolean updateable) { boolean PNom = canPredict(true, false, false, false, false, multiInstance)[0]; boolean PNum = canPredict(false, true, false, false, false, multiInstance)[0]; boolean PStr = canPredict(false, false, true, false, fa...
38a90766-8463-423f-a635-48ba0ad54f0f
9
void showdetail() { int max =0; ArrayList<Integer[]> scorelist0 = new ArrayList<Integer[]>(); ArrayList<Integer[]> scorelist1 = new ArrayList<Integer[]>(); for (int i=0; i<size*size-1; i++) { if (grid[i].value>max) { max = grid[i].value; ...
1726f86f-008f-4dd6-bc6c-88c9f24f3708
4
public synchronized void mouseMoved(MouseEvent e) { // this event is from re-centering the mouse - ignore it if (isRecentering && centerLocation.x == e.getX() && centerLocation.y == e.getY()) { isRecentering = false; } else { int dx...
ec0211c4-c6f9-4f99-857b-2b33a9a1a52a
4
public DFS addExeLog(String fileName) throws FileNotFoundException { Scanner sc = new Scanner(new File(fileName)); while(true) { if(!sc.hasNextInt(16)) break; int b = sc.nextInt(16); int hl = sc.nextInt(16); if(hl >= 0x8000) { System.out.println("skipping non-ROM address ...
1fef7936-a54b-4d08-bd0d-96744e0916b5
3
public World() { chunks = new Chunk[ncx * ncy * ncz]; for (int x = 0; x < ncx; x++) { for(int y = 0; y < ncy; y++) { for(int z = 0; z < ncz; z++) { chunks[x + (y * ncx) + (z * ncx * ncy)] = new Chunk(this, x * Chunk.chunkW, y * Chunk.chunkH, z * Chunk.chunkD); } } } grass = new Texture("/furn...
382e39e9-8df1-4ab4-bcf6-ea371b86b92f
3
public void setButtonReview(JButton button) { button.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent evt) { try { if (wbview.getSelectedRowCount() == 1) { wbview.getReviewDialog().setPK(wbview.getSelectedId()); wbview.invokeReviewMediaDialog(); } else { ...
ad6d400b-9632-495a-aff7-dd4831c7b551
5
@Override public void beginEditInterval(int start, int end) throws AlreadyEditingException { validateInterval(start, end); if (editedBy != null) throw new AlreadyEditingException(this); if (editedIntervals.isEmpty()) editionStarted(); for (Interval i : ...
868fc463-3c19-46b7-8bb5-4173d6e5d63b
5
private void writeLongArray(Object value, int type) { writeList.clear(); int len = Array.getLength(value); if (len > 0) { if (type == ElementType.TYPE_LONG_ARRAY) { for (int i=0;i<len;i++) { writeList.append(Array.getLong(value,i)); ...
80894812-afaa-4c8b-aa04-280c57594ab8
0
@Override public void setID(String iD) { super.setID(iD); }
af08f078-b811-4456-9fcd-c2d1c527b6a2
7
private boolean concatHelper(String curWord, int startIndex, int length) { if (startIndex >= length) { return true; } TrieNode curNode = root; for (int i = startIndex; i < length; i++) { char curChar = curWord.charAt(i); HashMap<Character, TrieNode> children = curNode.getChildren(); if (children.con...
83df9192-d135-4fc1-be15-fd51fd7da142
5
private int chooseDefaultLanguage () { if (languages.length == 1) return languages [0]; Locale dflt = Locale.getDefault (); int retval = languages [0]; for (int i = 0; i < languages.length; i++) { Locale current = LangCode.getLocale (languages [i]); // return exact matches if possible if ...
2e9908d5-3d06-4df7-b622-50e221af51c4
7
private static <T extends JComponent> T getComponentFromList(Class<T> clazz, List<T> list, String property, Object value) throws IllegalArgumentException { T retVal = null; Method method = null; try { method = clazz.getMethod("get" + property); } catch (NoSuchMethodExc...
ba148fe8-70b8-4681-ad97-86942679f52f
3
public SessionList getSessionsViewBy(String asViewById, String asLastModified, int aiMaxSize) { String lsParam = ""; if (aiMaxSize > 0) { lsParam += "&max_size=" + Integer.toString(aiMaxSize); } if (UtilityMethods.isValidString(asLastM...
c22dd562-550e-4a85-9f3d-9804055ed563
7
private String parameterValue(Object value) { if(value == null) return null; if(value.getClass() == String.class) return (String)value; else if(value.getClass() == Boolean.class) return ((Boolean)value).booleanValue()?"yes":"no"; else if(value.getClass() == List.class) { @SuppressWarnings("unchec...
e0435e56-4067-45f2-8d1f-8c9cfcd3b96d
5
public Map<Integer, SingleRunScore> scoreSubject(Experiment goldStandard, TobiiData subjectData, Map<Integer, List<Double>> recordMap, double lookThreshold) { Map<Integer, SingleRunScore> scoreMap = new HashMap<Integer, SingleRunScore>(); for(Integer trialID : goldStandard.getTrials().keySet()) { Trial trial =...