method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6d378d78-24ce-4d9d-b1bf-43283b8630db
7
private boolean isStraight(ArrayList<Card> player) { ArrayList<Integer> sortedHand=sortHand(player); removeDuplicates(sortedHand); if (sortedHand.get(sortedHand.size()-1 ) == 14) //if the top value is an ace, use the method below if (isLowestRankingStraight(sortedHand)) return true; int straightCounter=0; f...
9d59665f-3b4d-44e1-98a5-d3a6b2eed76d
4
public static void main(String[] args) throws InterruptedException { HuntField field = new HuntField(21, 70); for (int i = 0; i < numberOfTrees; i++) { new Tree(field); } for (int i = 0; i < numberOfDucks; i++) { new Duck(field).start(); } for (int...
b24cc39f-c512-4bb8-9708-6dc4d2662688
3
public void mouseClicked(int button, int x, int y, int clickCount) { if (fullScreenButton.getShape().contains(x, y)) { try { container.setFullscreen(!fullScreen); } catch (SlickException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (quit.getShape().contains(x, y)) { ...
f63cac6e-a3fc-46c6-943c-a35bd3540c0a
7
public void setNewImage(String imgFileName) throws IOException { System.out.println("**** New Image ****"); ImageBlocker blocker = new ImageBlocker(imgFileName); System.out.println("New image loaded: " + imgFileName); ArrayList<HashSet<Block>> parsedShapes = blocker.getLargeConnectedComponents(0.10); int s...
a99eb709-b641-4ba7-836a-41f81ad8ff13
9
private void sort(){ int indexFirstArray = 0; int indexSecondArray = 0; for(int i = 0; i<target.length; i++){ if(indexFirstArray<firstArray.length && indexSecondArray<secondArray.length &&(firstArray[indexFirstArray] < secondArray[indexSecondArray])) ...
36f4e8a8-5506-4af7-b593-017254eb9efb
6
private void correctCameraPosition() { Point2D camPos = gui.getController().getCameraPosition(); double x = camPos.getX(); double y = camPos.getY(); Map map = gui.getController().getMap(); if (getWidth() > map.getWidth() * TILE_SIZE) { x = (double) map.getWidth() / 2 - 0.5; } else if ((x + 0.5) * TILE_S...
94b085a3-0aea-480c-9181-66c8b8dacfca
5
private static void checkTargetsAndMyHills() { for (Target target : MyBot.oldTargets) { if (!target.getField().isVisible()) { if (target.getClass().equals(Food.class)) { MyBot.targets.add(new Food(target.getField())); } else { MyBot.targets.add(new EnemyHill(target.getField(), ((EnemyHill)...
803d606c-87c5-4705-abc2-9badb6bc27e6
0
@Override public void remoteConnectionDisconnectListener(ConnectionDisconnectListener listener) { connectionDisconnectListenerList.remove(ConnectionDisconnectListener.class, listener); }
1a4dc930-44b7-4177-b51d-cf53b5cac607
4
public void setCurrentDockable(Dockable dockable) { int index = mDockables.indexOf(dockable); if (index != -1) { int wasCurrent = mCurrent; mCurrent = index; for (Dockable one : mDockables) { one.setVisible(dockable == one); } mHeader.revalidate(); repaint(); acquireFocus(); if (mActive ...
0ff4835e-a4db-4276-9f23-6c66c7e5669a
7
public IntTreeNode convert(int[] p_inputs, int p_start, int p_end) { IntTreeNode l_root = new IntTreeNode(p_inputs[p_end]); if (p_start == p_end) { return l_root; } int l_splitter = p_end - 1; for (; l_splitter >= p_start; l_splitter--) { if (p_inputs[l_...
99264d33-8adc-41c6-821b-4fced9f9f415
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Pair other = (Pair) obj; if (i0 != other.i0) return false; if (i1 != other.i1) return false; return true; }
4aa49cb4-deff-492f-822e-289621c84c68
2
public Builder name(String receivedName) { if (receivedName == null || receivedName.equals("")) { throw new IllegalArgumentException("Name must be not null. Received value =" + receivedName); } this.name = receivedName; return this; }
ab73083a-e679-42b4-83a0-64b017598b81
3
@SuppressWarnings("static-access") @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onMobDamage (EntityDamageByEntityEvent event) { Entity entity = event.getEntity(); Entity damager = event.getDamager(); if (entity instanceof Skeleton) { final ...
b9e7ac17-e4db-42a9-aa8e-7cfb05b9fb7c
2
public void play() { currentTime = getTime(); while(!Display.isCloseRequested()) { getFps(); Input.checkInput(stage); stage.update(); Camera.get().update(); Camera.get().draw(); if(Keybinds.EXIT.clicked()) { Mouse.setGrabbed(false); } } }
e4c8ad88-0a37-4ef9-a68d-46b8a37070d3
4
private void calcLoads() { Vector3D Fb = new Vector3D(); // stores the sum of forces Vector3D Mb = new Vector3D(); // stores the sum of moments Vector3D Thrust = new Vector3D(); // thrust vector // reset forces and moments: vForces.reset(); vMoment.reset(); // Define the thrust vector, which ac...
d6d83eb0-5c17-4843-8cd7-c8f83d65ba71
9
public void sendBlockRemoving(int var1, int var2, int var3, int var4) { if(this.isHittingBlock) { this.syncCurrentPlayItem(); if(this.blockHitDelay > 0) { --this.blockHitDelay; } else { if(var1 == this.currentBlockX && var2 == this.currentBlockY && var3 == this.c...
01c8d54a-a0c8-4c21-920a-8b6ffbedd2e9
5
public void keyPressed(KeyEvent e) { // si se presiona spacebar, barra se mueve hacia la derecha if (e.getKeyCode() == KeyEvent.VK_RIGHT) { dirBarra = 1; } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { dirBarra = 2; } //si se acaba el juego, se re...
064333a0-2308-4fd4-b1d8-fffe3772c9a6
3
private void parseLandShape() throws FileNotFoundException, InvalidShapeFileException, IOException { try (FileInputStream is = new FileInputStream( "assets/shape/BestLandShape.shp")) { ValidationPreferences prefs = new ValidationPreferences(); prefs.setMaxNumberOfPointsPerShape(35529); ShapeFileReader...
e66dd5d5-6c68-462a-af20-8dd9701de865
1
private void applySelectionChange(BitSet newSel) { if (!newSel.equals(mSelection)) { selectionAboutToChange(); mSelection = newSel; selectionDidChange(); } }
903173a9-08e5-48c1-9760-511354693ec1
8
public Boolean getHide(String block) { if (block.equalsIgnoreCase("break")) return _jobsdata.getShow(0); if (block.equalsIgnoreCase("place")) return _jobsdata.getShow(1); if (block.equalsIgnoreCase("defeat")) return _jobsdata.getShow(2); ...
612c3b5b-9633-44fa-95c8-1b4436b7a39c
0
public void setEmail(String email) { this.email = email; }
6ed9af37-5d7e-4acd-8508-76c4259ef789
9
final void method4166(long l, byte[] bs, int i) { anInt4875++; int i_2_ = 0; if (i != -27938) { method4171((byte) -98); } int i_3_ = -(0x7 & (int) l) + 8 & 0x7; int i_4_ = anInt4891 & 0x7; long l_5_ = l; int i_6_ = 31; int i_7_ = 0; for (/**/; i_6_ >= 0; i_6_--) { i_7_ += (0xff & aByteArray488...
5a102d02-b45c-40a0-8c48-9cdd2f0f25e2
4
public void startApp() { InputStream is = getClass().getResourceAsStream(fileName); FileManager file = new FileManager(); double [] filter = new double [576]; for(int i = 0; i < filter.length; i++){ if( i <= 5 ) filter [i] = 1.0; ...
3e3efa12-5d8e-4246-bf4e-9ac9d51dbbad
9
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { if (this.averageGroundLevel < 0) { this.averageGroundLevel = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); if (this.averageGroundLevel < 0...
97ad950b-fd0a-4014-86b7-ed641c84825d
0
@Override public ProductB factoryB() { return new ProductB2(); }
15d84fd5-cad3-43fa-82c0-aad245da56aa
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Park other = (Park) obj; if (code == null) { if (other.code != null) return false; } else if (!code.equals(other.code)) return false;...
bc753ba5-4e8a-4f80-aded-5fae0e098f9a
2
@Override public void execute(HttpServletRequest request, HttpServletResponse response) { DaoFactory daoFactory = MySqlFactory.getDaoFactory(); OrderDao orderDao = daoFactory.getOrderDao(daoFactory.getConnection()); try { String[] checkedOrderIds = request.getParameterValues("che...
857397bf-02a9-4b54-9925-8a21a08914fe
0
public RouterPacket GetInternalMemoryRouterPacket(int index) { return internalMemory.get(index); }
788a383a-1ca5-4aac-a747-fe420d5fbd3a
7
private boolean hasMatchingAttributGroupUsage( final DynamicObjectType toBeRegisteredType, final Set<AttributeGroup> specifiedAtgs, final Set<Aspect> specifiedAspects) { final List<AttributeGroup> attributeGroups = toBeRegisteredType.getDirectAttributeGroups(); for(AttributeGroup attributeGroup : attributeGroups...
3e5f2582-32b9-4ea8-856b-13aed8498a9f
2
public List<Effect> getEffects() { final List<Effect> effects = new ArrayList<Effect>(); for (Element element : elements) if (element instanceof Effect) effects.add((Effect) element); return effects; }
3bf48ea3-c6ae-4bf0-986a-55b19000bea9
3
public static ArrayList<Bean> viewStudents() throws SQLException { ArrayList<Bean> list=new ArrayList<Bean>(); Bean bean=null; try{ String query="select count(schoolid),schoolid from awardstudent group by schoolid "; con=DBConnection.getConnection(); pt=con.prepareStatement(query); System.out.println...
f3e4fd7d-108a-4661-8481-cf58d1a88212
0
public Leafage(String name) { this.name = name; }
646ea3e0-0497-4beb-b0ef-d2ba64d8b92d
6
private void print() { Runnable updateText = new Runnable() { public void run() { if ( serverVersion != null ) { int stat = serverVersion.getDataStatus() ; if ( stat == 0 ) { messageTextArea.append( "ok\n\nno infos available or undetected e...
7234b7eb-ffa2-4cfd-97a7-b37a0920a342
5
private void attackPlaceRight(int position, char[] boardElements, int dimension) { if (isPossibleToPlaceRight(position, dimension)) { if (isPossibleToPlaceOnNextLine(boardElements, position + dimension) && isBoardElementEmpty(boardElements[positionRightBelow(position, dimension)]...
ed118641-6663-4dd2-86ee-6d4f3944626b
5
public static void killMC() { //if Mc is running if (LaunchFrame.MCRunning) { //open confirm dialog for closing MC YNDialog yn = new YNDialog("KILL_MC_MESSAGE", "KILL_MC_CONFIRM", "KILL_MC_TITLE"); yn.setVisible(true); yn.toFront(); if (yn.ready && ...
af28037a-3c23-40c5-96f7-1d1bec692cb8
5
public void develop() { if (grammar.getGraph().getInputs().isEmpty()) { System.out.println("There are not input nodes - add some to develop a graph."); return; } grammar.getGraph().removeMassSpringNetwork(); currentPoint = grammar.getGraph().getInputs().get(0); ...
72af1588-9490-485a-baba-448f41ee40f8
4
public List<Tarefa> getTarefas(String sql, Map<String, Object> parametros) { Query query = em.createNativeQuery(sql, Tarefa.class); if (!parametros.isEmpty()) { if (parametros.containsKey("colaborador")) { query.setParameter("colaborador", parametros.get("colaborador")); ...
d7a9f4fc-da2f-48fd-862c-714d29f101d3
6
@SuppressWarnings("deprecation") public synchronized static void NumForList(final String outerNum, final String flagHangup) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { if (butPanel.countComponents() == 10) butPanel.remove(9); JButton button = new JButton(); button.se...
ba3d5245-f8dc-4e7c-9a97-514f74c0c388
0
@Test public void virheellinenFormaattiListaKonstruktoriTapausA() { ArrayList<Piste> p = new ArrayList(); p.add(new Piste(200, 200)); p.add(new Piste(100, 100)); Este s = new Este(p); Este r = new Este(100, 100, 200, 200); assertTrue("Este ei muuttanut kulmia oikeiks...
f0a25a94-83e1-4007-8bf3-dd2b1526836e
8
public static void main(String[] args) throws Throwable{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for(int c = 0, C = parseInt(in.readLine().trim()); c++ < C; ){ StringTokenizer st = new StringTokenizer(in.readLine()); int t = parseInt(st.nextToken()), B = parseInt(st.nextToken...
e9b9f9dd-8c91-477b-a6d0-fba367945163
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 fe...
0ff2becc-2c38-4a21-8f24-45a814ef5f1c
8
public MenuPause () { super(); try { setImg(ImageIO.read(new File("img/background/menu.jpg"))); } catch (IOException e) { e.printStackTrace(); } _title.setBounds(310, 25, 155, 50); _title.setFont(new Font("Arial", Font.BOLD, 45)); add(_title); _highScore.setSize(200, 45); _highScore.setFont...
a1b8f79f-ea06-4047-baae-0d8b46e4a991
7
@SuppressWarnings("unchecked") public void run() { try { while (!isInterrupted()) { Serializable data = getNextMessageFromQueue(); if (data instanceof KeepAliveMessage) { } else if(data instanceof ClientToClientMessage) { getIncomeClientMsglistener().massageReceived((ClientToClie...
45e501cb-df19-4819-963e-dceab328c9c6
7
public synchronized Weather retrieveWeather(final int cityId) throws IOException, ParserConfigurationException, SAXException { Weather result = new Weather(); InputStream inputStream = null; try { inputStream = YandexWeatherChecker.class.getResourceAsStream("/weatherExample.xml"); ...
e75174f4-b3e6-49e0-a3a5-c8b618b1348f
2
public double test(int N1[], int N2[], double weight[]) { // Sanity checks if (N1.length != N2.length) throw new RuntimeException("Row length do not match: " + N1.length + " != " + N2.length); if (N1.length != weight.length) throw new RuntimeException("Weight length does not match data rows length: " + N1.length ...
c7632244-0ec0-41cf-b62a-f7eed42c0f2f
2
public void DisplayPic(ArrayList<Block[][]> _rgbBlock, BufferedImage _buffImage) { for(int y = 0, ylocation=0; y < this.height/8; y++, ylocation +=8){ for(int x = 0, xlocation=0; x < this.width/8; x++, xlocation +=8) { DisplayBlock(_rgbBlock.get(0)[x][y],_rgbBlock.get...
251a79b0-b28b-44bd-9830-cd1f48401ccc
1
public void setFrontRightTrim(int frontRightTrim) { this.frontRightTrim = frontRightTrim; if ( ccDialog != null ) { ccDialog.getTrim2().setText( Integer.toString(frontRightTrim) ); } }
ec7e8a4a-9f7f-4075-be81-07848319ee32
9
private static RobotScore readRobotScore(XMLEventReader eventReader) throws XMLStreamException { String name = null; double score = 0; double rounds = 0; double survival = 0; double damage = 0; while (true) { XMLEvent event = eventReader.nextEvent(); if (event.isEndElement() ...
d766d848-b913-4c2b-954c-d397ebbdda0f
2
private void runWork(){ while(this.noStopRequested){ try{ this.idleWorkers.add(this); process(handoffBox.take());//接收数据进行处理 }catch(Exception e){ e.printStackTrace(); } } }
8643efd1-fe04-4675-bd82-b9e23127da0d
4
public void hideTooltip() { if (tooltip != null) { tooltip.remove(); if (hide == null || !hide.isScheduled()) { hide = new Task() { @Override public void run() { if (tooltip != null) { tooltip = null; } } }; Timer.schedule(hide, 1); } } }
1475645c-ae8f-4ebe-8a82-90c4c923ec36
2
public Accounting() throws IOException { logPath = "account.txt"; try { logWriter = new WriteFile(logPath, true); logFile = new ReadFile(logPath); logFileText = logFile.OpenFile(); if(logFile.readLastLine().isEmpty()){ ...
20673bbf-5bd7-4cd1-8024-66725202f6db
8
public Frame10() { try{ Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(DB_URL,USER, PASS); statement = conn.createStatement(); }catch(SQLException se){ se.printStackTrace(); }catch(Exception e){ e.printStackTrace(); } setTitle("Blok D, 74 - 116"); setDefaultCloseOperation(...
b5841068-f577-4114-90e5-a05f7f038d73
8
private void handleDownloadFinished(DownloadFinished df) throws Exception { String fileUID = df.getFileUID(); DFSException error = df.getError(); if(error != null) { agentPrintMessage("Download failed for file "+fileUID); agentPrintMessage(error); LinkedList<GetFile> list = currentDownloads.remove(...
b39eab54-43c6-42bc-9a81-f0706d458de7
8
public void renderPlayer(int xp, int yp, Sprite sprite){ xp -=xOffset; yp -=yOffset; for(int y=0; y < 64; y++){ int ya = y + yp; for(int x=0; x<64;x++){ int xa = x + xp; if(xa < -64|| xa >= width || ya < 0 || ya >= height) break; if(xa < 0) xa=0; int color = sprite.pixels[x + y * 6...
dccfa11c-054e-4ba5-a4a0-dd766140bff3
8
private List<Gate> getLayeredGates(List<List<Gate>> gates, int inputSize) { List<Gate> res = new ArrayList<Gate>(); // Init wireLayer map with input wires HashMap<Integer, Integer> wireLayers = new HashMap<Integer, Integer>(); for (int i = 0; i < inputSize; i++) { wireLayers.put(i, 0); } for (List<Gate...
917a4e64-16a5-4190-8abd-c03244b1e12a
2
public void giveCard(Card card, CardPile drawPile) { if (hand.size() >= MAX_CARDS) { return; } hand.add(card); if (component != null) { component.addCard(card, drawPile); } }
c6499c5b-2213-4b95-af8d-0683528673d2
1
public static boolean validUserKeyField(JTextField userKeyTextField) { boolean valid = false; String userKey = userKeyTextField.getText(); if (userKey.matches(Constants.USERKEY_REGEX)) { Border greyBorder = BorderFactory.createLineBorder(Color.GRAY); userKeyTextField.setB...
6a6a0b39-0d52-434c-b96c-61116b30a1aa
6
private void formMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMousePressed GUIControl.getInstanceOf().restoreAllOriginalTileColors(); if (this.getComponentCount() > 0) { GUIControl.getInstanceOf().iluminarPosicoesPossiveis(this); ...
cb45b93c-d00e-40b7-bd0f-85778477aca6
3
public static String findSnzipExecutable() { for(File f : new File("bin").listFiles()) { if(f.getName().equals("snzip") || f.getName().startsWith("snzip.")) { return new File(new File("bin"), f.getName()).getAbsolutePath(); } } return null; }
e4ded05f-0e82-499e-ba07-1b114489a190
6
public void keyPressed(KeyEvent e) { int key=e.getKeyCode(); if(key == KeyEvent.VK_UP) dy+=0.07; if(key == KeyEvent.VK_DOWN) dy-=0.09; if(key == KeyEvent.VK_LEFT){ if(vx>0) vx=0; dx-=0.3; ChangeTex(0); } if(key == KeyEvent.VK_RIGHT){ if(vx<0) vx=0; dx+=0.3; ChangeTex(2); } ...
7cb56d50-b562-4a48-86a6-173474fce8e0
1
@Override public void init() { //Platform independence for swing look and feel try { UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeel...
5f0f1792-4c7d-4f5a-b3ee-528231061da5
3
@Override public String toString() { String returnString = ""; int indexOfLessThan = label.indexOf("<"); String truncatedLabel = label; if (indexOfLessThan != -1) { truncatedLabel = label.substring(0, indexOfLessThan); } returnString += "CALL " + label + "...
19106e08-e99c-4f1d-9fb8-bb7dedf32486
3
public String formatVerbleibendeZeit() { int zeit = this.getVerbleibendeZeit(); int minuten = 0; if (zeit > 60) { minuten = zeit / 60; zeit = zeit - (minuten * 60); } StringBuilder builder = new StringBuilder(); builder.append((minuten >= 10) ? minuten : "0" + minuten); builder.append(":"); builde...
c70619e5-439a-4613-a4a3-8988e83d6ed9
6
public static void main(String args[]) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int numberOfPeoples = sc.nextInt(); int totalBudget = sc.nextInt(); int numberOfHotels = sc.nextInt(); int numberOfWeeks = sc.nextInt(); ...
d5ec557f-74fa-489f-81e2-b1cbbf170fe8
9
@Override public String toString() { StringBuilder sb = new StringBuilder(); try { appendLB(sb, getPackageName()); if(hasAnnotations()) for(JPAnnotation anno:getAnnotations()){ appendLB(sb, "@"+anno.getType()); for(Str...
647bd59a-c738-4716-8f61-cae6ea68ccf1
9
@Override public void write(Fields fields) throws IOException { // Maps a PostingsFormat instance to the suffix it // should use Map<PostingsFormat,FieldsGroup> formatToGroups = new HashMap<>(); // Holds last suffix of each PostingFormat name Map<String,Integer> suffixes = new HashMa...
98a55720-8cc9-4904-b2f3-2a00aef40a45
2
private static Node insertionSort(Node n){ Node h = null; while(n!=null){ Node next = n.next; if(h==null){ h = n; h.next = null; } else{ h = insertIntoList(h, n); } n=next; } return h; }
405a725d-8b10-4b5c-af5c-4d9e7d86a82a
0
private String escapeXMLAttribute(String text) { text = StringTools.replace(text, "&", "&amp;"); text = StringTools.replace(text, "<", "&lt;"); text = StringTools.replace(text, "\"", "&quot;"); text = StringTools.replace(text, ">", "&gt;"); return text; }
06a3b38d-8013-4b23-87d8-df6c7617afb3
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...
d58fb548-d27e-4031-a339-55c728ff13b7
1
public void refreshTagData() { Thread t = new Thread() { public void run() { while (tagCount < list.size()) { list.get(tagCount).getData(); tagCount++; } } }; t.start(); }
c1d87684-2167-4954-b847-9d2d616e4d58
2
private static void writeInterfaceNames(final ClassEditor ce, final DataOutputStream dos) throws IOException { // Sort interfaces by name final SortedSet sorted = new TreeSet(); final Type[] interfaces = ce.interfaces(); for (int i = 0; i < interfaces.length; i++) { sorted.add(interfaces[i].className()....
2ae8e4f5-8792-4f28-8f41-6c0d40a7d4dd
7
static void dfs(int u, int depth, int modifiedEven, int modifiedOdd){ if(depth%2==0){ if(modifiedEven%2==(label[u]==target[u]?1:0)){ result++; modifiedEven++; picked.add(u); } } else{ if(modifiedOdd%2==(label[u]==target[...
4efdcd78-eb73-4543-8935-26bb52aadf91
1
public void writeChar(char v) throws IOException { if (trace == API_TRACE_DETAILED) { Log.current.println("writeChar = " + v); } write(CFASL_CHARACTER); write(v); }
e218ce68-88da-412c-a207-c90762dd656d
4
public Descriptor compile(SymbolTable table){ Descriptor d = null; if(type instanceof IdentNode){ String s = ((IdentNode) type).getIdentName(); if(s.equals("integer")){ d = new SimpleTypeDescriptor(Type.INTEGER); } else if(s.equals("boolean")){ d = new SimpleTypeDescriptor(Type.BOOLEAN); }...
954dbcb5-71ce-4c2a-a3d8-a72abdde3889
5
public void destroyPortal(final int portal){ Location portalloc; if(portal == 1){ if(one == null) return; portalloc = one.clone(); one = null; } else if(portal == 2){ if(two == null) return; portalloc = two.clone(); two = null; }else throw new IllegalArgumentException("Portal number must be ...
59f1696c-ee39-46ac-854c-f5e3e216f412
3
private Location findFood() { Field field = getField(); List<Location> adjacent = field.adjacentLocations(getLocation()); Iterator<Location> it = adjacent.iterator(); while(it.hasNext()) { Location where = it.next(); Object actor = field.getObjectAt(where); ...
27f4c3f2-9e76-4213-aeff-80d65382b527
9
private int initFieldsFromClass(Class<?> initClass, Map<Integer, JsonFieldDeserializer> customEncoders, List<JsonFieldDeserializer> fieldsWithAnnotatoins, Map<Integer, JsonFieldDeserializer> idToFieldMap, Map<Integer, String> nameToFieldMap) { int maxFieldId = 0; if (...
816aea41-69ff-4764-9772-da283730d9ef
3
private double makeSureSmaxIsntViolated(int i, double nextStake) { int sMaxI = road.getSmax(i); int sMax2 = road.getSmax(i-1); if (nextStake > sMaxI && nextStake > sMax2) { nextStake = sMaxI < sMax2 ? sMax2 : sMaxI; nextStake = lastStake() + nextStake; } return nextStake; }
122255a1-cc48-42be-9289-df108fbb412c
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...
a438d509-7f07-49c7-b25a-cec389a1fd10
8
private Object js_unescape(Object[] args) { String s = ScriptRuntime.toString(args, 0); int firstEscapePos = s.indexOf('%'); if (firstEscapePos >= 0) { int L = s.length(); char[] buf = s.toCharArray(); int destination = firstEscapePos; for (int...
a8616ced-6ffc-4e4c-bcce-94f43a921494
4
@Override public void remove() { super.remove(); // If a player is removed and he was carrying a flag, the flag is // dropped on the square where the player was last alive. final PlayerFlag inventoryFlag = getInventory().findFlag(); if (inventoryFlag != null) { Position positionPlayer = getGrid().getEleme...
be4f7614-78de-4057-a03e-7b4ccd76dcfc
1
public JSONArray getJSONArray(int index) throws JSONException { Object object = this.get(index); if (object instanceof JSONArray) { return (JSONArray) object; } throw new JSONException("JSONArray[" + index + "] is not a JSONArray."); }
703a0771-e121-4ed7-a6d4-28a038a68f67
4
public void update(GameContainer gc) { gui.update(); inputHandler.update(gc.getInput()); boolean flagsenses = false; if (inputHandler.hasDirect()) { if (ActionHandler.attemptPlayerMove(inputHandler.getDirection())) { flagsenses = true; //Moveme...
6f350d3b-e45e-4c8e-a939-bf11d1f3153c
6
@Override public void actionPerformed(ActionEvent e) { for (Ensemble ensemble : ShowGoDAO.getShowGo().getEnsembles()) { for (Person p : ensemble.getMembers()) { if (person == p) { JOptionPane.showMessageDialog(mainWindow, "Die Person " + person.getName() + " ist dem ensemble " + ensemble.getName() ...
20eb90e3-7fb3-407d-8729-605db8d496bf
2
@Override public boolean jouerCase(Case c) { int width = (300+this._partie.getParametre().getNbCaseX()+1)/this._partie.getParametre().getNbCaseX(); int height = (300+this._partie.getParametre().getNbCaseY()+1)/this._partie.getParametre().getNbCaseY(); ImageIcon bateauImage = null; ...
ac090b54-ae0a-4529-84d7-129ef3bc596a
4
public ArrayList<ArrayList<String>> respuestaDeQueryAListas(ResultSet rs) { ArrayList<ArrayList<String>> arreglos = null; ArrayList<String> arregloColumnas = null; ArrayList<String> arregloValores = null; try { arreglos = new ArrayList<ArrayList<String>>(); arregloColumnas = new ArrayList<String>(); ar...
6aacfe23-54fa-45c3-8204-2e11829a96a8
3
public String getSession(int i){ String hr, min; try{ hr = Integer.toString(session[i].get(11)); if (hr.length()==1) hr = "0" + hr; min = Integer.toString(session[i].get(12)); if (min.length()==1) min = "0" + min; return hr + ":" + min; } catch(NullPointerException e){ } return null; }
fa435da8-f7c9-4bf0-a542-9f386124bf1f
6
public void run() { if (DEBUG) log("Now running SubTaskAddition command"); if (taskViewToUpdate != null) { if (DEBUG) log("Get existing subTasks from TaskCommander"); ArrayList<SubTask> subTasks = TaskCommander.getSubTasks(); if (DEBUG) log("Add the subTask contained in this command to t...
759fe23f-8870-4fd1-9a6d-00a170631446
8
private boolean r_un_accent() { int v_3; // (, line 215 // atleast, line 216 { int v_1 = 1; // atleast, line 216 replab0: while(true) { lab1: do { if (!(out_groupin...
554bb9c0-48ca-46b1-b46a-3791ce20ec2a
7
@Override public boolean getControls(String control){ if(control == "Age"){ return true;} if(control == "Fade"){ return true;} if(control == "WolfRule"){ return true;} if(control == "Mat"){ return true;} if(control == "Orient"){ return true;} if(control == "Mirror"){ return true;} if(control == "Xf...
5ba6697a-7be9-4e32-9e1a-281b538f5a3e
9
public void calculateGisModel(DwgFile dwgFile) { if (getVertices() == null) return; int flags = getFlag(); List pts = getVertices(); double[] bulges = getBulges(); List newPts = new ArrayList(); double[] newBulges = null; if(bulges != null){ newBulges = new double[bulges.length]; System.arraycopy...
f1001275-6eb3-47f2-a4da-6f5caa08fd67
0
@Override public String getWorkingDay() { return super.getWorkingDay(); }
527c226a-5953-4717-afea-b3d0424747e8
7
public static int subtask1(CompositeText document) { List<TextComponent> sentences = listOfAllSentences(document); List<String> allWords; Set<String> uniqueWords; int count=0; for(int i=0;i<sentences.size();i++){ allWords = new ArrayList<String>(); uniqueWords = new HashSet<String>(); for(TextCompone...
11a0ddaf-6d1d-42f9-8584-faef06a0c514
7
public static ArrayList<Letter> extractLetters(ArrayList<Symbol> symbols) { ArrayList<Letter> letters = new ArrayList<Letter>(); int letterStart = 0; for (int i = 0; i < symbols.size(); i++) { if (symbols.get(i).type == SymbolType.PAUSE) { if (i > 0) { ...
244ef4dc-02d5-4f0b-9c9a-e962bcad32e1
3
@Override public GameState[] allActions(GameState state, Card card, int time) { GameState[] states = new GameState[1]; states[0] = state; if(time == Time.DAY) { //Do nothing } else if(time == Time.DUSK) { PickTreasure temp = new PickTreasure(); states = temp.allActions(new GameState(state), c...
6c21b080-079a-4443-8817-b20d3e25b8b7
1
public static Font load(String s) { GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment(); String[] fontFamilies = ge.getAvailableFontFamilyNames(); Print.say(fontFamilies.toString()); Font f; try { f = Font.createFont(Font.TRUETYPE_FONT, CustomFont.class.getResourceAsStre...
e6c34b7a-836c-465c-8627-2112b419b3c3
9
public Image get(String key) { // can be null if (key == null) { return null; } if (display != null) { /** * NOTE, for backwards compatibility the following images are supported * here, they should never be disposed, hence we ex...
52a1d406-2251-42f4-aaee-2eb184203d36
7
private void writeAnimToXml(XmlWriter aXmlWriter, Animation aAnimation) throws IOException { aXmlWriter.writeEntity("anim"); aXmlWriter.writeAttribute("name", aAnimation.getName()); aXmlWriter.writeAttribute("loops", aAnimation.getLoops()); int backupIndex = aAnimation.getCurren...
f169a7bd-0178-4411-9c6e-348cebd0cdff
4
public void checkPlayerCollision(Player player, boolean canKill) { if (!player.isAlive()) { return; } // check for player collision with other sprites Sprite collisionSprite = getSpriteCollision(player); if (collisionSprite instanceof PowerUp) { ...
36dcebf8-b9ef-4efb-8a57-fb1943b8dd79
7
final boolean method275(int i, int i_9_, int i_10_, int i_11_, int i_12_) { if (i_12_ != -1) return true; anInt272++; if (aClass206_284 == null || aClass262_292.isEnd((byte) 18)) return false; if ((i ^ 0xffffffff) != (anInt286 ^ 0xffffffff) || i_10_ != anInt275) { anInt286 = i; anInt275 = i_10_;...