method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f109d219-9307-4782-9767-5ff942d19c15
9
private static Set<Integer> kClosestElements(int[] items, int key, final int k) { final int crossOverIndex = findCrossOverIndex(items, key, 0, items.length - 1); System.out.println("Crossover index: " + crossOverIndex); int left = crossOverIndex; int right = crossOverIndex + 1; ...
e25cd697-e487-4084-99c9-271f37659e7f
8
private void applyHeightScaling() { double min = Double.MAX_VALUE, max = -Double.MIN_VALUE; for(int x = 0; x < detail; x++) { for(int y = 0; y < detail; y++) { if(vert[x][y][1] < min) { min = vert[x][y][1]; } if(vert[x][y...
b6d54a6c-fda4-4d5c-baff-51b97e5ecc63
5
public void music() { File soundFile = new File("tada.wav"); AudioInputStream audioInputStream = null; try { audioInputStream = AudioSystem.getAudioInputStream(soundFile); } catch (Exception e) { e.printStackTrace(); System.exit(1); } AudioFormat audioFormat = audioInputStream.getFormat(); ...
bb92b8c3-8f53-479c-8de8-9d59c6db8b3e
1
public void flagChildren(){ if(children!=null){ children.get(0).flag(); //System.out.println("\tChild flagged: "+children.get(0).toStringf()); children.get(1).flag(); //System.out.println("\tChild flagged: "+children.get(1).toStringf()); children.get(0).flagChildren(); child...
c3b7930e-e7a8-44ea-a70b-8b346412d8a4
4
@Override @EventHandler public void handleTeamPlayerDeath(PlayerDeathEvent e) { if (inTeam( CTFPlugin.getTeamPlayer(e.getEntity()) )) { System.out.println("Played died"); //set the respawn point e.getEntity().setBedSpawnLocation(spawnLocations.get(rand.nextInt(spawnLocations.size()))); ...
df51e6d8-37c5-4b79-b4d4-739e2912f8d2
5
public String makeMove(CardGame game, CardPanel panel) { if (indexTo != -1) { switch (moveTypeFrom) { case FROM_ACE_PILES: return makeAcePilesMove(game); case FROM_KING_PILES: return makeKingPilesMove(game); c...
6b31f3ea-3b76-41fb-819d-805e78ac0472
2
public static String getFilename(String path) { if (path == null) { return null; } int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR); return (separatorIndex != -1 ? path.substring(separatorIndex + 1) : path); }
b6497eea-ac19-44d8-80aa-0ccd340a28a9
6
@EventHandler public void ZombieInvisibility(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Zombie.In...
ea7219b8-e639-484a-b81b-2c771ace7d49
7
public final void method70(int i, int i_31_, byte i_32_, int i_33_, int i_34_, int i_35_, int i_36_, byte[] is, Class304 class304) { if (((Class310_Sub2) this).aClass304_3896 != class304 || ((Class310_Sub2) this).aClass68_3895 != Class68.aClass68_1183) throw new RuntimeException(); if (i...
cdd7d266-22dc-4db0-bac8-4d6e69c72e33
7
public void transform(String romanNr) { if (checkValidLetters(romanNr)) { if (syntaxCheckToggle) { if (!checkRomanNr(romanNr) || !checkThreeConsecLetters(romanNr)) { System.out.println("Sintaxa incorecta"); System.exit(statusCode); ...
2328d6c9-0da0-413a-b8ed-86130f611785
0
public String getValue() { return value; }
cfb2383a-a7ba-4ff9-8c5a-522fd4229dbf
9
@Override public void run() { try { if(!socket.isConnected()) return; //just for tests !! setUserPublicFields(); synchronized (server) { for (User user : server.userList){ if (user.userName.equals(userName)) { ...
c814ad02-2865-4fd0-be33-eee6b7517b68
0
@Override @XmlElement(name="id") public int getId() { return this.id; }
5ccaed32-e09b-4242-baff-eb30e73cab3d
2
public static <K, V extends Comparable<? super V>> Map<K, V> sortByValueDecending( Map<K, V> map ) { List<Map.Entry<K, V>> list = new LinkedList<Map.Entry<K, V>>( map.entrySet() ); Collections.sort( list, new Comparator<Map.Entry<K, V>>() { public int compare...
87566c2b-9b4c-45dd-88ff-487c1a415e97
9
private boolean isValidPath(String PathToFile){ if (PathToFile==null) return false; if (PathToFile.length()<1) return false; //if (File.isDirectory()) return false; String FileName = getName(); if (FileName.length()<1) return false; if (FileName.lengt...
cab45b1a-2536-451a-8e6c-737f872faf58
3
public static void main(String[] args) { try { // find out what pictures are stored inside your .mp3 file MP3 mp3 = new MP3("c:\\music\\bon jovi\\livin on a prayer.mp3"); List<AttachedPicture> attachedPictures = mp3.getPictures(); // if ...
f3cedac3-9930-4100-b8ec-1c9dfac723a3
5
private boolean checkDepository(String res) { boolean flag = false; if (formulaMap.containsKey(res)) { //存在该目标物品的合成公式 ResourceFormula rf = formulaMap.get(res); for (ResourceItem formulaItem : rf.getResourceFormula()) { if (!res.equals(formulaItem.getRe...
23c988ba-7830-493a-9b88-6392a0d72b80
0
public confirmRemoval() { this.requireLogin = true; this.addParamConstraint("id", ParamCons.INTEGER); this.addRtnCode(405, "venue not found"); }
9520414a-46d1-4922-a28b-6841f3865987
1
@Override protected void compute() { Loader loader = new Loader(); try { loader.setUrl(url); loader.load(); } catch (Exception e) { System.out.println(e); } System.out.println(i); }
def5351a-2a76-417e-91a5-3331867869d7
2
public Object fail(NullParamFn<? extends Object> fn) { return !this.suc ? fn.fn() : null; }
d7afb8b6-e428-414d-ac14-559fafff55dc
4
@Override public void onChatComplete(Player player, String reason, Object... playerList) throws EssentialsCommandException { // kick everyone on our list @SuppressWarnings("unchecked") ArrayList<Player> targetPlayers = (ArrayList<Player>)playerList[0]; String playerName = player.getName(); String playerLi...
a9e51ef0-933e-4863-af4b-439cf49b0ced
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String localVersion = this.plugin.getDescription().getVersion(); if (title.split(delimiter).length == 2) { final String remoteVersion = title.split(delimiter)[1].split(" ")[...
448ec3d0-a755-4dfe-b120-f350399b986e
5
public List<String> parseXml(Text value) { List<String> listAnchor = new ArrayList<String>(); String word=null; String xmlString = value.toString(); String[] listTitle = xmlString.split("<anchor>"); for (int i = 1; i < listTitle.length; i++) { int stop = listTitle[i].indexOf('<'); word=listTitle[i].sub...
d4e097e9-9b14-4395-81d2-6f7b05c01efa
9
public static void main(String[] args) throws Exception{ SOP("==========Chapter 4 Trees and Graphs==="); SOP("To run: java c4 [function name] [function arguments]"); SOP("Example: java c4 q1"); SOP(""); SOP("Possible functions:"); SOP("q1\tQuestion 1"); SOP("q2\tQ...
bdaed0e7-693b-4350-8e53-7010acf8b15a
5
@Override public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == saveProblem) { saveProblem(); } else if (source == saveDomain) { saveDomain(); } else if (source == openProblem) { openProblem(); } else if (source == exit) { exit(); } else if (source == newProb...
a40c73b4-fa8e-4b62-8fb5-bd88a1def097
2
private boolean isBetterThanOptimal(ArrayList<Rod> list, int pointer) { int currentOptimal = 0; int currentLength = 0; for(int i = 0; i < pointer; i++) { currentOptimal += list.get(i).getPrice(); currentLength += list.get(i).getLength(); } // TODO: Perform Greedy for the TEMP length // for everything ...
bfb5bf92-54f0-4cb3-acd1-b5ada7ea3703
6
private Tela navegarTelaVisualizarDadosDocente(NavigationEvent event) { if(dbController != null && event != null && event.getArg("Docente") != null){ Docente docente = (Docente) event.getArg("Docente"); TurmaDAO turmasDAO = new TurmaDAO(dbController); Collection<? e...
d81935fb-375e-442f-8155-38077f5bf0fc
7
public boolean validateMethodCall(List<binaryExpression_AST> actualArgs) { int argSize = 0; if (actualArgs != null){ argSize = actualArgs.size(); } int formalArgSize = 0; if (formalArgs != null){ formalArgSize = formalArgs.size(); } if (formalArgSize != argSize) { return false; } if (formalAr...
911c9e17-36ac-45ef-a734-31d59157f2df
6
static TypeAdapter<?> getAnnotationTypeAdapter(Gson gson, ConstructorConstructor constructorConstructor, JsonAdapter annotation) { Class<? extends TypeAdapter<?>> adapterClass = annotation.value(); ObjectConstructor<? extends TypeAdapter<?>> constructor = constructorConstructor.get(TypeToken.get(a...
35b3d0f1-25dc-480b-99c5-1f4f8c77ce22
2
@Override public String execute() throws Exception { Member a = (Member)memberDAO.findByUsername(member.getUsername()).get(0); if(a == null) return ERROR; if(!a.getPassword().equals( member.getPassword())) return ERROR; return SUCCESS; }
2eb3b41f-931b-450a-827b-9ab5b4fbb26b
3
public static Vector Reverse(Vector Vec, boolean X, boolean Y, boolean Z) { if (X) {Vec.setX(Vec.getX()*-1);} if (Y) {Vec.setY(Vec.getY()*-1);} if (Z) {Vec.setZ(Vec.getZ()*-1);} return Vec; }
cad97d87-adc3-47f3-9581-f86d3fae5a91
8
private static String[] splitToTwoParams(String param) throws Exception{ String[] splits=param.split(","); if(splits.length==2){//ֻ1šַûиϽṹ return splits; }else if(splits.length>2){//ж log(x,log(2,3)) , log(4,6) int commaIndex=0; //ָŵ int oddBracket=0; //ż1żһ int spiltCommaCount=0; //ָ. for(int i=...
42e7a39d-1356-4f74-8688-d777e8ed7a00
5
public static void printSpeed(){ DecimalFormat df = new DecimalFormat("#.000"); double calca = force/mass; double a = calca; distance = 0; IO.println("> Speed Calculation for " + force + "n with " + oforce + " opposing force, at acel " + a + ", between " + itime + "s & " + ftime + "s"); IO.print("...
070216cc-2d55-4f61-a95d-99018003290d
2
public void buildMask(int width, int height) { fogMask = new int[width][height]; for(int i = 0;i <width;i++){ for(int j = 0; j < height;j++){ fogMask[i][j] = 0; //ADD SOME CONVENTION // 0 is unseen // 1 is previously seen...
1ea80ecd-eefa-4a2e-be34-a339c6ae130a
4
public void mouse_released (MouseEvent evt) { if ( (selectedCursor!=null) ) { if (!stickyCursors.contains(selectedCursor.session_id)) { selectedCursor.stop(); cursorMessage(); if (manager.verbose) System.out.println("del cur "+ selectedCursor.session_id); if (jointCursors.contains(selectedCur...
eaa56b6f-4b89-4008-b44f-d531ff5f7f9b
1
Type getRootComponent(Type type) { while (type.isArray()) type = type.getComponent(); return type; }
94ce62a9-d650-420b-a5b3-4bb6b225fcb6
2
private Point mousePosition() { try { Point mp = this.getMousePosition(); if(mp != null) return this.getMousePosition(); else return new Point(0, 0); } catch (Exception e) { return ne...
eac9e2d2-4911-40a3-94d6-5eaef39a1eac
6
public void beginPreviewMode(boolean copy) { // !!!! awful awful hack !!! will break as soon as CPMultiUndo is used for other things // FIXME: ASAP! if (!copy && !undoList.isEmpty() && redoList.isEmpty() && (undoList.getFirst() instanceof CPMultiUndo) && (((CPMultiUndo) undoList.getFirst()).undoes[0] instance...
8ad35490-8cea-45d8-bf29-aadb74b15c88
8
private void sonificate() { try { if (outputFile.exists()) { /* * Check if chosen output file already exists. If so, we ask * gently whether the user wants to overwrite */ int selected = JOptionPane.showOptionDialog(null, String.format(props.getProperty("overwrite"), outputFile...
e90df9c8-dfed-4aca-a28a-8c667668cd75
8
public byte[] read (Handle hdl, long offset, int count, AttributeHandler fmt) { // check for auth data. if (offset == 0) { String dbUser = null, dbPassword = null; if (dbAuth != null && dbAuth.length() > 0) { int pos = dbAuth.indexOf (':'); if (pos != -1) { dbUser = dbAuth.substring (0, pos); ...
b69f9be7-4936-4768-9585-8db534b65021
4
public static List<ShopInfo> getAllShops() throws HibernateException { List<ShopInfo> shopList = null; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try { // Begin unit of work session.beginTransaction(); String hqlString = "select s from ShopInfo as s"; Query query = sess...
5c1a9fcf-fe52-4581-bdbf-1fdd74449514
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...
60337e73-69b1-4afe-9aa7-5a07a2806d4b
6
@Override public BMPImage apply(BMPImage image) { BMPImage filteredImage = new BMPImage(image); BMPImage.BMPColor[][] bitmap = image.getBitMap(); BMPImage.BMPColor[][] filteredBitmap = filteredImage.getBitMap(); int height = filteredImage.getHeight(); int width = filteredImag...
c046d29d-ef89-4c30-9cbd-9bb087f6a383
6
@Override public void processEntity(Entity entity) { Spatial spatial = entity.getComponent(Spatial.class); Velocity velocity = entity.getComponent(Velocity.class); PlayerControlled playerControlled = entity.getComponent(PlayerControlled.class); // Poll the event handelr and check if the key required for movin...
6610a46e-d19b-4ed1-bc86-d395abded4c6
2
public void ajErrorHiddenNode() { double sumChildren = 0.0; for (int t = 0; t < getOutgoingLinksNumber(); t++) { // for all neurons on next layer sumChildren += this.getOutgoingLink(t).getOut_node().getMisalignment() * this.getOutgoingLink(t).getWeight(); } this.setMisalignme...
30c0ca9f-c140-410e-b666-ba0ebc89d01c
1
public final EsperParser.for__return for_() throws RecognitionException { EsperParser.for__return retval = new EsperParser.for__return(); retval.start = input.LT(1); Object root_0 = null; Token FOR47=null; EsperParser.forgap_return forgap48 =null; EsperParser.statemen...
f6df519a-9cbc-403a-a093-f1f95527471e
2
public static void draw() { for(Model2D m : tiles.values()) { for(int x = 0; x<tilePos.get(m.textureNames[0]).size(); x++) { m.drawAt((float) tilePos.get(m.textureNames[0]).get(x).getX(), (float) tilePos.get(m.textureNames[0]).get(x).getY()); } } }
c4ca7c03-07f1-40f6-b9f2-76af03f5f754
2
protected void initialize() { String out = "addSequential(new "; double left = Robot.driveTrain.getLeftDistance(); double right = Robot.driveTrain.getRightDistance(); double turn = Robot.driveTrain.getGyroAngle(); if ((left < 0) != (right < 0)){ out += "GyroT...
26875da1-7acf-4567-abd4-3d6fc6b03530
7
public List<List<Integer>> subsetsWithDup(int[] num) { if(num == null) return null; Arrays.sort(num); List<List<Integer>> result = new ArrayList<List<Integer>>(); result.add(new ArrayList<Integer>()); Integer pre = (Integer)null; List<List<Integer>> preCopy = null; for (int i = 0; i < num...
b3ca872c-1727-4e13-a3e5-27876564a0e0
1
public static void main(String[] args) throws IOException, ParserConfigurationException, SAXException { if (args.length != 2) { System.out.println("Usage: makedictionary [path-to-input-file] [path-to-pack-resource-folder]"); System.exit(1); } final File inputFile = new F...
90f32567-75ff-4cf1-bbf1-4227ec2e718d
5
private void readyForTermination() { addKeyListener(new KeyAdapter() { // listen for esc, q, end, ctrl-c on the canvas to // allow a convenient exit from the full screen configuration public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); if ((keyCode == KeyEvent.VK_ESCAPE) || (keyC...
352c23ba-7aa0-4cfb-a662-fa1813a5a21a
6
@EventHandler public void onPlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); Action action = event.getAction(); if (action == Action.RIGHT_CLICK_BLOCK) { if ((player.getItemInHand().getType() == Material.GOLD_AXE) && (player.isOp())) { ...
e29f3fb9-4478-422f-b96f-f0305dcf382f
6
public static boolean copyFile(String source, File destination) { InputStream in = null; OutputStream out = null; try { destination.createNewFile(); in = FileUtils.class.getResourceAsStream(source); out = new FileOutputStream(destination); byte[] buffer = new byte[8192]; int bytesRead; while ((...
ef9ebbea-c855-4be1-ad6c-fdd7fd0ac025
6
public ImageIcon changeColor(BufferedImage image, Color toReplace, Color newColor, Color toReplace2, Color newColor2) { BufferedImage destImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g = destImage.createGraphics(); g.drawImage(image, nu...
8e458961-5a51-4786-8964-c773dab960e2
5
public Object nextEntity(char a) throws JSONException { StringBuffer sb = new StringBuffer(); for (;;) { char c = next(); if (Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if (c == ';') { break;...
a9636efa-6e1e-4b56-8b77-35bc485b4122
2
public ListNode partition(ListNode head, int x) { ListNode small = new ListNode(-1); // 添加辅助链表头 减少代码复杂度。 ListNode smallStep = small; ListNode big = new ListNode(-1); ListNode bigStep =big; while(head != null){ if(head.val < x){ smallStep.next = head; ...
7389ebc7-7162-46d1-93a0-766a7de96868
0
@Test public void testMenu() throws Exception { view.getImportDataMenuItem().getActionListeners()[0].actionPerformed(actionEvent); assertEquals(propertyName, MainWindowController.IMPORT); view.getExportDataMenuItem().getActionListeners()[0].actionPerformed(actionEvent); assertEquals(...
5dc6c014-2eed-4553-8432-19229174df83
9
private void visitSymbol(Symbol _sym) { Symbol sym = _sym; if (sym.kind == VAR || sym.kind == MTH) { while (sym != null && sym.owner != owner) sym = proxies.lookup(proxyName(sym.name)).sym; if (sym != null && sym.owner == owner) { ...
397381ed-488c-4459-9b35-7177e5fc4291
2
public Node getWord(String argString) { Node node = getNode(argString.toCharArray()); return node != null && node.isWord() ? node : null; }
c15c0972-97b2-4f08-bd8f-2bede04b2970
2
public Boolean markerIsTaken(int markerID, String hostName){ try { cs = con.prepareCall("{call returnMarkerOwner(?,?)}"); cs.setInt(1, markerID); cs.setString(2, hostName); ResultSet rs = cs.executeQuery(); if(rs.next()){ return true; } } catch (SQLException e) { e.printStackTrace(...
1689c0f0-8cb4-467d-bb6f-6c5783a3fc49
1
private static void test3(){ Player p = new Player(16); System.out.println("Test 3"); System.out.println("This one adds some cards to a players hand and then shows the hand and the value."); for (int i = 10; i<15;i++) { Card c = new Card(i); p.addCardtoHand(c); } System.out.print(p.stringHand());...
8ad90675-62e4-4e3b-b212-f526b1a5b0d1
2
public static void main(String[] args) { String number; boolean valid = false; System.out.println("This is a binary to hexadecimal converter."); while(!valid){ System.out.print("Enter a binary or hexadecimal now: "); number = s.nextLine(...
c5736a12-bacc-4d1d-b857-5fe7f88f27ec
3
@Override public void run() { while(true) { try { Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 1000); if (!Agent.getConflictExists()) { Agent.setValue(agentId, agentType); Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 2000); } el...
98737cff-c194-4aa4-a456-51a94d85c39f
2
void encodingError(String message, int value, int offset) throws java.lang.Exception { String uri; if (value >= 0) { message = message + " (byte value: 0x" + Integer.toHexString(value) + ')'; } if (externalEntity != null) { uri...
00347ab1-f868-40fa-af0f-e6d03fe87fce
8
public void getAtendimento(Atendimento atendimento) { try { txt_cliente.setText(atendimento.getCodcliente().getNomeFantasia()); if (atendimento.getDataFim() != null) { txt_dataFim.setText(Data.getDataByDate(atendimento.getDataFim(), "dd/MM/yyyy HH:mm")); } ...
c4ec88f2-da1b-4695-8edf-1f4c017d54ed
8
public final void run() { int optionCount = this.options.size(); if (optionCount < 1) { System.out.println( "No options for you to choose from."); } else { int input = -1; ConsoleOption selected = null; do { System.out.println( "Please select one of the following option."); for (i...
6d7f9472-0b99-4b81-ac95-d73e257f62e6
5
int count(int n, int digit) { int res = 0; int max = 0; // max counts per digits int more = 1; // additional counts in current length int pre = 0; // from lower digits to higher digits, the passed 'n' while (n > 0) { int x = n % 10; res += x * max; if (x > digit) { res += more; } else if (x ==...
dfdf278c-87ca-422c-ac9a-ac21ac8bcddf
3
public boolean jsFunction_waitEndMoveGob(int gob, int timeout) { deprecated(); int curr = 0; if(timeout == 0) timeout = 10000; while(JSBotUtils.isMoving(gob)) { if(curr > timeout) return false; Sleep(25); curr += 25; } return true; }
3d26929f-3a1a-4920-a0ec-2eae4d88a1c8
2
@Override public void tick() { super.tick(); Button oldSelected = selected; selected = buttons.get(pointer); if (oldSelected == null) { selected.hover(); } else if (!oldSelected.equals(selected)) { oldSelected.unHover(); selected.hover(); } buttons.forEach(Button::tick); }
f96b1a62-56d1-4c49-9918-d44768d61c25
5
@Override public void startListening() { if (this.state == ServerState.Running) return; try { this.server.bind(this.serverAddress); this.state = ServerState.Running; } catch (IOException ex) { ex.printStackTrace(); ...
6b5e220e-7e71-4bbb-bcba-60ddfd5ae240
2
private String[][] readScore() { String tempg = null; try { File file = new File(SavePath.getHighScorePath()); if(file.exists()) { FileReader fileReader = new FileReader(file.getAbsoluteFile()); BufferedReader bufferedReader = new BufferedReader(fileReader); tempg=bufferedReader.readLine();...
e0e8fd01-9514-4aeb-9772-a606f3fa15e5
8
public final void import_stmt() throws RecognitionException { try { // Python.g:210:13: ( import_name | import_from ) int alt37=2; int LA37_0 = input.LA(1); if ( (LA37_0==86) ) { alt37=1; } else if ( (LA37_0==83) ) { alt37=2; } else { if (state.backtracking>0) {state.failed=true; ...
6cfce4c7-2074-4f78-9ccc-4188cff1ebf1
4
public static int getWordCount(String str) { int length = 0; if (isEmpty(str) == true) { return length; } int i = 0; for (int len = str.length(); i < len; i++) { int ascii = Character.codePointAt(str, i); if ((ascii >= 0) && (ascii <= 255)) length++; else { leng...
93c1918b-0970-48e7-9eac-e4e9c913efbf
2
public PositionBox (boolean isEnemy, SelectListener selectListener, HoverListener hoverListener) { super (null); if (HOVER == null) { try { OPEN = ImageIO.read (new File (imagePath + "select_open.png")); OPEN_BG = ImageIO.read (new File (imagePath + "select_open.png")); LOCKED = ImageIO.read (new ...
7a5aa929-2682-41a2-893b-25b1157b93a1
5
public static int findClosingParenRecursively(String s, int startingParenLoc) { // check for valid parens location int returnVal = -1; if (errorCheck(s, startingParenLoc)) return -1; for (int i = startingParenLoc + 1; i < s.length(); i++) { if (s.charAt(i) == '(') { i = findClosingParenRecursively(...
ebe674a1-0cab-482d-9faa-ecd837be96c5
9
public void checkOutDir( Directory dir, String path, OnDirCollision onDirCollision, OnFileCollision onFileCollision, Run run ) throws Exception { FileMetadata md = filesystem.getMetadata(path); if( md != null ) { switch( onDirCollision ) { case MERGE: break; // We'll make sure it's a directory in a bit. ...
7dca1f93-188f-4032-9a51-cec3f51b6876
2
public static <T> T obtenirDeSession(HttpServletRequest requete, String nom, Class<T> classe) throws InvalidObjectException { Object obj = requete.getSession().getAttribute(nom); if (obj == null || obj.getClass().equals(classe)) { return (T)obj; } ...
84fb85c5-d06f-4cc7-a084-408e9443265f
2
public void handleEvent(Event event) { assert event != null && event.item != null; System.out.println("triggered TreeSelectionListener.handleEvent.Event = " + event.item); Editor editor = vermilionCascadeNotebook.getEditor(); VCNTreeItem item = editor.getTreeItem(); System.out.println("editor item = " +...
724069b6-68cd-4be5-a04d-4fe3e3c867fe
3
private void showTimeForm(TimeForm form){ int result = JOptionPane.showConfirmDialog(null, form, "Ny tävlande", JOptionPane.OK_CANCEL_OPTION, JOptionPane.NO_OPTION); if(result == JOptionPane.OK_OPTION){ if(form.isValidForm()){ Runner runner = getRunnerByStartNumber(form.getStartNumber()); ...
fc6b9981-fc07-44a5-bd40-4b7f1239f1f6
8
@Override public void paint(Graphics2D g) { super.paint(g); Image image = new ImageIcon("resources/sprites/zombie1.png").getImage(); if (getFace() == 1) { image = new ImageIcon("resources/sprites/zombie1.png").getImage(); } if (getFace() == 2) { image = new ImageIcon("resources/sprites/zombie2...
392c16e0-aa45-4af9-93af-4fd31a04242e
2
public void visit(Node node) { node.colorGrey(); Transition[] transitions = myAutomaton.getTransitionsFromState(node .getState()); for (int k = 0; k < transitions.length; k++) { Transition transition = transitions[k]; State toState = transition.getToState(); Node v = getNodeForState(toState); if (...
56a3ec9a-8224-4df5-a1d0-8546cd37a2a1
7
@Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child if(this._exp_ == oldChild) { setExp((PExp) newChild); return; } for(ListIterator<PCase> i = this._case_.listIterat...
c1154754-c70c-44ac-8b57-f3ebb0d1608f
3
private Collection loadFromSpreadsheet(final InputStream excelFile) throws IOException { XSSFWorkbook workbook = new XSSFWorkbook(excelFile); data = new ArrayList(); Sheet sheet = workbook.getSheetAt(0); int numberOfColumns = countNonEmptyColumns(sheet); List ...
78f5c20a-dd7c-4c33-aa80-061b036300f2
0
public long getIdConnection() { return idConnection; }
97becbfa-ea36-4d09-acc1-9dc8f0920ea1
8
@Override public void move(Entity e) { if (Collided) { byte b = affected.getAmmoType(); switch (b) { case 0: case 1: case 2: Bullet.CoolDown = 1; Bullet.cost = 1; break; case 3: Bullet.CoolDown = 10; Bullet.cost = 1; break; case 4: Bullet.CoolDown = 0; Bullet.cost...
23e7aea6-ccc8-498c-a9f5-a83638f624cc
8
public void keyPressed (KeyEvent ke) { switch(ke.getKeyCode()) { case KeyEvent.VK_W: W_KEY = true; break; case KeyEvent.VK_UP: UP_KEY = true; break; case KeyEvent.VK_A: A_KEY = true; ...
f50cf777-b6cd-461f-afd7-f047e074ec7e
5
@Override public void interpretar(String input) { if (input.contentEquals("roque")) { roque(); } if (input.contentEquals("roqueMenor") || input.contentEquals("roquemenor")) { roqueMenor(); } if (input.contentEquals("roqueMaior") || input.contentEquals("roquemaior")) { roqueMaior(); } else { jog...
a9213069-1808-4654-8fa3-377869486075
8
public static TokenType[] getTokens(Instruction i) { switch (i) { case SENSE: return (new TokenType[] {TokenType.SENSEDIRECTION,TokenType.NEXTSTATE,TokenType.ALTNEXTSTATE,TokenType.SENSECONDITION}); case MARK: return (new TokenType[] {TokenType.MARKER,TokenType.NEXTSTATE}); case UNMARK: return (n...
42c3ddad-df86-4b00-8db5-858149ad4f79
6
private static int pref(String op) { int prf = 99; //if (op.equals("")) prf = 5; if (op.equals("*") || op.equals("+")) { prf = 5; } if (op.equals("-")) { prf = 4; } if (op.equals("|")) { prf = 3; } if (op.equals(...
477066b9-62e4-4766-8209-2f716e43a383
6
public boolean save(final boolean save_photo_data) throws SDKException, APIException, SignInException{ final ArrayList<ArrayList> spreadSheet = new ArrayList<>(); final ArrayList<ArrayList> photoData = new ArrayList<>(); data.put(API_KEY_COMPUTER_ID, computer_id); da...
177342ac-99d0-471d-87cc-0884e61f4ed9
7
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub HttpSession session = request.getSession(); Connection con = null; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager....
b8255fd7-3afb-4222-8622-a55efc4e306d
6
public static void ensureCauseChainIsSet(Throwable thr) { if (INIT_CAUSE_METHOD == null) { return; } // Loop either until null or encountering exceptions that use this method. while (thr != null && !(thr instanceof LocatedRuntimeException) && !(thr instanceof LocatedExceptio...
0d74d106-322d-42c9-897d-7190b861fc12
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } UserMap other = (UserMap) obj; if (map == null) { if (other.map != null) { return false; } } else if (!map.equals(o...
3288a508-3d8e-4f71-a0fe-3a19a917b179
5
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Marker other = (Marker) obj; if (color != other.color) { return false; } if (id != other.id) { return false; } re...
63419660-27ee-4e25-832b-eb58b5ccdb8e
1
public Rank getPrimaryRank() { return (ranks.size() == 0 ? Rank.Null : ranks.get(0)); }
237e53ef-cadb-4c59-9593-764f8ec1e0e8
9
public static boolean addArtistByEntireName(boolean manually, String compName) { ArrayList<String> nameList = new ArrayList<String>(); String[] spl = compName.split(","); String[] names = spl[0].split("\\s"); String name = names[0]; if(spl.length == 1 && names.length > 1) { return false; } if(...
8a6dc968-b4d7-4006-8744-e66847991421
7
private static final int getTotalGroupsSizeParallel(ArrayList<LinkedDimGroup> groups, int sType, boolean countSpanning) { int size = sType == LayoutUtil.MAX ? LayoutUtil.INF : 0; for (int i = 0, iSz = groups.size(); i < iSz; i++) { LinkedDimGroup group = groups.get(i); if (countSpanning || group.span == 1) {...
ef2366d0-9a96-448f-85a0-3d43e09567b3
4
private void resaveParamsShowCity(SessionRequestContent request) { String validCityStatus = request.getParameter(JSP_CITY_VALID_STATUS); if(validCityStatus != null) { request.setSessionAttribute(JSP_CITY_VALID_STATUS, validCityStatus); } String invalidCityStatus = request.ge...
745f53ab-de86-4819-8a81-dd9109e975d5
8
public boolean GetConfig(ConsoleCommandSender sender, String[] args) { if (args.length < 2) { sendMessage(sender, ChatColor.RED, "Specify setting"); return true; } String settingName = args[1]; ConfigManager cm = Citadel.getConfigManager(); if (settingName...
47b968b4-7335-49eb-a23c-35b73e1728db
7
private boolean func_46116_a(EntityAITaskEntry par1EntityAITaskEntry) { Iterator var2 = this.tasksToDo.iterator(); while (var2.hasNext()) { EntityAITaskEntry var3 = (EntityAITaskEntry)var2.next(); if (var3 != par1EntityAITaskEntry) { if (...