method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1b109f0a-00cd-4523-b28e-215556ca38e1
0
private GeneticFunctions() {};
652e9d97-ebb1-4729-b55d-f3b74c061084
5
protected void reset() { mxGraph graph = graphComponent.getGraph(); if (placeholder != null) { Rectangle tmp = placeholder; placeholder = null; graphComponent.getGraphControl().repaint(tmp); } if (isHideSelectionHandler()) { graphComponent.getSelectionCellsHandler().setVisible(true); } /...
2a54a553-4208-405d-8269-7b771ae3cc86
9
private static int getMatches(String originalString, String anotherString) { //Calculates the number of matching characters betweent the two strings int matches = 0; if (originalString.length() > anotherString.length()) { for (int counter = 0; counter < anotherString.length(); counte...
db1dc98a-6b1a-4a65-a309-d2d9db145da3
4
public void onBlockPlacedBy(World var1, int var2, int var3, int var4, EntityLiving var5) { int var6 = MathHelper.floor_double((double)(var5.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if(var6 == 0) { var1.setBlockMetadataWithNotify(var2, var3, var4, 2); } if(var6 == 1) { var1.se...
12c44a46-0e66-4130-8751-fc4678f51331
8
public GraphElement[] getMinimalSpanningTree() { GraphLine[] tree = new GraphLine[this.points.size() - 1]; HashMap<Integer, GraphPoint> gps = new HashMap(); HashMap<Integer, GraphLine> gls = new HashMap(this.lines); int k = 0; gps.put(points.keySet().iterator().next(), points.get...
55c6eb0b-7ee7-4146-89fa-15a28cf94c42
4
private void updateGridletProcessing() { // Identify MI share for the duration (from last event time) double time = GridSim.clock(); double timeSpan = time - lastUpdateTime_; // if current time is the same or less than the last update time, // then ignore if (timeSpa...
ed4d6f1c-7219-48ce-82b1-67c1b01bfb64
8
public void paintComponent(Graphics graphics) { JPanel j = displayBackground(graphics); switch(_screen) { case 1 : displayMain(j); break; case 2 : displayHost(j); break; case 3 : displayC...
26209941-93c9-4546-827a-f80f90f2a369
7
public static RandomListNode copyRandomList(RandomListNode head) { Map<RandomListNode, RandomListNode> existedNodes = new HashMap<RandomListNode, RandomListNode>(); if(head == null) { return null; } RandomListNode current = head; while(current != null) { if(!existedNodes.contains...
cb5b3ce6-6580-4845-ada6-80b1d6bc0f3e
3
public MethodAnalyzer getMethod(String methodName, MethodType methodType) { for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName) && methods[i].getType().equals(methodType)) return methods[i]; } return null; }
e850d032-67ba-4cb6-b5c8-9927ddaa990d
9
private void desactivarOpcion(int dato) { if(Integer.parseInt(this.jButton9.getText()) == dato) this.jButton9.setBackground(Color.GRAY); else if(Integer.parseInt(this.jButton11.getText()) == dato) this.jButton11.setBackground(Color.GRAY); else if(Integer.parseInt(this...
7e8801b9-e6ff-4c90-bec5-0a4d7d122c9a
3
protected static void linkProgram(int program) { GL20.glLinkProgram(program); String infoLog = GL20.glGetProgramInfoLog(program, GL20.glGetProgram(program, GL20.GL_INFO_LOG_LENGTH)); if(GL20.glGetProgram(program, GL20.GL_LINK_STATUS) == GL11.GL_FALSE) throw new RuntimeException("Failure in linking program. E...
7080b335-8430-40a9-bf20-617c37ba83ab
9
public boolean validarCedula() { String numCedula = cliente.getCedula(); boolean cedulaCorrecta = false; try { if (numCedula.trim().length() == 10) { int tercerDigito = Integer.parseInt(numCedula.substring(2, 3)); if (tercerDigito < 6) { ...
02467347-e574-4ea2-9d62-568c09eeb466
5
public void init() { // Start GUI SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame("Auction System Server"); JPanel content = new JPanel(); final JButton generateReport = new JButton("Generate Report"); final JButton start = new JButton("Start...
bbee27f6-1c93-4242-b714-4fd3f44e7a99
2
@Override public String toString() { if (!bombers.isEmpty()) { return bombers.get(0).getBomberNumber() + ""; } else if (bomb != null) { return "b"; } else return type.toString(); }
be65e187-43ee-4c1f-93e0-19babbccb4da
3
public static String fetchURLGet(final String u, String parameters) { String returnedString = ""; try { final URL url = new URL(u + "?" + parameters); final BufferedReader reader = new BufferedReader( new InputStreamReader(url.openStream())); String line; while ((line = reader.readLine()) != null) ...
a3f315fa-b591-43fa-a8e2-4e0e5435c9d5
7
private AdobeGlyphList() { glyphToUnicodes = new HashMap<String, int[]>(4500); unicodeToGlyph = new HashMap<Integer, String>(4500); glyphLoaderThread = new Thread(new Runnable() { public void run() { int[] codes; StringTokenizer codeTokens; ...
c2bc72b0-28cd-4f35-8548-d1763da74b5e
9
public void valueChanged(ListSelectionEvent e) { ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (!e.getValueIsAdjusting()) { if (lsm.getSelectionMode() == ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) { // burst table JTable burstsTable = ((FormProcess) form).getTable(); fo...
2157e406-bf62-4560-bc63-b07cd35c72bb
9
public static byte[] readData(BufferedImage image, byte[] otp) { byte[] lengthBytes = new byte[4]; int bit = 0; int dataLength = 4; byte[] bytes = null; for (int y = 0; y < image.getHeight() && (bit / 8) < dataLength; y++) { for (int x = 0; (x + 3) < image.getWidth()...
3b73eeed-d4ab-4331-a8ab-53d2fe9bcdd0
4
private void addQuests(){ for(Map map : engine.getWorld().getMaps()){ for(Character c : map.getCharacters()){ if(c instanceof CivilianCharacter){ // add each civilian charaters quest to the list for(Quest q : ((CivilianCharacter) c).getQuests()){ quests.add(q); } } } } }
dd908cca-fb8f-4bd2-9d0a-e9bdc0769329
0
private void update(){ u.update(); }
5124f3e0-260c-4053-b4a0-08dfb94d43bb
9
public static void sendToClient(int statusCode, DirectoryClientList directory, InetAddress clientAddress, int clientPort) { String statusPhrase = new String(); switch(statusCode) { case 200: statusPhrase = "OK"; break; case 201: statusPhrase = "OK Peerlist"; break; case 400: statusPhrase = "Unk...
608b0e56-cbca-49d5-8981-db4765776a85
5
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; int totalNos, totalArestas; int no1, no2, peso; List<Node> grafo; UnionFindSet unionFind; while (true) { st = new StringTokenizer(br.readLine()); ...
b48f96a6-1b5b-4ed2-955a-ab079b2482b8
2
public static void testEncryption(String filename) { String keyfile=filename.replace(".","_"); String test=""; keyfile=keyfile+".key"; try { BufferedReader in = new BufferedReader(new FileReader(keyfile)); test=in.readLine(); } catch(Exception e){e.printStackTrace();} if(!test.equals(encrypt(fi...
716d7b47-91b9-4501-ae80-c6b3fe96c1cf
7
@Test public void checkAccountStatusAndFixIt06() throws IOException { int[] mapperSymbolTable = new int[]{0,0,0,0,0,0,0,0,0}; List<String> accounts = service.collectAccounts(FILENAME_UC04_06, mapperSymbolTable); List<String> expected = Arrays.asList("490067715"); assertThat(accounts, Is.is(expected)); String...
d82a9af3-d284-4eba-9d08-5ed9dcd6d506
5
public static String pformat(Collection<?> c){ if(c.size() == 0) return "[]"; StringBuilder result = new StringBuilder("["); for(Object elem : c){ if(c.size() != 1) result.append("\n "); result.append(elem); } if(c.size()!=1) result.append("\n"); result.append("]"); return result.toString(); ...
6955a3b2-1d5b-43c9-a878-2a8a8d57289a
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Microarea other = (Microarea) obj; if (!Objects.equals(this.idMicroArea, other.idMicroArea)) { ...
c7071b0f-9b53-45ac-ba60-8884c51d436b
6
public void startTrade(int uid) { for(int i=0;i<organisms.size();i++) { if(organisms.get(i).getWorld().equals(organisms.get(uid).getWorld())) { if(organisms.get(i).getX()==organisms.get(uid).getX()) { if(organisms.get(i).getY()==organisms.get(uid).getY()) { ...
3f012fb0-9d77-496a-9fb3-6dd3f66afb8d
4
public WriteOamDirect(int position, OamEntry value, boolean skipHl) { this.clear = value.equals(OamEntry.DISABLED); skipHlAddressOffset = skipHl ? 3 : 0; skipHlCycleOffset = skipHl ? -12 : 0; inputMap.put(skipHlCycleOffset + 20, toJoypadInput1(position << 2)); inputMap.put(skipHlCycleOffset + 3...
195064f0-92ea-42b2-8778-95b33f6293a6
1
public Object opt(String key) { return key == null ? null : this.map.get(key); }
c10912b8-f0ed-4352-ae28-daf258e71940
7
private void xmlReadContainerNode(Node node, ToolBarIOReadInfo tri) throws SAXException { if(node.getNodeType() == Node.ELEMENT_NODE) { Element elt = (Element) node; String name = elt.getNodeName(); if(name.equals("ToolBarPanel")) { String position = elt.getAttribute("position"); ToolBarPanel tp = nu...
ee084295-c935-431f-9b04-8021debc8d60
9
protected void addExtendsImplements(ClassDoc parent, ClassDoc cd, Content contentTree) { ClassDoc[] interfaces = cd.interfaces(); if (interfaces.length > (cd.isInterface()? 1 : 0)) { Arrays.sort(interfaces); int counter = 0; for (int i = 0; i < interfaces....
1e938c70-1b20-4875-a107-0296de2e0d6f
8
protected AnimationDescriptor generateAnimationDescriptor(Document document) { NodeList loopsList = document.getElementsByTagName("loops"); String loopsValue = loopsList.item(0).getTextContent().trim(); if (!(loopsValue.equals("true") || loopsValue.equals("false"))) { throw new GameLoadingError("Invalid loop a...
c7629b77-db7a-4f0f-9e4e-46215554e627
6
@Override public void run() { while (!stop) { try { opcion = canalEntrada.readInt(); } catch (IOException e) { System.out.println("Error al recibir comando" + e.getMessage()); } switch (opcion) { case 1: System.out.println(recibirMensaje()); break; } synchronized (this) {...
a9d7316f-5b67-4a7f-8704-b7dcbb6a70b6
7
public static void main( String[] args ) { int newport = 0; String log = ""; if ( args.length > 0 ) { args[ 0 ].trim(); try { newport = Integer.parseInt( args [ 0 ] ); } catch ( NumberFormatException e ) { if ( !args[ 0 ].equa...
b3f34440-3828-4c46-a116-c24ae58ae2dd
4
public static long convertTimeZone(long time,double fromZone,double toZone) { int MIN_GMT = -12; int MAX_GMT = 13; if (fromZone < MIN_GMT || fromZone > MAX_GMT) { return -1; } if (toZone < MIN_GMT || toZone > MAX_GMT) { return -1; } ...
3e9fa942-f466-4241-9755-5437404b0684
8
public Pixel[] getAdjPositions(int[] pos, int axis) { if(axis >= DIMENSION || pos.length != DIMENSION) { System.err.println("WARNING: Wrong dimension on request for adjacent positions!"); return null; } else { Pixel[] retPixels = new Pixel[2]; for(int i=0; i<DIMENSION; i++) { if(i == axis) pos[i]--;...
fbd92c42-7ffb-40cf-a5fb-bff558871ec6
7
public static void doMultiThreadTest(String host, int txn, int threads) { int eachUnitCount = txn/threads; final LoadMemTest ltu[] = new LoadMemTest[threads]; for(int i=0;i<threads;i++) { ltu[i] = new LoadMemTest("Test-"+i, host, eachUnitCount); ltu[i].setUp(); } Thread threadPool[] = new Thread[threa...
86ab9e8f-7ecd-4380-9e39-990736017386
8
public boolean stillRendering() { boolean finished = true; if (transitionToToughness > toughness) { toughness += 3; if (toughness >= transitionToToughness) { toughness = transitionToToughness; } else { finished = false; } } if (transitionToHot > hot) { hot += 3; if (ho...
840dea4f-4dae-47e5-b489-634608f70df1
2
public boolean validateGameID(int id){ if(id >= 0 && id < gameModelsList.size()){ return true; } else return false; }
c8a8ded4-8464-4d87-8d7c-0e2a3e77ae58
0
public void setDefaultOpenFileFormat(OpenFileFormat defaultOpenFileFormat) { this.defaultOpenFileFormat = defaultOpenFileFormat; }
332394f8-9dac-491a-ba47-7ed660e31ef2
3
public static boolean isNumber(String number) { if (isNull(number)) { return false; } for (char c : number.toCharArray()) { if (!isDigit(c)) { return false; } } return true; }
79c7dc1b-dd78-4228-abcd-ae6fbc825779
5
public static boolean onlyDigits(String s) { if (s == null || s.length() == 0) { return false; } for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c < '0' || c > '9') { return false; } } return true; ...
d33c7e7f-0a0b-458b-a333-3e5ef54fe9e4
1
public String next() throws Exception { if (!tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(reader.readLine().trim()); return next(); } return tokenizer.nextToken(); }
8289a0b1-c17b-48cc-aeb0-f926e03ddfb4
0
@Override public Object getInvokeHandler() { return invokeHandler; }
4d6a333c-5666-4a15-b385-215092d2e634
0
public ImageAttributes getImageAttributes() { return this.imageAttributes; }
f5548064-b802-49af-aee2-a0ed93c965a7
7
public GameMapData loadMap(GameMap g, int multiplier, TextDisplay textDisplay, int levelsDeep) throws Exception { spawnedPlayer = false; notSpawnedPlayerCount = 0; possibleSpawnPoints.clear(); // this method is going to manage appending and extending an array that is // going to be built by lo...
4611e674-6edd-4f5a-bd0b-820383f6d249
2
public static void main(String argv[]){ String host = argv[0]; int portNumber = Integer.parseInt(argv[1]); try { Socket client = new Socket (host,portNumber); PrintWriter out = new PrintWriter( client.getOutputStream(),true); BufferedReader in = new BufferedReader( new InputStreamReade...
d08070ab-a824-439e-8c38-1af25476faaa
9
private void sendpackets() { for (Vm vm : super.getVmList()) { for (Entry<Integer, List<HostPacket>> es : ((NetworkCloudletSpaceSharedScheduler) vm .getCloudletScheduler()).pkttosend.entrySet()) { List<HostPacket> pktlist = es.getValue(); for (HostPacket pkt : pktlist) { NetworkPacket hpkt = new...
32352afa-9958-4a36-95b1-710576fefb4b
5
@Override public String toString() { StringBuilder sb = new StringBuilder(); // Title row sb.append(String.format("%4s|", "")); for (int j = 0; j <= b.length; j++) sb.append(String.format("%4s|", (j > 0 ? b[j - 1] : ""))); sb.append("\n"); for (int i = 0; i <= a.length; i++) { sb.append(String.form...
51a92d3b-00aa-4c97-b611-7570546148d4
2
public LocalInfo findLocal(String name) { Enumeration enum_ = allLocals.elements(); while (enum_.hasMoreElements()) { LocalInfo li = (LocalInfo) enum_.nextElement(); if (li.getName().equals(name)) return li; } return null; }
2ad9838c-3cb8-4ff5-b880-e70806899cb1
3
public void examineTail(Tail tail) { if (tail.getOwner() == this) { canCreateTail = false; if (lastTail != tail && lastTail != null) tail.die(); } }
34a01624-5054-4a3f-8a89-b2ddcf565451
0
private OpenRouteFile() { // JFormDesigner - Action initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - End of action initialization //GEN-END:initComponents }
f0924ce2-e186-4a04-9a9a-e4a99cf45fef
1
private static Sprite loadSprite(String path, int width, int height) { try { return new Sprite(ImageIO.read(GameFrame.class.getResourceAsStream(path)), width, height); } catch (Exception e) { e.printStackTrace(); return Sprite.placeholder(width, height); } }
50648606-dc64-49de-86b1-2ebba8ebfb67
3
public String getRegisteredSpriteKey(int value) { //This method should not be used. //System.out.println("This method is deprecated, should not be used (other than debug)."); if(sprite_mapping.containsValue(value)) { Set<Map.Entry<String, Integer>> entries = sprite_mappin...
e530e18f-a56e-469e-b462-a0f00ee5e4e1
9
URL getConfigSource(final String configFile, final String[] args) throws MalformedURLException { if (configFile.startsWith("http:") || configFile.startsWith("https:") || configFile.startsWith("file:")) { return new URL(configFile); } if (configFile.equals("--")) { final Charset ISO = Charset.forName("IS...
d3da4eef-8489-4b54-b73f-d5c2376270d1
2
public boolean elementExist(TreeValue searchValue) { Iterator<TreeValue> step = new TreeIterator<>(root); while (step.hasNext()) { if (step.next() == searchValue) { return true; } } return false; }
32c5745d-18f4-42a2-b282-8a258ee7d397
1
@Override public void setValueAt(Object value, int row, AttributeTableModel model) { AttributeContainer node = view.tree; if (node == null) { return; } String key = (String) model.keys.get(row); boolean readOnly = node.isReadOnly(key); Object oldValue = node.getAttribute(key); model.val...
3b79ed7e-06c2-4d78-88a9-41e54247c34e
2
public boolean filter(List<String> allowedFrameElements) { boolean result = false; Iterator<Frame> iter = frames.iterator(); while (iter.hasNext()) { if (iter.next().filter(allowedFrameElements)) { result = true; } else { iter.remove(); } } return result; }
3a774279-d9ae-4ea4-8416-db0ce9a7e24a
1
public Integer getValueFromCell(int adresse) { try { return speicherZellen[adresse].getValue(); } catch(ArrayIndexOutOfBoundsException e) { System.err.println("Speicherbereich nicht vorhanden"); e.printStackTrace(); } return null; }
737f6da9-cf48-475d-b9e4-534b87b3ff9f
8
private void YspeedTFKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_YspeedTFKeyTyped boolean OK = false; if((evt.getKeyChar()=='-')&&(YspeedTF.getText().equals("")))OK = true; if((evt.getKeyChar()=='.')&&(!YspeedTF.getText().equals("")&&!YspeedTF.getText().equals("-")))OK = true; ...
b28847dd-df79-47fa-b421-dffdc43d0891
1
public Object bind(Object delegate) { this.delegate = delegate; Class<?> clazz = delegate.getClass(); return Proxy.newProxyInstance(clazz.getClassLoader(), clazz.getInterfaces(), this); }
60ec3493-01eb-442b-9c53-4d9675ea48bb
9
private DownloadProcess waitForFirstSuccess() { // kingdom for a @tailrec! while (true) { boolean allDone = true; boolean allCanceled = canceled; for (final Map.Entry<DownloadProcess, Future<List<Result>>> entry : downloads.entrySet()) { final DownloadProcess download = entry.getKey(...
a7916ca8-4d37-4ab7-9866-a12c4044d60a
7
public FieldAnalyzer getField() { ClassInfo clazz = getClassInfo(); if (clazz != null) { ClassAnalyzer ana = methodAnalyzer.getClassAnalyzer(); while (true) { if (clazz == ana.getClazz()) { int field = ana.getFieldIndex(ref.getName(), Type.tType(ref.getType())); if (field >= 0) retu...
bb7ad026-dfe5-4e44-b8c6-526a1222af71
4
public void hally() { if(IsAttackingNPC && playerEquipment[playerWeapon] == 3204) { setAnimation(440); actionTimer = 4; SpecDamgNPC(30); DDS2Damg = true; DDStimer = 1; resetAnimation(); teleportToX = absX; teleportToY = absY; ...
f0e7ab55-cde9-49f4-bbf3-a7e3c5f3d2d9
5
@Override public List<ItemSet<V>> aprioriGen( List<ItemSet<V>> frequentCandidatesKMinus1) { Collections.sort(frequentCandidatesKMinus1); // Keep track of how many combinations we have created int allGeneratedCandidatesCounter = 0; // The set to put all the new combinations Set<ItemSet<V>> fre...
43e18113-6a2d-4ea3-8d86-2e3d4ed2790a
8
public static boolean isPrime(long n) { if (n < 2) return false; if (n == 2 || n == 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; long sqrtN = (long) Math.sqrt(n) + 1; for (long i = 6L; i <= sqrtN; i += 6) { if (n ...
f57a2a08-6070-4a1c-8e6b-08235b525794
3
public boolean depositCashPurse(String serverID, String assetID, String nymID, String oldPurse, ArrayList selectedTokens, String accountID) { Helpers.setObj(null); System.out.println("depositCashPurse starts, selectedTokens:" + selectedTokens); String recepientNymID = otapiJNI.OTAPI_Basic_GetAc...
6eb48230-81a1-4541-86bc-1b3325eefd36
8
@Override public boolean click(int mx, int my, boolean click) { if(autoCheck) typeProcessor(); xPt = mx; yPt = my; if(mouseIn(mx,my)&&click) { cursPosOne = getClosestIndex(mx); if(!drag) cursPosTwo = cursPosOne; selected = true; drag = true; } if(!click) { drag = false; ...
e68a7f01-87eb-4dc3-964c-c13cec6725a4
5
public GlobalThresholdDialog(final Panel panel) { setTitle("Global Threshold"); setBounds(1, 1, 250, 150); Dimension size = getToolkit().getScreenSize(); setLocation(size.width / 3 - getWidth() / 3, size.height / 3 - getHeight() / 3); this.setResizable(false); setLayout(null); JPanel pan = new JPane...
747f150d-9e0a-4bd3-9830-922cbcb0b1c0
6
public static void analyseUserProByTime(String username) throws IOException{ BufferedWriter bufWrite=new BufferedWriter( new OutputStreamWriter( new FileOutputStream( new File(username+"_problems.txt")))); String timeRegex="(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})";//匹配提交时间 String status...
f3ecd7cd-b477-466c-8b11-8a1c41b32e47
5
private void jbCabinKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jbCabinKeyPressed // Key Binding Code if (evt.getKeyCode() == KeyEvent.VK_C) { jbCabinActionPerformed(null); } else if (evt.getKeyCode() == KeyEvent.VK_L) { jbLeanToActionPerformed(null); ...
b6feb3e2-2582-4bf0-8fd7-cf50884d1768
1
public void deleteTache(PrintWriter out, String [] choix){ if(taches.containsKey(Integer.parseInt(choix[1]))){ taches.remove(Integer.parseInt(choix[1])); out.println("OK"); }else out.println("KO"); out.flush(); }
f5a138d7-04f7-4fc0-a7ed-d0d73276d5f6
4
public void testIntLargeArrayArraycopy() { int[] data = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int startPos = 2; int length = 8; LargeArray.setMaxSizeOf32bitArray(1073741824); IntLargeArray a = new IntLargeArray(data); IntLargeArray b = new IntLargeArray(2 * data.l...
3ebbc333-6f3d-4b05-bd9f-bcb68ddde569
8
private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options ) { // Lots of error checking and exception throwing if( source == null ){ throw new NullPointerException( "Source array was null." ); } // end if ...
51f13ee6-6c85-486a-bb5c-32500b2efefc
3
public static void main(String[] args) { try { War warModel = new War(); AbstractWarView viewGui = new WarGui(); WarController controller = new WarController(warModel,viewGui); new XMLparser(controller, warModel); new WarDBConnection(); } catch (ParserConfigurationException e...
3096215b-fa60-44ea-b0aa-d7c6b0dfb447
2
public Bag getDiscsFromManufacturer(Manufacturer manufacturer) { LOGGER.log(Level.INFO, "Getting discs by manufacturer " + manufacturer); Bag discBag = new Bag(); for (int i = 0; i < discs.size(); i++) { if (discs.get(i).getManufacturer() == manufacturer) { discBag...
a1578703-1e96-4727-b154-8a7e437c4ccb
6
private void statement() { if (have(NonTerminal.VARIABLE_DECLARATION)) { variableDeclaration(); } else if (have(NonTerminal.CALL_STATEMENT)) { callStatement(); } else if (have(NonTerminal.ASSIGNMENT_STATEMENT)) { assignmentStatement(); } else if (have(NonTerminal.IF_STATEMENT)) { ifSt...
79d0d8e9-eb13-4097-bafc-9f9ec292980c
7
@Override protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException { _Fields setField = _Fields.findByThriftId(fieldID); if (setField != null) { switch (setField) { case SHORT_VALUE: Short short_value; ...
78137c0e-d7f7-49e5-a32a-28df8303a2e6
6
private void checkRangePosition(Position p,Report r){ AUnit t = Game.getInstance().getUnitByID(p.getTargetID()); UnitConfiguration unitConfig = t.getConfiguration(); double acousticRange = (t.getSpeedMs() - unitConfig.getSilentSpeed()) * (unitConfig.getMaxSpeedMs()/(unitConfig.getMaxSpeedMs()-unitConfig.getSilent...
609e1208-0215-4f65-a0e0-d53a8fd04ed0
1
public void map_move(int obj_id, Coord offset) { Coord oc, sc; int btn = 1; int modflags = 0; Gob gob; synchronized (glob.oc) { gob = glob.oc.getgob(obj_id); } if (gob == null) return; sc = new Coord((int) Math.round(Math.random() * 200 + sz.x / 2 - 100), (int) Math.round(Math.random() * 200 +...
46a842b0-679f-4103-823f-715598382bac
2
@Override public void mouseWheelMoved(int change){ selectedInv += change / 120; if(selectedInv > player.playerInv.inv.length - 1) selectedInv = 0; if(selectedInv < 0) selectedInv = player.playerInv.inv.length -1; }
3d18ada4-2e3c-4561-832e-bfca8250ba4b
7
private static boolean removeAbonnement(Croakos croakos) throws Exception { // On met à jour l'user actuel croakos = service.path("getUser/" + croakos.getNom()).get(Croakos.class); ArrayList<String> abonnement = croakos.getFollowing(); Scanner sc2 = new Scanner(System.in); ...
5a0a9323-15b4-41c3-87bd-e145d76a6619
7
public NativeFont (String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor) throws IOException { super (baseFont, fontObj, descriptor); String fontName = descriptor.getFontName (); PDFObject ttf = descriptor.getFontFile2 (); if (ttf != null) ...
4c2bc2b0-85b3-40e1-87cc-0779c4cbfbfd
2
public double bonusDefense(Territoire t, Peuple attaquant) { return (t.has(MachineACafe.class) ? 1.0 : 0.0) + (t.has(Photocopieuse.class) ? 1.0 : 0.0); }
94156fb5-9124-4e8e-bd4c-9c87155a3370
7
public void renderItemList(Screen screen, int xo, int yo, int x1, int y1, List<? extends ListItem> listItems, int selected) { boolean renderCursor = true; if (selected < 0) { selected = -selected - 1; renderCursor = false; } int w = x1 - xo; int h = y1 - yo - 1; int i0 = 0; int i1 = listItems.size()...
c132145f-2c18-43ae-8e65-d8fb9e9f6e4e
7
@Override public void viewAccepted(final View newView) { new Thread(new Runnable() { @Override public void run() { if (currentView == null) { waitForBalacing.drainPermits(); currentView = newView; workerThread = new Thread(worker); workerThread.start(); ...
67fa0fba-783c-4e81-a009-f2b0e5977efa
7
protected void onTick() { ACLMessage msg = myAgent.receive(); if (msg != null && msg.getPerformative() == ACLMessage.ACCEPT_PROPOSAL) myAgent.served.add(msg.getConversationId()); String food = myAgent.food.get(RandomUtils.range(0, myAgent.food.size() - 1)); String drink = myAgent.drink.get(RandomUtils.ran...
658f5126-2308-47cc-a5cc-be3e4a59300f
1
public Connection getConnection() { try { return this.dataSource.getConnection(); } catch (SQLException e) { throw new RuntimeException(e.getSQLState() + "\nCaused by\n" + e.getCause(), e); } }
53553eb1-4f64-41b9-8552-e26fc4923636
5
private void initCredential() throws MissingCredentialException { ConfigManager conf = ConfigManager.getInstance(); int suffix = 1; String prefix = Constants.ACCCOUT_PREFIX; Map<String, String> credMap = conf.getValuesByCategory(prefix); Set<String> acctSet = conf.getNumOfAcct(); if (acctSet.size() == 0) { ...
2c475f2e-a602-4846-a718-08d346280759
4
FocusChangeDirection asFocusChangeDirection() { if(this == NEXT_INTERACTABLE_DOWN) return FocusChangeDirection.DOWN; if(this == NEXT_INTERACTABLE_RIGHT) return FocusChangeDirection.RIGHT; if(this == PREVIOUS_INTERACTABLE_LEFT) return Fo...
0460642b-0ad8-4e44-918a-bc546e0d4c80
1
public Stmt stmt() { Node p = parent; while (!(p instanceof Stmt)) { Assert.isTrue(!(p instanceof Tree), "Invalid ancestor of " + this); Assert.isTrue(p != null, "Null ancestor of " + this); p = p.parent; } return (Stmt) p; }
37929fbb-39ae-4d2c-99ff-76217083f80f
1
@RequestMapping(value = "/room-events/{hallEventId}", method = RequestMethod.GET) public ModelAndView allRoomEventsPage( final HttpServletRequest request, final HttpServletResponse response, @PathVariable(value = "hallEventId") final String hallEventIdStr ) throws IOException...
31f869ab-cc49-4edb-9f89-5860e3d51f83
5
protected static void sort(Comparable[] a) { int N = a.length; int h = 1; while (h < N / 3) { h = 3 * h + 1; } while (h >= 1) { for (int i = 0; i < N; i++) { for (int j = i; j >= h && less(a[j], a[j - h]); j -= h) { exch(a, j, j - h); } } h = h / 3; } }
cd3710fb-5ebf-4f28-ac82-67a63ccbd1fe
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...
3cf53c54-89bb-4c9b-82d1-fb5ae2c42022
4
@Override public boolean containsDouble(String name) { JOSObject<? , ?> raw = this.getObject(name); if(raw == null) return false; if(raw.getName().equalsIgnoreCase(DOUBLE_NAME)) return true; return false; }
12fa0cc1-678f-48dd-9308-05362b0f6eab
6
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) { if (!(msg instanceof Request)) { log.error("not a request!"); ctx.close(); return; } Request request = (Request) msg; Response response; if (!request.getInterfaceName().equals(metadata.getInterfaceName())) { lo...
2278bea4-20b3-4108-81c2-75cd93a37841
2
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { jButton2.setVisible(true); jButton3.setVisible(true); jButton4.setVisible(true); jComboBox1.setEnabled(false); jTextField1.setEnabled(false); jButton5.setEnabled(false); jLabel3.setVisible(true); jLabel4.setVi...
d8e890f2-70e9-46a9-98e3-129487e7828f
4
@Override public int compareTo(Measurement o) { if(this.getCoordinates().getX() < o.getCoordinates().getX()) {return -1;} else if(this.getCoordinates().getX() > o.getCoordinates().getX()) {return 1;} else { if(this.getCoordinates().getY() < o.getCoordinates().getY()) {return -1;} else if(this.getCoordinate...
bcf6439f-1ac6-4515-bd7a-668a6e1ba243
3
public static String search(int id) { boolean result = false; Connection con = getcon(); boolean a=false; ResultSet rs = null; String name=""; try { String stusql = "select name from testtable where id=? "; PreparedStatement stmt = null; ...
62bdeb0f-98d5-4374-a71f-a93efe005270
0
public Integer getRecordStatus() { return this.recordStatus; }