method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
bb48811a-e366-4aa8-b112-fa316191d885
8
private boolean bitmaskIntersect(Entity e) { BufferedImage mask1 = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_BINARY); Graphics2D g = mask1.createGraphics(); g.rotate(radians, width / 2, height / 2); g.fillPolygon(entity); BufferedImage mask2 = new BufferedImage(e.width, e.height, BufferedImage...
723caf8a-0c1b-47aa-bca4-6c7b5b553be2
2
public List<Teacher> getTeachersList() { List<Teacher> list = new ArrayList<Teacher>(); try { ResultSet rs = con.createStatement().executeQuery("SELECT * FROM teacher"); while(rs.next()) { list.add(getTeacherFromRS(rs)); } rs.close(); } catch (SQLException e) { // TODO Auto-generated ca...
e0164dd2-db5e-40a3-b810-0e67305dc902
4
public char[] getBestSequence() { if (bestSequence == null) { bestSequence = new char[length]; for (int i = 0; i < countMatrix[0].length; i++) { int max = 0, maxb = 0; for (int b = 0; b < BASES.length; b++) { if (max < countMatrix[b][i]) { max = countMatrix[b][i]; maxb = b; } ...
cfc8f792-fddc-44d1-a103-10ea3d42c5ac
5
private void checkMessage() throws Exception { if(iterator < tokenList.size() && tokenList.get(iterator++).getType() != TokenType.ID && tokenList.get(iterator-1).getType() != TokenType.STRING) { // missing print arguments throw new Exception("Syntax Error at line " + tokenList.get(iterator-1).getLine() + ...
7c4bf5bd-85f3-41c5-9f40-f9397ead207c
3
public static int getMouseButtonCode(MouseEvent e) { switch (e.getButton()) { case MouseEvent.BUTTON1: return MOUSE_BUTTON_1; case MouseEvent.BUTTON2: return MOUSE_BUTTON_2; case MouseEvent.BUTTON3: return MOUSE_BUTTON_3; ...
25de476f-6302-4fde-aab0-da724293b866
7
public static String convertToString(long t) { t = t / 1000; long s = t % 60; t /= 60; long m = t % 60; t /= 60; long h = t % 24; t /= 24; long d = t; if (d < 1 && m < 1 && h < 1) { return s + " seconds"; } if (d < 1 && h < 1 && s == 0) { return m + " " + minOrMins(m); } if (d < 1)...
05154673-6da7-4437-bc88-4239015272fe
3
protected void execute() { //if(autonMode.getSelected() == "Left"){ timeMove(0.4,2.75); //180 degree turn long milis = (long)(3 * 1000); long time = System.currentTimeMillis(); while (System.currentTimeMillis() < time + milis) { drive.MoveOpposite(0.35); ...
c3531545-f0ff-4c2c-b1c5-731fe8518de6
5
private void render() { BufferStrategy strategy = getBufferStrategy(); if (strategy == null) { createBufferStrategy(2); return; } Graphics2D graphics = (Graphics2D) strategy.getDrawGraphics(); graphics.setColor(Color.BLACK); graphics.setFont(font);...
26dc3768-7ce9-42d7-b790-8a0d393ac780
7
@Override public Interactable.Result keyboardInteraction(Key key) { switch(key.getKind()) { case Enter: onPressEvent.doAction(); return Result.EVENT_HANDLED; case ArrowDown: return Result.NEXT_INTERACTABLE_DOWN; ...
4864f36a-4bb1-45ac-906a-1c5a96873de0
5
public void testDelimiter() throws Exception { final java.io.Writer writer = new StringWriter(); final Set<String> header = new LinkedHashSet<String>(); header.add("Header1"); header.add("Header2"); header.add("Header3"); final List<Map<String, String>> dataList = new A...
b87f926d-1009-4f0c-b4a1-54414d3045a6
5
private void applyColorFor(Pane pane, CellDisplayState cs) { switch(cs) { case BORN: pane.setStyle(bornStyle); break; case ALIVE: pane.setStyle(aliveStyle); break; case SURVIVED: pane.setStyle(survivedStyle); break; case KILLED: pane.setStyle(killedStyle); break; case DEAD: pane.s...
30f76e02-0bb9-411f-8f8d-d9bb2611fa9f
1
public void addRefereeClassToList(RefereeClass r) { // if there are already 12 elements in the array // throw an exception if (elementsInArray >= MAX_REFEREES) throw new StringIndexOutOfBoundsException(); else // otherwise add RefereeClass to the refereeClassArray { RefereeClass[] updatedrefereeClassAr...
d7ff8ab0-bd8e-426f-9400-e8e7d3f9c913
3
public int split(int i, int j) throws Exception { if (i > j) throw new Exception("Invalid Matrix sequence"); if (i > n || j > n) throw new Exception("Non existent matrix specified"); return split[i][j]; }
a8ffee41-e702-498d-bc49-9c9176c08d70
8
public Compass getQuadrant() { if (isOrigin()) return Compass.CENTER; if (rep.x() == 0.0d) { return (rep.y() > 0.0d) ? Compass.N : Compass.S; } else if (rep.y() == 0.0d) { return (rep.x() > 0.0d) ? Compass.E : Compass.W; } double angle = rep.arg(); ...
bde1254b-1304-4b20-a94b-c81140e41ec1
5
public boolean checkAndUpdate() { QuarterBukkit plugin = QuarterBukkit.getPlugin(); try { // ----- Version Check ----- plugin.getLogger().info("Querying server mods api ..."); // Get latest version List<ProjectFile> availableFiles = new FilesQuery(PROJ...
d5b55aef-898b-4d31-8210-d00c36c17af6
2
public int getFirstAddr() { int minAddr = Integer.MAX_VALUE; Enumeration enum_ = usingInstrs.elements(); while (enum_.hasMoreElements()) { InstrInfo info = (InstrInfo) enum_.nextElement(); if (info.instr.getAddr() < minAddr) minAddr = info.instr.getAddr(); } return minAddr; }
f97cac40-3b4c-4bfe-b0ac-b6e1c294d992
7
private void createEdges() { while (!nodeRefQueue.isEmpty()) { Long fn = nodeRefQueue.poll(); if (!nodeRefQueue.isEmpty()) { Long tn = nodeRefQueue.peek(); if (mappingNodesFirst && !idMap.isEmpty()) { int mappedFN = idM...
aaaad5de-4678-4efa-a174-b5485f188110
2
@Override public void run() { try { while (true) { putMessage(); Thread.sleep(1000); } } catch (InterruptedException e) { } }
9551fdc0-5e9c-4e92-8005-8d48b0a1f1b4
0
public static Base getBase(int i) { return new Base(i) { { System.out.println("Inside instance initializer"); } public void f() { System.out.println("In anonymous f()"); } }; }
cacc5902-735c-4cb6-a1a4-a576a633337a
6
public static Stella_Object accessDimNumberSlotValue(DimNumber self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Utilities.SYM_UTILITIES_PID) { if (setvalueP) { self.pid = ((Ratio)(value)); } else { value = self.pid; } } else if (slotnam...
bd0e12be-9ece-452a-b974-d3fe39d24ba1
3
@Override public ArrayList<Map<String,String>> getAuctionsByCategory(String category) { ArrayList<Map<String,String>> auctions = new ArrayList<Map<String,String>>(); TypedQuery<Auction> categoryAuctionsQuery = emgr.createNamedQuery( "Auction.findAuctionsByCategory", Auction.class); categoryAuctionsQuer...
c1fc4e58-a22a-4100-8dec-920cfb4c554e
9
public static void readTrainData(String trainPath, String split_Sign) throws IOException { File file = new File(trainPath); BufferedReader buffRead = new BufferedReader(new InputStreamReader(new FileInputStream(file))); boolean flag = true; int tmp = 0, count = 0; int[] userIndex = new int[DataInfo.nu...
ec39a682-1859-4fcd-9514-6d4da2771c9c
5
public static void main(String[] args) { int numberOfHits = 0; final long numberOfThrows = 1000000; for (int i = 0; i < numberOfThrows; i++) { double x = (Math.random() * 2) - 1; double y = (Math.random() * 2) - 1; // set a condition so that the dart doesn't cross the diagonal line double condition = ...
00318f4f-e56f-4527-a9c4-970e1cfdc6e8
0
@Override public String getGUITreeComponentID() {return this.id;}
4446ad7d-c7d0-4efe-b57c-a8b95bac9146
4
public boolean checkColumn (int col) { int i = 0, j = 0, count = 0; /* Uses nested for loops to check the entries in the column */ for (j = 0; j < 10; j++) { count = 0; for (i = 0; i < 16; i++) { if (j == Integer.parseInt(entries[i][col].getText())) { count++; } if (count ...
20d0eab0-1de6-4184-92e5-41e0d89863c6
7
public static Cons allPropositionsMatchingArguments(Cons arguments, Surrogate relation, boolean specializeP) { { Stella_Object backlinkedinstance = Logic.selectInstanceWithBacklinks(arguments, relation); if (backlinkedinstance == null) { return (Stella.NIL); } { Cons value000 = Stella.NIL...
de99cc82-29d3-49f5-b1a9-60ff886220e5
6
public HashSet<ArrayList<Rule>> FindMinLeftRecursiveDerivations(){ HashSet<ArrayList<Rule>> res = new HashSet<ArrayList<Rule>>(); minLen=Integer.MAX_VALUE; cyrcles.clear(); HashMap<String,HashSet<String>> g = BuildGraph(); for(String s : m_nonterminals){ Bfs(g,s); ...
1dea1207-0e69-4614-b194-9fa8a3f7b8f9
2
public boolean closeConnection(Connection con) { if (con != null) try { con.close(); } catch (SQLException e) { String msg = "[ERROR] Could not close jdbc connection."; System.out.println(msg); System.out.println(e.getErrorCode() + ": " + e.getMessage()); return false; } return true; }
2a248f7c-539b-4940-a55a-89edcfdd1c11
2
public Polynomial diff() { if (coeff.length == 0) return this; long[] c = new long[coeff.length - 1]; for (int i = 1; i < coeff.length; i++) c[i - 1] = PF.mul(PF.nth(i), coeff[i]); return new Polynomial(c); }
e2015609-bd48-4ae0-a553-6644c8168795
6
public int threeSumClosest(int[] nums, int target) { if (nums == null || nums.length == 0) return 0; Arrays.sort(nums); int closestSum = Integer.MAX_VALUE; int diff = Integer.MAX_VALUE; for (int i=0; i<nums.length; i++) { int l=i+1; int r=nu...
93effc42-a145-4b53-bb59-e07861d8cfdd
6
@EventHandler public void onPlayerInteract(PlayerInteractEvent event) { if (!ChunkyManager.getChunkyWorld(event.getPlayer().getWorld().getName()).isEnabled()) return; if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK) || event.getAction().equals(Action.LEFT_CLICK_BLOCK)) { if (event...
677b01eb-74bc-4308-9f3f-a392af2867f1
8
public final GalaxyXSemanticParser.assignment_statement_return assignment_statement() throws RecognitionException { GalaxyXSemanticParser.assignment_statement_return retval = new GalaxyXSemanticParser.assignment_statement_return(); retval.start = input.LT(1); int assignment_statement_StartIndex ...
b240fed3-a345-4b27-8d95-1207011b5481
3
private static int mapCharToInt(Reader input) throws IOException { int c; while ((c = input.read()) != -1) { int result = REVERSE_MAPPING[c]; if (result != 0) return result - 1; if (c == '=') return -1; } return -1; }
46599888-0fb4-4f9c-b691-b079c6f31489
4
@Override public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int contador; //contador = Integer.parseInt((String)request.getSession().getAttribute("contador")); //request.getSession().setAttribute("contador", contador++); ...
7f40617e-6182-496b-a7df-54f1b83bfb76
3
public void printDebugingInfo(Declaration decl, Note note) { Messager m = (Messager) env.getMessager(); System.out.println("aaaa" + note.value()); switch(note.level()) { case IMPORTANT: m.printWarning((SourcePosition) decl.getPosition(), decl.getSimpleNa...
22dfe901-4f0f-4475-be6e-f9d75e067879
5
private Tour getTourduGrand() { Tour grand = t1; int tailleT1,tailleT2,tailleT3; if(t1.getHauteur()>0) tailleT1 = t1.getTour().get(t1.getTour().size()-1).getTaille(); else tailleT1 = nbr+1; if(t1.getHauteur()>0) tailleT2 = t2.getTour().get(t2.getTour().siz...
b4d0ea54-59b1-4b04-ba13-1c10f641fc20
5
public RankedPlayer(UUID uuid) { this.uuid = uuid; Player player; try { player = Bukkit.getPlayer(uuid); if (player.hasPermission("rank.vip")) { this.permission = "rank.vip"; } else if (player.hasPermission("rank.sponsor")) { this.permission = "rank.sponsor"; } else if (player.hasPermiss...
92433660-d855-4a68-b267-924a327165c2
5
public void removeInteractiveObject(int x, int y, int z) { Ground tile = groundArray[z][x][y]; if (tile == null) return; for (int e = 0; e < tile.entityCount; e++) { InteractiveObject entity = tile.interactiveObjects[e]; if ((entity.uid >> 29 & 3) == 2 && entity.tileLeft == x && entity.tileTop == y)...
6cedfa59-5786-436c-9e3d-3289fb035617
1
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
8036b3b2-df40-4e9d-a725-c325a795f5e3
4
public static void Actions(String command1, String command2) { // Adds an item ID to the current room if(command1.equals("additem")) { try { Integer.parseInt(command2); } catch(Exception e) { System.out.println("Failed to parse second parameter. Please only type integers."); } for(int i=0; i<Ite...
4b156b00-d78d-49cd-9970-c74dbbfd936c
1
public boolean opEquals(Operator o) { return (o instanceof UnaryOperator) && o.operatorIndex == operatorIndex; }
05e681f4-6493-4663-8f55-ef815929820c
7
public <T> ResultSet queryDB(String query, ArrayList<T> sqlParam){ PreparedStatement ps = null; ResultSet rs = null; try{ ps = conn.prepareStatement(query); int i = 1; for (T a : sqlParam){ //System.out.println(a.getClass()); if (a.getClass() == String.class){ ps.setString(i, (String)a); ...
fb186291-46cd-4f4d-99de-cbf3af3cd0a1
3
@Override public void actionPerformed(ActionEvent e) { OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(); OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode()); if (textArea == null) { return; } Node node = textArea.n...
6e7d812c-8d93-4bc8-8dad-c64e84addc32
1
public static void main(String[] args) { Date now = new Date(); RecordDAO recordDAO = new RecordDAO(); /* Timestamp p = new Timestamp(now.getTime()); Record record = new Record(4,"小明","1234567",1,p);*/ //System.out.println(recordDAO.findById(1).toString()); List<Record> list = recordDAO.findPage(1, 2); ...
8af7dda5-8ef7-4581-8ea8-a929ded2bce6
8
public void translateMessageFromServer(String inMessage) throws IOException { if (Agent.debugMode) System.out.println("Message from server: '" + inMessage + "'"); if (inMessage.contains("start")) { startTheGame(inMessage); } else if (inMessage.contains("second_move")) { respondToSecondMove(in...
b3b92674-dea4-4743-9b93-cb4e7549aa9b
8
protected void updateCapabilitiesFilter(Capabilities filter) { Instances tempInst; Capabilities filterClass; if (filter == null) { m_AttributeEvaluatorEditor.setCapabilitiesFilter(new Capabilities(null)); m_AttributeSearchEditor.setCapabilitiesFilter(new Capabilities(null)); return; ...
276f2181-80b1-4f51-911e-c1bddc8974bb
6
public boolean searchForUpdate(int startIndex, int currentIndex, int offset, int player) { int nextIndex = currentIndex + offset; if (indexIsOutOfBounds(nextIndex) || boardArray[nextIndex] == OPEN) return false; else if (boardArray[nextIndex] == opponent(player)) { boolean update = s...
a91870f6-4b40-42f0-8c87-262e5b61cae4
1
private double getDistance(Point point, Point key) { double sum = 0; for (int i = 0; i < point.size(); i++) { sum += point.get(i) * point.get(i) + key.get(i) * key.get(i); } return Math.sqrt(sum); }
34fe1f62-d1ec-4841-9f34-5361113e77d9
9
private void fillResolutionDropDown(final Screen screen) { try { DisplayMode currentMode = Display.getDisplayMode(); List <DisplayMode> sorted = new ArrayList<DisplayMode>(); DisplayMode[] modes = Display.getAvailableDisplayModes(); for (int i=0; i<modes.length; i++) { DisplayMode m...
4b9f50fc-895a-4747-bc75-0d6f190e9a82
5
public void init(PolicyFinder finder) { PolicyReader reader = new PolicyReader(finder, logger, schemaFile); Iterator it = fileNames.iterator(); while (it.hasNext()) { String fname = (String)(it.next()); try { AbstractPolicy policy = re...
3ed2902d-38e5-4e87-b416-d7c737adf965
9
public void execute(byte[] bytes) { for (int i = 0; i < bytes.length; ++i) { byte b = bytes[i]; switch (b) { case STORE: i += 1; stack.push(NumberUtil.bytesToDouble(bytes, i)); i += 7; break; ...
04b51403-9c1f-43b7-a4c5-38f27a50c2ce
8
@Override public AuthenticationProvider parseValue(String authProviderClassName) throws GuacamoleException { // If no property provided, return null. if (authProviderClassName == null) return null; // Get auth provider instance try { Object obj = GuacamoleC...
884fe140-9ed7-484a-9c86-5ac7838a6d44
5
public synchronized List<Product> buyProduct(Client client, Product product, int quantityOfProductsToBuy) { if (client != null && listOfPurchaseOfAllCustomers.get(client) != null && product.getQuantity() >= quantityOfProductsToBuy) { /* if there is already a list*/ List<Product> listAux = listOfP...
330b0f55-0615-48ba-bc1e-25c3432edfb6
6
public Player getOpposingPlayerClosestBall(){ float cdistance = 100f; Player ballHolder = getPlayerWithBall(); if(ballHolder == null) return null; float ballX = ballHolder.getDisplay().getRect().getX(); float ballY = ballHolder.getDisplay().getRect().getY(); int index = 0; if(team1 == getTeamWithBall(...
2cf0d387-d518-4d52-ab50-4a7893854a87
5
public static boolean array_in_search(String needle, Map<String,Object> haystack) { if (needle == null) return false; if (haystack == null) return false; String value = ""; for (Map.Entry<String,Object> entry: haystack.entrySet()) { try { value = (String) entry.getValue(); } catch (Throwable e) { ...
2031825d-d01b-4fb2-b90a-b8390b719f50
2
public String search(String rootFolder, String name) throws ReaderException { count.start("Timing the configuration file searcher."); File root = new File(rootFolder); // Check if given root folder exists if (!root.exists()) { throw new ReaderException("Given root could not be found."); } // Loo...
43678d48-a5e7-40e6-a68f-1b42e36ee96a
7
public void addnode(Point pnt){ Circle c = new Circle(pnt); if (deleteNode(pnt)==-1){ boolean result = false; for (int i=0;i<count && result;i++) if (pnts[i]==null){ pnts[i] = c; result =true; } i...
d0ae8619-6288-462d-ba8e-2bfd66ed2ab3
7
public BatchSessionSearcher search() { final long tstart = System.currentTimeMillis(); this.openOutputFile(); final String dir = this.globalConf.getFileCopyLocalTargetDir(); final String searchTerm = this.globalConf.getUserSearchTerm(); if (searchTerm == null || searchTerm.length() == 0) { LO...
ec25dae0-e480-4b01-a41f-27030d31feeb
2
private static String getFileName(String url) { String name = ""; for (int i = (url.length() - 1); i >= 0; i--) { char symbol = url.charAt(i); if (symbol == '/') break; name += symbol; } return new StringBuffer(name).reverse().toString(...
2caf675b-67c6-4a47-99b7-c6e8d3653510
4
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == PluginsTab.getInstance().searchButton || e.getSource() == PluginsTab.getInstance().search) { BasicPlugin[] plugins = PluginManager.getPluginArray(); List<String> newPluginList = new ArrayList<String>(); for (int i = 0; i < plugins.l...
28868842-fefc-45cd-a437-632f32ad53c9
9
private List<Pair> orderTimeslots(int meeting, Assignment a, CSP c) { // TODO Auto-generated method stub //for(t : timeslots) //updatePossibilities Comparator<Pair> comp = new Comparator<Pair> () { @Override ...
73260d2c-c5c2-4172-9e9d-89d9eab91464
4
public int findShortestPass(HashMap<Integer, Vertex> G, int from, int to) { PriorityQueue<Vertex> Q = new PriorityQueue<Vertex>(); setNewMinDist(G, from, 0, from); Q.add(G.get(from)); while(!Q.isEmpty()){ Vertex u = Q.poll(); if(u.Vertex == to) break; // foun...
52cbd88e-0ac5-4d71-9e45-534678f28b97
0
public AttributeContainerImpl() {}
b0a343b9-5b2d-4708-9059-b5b2c89445ea
4
public void slayerComplex(int screen) { if (screen == 1) { clearMenu(); menuLine("1", "Enchanted Gem", 4155, 0); menuLine("1", "Bag Of Salt", 4161, 1); menuLine("1", "Ice Cooler", 6696, 2); menuLine("1", "Spiny Helmet", 4551, 3); menuLine("1", "Rock Hammer", 4162, 4); menuLine("10", "Facemask", 4...
8b97d767-cf61-431f-874c-28c22a929297
0
@Test public void testGetWordList() { assertTrue(_dictionary.getWordList().size() > 0); }
e81866d9-8c50-4698-8c8b-78d81b12a751
7
public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Please enter the length of the first array"); int arr1Length = sc.nextInt(); System.out.println("Please enter the length of the second array"); int arr2Length = sc.nextInt(); while (arr1Length <= 0 && arr2L...
bed2b73c-17b1-4e9c-ab9c-0f906d549a52
9
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (index > 0 && index <= cbs.size()) { ObjCheckBox cb = cbs.get(index - 1); if (cb.getObj() == nullObject) { return separator; } cb.setBackground(...
9bb9a138-f09c-462f-a3be-9dabc23a63bd
9
public static void startupVisualize() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/ONTOSAURUS", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$,...
396354a9-55da-4a7a-b453-4cff9e465161
3
public void read(byte[] buffer) throws IOException { byte[] tmpBuffer = buffer.clone(); raf.read(tmpBuffer); if(endianness == LITTLE_ENDIAN) { for(int i = 0; i < tmpBuffer.length; i++) buffer[(tmpBuffer.length - 1) - i] = tmpBuffer[i]; } else for(int i = 0; i < tmpBuffer.length; i++) buff...
3ba5d6dc-b740-4e2c-87dc-882dcb23bda0
1
public void mouseDragged(MouseEvent event) { if (state == null) return; state.setPoint(event.getPoint()); getView().repaint(); }
a8e28477-f9f1-47d7-a8f8-3873a97dc3ac
8
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onBlockPhysics(BlockPhysicsEvent e) { CBlock conBlock = parent.getControllerBlockFor(null, e.getBlock() .getLocation(), null, Boolean.valueOf(true)); if (conBlock == null) { return; } if (conBlock.isBeingEdited()) { i...
9f193407-182b-4d74-94fb-0168816614b4
5
public void randomGenerateCheese() { ArrayList<Coordinate> openSpaces = new ArrayList<Coordinate>(); for(int row = 0; row < mazeMap.getRows(); row++){ for(int column = 0; column < mazeMap.getColumns(); column++){ Coordinate current = new Coordinate(column, row); MazeNode node = mazeMap.getNode(current); ...
b0bd241d-a54f-4f3d-b4b9-7aee23b9ab04
7
@Override public int castingQuality(MOB mob, Physical target) { if(mob!=null) { final Room R=mob.location(); if(R!=null) { if((R.domainType()&Room.INDOORS)>0) return Ability.QUALITY_INDIFFERENT; final Area A=R.getArea(); if((A.getClimateObj().weatherType(mob.location())!=Climate...
7a7b5690-dc0f-40e5-82cd-70a804af53d7
3
private static int[] kmpTable(String s) { int[] table = new int[s.length()]; table[0] = -1; table[1] = 0; int i = 0; int j = 1; while (j != s.length()-1) { if (s.charAt(i) != s.charAt(j)) { i = 0; if (s.charAt(i) != s.charAt(j)) { table[j+1] = 0; } else { table[j+1] =...
07ceee5c-566d-44d3-a33e-abd90ca1f2f3
5
private void extractProperties() throws RsPropertiesException { // get the hostName hostName = extractMandatoryString("hostName"); // get the port number String string = extractMandatoryString("port"); try { port = new Integer(string).intValue(); } catch (NumberFormatExce...
fe214a25-a794-49a3-884e-011f028e4864
8
public Hex addEdge( Edge anEdge) { // System.out.printf( "\tAdding edge %s\tto hex %s%s", // anEdge.toString(), // this.getClass().getName() + "@" + String.format("%x", this.hashCode()), // Const.CRLF); Edge prev = myEdge[myHighestCachedEdge]; Edge cur; boolean enter...
6e4e673b-e809-44f7-bea0-2e2b3649ea5f
7
private static void importSQLiteSchema() { InputStream is = ClassLoader.class.getResourceAsStream(SQLite_Schema); if(is != null) { try { BufferedReader bf = new BufferedReader(new InputStreamReader(is)); String sql = ""; String line = ""; while(true) { line = bf.readLi...
aba59aa3-2074-4ef8-a40b-e0e90dff18c0
1
public LLParseTableDerivationPane(GrammarEnvironment environment) { super(new BorderLayout()); Grammar g = environment.getGrammar(); JPanel right = new JPanel(new BorderLayout()); JLabel description = new JLabel(); right.add(description, BorderLayout.NORTH); // FirstFollowModel ffmodel = new FirstFollowMo...
b0722156-9a3a-4a6f-8ab1-bec0fd0fe7b2
1
public static ArrayList<Excel> move(int a, int b, ArrayList<Excel> tranformated) { ArrayList<Excel> result = new ArrayList<Excel>(); double[][] m = { {1,0,a}, {0,1,b}, {0,0,1} }; Matrix matrix = new Matrix(3,3); matrix.setMatrix(m); for(Excel ex: tranformated ) { double l[] = {ex.getX(), ...
7bb782e5-ae5c-43c4-abf4-8e0bfea047b1
4
public LinkedList<Integer> searchForPattern(String pattern, String context){ LinkedList<Integer> foundPatternList = new LinkedList<Integer>(); int patternLength = pattern.length(); int contextLength = context.length(); long specialValue = this.computeSpecialValue(patternLength); long patternHash = this.computeH...
7cdd55c5-6583-4056-b05c-be67aa6a466a
4
public void entrenar(String[][] entradas){ boolean finalizado = false; int y; double error = 0, errorCuadraticoMedio = 0, valorActivacion = 0; this.numeroEpocasFinal = 0; while(!finalizado){ for(int n = 0; n < entradas.length; n++){ valorActivacion = this.obtenidaSigmoide(ent...
1c2bb12f-21af-4e4b-91be-b25dae70bd48
9
static void getdata_lar() { if ((opcode_minor & 0x80)!=0) memaccess = (char)ind; else memaccess = (char)dma; R.ALU = M_RDRAM(memaccess); if ((opcode_minor & 0x80)!=0) { if ((opcode_minor & 0x20)!=0 || (opcode_minor & 0x10)!=0) { ...
50e85fd2-c6c9-45ce-8687-28faaf6cf3d8
7
public static ArrayList<ArrayList<String>> readRecords(String FILE_PATH){ BufferedReader reader = null; ArrayList<ArrayList<String>> records = new ArrayList<ArrayList<String>>(); try { File f = new File(FILE_PATH); FileInputStream fis = new FileInputStream(f); reader = ne...
f9b58fac-d49b-47e9-94a8-5d2a27f1a8a6
3
private void compact() { int from = 0; int to = 0; while (from < this.capacity) { Object key = this.list[from]; long usage = age(this.ticks[from]); if (usage > 0) { this.ticks[to] = usage; this.list[to] = key; th...
c04ae933-876b-412e-a3bb-8ec63dfe62bb
7
public static LinkedList<Tile> getImportantTiles(){ LinkedList<Tile> impTiles = new LinkedList<Tile>(); int w = Engine.WIDTH, h = Engine.HEIGHT; for(int i = 0; i < cloneTiles.size(); i++){ Tile tile = cloneTiles.get(i); boolean x = false, y = false; if(tile.tileX >= 0){ if(tile.tileX <= w){...
2db651ef-c12e-49e8-be86-2f04021fb948
9
@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 ModelPropertyPK)) { return false; } ModelPropertyPK other = (ModelPropertyPK) object; if ((this.name == null &&...
f437f198-0bbb-4e52-99ff-7ff4f05073da
0
@Override public String toString() { return "[gainTrack_dB=" + gainTrack_dB + ", gainAlbum_dB=" + gainAlbum_dB + ", peakTrack=" + peakTrack + ", peakAlbum=" + peakAlbum + ", gainReference_dB=" + gainReference_dB + "]"; }
8938c49d-6224-4309-8961-40bd5e2af819
5
public ByteBuffer getData() { ByteBuffer buffer = null; try { int available = ais.available(); if(available <= 0) { available = ais.getFormat().getChannels() * (int) ais.getFrameLength() * ais.getFormat().getSampleSizeInBits() / 8; } byte[]...
73a9d6b9-d3de-45f2-975f-af50d1b69380
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...
eb9ad4ef-ea6f-4672-9848-a97506e836c3
0
public void setFunNombres(String funNombres) { this.funNombres = funNombres; }
dfd4d3ad-26fe-4192-a418-f2beb635a18b
6
int[] breakCaesar(HashMap<Integer, Integer> quantityHashMap) { // eine linkedlist bauen, die die character representationen enthält, von vorne nach hinten // sortiert nach der auftrittshäufigkeit LinkedList<Integer> charactersByQuantity = new LinkedList<Integer>(); while (!quantityHashMap.isEmpty()) { ...
937ffe6e-86ec-4f65-bbbf-3055d54d758f
9
public void handle(BufferedReader in, PrintWriter out){ String[] datas = query.split(Utils.SEPARATOR, 6); String domain = datas[0]; String task = datas[1]; if( domain.equals("chat") ){ if( task.equals("add")){ String message = datas[5]; String login = datas[3]; String serveur = datas[2]; ...
a5895f80-944b-49e7-93bc-fac6596486fa
6
private void hybrid(int ch, int gr) { int bt; int sb18; gr_info_s gr_info = (si.ch[ch].gr[gr]); float[] tsOut; float[][] prvblk; for(sb18=0;sb18<576;sb18+=18) { bt = ((gr_info.window_switching_flag !=0 ) && (gr_info.mixed_block_flag !=0) && (sb18 < 36)) ? 0 : gr_info.block_type; ...
a2f366b7-9cc6-497b-a2a9-98b4f9181802
3
@Override public void solidify() { solidifying = true; subComponents = new GUIComponent[initSubComponents.size()]; for (int i = 0; i < initSubComponents.size(); i++) { subComponents[i] = initSubComponents.get(i); } for (GUIComponent subComponent : subComponents)...
d846eb0c-de38-45fc-923c-80ffe5d13b08
0
public void reset() { this.setFocused(false); }
5d567769-9988-4b92-bc8c-727f81ea7b67
0
@Test public void printOutGameStateTransitionTest() { GameStateTest gameState = new GameStateTest(); }
001cafb1-e3c3-414e-bf8d-ccb3ebc52b63
0
public Move (Vehicle vehicle, int steps, int gridSize){ this.vehicle = vehicle; this.steps = new Integer(steps); this.gridSize = gridSize; }
23269501-3bae-4591-b5a5-40cc79f770a8
4
private boolean is_on_start(){ if(white && x==6 || !white && x==1){ return true; } return false; }
8310855c-0377-49bb-aa30-754fbcf3917a
8
public static void main(String[] args) { //============================================================================================// //=============================== Submitting a Request =======================================// //====================================================================...
97725ac8-ddb4-4fe8-adb1-f0e3d63f317c
9
private boolean EsDireccionCorrecta(String entrada_Direccion){ char Letra; boolean DireccionCorrecta = true; boolean DireccionIncorrecta = false; if(entrada_Direccion.equals("")){ return DireccionIncorrecta; }else{ for(int Indice = 0; Indice < entrada_Di...