method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ca0f0254-66fb-40cb-8d38-c2825f12e377
1
@Override public void removeTray(Tray tray) { tx.begin(); for (State state : tray.getStates()) { tray.removeState(state); em.remove(state); } em.merge(tray); em.remove(tray); tx.commit(); }
28a4ef27-fd6c-4439-adfd-fddc38e4b5c9
6
@Override public void run() { Peer potentialPeer = null; int i; for(i=6881; i <=65536; i++) { if(portOpen(i)) break; } manager.setListeningPort(i); ServerSocket listeningSocket = null; try { listeningSocket = new ServerSocket(i); this.listeningSocket = listeningSocket; } catch (IOExce...
b8160344-c8f9-4bd0-b0e7-4d790b08a358
7
@Test public void bishopOnFullBoard() { Map<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(BISHOP.toString(), 2); Chessboard chessboard = Chessboard.newBuilder(figureQuantityMap) .withDimension(DIMENSION_6) ...
db2e1343-0537-4ea4-bac4-f073dd9bc3b0
8
public static Stella_Object accessTokenizerTableSlotValue(TokenizerTable self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Stella.SYM_STELLA_TRANSITIONS) { if (setvalueP) { self.transitions = ((StringWrapper)(value)).wrapperValue; } else { value = Str...
ed3d7b19-5015-4cb1-b73c-8a1119fd179c
5
public static int iterate(Complex z0) { Complex z = new Complex(z0); if (mandelbrot){ //Iterates the passed complex z after the formula z_next = z^2 +z0 for (int i = 0; i < maxIterations; i++) { if (z.abs() > 2.0) { return i; } z = z.times(z).plus(z0); } return maxIterations; } el...
f05fb583-05bc-4a02-9a8c-d51eefb0e977
4
private Type compileArray(Type base) throws ParseException, IOException { // [ while ((tokenizer.tokenType() == Tokenizer.SYMBOL) && (tokenizer.symbol() == '[')) { advance("program not ended"); int length = compileConstValue().intValue(); base = new ArrayType(base, length); // ] if ((tok...
7796dc43-401e-47b2-b30b-bec42b1266dc
9
public boolean isWriteable(Object bean, String name) { try { Object[] call = resolveNested(bean, name); if (call != null) { bean = call[0]; name = (String) call[1]; } } catch (IllegalAccessException e) { return false; ...
f68b4afa-f3b9-4f07-aa19-a3c5b3662c03
4
public static void main(String[] args) { //загрузка настроек для интерфейса try { getConfig(); } catch (IOException e) { e.printStackTrace(); } //установка скина для приложения java.awt.EventQueue.invokeLater(new Runnable() { public void run() { try { SubstanceLoo...
05f8652d-e0c3-4ff5-bfa8-ad777c35c217
7
public static String timeIntervalToString(long millis) { StringBuffer sb = new StringBuffer(); if (millis < 10 * Constants.SECOND) { sb.append(millis); sb.append("ms"); } else { boolean force = false; String stop = null; for (int ix = 0...
d81a5b61-5699-40ea-86f0-d9f850761e9c
8
public static void sortString(String[] strings, int longestBit) { int currBit = 1; int bucketNum = 256+1; // Additional one bit for the string which is smaller than the longestBit size String[][] bucket = new String[bucketNum][strings.length]; int[] bucketCount = new int[bucketNum]; while (currBit<=longest...
04f4b294-4fc4-4c7b-a0a2-1367a79e6afd
5
public final void execute(CommandSender sender, String[] args) { this.isPlayer = sender instanceof Player; if (this.playersOnly() && !this.isPlayer) { error(sender, "MEOW MEOW MEOW MEOW MEOW MEOW MEOW"); return; } if (this.isPlayer) { if (this.getPermission() != null && !sender.hasPermission(this...
ce59ef9d-7898-4f96-a9e3-94365ae9d8ee
0
@Override public String toString() { return getName(); }
28097307-6785-46c9-bf3c-9bd7f29639a7
7
public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int a = 0; for(String ln;(ln = in.readLine())!=null;){ if(a>0)sb.append("\n"); int n = parseInt(ln); HashMap<String, int[]> sums = ...
5c2663ef-ff38-4ffa-af98-3509d888fa64
8
double read(boolean first) { Point2D centre = new Point2D.Double(localPosition.getX(), localPosition.getY()); Point2D front = new Point2D.Double(localPosition.getX() + range * Math.cos(localPosition.getT()), localPosition.getY() + range * Math.sin(localPosition.getT())); // reads the robot's position robot....
defe9d17-ad67-4430-ac85-03da8ec45f46
0
public void setDataRejestracji(Date dataRejestracji) { this.dataRejestracji = dataRejestracji; }
3bea152f-1bda-476a-a6ec-fc5c113e6746
2
public List<ScriptCoverageCount> getEmptyCoverageData(Set<String> urisAlreadyProcessed) { List<ScriptCoverageCount> scripts = new ArrayList<ScriptCoverageCount>(); for (File file: fileScanner.getFiles(urisAlreadyProcessed)) { String uri = ioUtils.getRelativePath(file, config.getDocumentRoot(...
7ece47cc-c673-46ee-90e3-14060acbc505
5
private static String[] readNames(String filePath) throws IOException { FileReader fr = new FileReader(filePath); BufferedReader textReader = new BufferedReader(fr); String line = textReader.readLine(); int num = 0; for (int i = 0; i < line.length(); i++) { if (line.charAt(i) == '\"') { num++; } ...
f8d34c9f-3d90-405a-897c-98728ae1d071
9
static boolean isStandardProperty(Class clazz) { return clazz.isPrimitive() || clazz.isAssignableFrom(Byte.class) || clazz.isAssignableFrom(Short.class) || clazz.isAssignableFrom(Integer.class) || clazz.isAssignableFrom(Long.class) ...
1b589155-018f-4be6-96fd-87380418d87b
8
@Override final public void set_hand_to_hand(int level){ if(level >= 15){ bonus_dodge = 3; number_of_attacks = 7; number_actions = 7; bonus_strike = 2; crit_range = 19; } else if(level >= 12){ bonus_dodge = 3; ...
bc84a330-c6cd-4b19-aff9-868301ef7fb7
8
private void renderSecondSet(String choice, final GameContainer gc) { secondGroup.removeAll(); /* secondGroup.setSize(85, 130); secondGroup.setLocation(100, 465); secondGroup.setOpaque(true); secondGroup.setBackground(Color.black); RowLayout layout = new Row...
6d58f8fb-bc20-4bde-b8f3-4e6a0d9f474c
8
public void knapsack(int[] wt, int[] val, int W, int N) { long negativeInfinity = Long.MIN_VALUE; long[][] m = new long[N + 1][W + 1]; long[][] sol = new long[N + 1][W + 1]; for (int i = 1; i <= N; i++) { for (int j = 0; j <= W; j++) { long m1 = m[i - 1][j];...
85197516-e266-4898-91a0-407b25e433a5
5
public void actionPerformed(ActionEvent e) { if (aliens.size()==0) { String msg = "You won"; String msg1 = "Score = " + score+ "Topscore!!"; timer = new Timer(10, this); timer.start(); ingame = false; } ArrayList ms = craft.getMiss...
55056805-1c87-4182-b163-2bba0a42d312
0
public T[] getFooArray() { return fooArray; }
5e193225-6d58-4b8a-bd44-6c8fe26a4754
1
public Result[] SendLong(Submit submit) { if (this.LoginResult.ErrorCode == 0) { return this.pconnect.SendLong(submit); } else { Result [] result=new Result[1]; result[0]=this.LoginResult; return result; } }
83513cda-4a0d-4cc3-8d29-73dfcbe575c3
0
public void setDeletedById(Integer id, boolean isDeleted) { String query = "update Task set isDeleted = :isDeleted where id = :taskId"; sessionFactory.getCurrentSession().createQuery(query) .setInteger("taskId", id) .setBoolean("isDeleted", isDeleted) .exe...
4c432533-04db-4d08-aef3-e26aba9e008f
0
@Override public void logic2() { System.out.println("独自処理2 " + LoggerUtils.getSig()); }
5f9fce26-3c3b-442e-a26e-262d596546a4
7
@Override public void update(Observable arg0, Object arg1) { if(model.getState() != 2 || model.getPhase() == 1){ return; } Player owner = model.getTerritory(0).getOwner(); for(int i = 1; i < model.getTerritories().length; i++){ if(owner != model.getTerritory(i).getOwner()){ return; } } long st...
9ca67856-0bc5-4818-84e4-3b0b1a8a734f
0
@Override public void loose(GameEvent event) { endGame("Verloren", event.getPoints()); }
b4340b7a-50d3-477d-808a-22cdb2381859
4
public void checkType(Symtab st) { if (fc != null) { fc.setScope(scope); fc.setSymtab(st); } else if (oa != null) { oa.setScope(scope); oa.checkType(st); } else if (lg != null) { lg.setScope(scope); lg.checkType(st); } else if (ident != null) { ident.setScope(scope); ident.checkcontext(s...
b83bff44-5551-4136-bc52-c5f1977cd023
8
public static void main(String[] args) throws IOException, InterruptedException { if (args.length == 0) { usage(); } File file = new File(args[0]); if (!file.exists()) { System.out.printf("File \"%s\" does not exist.%n", args[0]); System.exit(0); ...
f82773cc-9a78-46d3-bf1d-079333dbb20c
0
public int getThickness() { return thickness; }
c8ba0d1e-6bb3-4a5a-af68-ff0589b4683a
3
public static void remove_stopwords(String[] query, String[] stopwords) { Set<String> stopWordSet = new HashSet<>(); for (String s : stopwords) { stopWordSet.add(s); } for (String word : query) { if(!stopWordSet.contains(word)) { System.out.prin...
3d488156-ca7a-4d46-b2c1-f54cf79f1ec3
0
public UserCommand(TotalPermissions p) { plugin = p; }
af93a9b1-d869-4764-b142-ec3e1ae7420b
7
private void batchEstimateDataAndMemory(boolean useRuntimeMaxJvmHeap, String outputDir, int reduceBase) throws IOException { //File mDataOutputFile = new File(outputDir, "eDataMappers.txt"); //File rDataOutputFile = new File(outputDir, "eDataReducers.txt"); File mJvmOutputFile = new File(outputDir, "eJvmMapper...
a836a77d-c2eb-491a-ac39-2118e4dbbc08
9
private void executeSelectCommandsOnNodes(final Command[] commands, final ObjectOutputStream clientOut) throws InterruptedException{ final int maxCounterMsg = numberOfNodes; final CountDownLatch latch = new CountDownLatch(maxCounterMsg); for(int i=0; i!=numberOfNodes; ++i){ final int index = i; if(co...
53376b0a-6a5b-4bcb-bd26-6c51ce3253ce
4
public Double getMatch(String... searchForKeys){ for(String searchForKey : searchForKeys){ int found = 0; for(String key : keys){ if(searchForKey.equalsIgnoreCase(key)){ found++; } } if(found == 0){ match -= (1.0/searchForKeys.length); } } return (double)Math.round((...
c8e7af1c-cc41-4026-9a2b-7d72ccef9467
1
public void testConstructor_invalidObject() throws Throwable { try { new DateTime(new Object()); fail(); } catch (IllegalArgumentException ex) {} }
14d1e23d-db2a-434a-86ac-9c07d896944a
9
public void balanElimIzq( Retorno retorno ) { switch( balance ) { case BIZQ: if( izqNodo != null){ if( izqNodo.balance != BDER ) { retorno.respuesta = roteDer( ); if( retorno.respuesta.balance == BAL ...
6f554642-8977-433d-95d4-c20d3ceca573
6
private void pesquisarProduto() { dtm = (DefaultTableModel) JT_Venda_Produtos.getModel(); String sql = ""; if (!JTF_Produto.getText().equals("") && !JTF_Codigo.getText().equals("0")) { sql = "SELECT id, descricao, valor_venda FROM b_produtos WHERE (id = " + JTF_Codigo.getText() + "...
1416598c-cde4-4f1b-a2a5-d20f09e02b11
6
private ArrayList<Block> findLeafNode(Block root) { ArrayList<Block> leafList = new ArrayList<Block>(); Queue<Block> queue = new LinkedList<Block>(); HashSet<Block> visited = new HashSet<Block>(); queue.add(root); while (!queue.isEmpty()) { Block blk = queue.remove(); if (blk == null || visited.contain...
f1fea7d2-daca-4b05-93ef-3f5ba3a49c71
7
private static int[][] FileToWeightedGraphArray(String dat) { int[][] A = null; FileInputStream fis = null; try { fis = new FileInputStream(dat); } catch (Exception e) { System.out.println(dat + " konnte nicht geoeffnet werden"); System.out.println(e.g...
a0251ce8-7e76-49cf-9200-06f2e418f508
3
@Override public void setValue(String value) { for (HTMLComponent c : getChildren()) { if (c instanceof HTMLOption) { HTMLOption op = (HTMLOption)c; // System.out.println("option: " + op); if (op.getName().equals(value)) { super.setValue(value); return; } } } System.err.printf("Wa...
b0059274-8727-4b09-ac2f-ef6eebebbe8c
5
public void update() { if (xPos < 0) { xPos = 0; } else if (xPos > Main.WIDTH - size) { xPos = Main.WIDTH - size; } if (yPos < 0) { yPos = 0; } else if (yPos > Main.HEIGHT - size) { yPos = Main.HEIGHT - size; } if (health < 1) { alive = false; health = 0; } }
640dc780-c55b-467f-a55b-cf538f33ebb6
2
@Override public void actionPerformed(ActionEvent e) { int option = FktLib .beenden(null, "Beenden?", "Wollen Sie das Spiel beenden"); if (option == JOptionPane.YES_OPTION) { System.exit(0); }else if(option== JOptionPane.CANCEL_OPTION){ return; } }
59262b45-d9e1-4b3e-bb95-7910339fb3fc
4
public int compareTo(WordSpan s) { if (getStart() < s.getStart()) { return -1; } else if (getStart() == s.getStart()) { if (getEnd() > s.getEnd()) { return -1; } else if (getEnd() < s.getEnd()) { return 1; } else { return 0; } } else ...
2e2371ae-81e3-46e6-b772-d1b209990fe4
8
public static int[][] permutations(int[] a) { int permutations[][] = new int[1][a.length]; int[] tempCopy, aCopy; boolean foundAk; int k = 0, l = 0, n, p = 0, al, ak, r; a = bubbleSortIncreasing(a); //reset the array for algorithm permutations[p++] = Arrays.copyOf(a, a.le...
15be5081-676e-496f-b259-b7cc47711174
6
@Override public String getColumnName(int columnIndex) { String res = ""; switch (columnIndex) { case 0: res = "id"; break; case 1: res = "First Name"; break; case 2: res = "LastName"; break; case 3: res = "Age"; break; case 4: res = "StreetName"; break; ca...
0e1f7eef-a855-4f40-9328-99188aad3372
8
public void setField(Integer field, String value) { switch(field) { case 1: field1 = value; updateMap.put("field1", value); return; case 2: field2 = value; updateMap.put("field2", value); retu...
e5fc5b9b-4e9a-45c2-9092-f4e94777e992
3
private String Pretreatment(String filePath) { String result = ""; String FileName = filePath; File myFile = new File(FileName); if (!myFile.exists()) { System.err.println("Can't Find " + FileName); } try { BufferedReader in = new BufferedReader(new FileReader(myFile)); String str; while (...
2432aa00-c0c6-41cc-92cf-295d64b04e05
3
public void setup(){ Object[] options = {"Browse", "Build"}; int i = JOptionPane.showOptionDialog(null, "There has been an error locating the startup file." + "\nPlease select below either 'Browse' to navigate to" + " the correct file" + "...
fa56934d-03c2-4216-bb85-873b00b5f107
5
public void run() { int amountInput = 0; //统计类的参数最好在一开始初始化 println ("This program find the largest and smallest numbers."); /* set a sentinel number */ int n = readInt ("? "); if ( n == SENTINEL) { println ("The program is terminated by your input of the setinel number. "); } /* variable amountIn...
fcd32f2b-9a06-431b-8e19-5df69c46e95f
5
public void body() { logger.info(super.get_name() + " is starting..."); // get the resource id if (resID < 0) { logger.severe("Invalid resource: " + GridSim.getEntityName(resID)); return; } boolean success = submitGridlets(); if(succes...
acbd1fab-07d9-45a6-9326-afe08c3047dd
8
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (!_pendingRics.isEmpty()) createRenderers(); // column is index of table view, not of table model. // Must use JTable.getColumnN...
c600fa68-482d-4181-9f3d-be4a93d94a00
1
public boolean MouseUpListener(int mX, int mY, int button) { if(mainLogic.currentState == GameLogic.GameState.PLAYING) { currentMouseAction.onMouseUp(mX, mY, button); } return false; }
d11ad53a-1bbe-4f80-890a-ff7e515f411c
6
public boolean move(Matrix matrix, Square destination) { if (destination.getCharacter() != null) { if (destination.getCharacter().isAlive()) { return false; } } if (destination instanceof Door) { if (!((Door)destination).isOpen()) { return false; } } ...
68e0fdd2-e2b8-452d-9e89-210e124e934c
9
public static void main(String args[]) { int N = Integer.parseInt(args[0]); int a, b, c, d, a3, b3, c3, d3; for (a = 1; a <= N; a++) { a3 = a * a * a; if (a3 > N) break; for (b = a; b <= N; b++) { b3 = b * b * b; if (a3 + b3 > N) break; for (c = a + 1; b <= N;...
d3741e68-724c-4b1f-a59e-c07b863155c9
2
public static void main(String[] args) { try { Display.setTitle("TestThingy"); Display.setDisplayMode(new DisplayMode(1280, 720)); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); } glMatrixMode(GL_PROJECTION); glLoadIdentity(); GL11.glOrtho(0, 1280, 0, 720, ...
d034048c-9729-407f-a9f2-1202935e71ab
3
public static <T extends DC> Set<Set<Pair<T,T>>> despatch(Pair<T,T> pair,Set<Set<Pair<T,T>>> sets) { if(pair==null) { return sets; } else { if(sets==null) { return new Set(new Set(pair,null),null); } else//pair!=null && sets!=null { if(sets.next==null) { return new Se...
dd3f4599-7ba1-49d1-9066-d1e74260910c
2
public DisplayObject addChild(DisplayObject child) { DisplayObjectImpl impl = ((ContainerImpl) overlay).addChild(child.getOverlay()); if (impl != null) { children.add(child); } return (impl != null ? child : null); }
45fdd3d9-b2d7-4778-a8be-9226b6b1922d
6
@ Override public int compare(File lhs, File rhs) { if (lhs.isDirectory () && !rhs.isDirectory ()) { if (order == FileFolderOrder.DIRECTORY_FIRST) return -1; // list directories first else return 1; // list directories last } else if ( !lhs.isDirectory () && rhs.isDirectory ()) if (order == FileF...
e179f0ba-26ea-4721-ae99-8f4fe21b0414
9
private void affichageErreurs(List<Error> erreurs){ for(Error e : erreurs){ switch(e){ case raisonSocialeVide : this.labelErreurRaisonSociale.setText("Veuillez saisir une raison sociale"); break; case telephoneVide : ...
b2c9a891-3aaf-47f8-86c0-a20d37a9405c
1
@Override public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) { if (e.getDocument() == null) { setEnabled(false); } else { calculateEnabledState(e.getDocument().getTree()); } }
65c78020-1827-4e34-8c46-47d095fcadc1
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the server with glorious data task = plugin.getServer().getScheduler() .runTaskTimerAsynch...
f45555d4-0be1-4290-9611-578a385eccfe
8
public boolean verifierEmplacement(Piece p) { for( int y=0;y<p.getLongueur();y++) { for(int x=0;x<p.getLargeur();x++) { if( 0<=y+p.getPositionY()&& y+p.getPositionY()<longueur && 0<=x+p.getPositionX() &&x+p.getPositionX()<largeur ) ...
034b2167-b7a8-4fbc-92cc-52b2681e2dcb
9
private MainFrame() { // Set frame options. setTitle("Wombat - Build " + Wombat.VERSION); setSize(Options.DisplayWidth, Options.DisplayHeight); setLocation(Options.DisplayLeft, Options.DisplayTop); setLayout(new BorderLayout(5, 5)); setDefaultCloseOperation(EXIT_ON_CLOSE)...
ec69d526-4e8b-4073-86d1-b676af839616
9
@Override public StringConverter<?> findConverter(Class<?> cls) { if (cls.isArray() && cls.getComponentType().isPrimitive()) { if (cls == long[].class) { return LongArrayStringConverter.INSTANCE; } if (cls == int[].class) { return IntArrayS...
d54f4fd7-3457-4db3-a89e-678b72ca27ec
5
private static void updateVersions() { try { String path = VersionUtil.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath(); Attributes a = getManifest(path).getMainAttributes(); if (a.getValue("Plugin-Version") != null) { PLUGIN_VERSION...
23770d46-cbef-4294-8bb9-4b2d610d6e62
3
public void sendFeedbackMove(String feedback){ check(isMyTurn() && currentMove == FEEDBACK); check(masterMindLogic.checkValidFeedback(feedback)); if (feedback.equals("4b0w") || ((List<String>)state.get(GUESSHISTORY)).size() == (Integer) state.get(MAXTURN)){ this.sendFeedbackMoveVerify(feedbac...
1d5c41b3-42d2-4e9c-b0d6-e439d3253370
2
private Token isReservedWord(Token token) { Token tok = token; for (ReservedWord rw : ReservedWord.values()) { //Si encontramos que en el enum ReservedWord existe el lexema que estoy comparando, entonces devuelvo el TokenType que tiene asociado en ese enum. //de lo contrario devu...
8ef0a619-170e-42b1-ac93-5a171d33f974
4
public static ArrayList<Critter> getViewableCritters(Critter self, Environment envi){ synchronized(envi.lock_critter){ Arc2D arc = getView(self); Ellipse2D circle = getCloseView(self); ArrayList<Critter> viewable = new ArrayList<Critter>(); Iterator<Critter> iter = envi.getCritters().listIterator();...
6cd1771a-2dc6-42ff-8a87-b5bfafec70a2
7
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String args[]){ if (!(sender instanceof Player)) { sender.sendMessage("This command can only be run by a player."); return true; } Player player = (Player)sender; if (args.length <= 0){ player.sendMessage(Util.edit(USE_HE...
90d2123a-ccae-48d4-9b55-c5883a782a71
4
public boolean conflicts(String name, Scope inScope, int context) { int dot = name.indexOf('.'); if (dot >= 0) name = name.substring(0, dot); int count = scopes.size(); for (int ptr = count; ptr-- > 0;) { Scope scope = (Scope) scopes.elementAt(ptr); if (scope == inScope) return false; if (scope....
6c59face-dede-4cbb-b8d1-8f9584c4916d
8
public void renderProjectile(int xp, int yp, Projectile p) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < p.getSpriteSize(); y++) { int ya = y + yp; for (int x = 0; x < p.getSpriteSize(); x++) { int xa = x + xp; if (xa < -p.getSpriteSize() || xa >= width || ya < 0 || ya >= height) break; if...
01dcf455-d08b-4360-9a6a-2fb3167f0f41
4
public void start(){ try { Display.setTitle("openGLTutorialPongGame learning!"); Display.setResizable(true); Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT)); Display.setVSyncEnabled(VSYNC); Display.setFullscreen(FULLSCREEN); Display...
601dca23-5cde-462b-bf4e-ae88397b6ee2
9
private boolean matches(ProcessingEnvironment procEnv, boolean strict, List<? extends TypeMirror> parameterTypes, List<? extends TypeMirror> expectedParameterTypes) { for (int i = 0; i < parameterTypes.size(); i++) { boolean foundMatch = false; if (strict) { for (int j = 0; j < expectedParameterTypes...
c8f7a21e-21b1-4440-ac56-5ddc4ed73d79
6
public boolean accept(File f) { if (f.isFile()) { String name = f.getName(); int pos = name.lastIndexOf("."); if (pos > 0 && pos < name.length() - 1) { String suffix = name.substring(pos + 1); for (int i = 0; i < extensions.length; i++) { if (extensions[i].equals("*") || ...
09abcd6e-643c-4559-94cf-5708f4c095b3
0
public DataModel() { }
d8b016b0-ff5a-4761-bea1-50bb74121cdf
1
public boolean updateStateDevuelto(Prestamos p){ PreparedStatement ps; try { ps = mycon.prepareStatement( "UPDATE Prestamos "+ "SET estado='devuelto' "+ "WHERE id=?" ); ps.setInt(1, p.getId()); return (ps.e...
e1839ec9-c7d7-4668-b2df-c93c198b58d4
8
private final int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(5, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0, acti...
8a6b667a-e166-4a6d-83bf-1898ec24ec4b
5
private static void method342(int i, int j, int k, int l, int i1) { if (j < topX || j >= bottomX) return; if (l < topY) { i1 -= topY - l; l = topY; } if (l + i1 > bottomY) i1 = bottomY - l; int j1 = 256 - k; int k1 = (i >> 16 & 0xff) * k; int l1 = (i >> 8 & 0xff) * k; int i2 = (i & 0xff) * k...
bfe6e64d-c906-4e0a-b9b0-c3356327f09e
4
public void lisaaYhteys(Piste yhteys, Suunta suunta){ //Suunta: 1=Pohjoinen, 2=itä, 3=etelä,4=lansi switch(suunta){ case Pohjoinen: Pohjoinen = yhteys; break; case Ita: Ita=yhteys; break; case Etela: ...
52c9e7d1-48c0-46d0-8d53-ed1c33033aab
8
private void parseEvent() { if(sEvt.matches(REGEX_CHATCOMMAND)) parseAsChatCommand(); else if(sEvt.matches(REGEX_GAMECOMMAND)) parseAsGameCommand(); else if(sEvt.matches(REGEX_JOINEVENT) || sEvt.matches(REGEX_QUITEVENT)) parseAsConnectionEvent(); else if(sEvt.matches(REGEX_KICKEVENT)) parseAsKickEvent(); e...
169d2de9-c711-42f0-bf29-a52012a84ca2
2
public static void insertVelo(Velo velo) { PreparedStatement stat; try { stat = ConnexionDB.getConnection().prepareStatement("insert into velo (serialNumber, dateMiseEnService, kmParcourus, etat, fk_id_borne) values (?,?,?,?,?)"); stat.setString(1, velo.getSerialNumber()); ...
4a055f69-4b72-4138-aa60-97600555d847
9
public void quicksort() { SortierListe lLinkeListe = new SortierListe(); SortierListe lRechteListe = new SortierListe(); Integer pivot = null; if (this.laenge() > 0) { this.zumAnfang(); pivot = (Integer) this.aktuellesElement(); ...
b56af2c5-d919-4668-b349-c1b6b59d5f69
0
protected boolean isFinished() { return false; }
e6b9eec2-a6e9-432e-9ca6-8680cb8cc178
8
@Override public void mouseReleased(MouseEvent e) { Point p = e.getPoint(); int[] cubie = getCubie(p); if (cubie != null) { display.undoneActions.clear(); if (cubie[1] == 1 && cubie[2] == 1) { String turn = ""; if (e.getButton() == 1) { turn = this.getSide(getColor(cubie)).getName(); turn...
6e0a86cc-5544-490b-8a33-b87b622efa5e
0
public void removeChatGuiListener(ChatGuiListener listener) { chatGuiListener.remove(listener); }
94a8ceb6-9667-43a2-ac72-84b958f620b5
9
@SuppressWarnings("rawtypes") public final static Producto jsonToProducto(String json) throws ParseException { Producto prod= new Producto(); JSONParser parser = new JSONParser(); ContainerFactory containerFactory = new ContainerFactory() { public List<String> creatArrayContainer() { return new LinkedList...
9f5e0646-22a9-4683-b39b-710fe41395f4
1
private void registerResources(Environment environment){ final Map<String, Object> beansWithAnnotation = applicationContext.getBeansWithAnnotation(Path.class); for (String beanName : beansWithAnnotation.keySet()) { Object resource = beansWithAnnotation.get(beanName); environme...
2f29eb33-f690-4534-b0dc-0340dfe887e4
9
public void execute() throws ClassNotFoundException, SQLException, IOException { DataWriter writer = new ExcelWriter(context); Class.forName(context.getJdbcDriver()); Connection connection = DriverManager.getConnection(context.getConnectionUrl()); PreparedStatement statement = n...
1372b0a2-fb28-4698-9c52-352201db0058
8
public final int[] randomCARule(int maxLength, int actualLength, Random randNum){ int[] itemArray = new int[maxLength]; for(int k =0;k < itemArray.length;k++) itemArray[k] = -1; if(actualLength == 1) return itemArray; int help =actualLength-1; if(hel...
effe0eac-eb53-4503-b14c-73b387a2d333
6
public static boolean available(int port) { if ((port < MIN_PORT_NUMBER) || (port > MAX_PORT_NUMBER)) { throw new IllegalArgumentException("Invalid start port: " + port); } ServerSocket ss = null; DatagramSocket ds = null; try { ss = new ServerSocket(port...
5d167b50-87c3-4523-a6e9-0d1b87d28f73
9
public static RandomListNode copyRandomList(RandomListNode head) { if (head == null) { return null; } RandomListNode p = head; while (p != null) { RandomListNode temp = new RandomListNode(p.label); temp.random = null; temp.next = p.next; ...
42c546ed-27a9-4c8c-a241-d542f07f5abf
5
public Players(int num, String[] names, Deck deck) { this.numPlayers = num; this.playerList = new Player[this.numPlayers]; PlayerHand[] ph = new PlayerHand[this.numPlayers]; int numCardsInHand; // Determine how many cards will be in each deck if (this.numPlayers <= 4) { numCardsInHand = 7; } else { ...
632fcf9f-5be7-4146-9355-8f144b1c6f6f
5
public void draw(Graphics2D g) { for( int row = rowOffset; row < rowOffset + numRowsToDraw; row++) { if(row >= numRows) break; for( int col = colOffset; col < colOffset + numColsToDraw; col++) { if(col >= numCols) break; if(map[row][col] == 0) continue; ...
18cda4f3-5def-49e5-96f4-6af0c0ea4a1e
2
@Test(timeout = 700) public void alterOutput() throws Exception { C c = new C(); c.addListener(new Listener() { @Override public void notice(Type T, EventObject E) { if (T == Type.OUT) { DataflowEvent ce = (DataflowEvent) E; if (ce.getValue() instanceof Double) { assertEquals(1.2, ce.ge...
1dd72838-aecb-4a32-a301-5bfe3cb01a1b
6
public ByteChunk get( ByteChunk key ) { long indexPos = indexPos(key); FileLock fl = null; synchronized( this ) { try { try { if( fileChannel != null ) fl = fileChannel.lock(0, Long.MAX_VALUE, true); long chunkOffset = getLong( indexPos ); while( chunkOffset != 0 ) { ByteChunk...
2db2a06c-6b61-4f89-93b7-7def9bf36f96
7
public ListNode mergeKLists(ArrayList<ListNode> lists) { if (lists.isEmpty()) return null; if (lists.size()==1) return lists.get(0); ListNode header = new ListNode(0); ListNode p = header; while(true){ int min = Integer.MAX_VA...
6a713b6a-47f6-4923-b521-712637631739
3
private static boolean tryOSGILoadLibrary () { try { Class<?> fwUtilClass = NativeUnixSocket.class.getClassLoader().loadClass("org.osgi.framework.FrameworkUtil"); Method getBundleMethod = fwUtilClass.getMethod("getBundle", new Class[] { Class.class }); ...
8846302a-1c27-4d5e-9889-132916048ae7
2
@Override public int compare(Achievement achievement1, Achievement achievement2) { if (achievement1.id < achievement2.id) return -1; else if (achievement1.id > achievement2.id) return 1; else return 0; }