method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7aca824f-eea0-43c4-96ba-eed866ca18c4
4
public void testHexDecodeInvalidStrings() { try { EncodingTool.hexDecode("zz"); fail("Expecting IllegalArgumentException"); } catch (IllegalArgumentException ex) { if (DEBUG) { System.out.println(ex.getMessage()); } } try { ...
cec9fee8-c63c-43ae-b9fc-6dc42f8fe225
3
public static String getUserName() throws MainExceptions { boolean valid = false; String playerName = null; Scanner keyboard = new Scanner(System.in); while (!valid) { System.out.println("Please enter your name:"); playerName = keyboard.nextLine(); pla...
df908cf2-503b-4d57-8001-5b117bb8209e
6
public static FreenetTopKey fromBytes(InputStream rawBytes) throws IOException { DataInputStream inputStream = new DataInputStream(rawBytes); try { byte[] versionBytes = new byte[HEADER.length]; inputStream.readFully(versionBytes); if (!Arrays.equals(HEADER, versionBy...
d91c3d80-eed1-49e4-8d09-bced6f7617a6
7
public int[][] generoiLuolasto(int koko, int iAloitus, int jAloitus, int iMaali, int jMaali){ this.koko = koko; int[][] matriisi = new int[koko][koko]; for (int i = 0; i < koko; i++) { for (int j = 0; j < koko; j++) { matriisi[i][j] = 10; } } ...
810cce1f-e3df-4a61-b7fc-7902e4bac2b5
6
private FrameType(String id, String description, Class<?> frameBodyClass) { this.id = id; this.description = description; this.frameBodyClass = frameBodyClass; try { // the ID3v23FrameBodyTextInformation and ID3v23FrameBodyURLLink classes implement multiple ID3v...
87aa57a6-4fc2-46b0-8a21-626c2f1ffc64
8
public static boolean isFit(int i, int j, int[][] imageGraph, int[][] structuringElement, int foregroundClass) { int rowCounter = i - structuringElement.length / 2; int columnCounter = j - structuringElement[0].length / 2; int initialColumnValue = columnCounter; for (int k = 0; k < structuringElement.length;...
75b67479-712e-4def-993e-42f430debc18
3
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPotionSplash(PotionSplashEvent event) { for (LivingEntity entity : event.getAffectedEntities()) { if (entity instanceof Player) { xAuthPlayer xp = plyrMngr.getPlayer(((Player) entity).getName()); if (plyrMngr.isRestricted...
ed885166-b1c8-4264-ab96-86585cab1fec
3
public void saveKitF() { if ((this.kits == null) || (this.KitF == null)) return; try { getKitF().save(this.KitF); } catch (IOException ex) { Bukkit.getLogger().log(Level.SEVERE, "Could not save config to " + this.KitF, ex); } }
0a7c01f0-8c33-4390-a0f9-c018e176ce53
6
public static void main(String[] args) throws Exception { new File(System.getenv("APPDATA") + "\\.MinebookLauncher\\").mkdir(); new File(System.getenv("APPDATA") + "\\.MinebookLauncher\\packs\\").mkdir(); new File(System.getenv("APPDATA") + "\\.MinebookLauncher\\accessCodes\\").mkdir();...
4f91ba89-02d1-4c5c-a9be-376e7a97fabe
9
public static void main(String[] args) throws Exception { if (args[2].equals("1")) raw = true; data = loadRawInteger(args[0]); long time = System.nanoTime(); System.out.println("Processing..."); if (raw) { FileOutputStream fos = new FileOutputStream(args[1]); dos = new DataOutputStream(fos); } else { ...
96bb7d84-4957-452b-8a8a-e3a14903338f
9
private void look() { Tile location = player.getLocation(); String[] weapons = location.getItems().getWeaponTexts(); String[] armour = location.getItems().getArmourTexts(); String[] foods = location.getItems().getFoodsTexts(); String[] misc = location.getItems().getMiscTexts(); int inventoryLength = weapons...
6042f434-46a5-422c-ac33-7f2fb841b0d1
8
@SuppressWarnings("unchecked") private void parseQuery(String query, Map<String, Object> parameters) throws UnsupportedEncodingException { if (query != null) { String pairs[] = query.split("[&]"); for (String pair : pairs) { String param[] = pair.split...
1a003169-fb86-4e5d-9a21-b0584ed8c7d1
5
public boolean occursBetweenDates(Calendar initDate,Calendar finalDate){ int month_date=movement_date.get(Calendar.MONTH)+1; int year_date=movement_date.get(Calendar.YEAR); int month_initDate=initDate.get(Calendar.MONTH)+1; int year_initDate =initDate.get(Calendar.YEAR); ...
82cc3fcd-8e86-489e-b19a-715a01206138
3
@Override public AModelDAO getModelDAO(String type) { AModelDAO modelDAO=null; switch(type){ case "Game Model": modelDAO = new SQLGameModelDAO(this); break; case "Game Description": modelDAO = new SQLGameDescriptionDAO(this); break; case "Users": modelDAO = new SQLUsersDAO(this); break; }...
aeb4d89f-948d-4dc2-aa5d-5cf8482bce7f
1
public Hive() throws SQLException { try { Class.forName(driverName); } catch (ClassNotFoundException e) { e.printStackTrace(); System.exit(1); } Connection con = DriverManager.getConnection(context.getHiveJdbc(), "", ""); this.stmt = con.create...
c857e34a-688d-4960-8e34-a7e4b62cb46d
1
private void drawNumberInsideCardArea(Graphics g, Card aFaceDownCard) { Rectangle cardArea = aFaceDownCard.getCardArea(); int numberLeftInPack = cardStack.size(); g.setFont(new Font("Times", Font.BOLD, 48)); if (numberLeftInPack < 10) { g.drawString("" + numberLeftInPack, cardArea.x + cardArea.w...
6044ce3c-5fdf-4828-880d-cac09a85d35c
2
public static void main(String[] args){ String path = "D:\\tmp"; if(args.length > 0){ path = args[0]; } ArrayList<String> files = FileList.getFiles(path); for(String file: files){ out.format("%s%n", file); } }
15103547-1efe-4a83-887e-fbfb4112f7ee
7
public void notifyDataAvailable(AvailableData availableData, boolean lastData) { contents.append(" " + "\r\n"); contents.append("----- New data available. -----------" + "\r\n"); if(availableData.getObjectDescriptors() != null){ List<ObjectDescriptor> listObjDescs = availableData.getObjectDescriptors().get...
06e9aa32-d76d-48ac-9ad0-02b5dee941f8
1
static void test(Fraction f1, Fraction f2, String msg1, String msg2){ if (!f1.equals(f2)){ System.out.println(msg1 + f1.toString()); } else{ System.out.println(msg2 + f1.toString()); } }
ee6e728d-1a76-4fb2-aa34-246c2394bd57
5
protected double getBorderline(int i) { double energy = 0.0; if (isOptimizeBorderLine) { // Avoid very small distances and convert negative distance (i.e // outside the border to small positive ones ) double l = v[i].x - boundsX; if (l < minDistanceLimit) l = minDistanceLimit; double t = v[i]....
12aa44b7-b5d9-4536-bfcd-7000ffcc634f
3
public VariableEditor() { setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); if(System.getProperty("resources") == null) System.setProperty("resources", System.getProperty("user.dir") + "/resources"); setBounds(100, 100, 450, 350); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(...
baa0f3d8-2e42-4552-bf2e-88c84df692d7
4
public SectorView(InGame parent, Capital targetSector) { super(); this.parent=parent; // Create listeners buttonWatch = new ButtonClick(); sector=targetSector; sectorstr=sector.getType(); setTitle("Sector View - " + sectorstr); // Description if (sectorstr.equals("Commercial")){ setDescrip...
170528b3-35c8-4d5c-b148-bc0f7f447101
9
final public void Class_head() throws ParseException { /*@bgen(jjtree) Class_head */ SimpleNode jjtn000 = new SimpleNode(JJTCLASS_HEAD); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { jj_consume_token(CLASS); if (jj_2_14(3))...
c9f46be7-8ce8-4613-8c7b-3509d231c5c3
4
public void GenerateCustomer(int CustomerNum, int StartTime){ int num = CustomerNum; int time = StartTime; //For however many initial customers for(int i=0; i<num; i++){ CustomerItem thing = new CustomerItem(); //First decide what kind of customer they are ...
c1bc5339-1ee7-473e-98c0-5685e423decf
0
public static void setFirstPick() { firstPick.setLocation(corner.getX() + 20, corner.getY() - 50); }
d4f96120-a873-4bcf-a3a6-b3be19aeec5e
6
@Override public List<Node> findPath(Node start, Node goal) { Set<Node> closedSet = new HashSet<>(); Map<Node, Double> gScore = new HashMap<>(); gScore.put(start, 0.0); Map<Node, Double> fScore = new HashMap<>(); fScore.put(start, gScore.get(start) + heuristicCostEstimate.a...
e1e61f91-df8e-446b-b505-80a2cba7739c
7
public static void main(String... args) throws IOException { MyScanner sc = new MyScanner(); int r = sc.nextInt(); int g = sc.nextInt(); long sum = 0L + r + g; int h = (int) Math.sqrt(sum * 2); if (1L * h * (h + 1) / 2 > sum) { h--; } if (r...
974e0852-8c94-4fdc-876e-d92c7b65e01a
3
public boolean isGameOver(){ for(Player p : allPlayers){ if(p.getLetterTiles().size()==0 && allLetterTiles.size()==0){ return true; } } return passedTurn >= Math.max((allPlayers.size()*2),6) ; }
08eccd2e-3d75-4254-b1f1-43fd22fef824
4
public void removeCards(int player) { for (Component c : table.getComponents()) { if ((c.getClass().equals(TCard.class) || c.getClass().equals(Token.class)) && ((TCard) c).getID().charAt(0) == player + 'A') { table.remove(c); } } table....
3ac3efbe-95de-4d6e-8d4c-c5ccd2076710
9
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || !(obj instanceof Immobilie)) return false; Immobilie other = (Immobilie)obj; if(other.getId() != getId() || other.getPlz() != getPlz() || other.getFlaeche() != getFlaeche() || !Helper.compareObjects(thi...
b24acfb0-aa49-4c92-8804-7317e5ba1cee
7
public State sparse(List<String> lines, String blank,String startingStateName) { alphabet = readAlphabetFromHeader(lines.get(0)); alphabetSet = new HashSet<String>(Arrays.asList(alphabet)); List<String> functionsList = lines.subList(1, lines.size()); statesNames = readStatesFromLines(functionsList); Map<St...
0cd1bc47-f1bb-413e-99f4-fd9008150e9f
1
public void salvar(){ if(dao.Salvar(entidade)){ exibirMensagem("Salvo"); entidade = new Funcao(); } else{ exibirMensagem("Erro!"); } }
097cb608-914b-4b66-922f-ae22423d95de
1
public String[] OpenFile() throws IOException { FileReader fr = new FileReader(path); BufferedReader textReader = new BufferedReader(fr); int numberOfLines = readLines(); String[] textData = new String[numberOfLines]; int i; for (i = 0; i < numberOfLines; i++) { ...
ca0af3c4-7d49-495a-9001-3ec4b7d08f6f
0
public void testCsvTools3() { String filePath = "C:\\Users\\tdhuang\\Desktop\\功夫baby数据表格1(未加数值)\\战斗关卡地图\\rich_map.csv"; CsvFile csvFile = new CsvFile(filePath, 0, 4, 1, new int[] { 0, 26 }); CsvDataWriter writer = new SqliteWriter("test.db", "rich_map"); writer.write(csvFile); assertTrue(true); }
5dea07df-6429-4adf-8e60-729e749d5d71
2
public void visitCallExpr(final CallExpr expr) { if (expr instanceof CallMethodExpr) { visitCallMethodExpr((CallMethodExpr) expr); } else if (expr instanceof CallStaticExpr) { visitCallStaticExpr((CallStaticExpr) expr); } }
b8063e6a-55f2-4174-84aa-ba3da4001c14
2
public void setEnabledAll(boolean enabled) { for(UIElement e : uiElements) { e.setState(enabled ? ENABLED : DISABLED); } }
1a8249f6-1450-4049-be01-e5bbb835d6e0
1
public int getSize() { if(xSize == 1) return ySize; return xSize; }
1f82b458-c3c8-48ea-9fcc-1c6224ff039f
3
public Cell getWalltype(int fileNum, int x, int y) { Cell tempCell = null; if (fileNum == 1) tempCell = new Wall(x, y); else if (fileNum == 2) { // something else } else if (fileNum == 0) { tempCell = null; } return tempCell; }
b0debcff-802d-47dd-a05b-2ffd21d9bd3e
8
private BitSet selectAngularBonds(String str) { MolecularModel mm = (MolecularModel) model; int n = mm.bends.size(); if (n <= 0) return null; BitSet bs = new BitSet(n); if ("selected".equalsIgnoreCase(str)) { synchronized (mm.bends.getSynchronizationLock()) { for (int i = 0; i < n; i++) { if (m...
f6f915cc-9d0b-4026-825d-f231d0e046e3
6
private static ArrayList<Object> parseArray(ListIterator<Character> chars) { ArrayList<Object> ret = new ArrayList<>(); boolean sep = true; while (chars.hasNext()) { if (sep) { Object obj = parse(chars); if (obj == null) return null; ret.add(obj); sep = false; continue; } char cu...
07e36cc1-83c2-41d9-b3d3-11bffa632a85
3
@Test public void oneIngredientTest() { userInput.add("hello"); userInput.add("daniel"); userInput.add("can you help me with cooking"); userInput.add("tell me the first ingredient of hamburger"); userInput.add("tell me the next ingredient"); runMainActivityWithTestInput(userInput); assertTrue(nlgResults....
58d32bae-6525-4bf5-a377-5a65e80f4fb3
9
@SuppressWarnings({"unchecked"}) public static <V,E> void transitiveClosure(Graph<V,E> g) { for (Vertex<V> k : g.vertices()) for (Vertex<V> i : g.vertices()) // verify that edge (i,k) exists in the partial closure if (i != k && g.getEdge(i,k) != null) for (Vertex<V> j : g.vertices(...
13ba7237-b009-49e0-975b-d442b42e6463
0
public String getTime() { return timeOfDay; }
5291f9ce-fb0f-4b73-a787-482ad23f7dc3
6
public boolean growCarrots(Player player, String[] args, int radius) { Block playerCenter = player.getLocation().getBlock(); // Get Centrepoint (Player) int carrots = 0; for (int x = -radius; x < radius; x++) { for (int y = -radius; y < radius; y++) { for (int z = -radius; z < radius;...
e2766e9a-b265-44f3-8708-7b25b2f8b9ab
4
protected boolean handleGeneralProperty(Node c) { String nodeName = c.getNodeName(); // General properties: name, status, description, trigger[] if (nodeName == "name") { name = c.getFirstChild().getNodeValue(); name = c.getFirstChild().getNodeValue(); return true; } else if (nodeName == "status") {...
2f31fb2c-1598-40b1-8edd-d6d1b7c03c7a
9
void scaleSampleRate(int index, float scaleFactor) { if (debugFlag) debugPrintln("JavaSoundMixer: scaleSampleRate index " + index + ", scale factor = " + scaleFactor); JSSample sample = null; if ((sample = (JSSample)getSample(index)) == null || thread == ...
b26ff0e3-b96d-4917-8a5c-be8e156a23d6
1
@Override public void onEnable() { saveDefaultConfig(); try { loadConfig(); } catch(InvalidConfigurationException e) { getLogger().severe("Error loading config: "); getLogger().severe(e.getMessage()); setEnabled(false); return; } getCommand("entitycap").setExecutor(new CapCommand(...
4cd3ef3d-85d2-4cb4-a55c-4ceb15906415
6
public void initGui() { if (this.lines == null) { this.lines = new ArrayList(); try { String var1 = ""; String var2 = "\u00a7f\u00a7k\u00a7a\u00a7b"; short var3 = 274; BufferedReader var4 = new Buffe...
a84beec0-dcb6-4d70-ab29-500e4d3977ce
5
private static void reflectAxis(int[][] array, int size, boolean axis) { int temp; if (axis) { for (int i = 0; i < size*size; i++) { for (int j = i + 1; j < size*size; j++) { temp = array[i][j]; array[i][j] = array[j][i]; ...
3aae5522-6f3f-46f1-9f20-714a1ce5d5dd
4
private TreeNode successor(TreeNode predecessorNode) { TreeNode successorNode = null; if (predecessorNode.left != null) { successorNode = predecessorNode.left; while (successorNode.right != null) { successorNode = successorNode.right; } } else { successorNode = predecessorNode.parent; wh...
933b0011-31c7-4a68-b8fe-6ed3539c3e3c
2
public void withdraw (int amount) { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("withdraw", true); $out.write_ulong (amount); $in = _invoke ($out); return; ...
b35777b1-49b4-44bc-a35a-535131e1a72b
7
private void handleStorageCommands(ClientHandler handler, String command) throws SocketTimeoutException, IOException { Data data = (Data) handler.getClientData(); /* <command name> <key> <flags> <exptime> <bytes> [noreply]\r\n cas <key> <flags> <exptime> <bytes> <cas unique> [noreply]\r\n */ String cmdD...
b0baa3ca-dc7a-444f-82fd-e776742c35ae
9
@Override public void mouseDragged(MouseEvent e, EditPanelModel editPanelModel) { cleanUp(editPanelModel); Settings settings = controller.getSessionModel().getSettings(); if (pressedMouseEvent == null) { pressedMouseEvent = e; } Point pressedPoint = pressedMouseE...
d482f4ee-0181-456f-824b-0571263caafa
7
public void fillTableForThisMonth() { int currentYear = new GregorianCalendar().get(Calendar.YEAR); this.currentMonth = new GregorianCalendar().get(Calendar.MONTH) + 1; this.setTitleMonth(this.currentMonth, currentYear); this.monthsAhead = 0; this.yearsAhead = 0; String keyStart = currentYear + "/" + S...
69642214-6038-4cf6-86f6-0e671a8d6610
2
public static void main(String[] args) { int x = 5; if (x < 5) { if (x > 5) { System.out.println('b'); } else { System.out.println('a'); } } }
9939a4ea-270f-46a3-bca5-0e26256ddc80
3
public void paintComponent(Graphics g){ super.paintComponent(g); //System.out.println(SwingUtilities.isEventDispatchThread()); if(counter==1){ } else if(counter == 2){ title2.setText("In Association With"); title1.setText("El Pollo Diablo Productions"); } else if(counter == 3){ timer....
e4214e08-0307-4694-874d-2734572b636f
7
public int move(char move) { int retVal = 0; switch (move) { case 'w': board.up(); System.out.println(board); break; case 'a': board.left(); System.out.println(board); break; case 's': board.down(); System.out.println(board); break; case 'd': board.right(); ...
e443f12b-2a66-481c-80d3-ef8bea583507
4
@Override public void serialize(Buffer buf) { super.serialize(buf); buf.writeUShort(charactersToRecolor.length); for (CharacterToRecolorInformation entry : charactersToRecolor) { entry.serialize(buf); } buf.writeUShort(charactersToRename.length); for (int ...
c6e8673f-874d-4f13-9119-03a19479293d
8
public LogicalSystem compile(java.io.InputStream input) { try { // Cria o analisador léxico scanner = new Yylex(input); scanner.setDebug(debugLex); if (!doSyntactic) { // só faz a análise léxica while(!scanner.isEOF()) ...
dde0adef-537d-4fe6-b6b2-b80285faf06f
9
public List<Column> getColumnByForeignKey(String catalog, String schema, String name) { List<Column> cols = new ArrayList<Column>(); Column col = null; for(int i = 0; i < referentialConstraints.size(); i ++) { ReferentialConstraints r = referentialConstraints.get(i); if(r.getUnique_Constraint_schema()...
233eb7e9-e368-4f21-95c1-8ad17260c1ec
8
private static boolean testPolyomino(boolean[][] polyomino){ boolean[][] negative = new boolean[polyomino[0].length][polyomino.length]; for (int x=0; x<polyomino.length; x++){ fillWithConstraints(negative, polyomino, x, 0); fillWithConstraints(negative, polyomino, x, polyomino[0]...
7dd87774-ecae-4ff3-8d2b-46297f8218ef
2
public void add(IntNode node) { if (empty()) _head = node; else { IntNode ptr = this._head; while ( ptr.getNext() != null) ptr = ptr.getNext(); ptr.setNext(node); } }
93cd64ab-f0e0-421c-82d2-99c96def744f
4
private synchronized void defaultSend(Sim_event ev, int gisID, int statID, int shutdownID) { IO_data io = (IO_data) ev.get_data(); int destId = io.getDestID(); /***** // DEBUG info System.out.println(super.get_name() + ".defaultSend(): Send to " + GridS...
78fbe69d-cc4f-4b27-bf85-1ea0ef973f79
1
@Override public Position<T> right(Position<T> p) throws BoundaryViolationException, InvalidPositionException { BTPosition<T> rp = checkPosition(p); Position<T> rightP = rp.getRight(); if (rightP == null) throw new BoundaryViolationException("No right child"); return rightP; }
b520b0d1-3211-4d4c-a95f-5d782d8f81bd
7
public double weightedCoefficientOfVariation() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } boolean holdW = Stat.weightingOptionS; if (weightingReset) { if (weightingOptionI) { Stat...
f89f2242-eb75-4cfc-8d8c-b46fdcdaaa5c
0
public void addCar(int idEvent, int nbSeat){ tx.begin(); Event event = getEvent(idEvent); Car car = new Car(); car.setSeat(nbSeat); car.setEvent(event); manager.persist(car); tx.commit(); }
439fd81f-429f-42c0-a65a-48132a655ad5
6
@Override public List<BroadCastProgramme> programmesThisWeek() { List<BroadCastProgramme> programmeList = new ArrayList<BroadCastProgramme>(); for (int i = 0; i < BIG_BANG_EPISODES.length; i++) { //some randomness for the dates DateTime broadCastDate = new DateTime(); broadCastDate.plusDays(i); broa...
39006ca2-2351-4fad-ba6c-001f7a948391
5
public DestructibleBrickView (int hardness, int x, int y) { BufferedImage img = null; try { switch (hardness) { // Кирпичи с разной прочностью имеют разные спрайты case 1: { double rand = (Math.random() * 1); if(Math.round(rand...
6e5f7147-60a2-4ac6-9231-a7b205ea9d83
7
public void stopReward(String type) { if (type == "UltraBall") { for (int i = 0; i < current_rewards.size(); i++) { if (type == current_rewards.get(i).type) { Ball.ultraballmode = false; current_rewards.get(i).reward_on = false; game.text.rewards_label.setText(""); current_rewards.remove(cu...
c01796ef-5872-4cc2-9b19-b28e285042a0
8
public static void main(String[] args) { //getting the data using standard input Scanner in = new Scanner(System.in); int width = in.nextInt(); in.nextLine(); int height = in.nextInt(); in.nextLine(); String text= in.nextLine().toUpperCase(); ArrayList<String> ascii = new ArrayList<String>(); for(i...
c32c6bb4-c217-433c-8405-5d1bd292606c
5
public int getBlackjackValue() { // Returns the value of this hand for the // game of Blackjack. int nVal; // The value computed for the hand. boolean isAce; // This will be set to true if the // hand contains an isAce. int nCardCount; ...
69a1a4d0-7629-4229-8794-21a5fbbd077f
8
public void handleConnect(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException { URI uri = request.getURI(); try { if (log.isDebugEnabled()) { log.debug("CONNECT: " + uri); } InetAddrPo...
3615446d-f20c-4969-b1b1-2e80985ae1cb
7
@Override public void keyPressed(KeyEvent event) { if (event.getKeyCode() == Preferences.getValue("upKey")) player.setGoingUp(true); else if (event.getKeyCode() == Preferences.getValue("leftKey")) player.setGoingLeft(true); else if (event.getKeyCode() == Preferences.g...
33a50ad9-c827-4637-98bc-a1a3154f3b83
3
private boolean withinBounds(Point p, Point topleft, int width, int height){ double topLimit; double bottomLimit; double leftLimit; double rightLimit; topLimit = topleft.getY(); bottomLimit = topLimit + height; leftLimit = topleft.getY(); rightLimit = leftLimit + width; boolean inLREd...
8e20dda3-fb8c-40a0-ba02-f14b5d5ebc41
7
void animate(ArrayList<Node> nodes,int start,int end, float interpolation,boolean highlight){ Node n1 = nodes.get(this.node1); Node n2 = nodes.get(this.node2); int startPersistence = this.persistence.get(start); int endPersistence = this.persistence.get(end); int interp...
0fc42a4f-eed1-4ef9-ac8e-8f6ac9b803db
2
public void test_04() { Random rand = new Random(20130609); // Create many random tests for (int i = 0; i < 100000; i++) { // Random degrees of freedom int degOfFreedom = rand.nextInt(20) + 1; // Random chi^2 double chi2 = 0; for (int j = 0; j < degOfFreedom; j++) { double z = rand.nextGaussi...
5cb83c42-e584-43cd-afeb-033aef8a5282
6
protected Enum<?> getConfigEnum(String world, String path, Enum<?> def) { String completePath = world + "." + path; try { if (!configSet(completePath, def.toString())) { String e = getConfigString(world, path, def.toString()).toUpperCase(); if (def instanceof ...
ff089a85-0559-4e39-b881-40d1105df0d7
2
public boolean needsBraces() { return isDeclaration || (declare != null && !declare.isEmpty()); }
308534dd-1e00-478e-8ca5-c84af30cad5e
6
@Override public void run() { try { System.out.println("Running"); byte[] inputBuff = StreamProcessors.readFile(_server.getInput()); Scanner sc = new Scanner(new ByteArrayInputStream(inputBuff)); String string = sc.next(); Thread co; if(string.isEmpty()){ System.err.println(Errors.INVA...
ae8b9e78-80f8-4a3e-a1ae-3e26177d1661
2
@Override public void init(Map<TablePart, Date> data) { MyResultSet rs = DB.instance().simpleQuery(new SQLBuilder(DBConfig.SCHEMA, DBConfig.PARTITION_INFO) .select(null, "table", "part", "date")); while (rs.next()) { String table = rs.getString("table"); data.put(new TablePart(table, rs.getInt("par...
614a1804-c937-40d7-b7e1-27e2d8aefcaa
7
public int isTop(int level, int universe, Point p1, Point p2){ for(int i = 0; platforms[level][universe][i] != null; i++){ if((platforms[level][universe][i].getMinX() < p1.x && platforms[level][universe][i].getMaxX() > p1.x) || platforms[level][universe][i].getMinX() < p2.x && platforms[level][universe][i].ge...
d52b53d9-d4c0-4422-92e9-25d1d63952fd
4
public void get(int key) { HashPrinter.tryGet(key); /** Run along the array */ int runner = 0; int hash = (key % TABLE_INITIAL_SIZE); int edge = (int) Math.ceil((double) TABLE_INITIAL_SIZE / 2); while (table[hash] != null && runner < edge) { if (table[hash].getKey() == key) { break; } runn...
9e1e1263-f341-4015-94ee-65eae0165f23
4
public String toString() { return "AxisLineFormat: " + ((id == 0) ? "Axis" : ((id == 1) ? "Major" : ((id == 2) ? "Minor" : ((id == 3) ? "Wall or Floor" : "Unknown")))); }
bedfa174-ecbb-46b7-acbf-80b5dc23b0ae
2
public static ReferencePointDirectionEnum fromValue(String v) { for (ReferencePointDirectionEnum c: ReferencePointDirectionEnum.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
c88575e8-397f-43e4-ba1e-712d64423eab
9
private void calcIDoms() { orderNodes(); List<IGraphNode> lstNodes = colOrderedIDoms.getLstKeys(); while (true) { boolean changed = false; for (IGraphNode node : lstNodes) { IGraphNode idom = null; if (!setRoots.contains(node)) { for (IGraphNode pred : node.getPr...
f6d62de5-0dd5-448d-aa16-7e3596fdf066
0
public static void end(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { // Record the EditingNode, Mark and CursorPosition tree.setCursorMarkPosition(currentNode.getValue().length()); tree.setCursorPosition(currentNode.getValue().length(), false); tree.getDocument().setPreferredCaretPosition(curre...
33fc9e3c-5de7-4a2c-b544-8d3b154335cb
5
public static String getExistingTrustRootPath() { String str2 = System.getenv("GLOBUS_LOCATION"); if (str2 == null) { str2 = System.getProperty("GLOBUS_LOCATION"); } String str1 = System.getenv("X509_CERT_DIR"); if (str1 == null) { str1 = System.getPropert...
800d1dd8-b4b6-4b17-984a-42b64f7e5f1c
3
@Override public void mousePressed(MouseEvent arg0) { if (arg0.getButton() == 1) { // future fireWeapon method map.fireWeapon(); System.out.println("mouse clicked"); int x = (arg0.getX() + camera.getX()); int y = arg0.getY() + camera.getY(); System.out.println("New Bullet created at (" + ...
3d5f4e2c-8b64-4fb4-9ef4-4bba67dbd55c
4
public int nextProposalNumber(int PID,int cur_Pnum){ int i=0; while(true){ if(i<=cur_Pnum) i++; else{ if(i%network.numProposers()==PID) return i; else i++; } if(i==MAX_PROPNUM) return -1; } }
d66e589c-6557-4647-a988-0a428068df03
8
public void setSeatsMode() { System.out.println("setSeatsMode called hushed?: "+hush_setSeatsMode); if( hush_setSeatsMode) { return; } hush_setSeatsMode = true; boolean was_total = Settings.seats_mode == Settings.SEATS_MODE_TOTAL; int prev_total_seats = Settings.total_seats(); Settings.seats_mode = th...
6263befd-38ca-401a-abe4-aa4597af55a3
5
public boolean getBoolean(final String area, final String name) { if (hasLong(area, name)) return getLong(area, name) == 0; if (hasDouble(area, name)) return getDouble(area, name) == 0.0; final String res = get(area, name); if (res.equals("false")) return false; if (autoLearn && res.isEmpty()) { ...
ff8ecc38-f6db-4dea-988e-ae5a038ac915
5
private Model getChildModel() { if (super.animation >= 0 && super.animationDelay == 0) { int frameId2 = AnimationSequence.animations[super.animation].frame2Ids[super.currentAnimationFrame]; int frameId1 = -1; if (super.queuedAnimationId >= 0 && super.queuedAnimationId != super.standAnimationId) fram...
7dd33cca-8c7f-4372-89c9-8a108a8e7df0
6
public void contabilizaErro(){ if(jogandoEmCruz || jogandoEmLinha) numAtualErros += 1; if(numAtualErros == 3 && jogandoEmCruz){ jogandoEmCruz = false; jogandoEmLinha = true; numAtualErros = 0; }else if(numAtualErros == 2 && jogandoEmLinha){ jogandoEmLinha = false; numAtualErros = 0; } }
ae35fafd-ec85-435c-a985-0b5bbfbb5b23
6
public String diff_toDelta(LinkedList<Diff> diffs) { StringBuilder text = new StringBuilder(); for(Diff aDiff : diffs) { switch(aDiff.operation) { case INSERT: try { text.append("+").append( URLEncoder.encode(aDiff.text, "UTF-8").replace('+', ' ')).append("\t"); } catch(Unsup...
01af517f-1d45-4831-b6f9-d651870044af
0
private void initializeComponents(Container contentPane) { JButton step = new JButton("Advance algorithm"); JButton redraw = new JButton("Redraw graph"); step.addActionListener(new StepButtonListener(canvas.getDrawer())); redraw.addActionListener(new RedrawButtonListener(canvas.getDrawer...
4a86551a-3b50-4977-9547-14d2a809de8f
6
@Override public void update(Observable o, Object arg) { if(o==ui){ int input = ui.getUserCommand(); switch(input){ case 0: {model.moveDown(); break;} case 1: {model.moveUp(); break;} case 2: {model.moveRight(); break;} case 3: {model.moveLeft(); break;} } } if(o==model)...
4e9c6c2a-8bf6-4b84-b8d7-9aab4b3d7334
8
public Pedido insertar(Pedido vo) throws DAOExcepcion { System.out.println("PedidoDAO: insertar()"); String query = "INSERT INTO pedido (id_usuario,fecha,estado,total) VALUES (?,?,?,?)"; Connection con = null; PreparedStatement stmt = null; ResultSet rs = null; try { con = ConexionBD.obtenerConexion(); ...
e28baeeb-16fb-4017-b610-ba4d4ab752bb
5
@Override protected final Dimension calculateMinimumSize() { if (layoutManager == null) { final Inset i = getInset(); int maxX = 0; int maxY = 0; for (Widget w : children) { if (!w.isVisible()) { continue; } ...
4e5e970b-4454-4f53-ab7b-efacf3883705
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof TipoPessoa)) { return false; } TipoPessoa other = (TipoPessoa) object; if ((this.codtipopessoa == null && other...
7a7d5750-afa6-450b-8403-67d4fe55c6e1
3
public static void main(String[] args) throws Exception { if (args.length != 1) { System.err.println( "Usage: java Source <processing server address>"); System.exit(1); } // get the destination host + port from console String dest_host = args[0...