method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e2dce792-9ac2-4ac4-8121-877e56f243d5
0
public void addVertex(Vertex v) { DoublyLinkedList<Vertex> vList = new DoublyLinkedList(); vList.insert(v); vertices.insert(v); adjacencyList.addVertex(v); }
d9fb9e9b-c8f7-4994-bedd-bfaeb295ee48
6
public boolean isNearlyIdenty(double tolerance){ boolean test = true; if(this.numberOfRows==this.numberOfColumns){ for(int i=0; i<this.numberOfRows; i++){ if(Math.abs(this.matrix[i][i]-1.0D)>Math.abs(tolerance))test = false; for(int j=i+1; j<this.numberOf...
94fd77be-f6f5-41e0-8fa7-61ea2405bd6f
6
private Gob gobatpos(Coord c) { for (Sprite.Part d : obscured) { Gob gob = (Gob) d.owner; if (gob == null) continue; if (d.checkhit(c.add(gob.sc.inv()))) return (gob); } for (Sprite.Part d : clickable) { Gob gob = (Gob) d.owner; if (gob == null) continue; if (d.checkhit(c.add(gob.sc....
f86bc96f-56d2-4cd4-bb40-53b6dcd404cc
9
public void renderBg(Bitmap bm, int xScroll, int yScroll) { int w = bm.w / 24 + 4; int h = bm.h / 6 + 5; int x0 = xScroll / 24 - 2; int y0 = yScroll / 6 - 3; int x1 = x0 + w; int y1 = y0 + h; mapSprites.clear(); boolean visible = true; for (int y = y0; y < y1; y++) { for (int x = x0; x < x1; x++) ...
97a80e5b-cd5d-42cc-8e6b-cde14f015ef4
7
DoctorPanel(ResultsDisplay x){ rd = x; setLayout(null); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBounds(214, 5, 21, 21); add(tabbedPane); JButton btnQuery = new JButton("D Names"); btnQuery.setBounds(22, 52, 117, 29); add(btnQuery); btnQuery.addActionLi...
db2f42d7-2529-4b8a-9ee7-20980e980bca
2
private void checkIfNullOrEmpty(String input) { if (input == null || input.trim().isEmpty()) { throw new IllegalArgumentException("input is empty"); } }
c387dfad-44ff-4a94-9be2-7463f07ed953
2
@Override public Converter put(String key, Converter value) { Converter v = super.put(key, value); if (v != null) { throw new IllegalArgumentException("Duplicate Converter for " + key); } return v; }
f78513e7-cb6b-40d2-8044-55f8de540203
8
void selectItem (CTableItem item, boolean addToSelection) { CTableItem[] oldSelectedItems = selectedItems; if (!addToSelection || (getStyle () & SWT.SINGLE) != 0) { selectedItems = new CTableItem[] {item}; if (isFocusControl () || (getStyle () & SWT.HIDE_SELECTION) == 0) { for (int i = 0; i < oldSelectedItems....
5af483a0-49ac-4b1b-9134-2e437d6a15dd
0
public int [] getBottomRight () { return bottomRight; }
db99a5ad-4780-433d-a081-78b776dc053b
7
private void setModule2Topology() { for (int neuron = 0; neuron < getSize(); neuron++) { if ((neuron % 5) == 0) neurons[neuron].setInhibitory(true); else neurons[neuron].setInhibitory(false); } for (int neuron = 0; neuron < getSize(); neuron++) { int CA = neuron / neuronsI...
a667fafa-35a7-49a2-835d-b8b86d1fa5ff
5
public static double getDouble(byte[] b, int offset) { if (isBlank(b)) { throw new IllegalArgumentException("blank byte array."); } if (offset < 0) { throw new IllegalArgumentException("invalid array offset:" + offset + "."); } long out = b[0] < 0 ? -1L : 0L; for (int l = b.length - offset, i = l < DO...
83b70c32-563b-4246-8fc2-542dc49eefdb
3
private Object readArrayValue() throws IOException, JSONException { Object obj = this.readValue(); int c = this.skipWSRead(); if (c == JSON.VALUE_SEPARATOR || c == JSON.END_ARRAY) { if (c == JSON.END_ARRAY) this.unread(c); return obj; } else { String message = String.format...
d619a5d8-4d31-4307-ac82-ecf57e0065bd
2
public void shutdown () { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("shutdown", false); $in = _invoke ($out); return; } catch (org.omg.CORBA.portable.ApplicationException...
f02ad55c-e669-4847-87c0-4861d0cb1aa9
2
public static void main(String[] args) { /* Verify a DSA signature */ if (args.length != 3) { System.out.println("Usage: VerSig " + "certfile signaturefile " + "datafile"); } else try { verifySign(args[0], args[1], args[2]); } catch ...
083fc7ec-3cf4-4a31-b239-7a9605f86adc
4
public Player getPlayer2() { boolean test = false; if (test || m_test) { System.out.println("FileManager :: getPlayer2() BEGIN"); } if (test || m_test) { System.out.println("FileManager :: getPlayer2() END"); } return m_player2; }
4236fa51-4f5b-4a50-b3cc-396129c483ba
1
public void render() { Game.updateShader(gunTransform.getTransformation(), gunTransform.getPerspectiveTransformation(), gunMaterial); gunMesh.draw(); if((double)Time.getTime()/Time.SECOND < gunFireTime + GUN_FIRE_ANIMATIONTIME) { gunTransform.setPosition(playerCamera.getPos().add(playerCamera.getForward(...
97398ce3-ea6e-4b14-9a54-a2675e36c20a
5
private int method168(int arg0, int arg1, int arg2) { if (arg2 == 1) { if ((arg1 & 0x7fff) < 16384) { return arg0; } else { return -arg0; } } if (arg2 == 2) { return Soundtrack.sineTable[arg1 & 0x7fff] * arg0 >> 14; } if (arg2 == 3) { return ((arg1 & 0x7fff) * arg0 >> 14) - arg0; } ...
ddd3b844-5484-4eee-95d6-e581fa0716c4
2
@Override public void conexion(Conexion.Tipo_conexion tipo) throws Exception { try { GenericConnection oConexion; if (tipo == Conexion.Tipo_conexion.DataSource) { oConexion = new DataSourceConnection(); } else { oConexion = new DriverManag...
b61e93b3-aa3a-454f-a09f-74192e8501b9
8
private void calculateScore() { if (isStraightFlush()) score += 1l << 60; else if (isFourOfAKind()) score += 1l << 59; else if (isFullHouse()) score += 1l << 58; else if (isFlush()) score += 1l << 57; else if (isStraight()) score += 1l << 56; else if (isThreeOfAKind()) sc...
0f6d321a-cb4b-485f-a248-36173200ac39
8
public boolean testOverlappingRecordTime(int streamID, long startTime, long endTime) { for( int i=0 ; i<schedulVector.capacity() ; i++ ) { //is overlapping when: // - the job belongs to the right stream // - t if(schedulVector.get(i).getStreamID() == streamID && ( (startTime >= schedulVector.get(i...
558b7263-87d9-44f6-907b-02784b62b33f
4
private void updateRoot(ArrayList<String> databases) { DocumentBuilderFactory docFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder; try { docBuilder = docFactory.newDocumentBuilder(); // root elements Document doc = docBuilder.newDocument(); Element rootElement = doc.cre...
bcec77cd-6224-472f-bfa0-6b6069b00ed8
6
@Override public Color winner(int turnCount) { Color playerInTurn = (this.game.getPlayerInTurn() == Color.NONE) ? Color.BLACK : this.game.getPlayerInTurn(); Color opponent = (playerInTurn == Color.BLACK) ? Color.RED : Color.BLACK; Location playerInTurnBearOff = (playerInTurn == Color.BLACK) ? Location.B_BEAR_...
da8cc306-9608-4c3a-978f-f66ab84196f5
9
public static final String unzip(String compressedStr) { if (compressedStr == null) { return null; } ByteArrayOutputStream out = null; ByteArrayInputStream in = null; ZipInputStream zin = null; String decompressed = null; try { byte[] compressed = new sun.misc.BASE64Decoder() .decodeBuffer...
536b2dc2-e07f-4005-aaac-ff34202f9b67
9
@Override public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { tracer.addMapping(bytecode); if (exitType == EXIT_RETURN) { TextBuffer buffer = new TextBuffer("return"); if (retType.type != CodeConstants.TYPE_VOID) { buffer.append(' '); ExprProcessor.getCastedExpre...
b026ddd3-0378-41fe-b6e2-e2588ec5fbb3
1
public InputSource resolveEntity(String publicId, String systemId) { if (systemId.equals("http://mapeditor.org/dtd/1.0/map.dtd")) { return new InputSource(TMXMapReader.class.getResourceAsStream( "resources/map.dtd")); } return null; }
1aed8b40-32f3-4184-8b02-08e66c54e010
4
@Override public void drop(DropTargetDropEvent event) { // Accept copy drops event.acceptDrop(DnDConstants.ACTION_COPY); // Get the transfer which can provide the dropped item data Transferable transferable = event.getTransferable(); // Get the data formats of the dr...
d6528555-8222-455a-8f33-7ca2a76b0bad
0
public byte[] getValueMAC() { return valueMAC; }
a4126aee-eae0-4747-9170-a02dedd59d7b
3
public static void main(String[] args) { Scanner entrada = new Scanner(System.in); System.out.print("N="); int n = entrada.nextInt(); int i = 1; int j; if (n % 2==0) n++; int sp=(n-1)/2+1; while (i <= n) { j=1; espacos(sp); while (j <= i){ System.out.print("X"); j...
390b73b9-bd24-4dbd-8152-97cb996a7d1c
1
public static ArrayList<Character> myCharactersAfterMyArchNemesisHacksIntoMyAccount() { ArrayList<Character> retval = new ArrayList<Character>(); for (int i = 1; i <= 85; i++) { Character character = new Character(Race.ORC, i, i, i); retval.add(character); } Collections.shuffle(retval); // then my ...
f266e5f5-551a-4dab-960f-3c557d49f0ec
5
public static void q6(String[] args) throws Exception{ //Question 4.6: Write an algorithm to find the 'next' node (i.e., in order successor) of a given node in //a binary search tree. You may assume that each node has a link to its parent. SOP("Running q6"); if(args.length != 1){ ...
a94240f7-5fa3-4dd4-aded-e9d0a562b6c2
9
public void processBDSax(int windowSize, ConfigGeneral cg, String DBPath) throws SAXException, IOException { System.out.println("Parser: SAX"); _threshold = cg.getThreshold(); String objName = cg.getDbObjectName(); System.out.print("Starting XML reader..."); SaxToD...
525fc840-53a8-4142-83e6-754614dd8eb5
6
NpcLoader(GameMode class230, int i, boolean bool, IndexLoader class45, IndexLoader class45_7_) { do { try { ((NpcLoader) this).aBoolean3583 = bool; npcIndexLoader = class45; ((NpcLoader) this).modelIndexLoader = class45_7_; ((NpcLoader) this).aClass230_3578 = class230; if (npcIndexLoader == null) ...
802a3799-a9df-4adc-8beb-eeab445d18cb
3
public Door(Bitmap img) { Random random = new Random(1000); int w = 6; int h = 6; double ws = 1.0 / (w); double hs = 1.0 / (h); for (int x = -1; x <= 1; x++) { for (int z = 0; z < w; z++) { for (int y = 0; y < h; y++) { doub...
bbab5693-3777-45b5-95d2-65100e519703
6
private boolean locationOfCode(String code) { boolean afterHlt = false; for (int i = 0; i < codeList.length; i++) { if (codeList[i].equalsIgnoreCase("0000")) { afterHlt = true; } if (afterHlt && codeList[i].equals(code)) { return ...
1cfaf56e-9859-48b3-b654-4d40f15b535a
5
public static String serialize(Table table, Storeable value) throws ColumnFormatException { try { value.getColumnAt(table.getColumnsCount()); throw new ColumnFormatException("Too many columns!"); } catch (IndexOutOfBoundsException e) { } Gson gson = new Gson(); ...
cf6282af-1077-49c0-91ef-863e1818c087
3
public void readLevel(){ Scanner fin=null; Scanner counter = null; try { fin=new Scanner(loc); counter = new Scanner(loc); } catch (FileNotFoundException e) { e.printStackTrace(); } int count = 0; counter.nextLine(); while (counter.hasNextLine()) { counter.nextLine(); count++; } comp...
5867cdd4-8b28-4aa6-b5b1-075fe388b322
9
private byte[] waitForResponse(final IndividualAddress from, final int minAsduLen, final int maxAsduLen, final long timeout) throws KNXInvalidResponseException, KNXTimeoutException, InterruptedException { long remaining = timeout; final long end = System.currentTimeMillis() + remaining; synchronized (indicat...
c5a1d781-75fa-42eb-98e8-106c98a9ad0c
9
@Override public <T> List<T> sendQuery(String query, Object[] params, int pageSize, Connection conn, RowMapper<T> mapper) throws DaoException { if (params == null) { throw new DaoException(PARAMS_IS_NULL_ERROR); } List<T> result = new ArrayList<>(); PreparedStatement ps ...
520b7fcc-201f-4cc5-a8a1-7502c54450b1
9
public Set<String> getCombinedHeaders(String[] h1, String[] h2, Set ignoreSet) { Set<String> headerFields = new HashSet<String>(); int idCounter = 0; for(String field : h1) { if("id".equals(field)) { idCounter += 1; } if(! ignoreSet.contains(fi...
07769f4f-0852-422c-b4bb-eba242ede84c
7
@Override public void keyTyped(final KeyEvent e) { c1a[0] = e.getKeyChar(); if (c1a[0] < 0x20) { if (c1a[0] == '\b') { if (textField.getSelectionStart() == textField .getSelectionEnd()) { int pos = textField.getCaretPosition(); if (pos == 0) return; textField.setSelectio...
8bb1430a-e7a7-441d-91af-893c39c3687b
4
static List<String> listStations(ObjectOutputStream toServer, ObjectInputStream fromServer) throws IOException, ClassNotFoundException { log.debug("Start \"listStations\" method"); GetAllStationsRequestInfo req = new GetAllStationsRequestInfo(); log.debug("Send GetAllStationsRequestInfo to serve...
20b48e5d-6853-4649-8dc7-aa1f15dfa33c
3
private String getOptionalString(String propertyKey) { try { String localizedText = Tools.getLocalizedString(propertyKey); if (localizedText != null && localizedText != "") return localizedText; else { return null; } } catch (IllegalArgumentException ex) { return null; } }
25e7fe8d-b426-41fb-8c04-5af0f4cce063
7
public String[] getInput() { Scanner inFile = new Scanner(System.in); System.out.println("\n\t---------------------------------------------------------------"); System.out.println("\t Enter a list of names of those who will be playing Sudoku. "); System.out.pri...
74182dbd-6599-4e03-b99c-30a017152d31
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; JsonObject other = (JsonObject) obj; if (other.hasComments() ^ hasComments()) return false; if (value == null) { if (other.value !=...
02be6936-aa99-4ec6-adbf-ddfff301bdeb
5
public ListGraph(int nNodes, List<Rectangle> obstacles, int width) { Logger log = Logger.getLogger("fr.upem.algoproject"); this.array = new ArrayList[nNodes]; for(Rectangle l: obstacles ) { for(int i=l.topleft.x; i <= l.bottomright.x; ++i) { for(int j = l.topleft.y; j <= l.bottomright.y; ++j) { log.fi...
6c907d0d-afe5-4006-8624-c507e791d943
1
public AnnotationVisitor visitAnnotation(String desc, boolean visible) { AnnotationVisitor av = fv.visitAnnotation(remapper.mapDesc(desc), visible); return av == null ? null : new RemappingAnnotationAdapter(av, remapper); }
57e861c8-06a3-4331-a2c9-a3358c5df422
6
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub HttpSession session = request.getSession(); Connection con = null; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverMa...
7ba90f99-89d0-49c6-a580-ec2ca925b2c4
4
private static void setShowDebug(final Map<String, Object> xmlResults) { for (final Entry<String, Object> entry : xmlResults.entrySet()) { XMLRecordElement xmlrecEle = null; final String recordID = entry.getKey(); List<ColumnMetaData> columns = null; if (recordID....
d8f939dc-3d01-46da-a209-79cf9adfb7de
8
public void completed(final HttpResponse response) { LOGGER.info(response.getStatusLine() + " -> [" + httpHost.getHostName() + "] " + request.getRequestLine().getMethod() + " " + request.getRequestLine().getUri()); File directory = new File(CRAWLED_HOSTS_PATH + "/" + httpHost.getHostName()); if (!dir...
2164700a-2985-48da-8670-24db9e715a0d
6
public static int find(int [] a,int result,int low,int high) { // TODO Auto-generated method stub if(result>a[high]||result<a[low]||low>high){ return -1; }else{ int mid=(low+high)/2; if(a[mid]==result){ return mid; } if(a[mid]>result){ return find(a,result,low,mid-1); } if(a[mid]<result){ ...
226e4bca-efd7-4515-93f6-e4b068fe7c2f
8
public static Node sumThatShit(Node node1, Node node2, int extraCarry, Node result) { if(node1==null && node2==null) return null; int sum = extraCarry; if(node1 != null) sum += node1.intVal; if(node2 != null) sum += node2.intVal; if(sum >= 10) { sum = sum - 10; extraCarry = 1;...
a7958296-1e0c-4e89-8ac7-49c2e07c6719
8
private static synchronized void applySendRules(TimeStampedMessage message){ updateRules(config_filename); String action = ""; if(sendRules.size() > 0){ Rule currentRule = sendRules.get(0); for(int i = 0; i< sendRules.size(); i++){ currentRule = sendRules.get(i); //System.out.println("checking sendR...
87285699-0798-46c5-a465-ad40f5d8899c
4
public void parse() { if(message.contains("004")) { Log.info("Successfully connected."); } else if(message.contains("443")) { Log.info("Username already in use."); } else if(message.startsWith("PING ")) { Main.getBot().getConnection().write("PONG :" + message.substring(5) + "\r\n"); Main.getBot().getC...
cc2d4b20-4be4-49cb-bc32-9f13df530000
4
public static BonusTypeEnumerator create(int i) { switch (i) { case 1: return BETTER_JUMP; case 2: return ONE_UP; case 3: return ADD_TIME; case 4: return ADD_POINTS; default: throw new IllegalArgumentException("Taki bonus nie istnieje."); } }
6f3b5be5-d749-40fb-9c9b-8d3b89b903d7
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...
e32ce04a-fee2-4de9-b882-a84da195f695
7
private static Set<String> getClassNameFromJar(Enumeration<JarEntry> jarEntries, String packageName, boolean isRecursion){ Set<String> classNames = new HashSet<String>(); while (jarEntries.hasMoreElements()) { JarEntry jarEntry = jarEntries.nextElement(); if(!jarEntry.i...
9678140f-2ab1-4195-aaea-8ac1b40f5667
2
public void input() { int num; System.out.printf("%s\n%s\n %s\n %s\n", "Enter numbers to determine if they are even or odd.", " Please input number:", "On UNIX/Linux/Mac OS X type <ctrl> d then press Enter", "On Windows type <ctrl> z then press Enter"); Scanner s = new Scanner(System.in); while ...
28337556-a1db-4017-a77e-7632480b9709
3
public static int maxProfit(int[] prices) { int profit = 0; int min = Integer.MAX_VALUE; for(int i = 0; i < prices.length; i++) { profit = profit < prices[i] - min ? prices[i] - min : profit; min = min > prices[i] ? prices[i] : min; } return profit; ...
e6a5975f-a26b-4a3f-baf8-002abc5d0fee
3
private int getReachableCnt(String root,Map<String,List<String>> map){ Set<String> set=new HashSet<String>(); LinkedList<String> linkedList=new LinkedList<String>(); linkedList.offer(root); while (!linkedList.isEmpty()){ String s=linkedList.poll(); if(!set.contain...
f6ef8aa7-1ff8-4c7a-86ba-b4f8791cce56
3
public static void main( String[] args ) { // SECTION A int number = 0; if ( number == 0 ) { System.out.println( "Zero" ); } else { System.out.println( "NON - Zero" ); } // SECTION B int score = 89; if ...
daf9bb99-29a1-442a-bb37-0d501f488413
2
public void run() { while (true) { semaphore.take(); System.out.print(number); semaphore.give(); try { sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } }
daeef5bd-5e8f-49e3-ad00-d54f00cf7c8c
3
@Override public void paintComponent(final Graphics g) { // Check if we have a running game super.paintComponent(g); g.setColor(this.getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); if (this.model != null) { // Draw all tiles by going over them x-wise and y-wise. for (int i = 0; i < this....
478cfe31-aaa4-44e0-812f-a0effd32ffa1
6
public void generateDatabase(int transactionCount, int maxDistinctItems, int maxItemCountPerTransaction, String output) throws IOException { // We create a BufferedWriter to write the database to disk BufferedWriter writer = new BufferedWriter(new FileWriter(output)); // For the number of transactions to ...
01164aa9-7696-4901-a16e-f6ed53412a61
2
public boolean isLoaded() { for (World w: Bukkit.getServer().getWorlds()) { if (w.getName().equals(this.worldName)) { return w.getPlayers().size() == 0; } } return false; }
f23e20a7-9589-4968-8c5b-f70b75ae0df9
9
private void executeWriteRequestOnWriteQuorum( HashMap<Machine, Boolean> writeStatus, HashSet<Machine> successfulServers, HashSet<Machine> failedServers, Article aToWrite) { /** * to execute a write on the group of servers we again need to start a * countDownlatch with writer service */ if (faile...
492b5bd7-3cbb-47f9-9ab8-06496a62b33f
3
private Item get(final Item key) { Item i = items[key.hashCode % items.length]; while (i != null && (i.type != key.type || !key.isEqualTo(i))) { i = i.next; } return i; }
639d3867-5ded-4838-aa6a-9baaba087416
8
boolean parseMessage(Message request) { clientIdToServer = new String(request.contents.getAttributes().getNamedItem("id").getNodeValue()); Node child = request.contents.getFirstChild(); if (child.getAttributes().getNamedItem("type").getNodeValue().equals("open")) myType = EventType.OPEN; else if (child.g...
89e60d75-2dae-4a2f-8abc-6c6597b1c82f
9
public static InetSocketAddress parse(String arg, boolean isany) throws UnknownHostException { try { if (arg.equals(":") && isany) return new InetSocketAddress(0); String[] parms = arg.split(":"); if (parms.length==2) { int port=0; if (parms[1].length()>0) port=Integer.parseInt(parms[1]); ...
dad058f2-35fb-4db9-9058-5f6e67a79614
1
JobSchedulerBuilder( final Class<? extends Job> jobClass ) { this.jobClass = jobClass; }
1be5d7fe-3fe7-4119-9d58-eb22733f164a
7
public HashMap<Position, TileImpl> makeTileList() { String[] layout; layout = new String[] { "...ooMooooo.....", "..ohhoooofffoo..", ".oooooMooo...oo.", ".ooMMMoooo..oooo", "...ofooohhoooo..", ".ofoofooooohhoo.", "...ooo..........", ".ooooo.ooohooM..", ".ooooo.oohooof..",...
27618ade-9fec-4220-bd23-59ba059acf34
8
static void srdarwin_drawsprites(osd_bitmap bitmap, int pri) { int offs; /* Sprites */ for (offs = 0;offs < 0x200;offs += 4) { int multi,fx,sx,sy,sy2,code,color; code = buffered_spriteram.read(offs+3) + ( ( buffered_spriteram.read(offs+1) & 0xe0 ) << 3 ); sx = (241 - buffered_spriteram.read(offs+2...
0a1cfd9d-a4c1-4448-be9f-4706f50dc5ba
9
private MITMAdminClient( String [] args ) { int remotePort = 8002; String remoteHost = "localhost"; if( args.length < 3 ) throw printUsage(); try { for (int i=0; i<args.length; i++) { if (args[i].equals("-remoteHost")) { remoteHost = args[++i]; } else if (args[i].equals("-remotePort"))...
a65e676b-6c12-47fd-b81f-b304407e628a
8
private void readBeamElement(Hashtable ht) throws Exception { String name = ""; String typeId = ""; String imageName = ""; String beamImageName = ""; String beamEndImageName = ""; int range = 0; boolean requireWall = false; boolean scaleToWall = false; if (ht.get("RANGE") != null) range = Integer.parseInt((...
4707fb9a-688a-4531-8a71-e7effc990e44
6
public void stay() { player.turn = !player.turn; dealer.turn = !dealer.turn; while(dealer.getScore() < player.getScore() && dealer.getScore() <= 21){ this.hit(); } if(player.getScore() == dealer.getScore()){ System.out.println("Your Score: " + player.getScore()); System.out.println("Dealer Score: " +...
2bae4d62-c413-4d05-a1a5-b4b119b5e686
9
protected void validateDefaultPages(final Map<PageType, String> defaultPages) { final String viewPage = fixWicketUrl(defaultPages.get(PageType.VIEW)); defaultPages.put(PageType.VIEW, viewPage.startsWith(wicketFilterPath) ? viewPage : wicketFilterPath); String defaultPage = defaultPages.get(PageType.ACTION); if...
34d99551-d5fb-4ee8-9707-82bfe15a2dbd
4
public boolean doTransformations() { return ((initBlock == null && type == POSSFOR) || (initInstr == null && type == FOR)) && CreateForInitializer.transform(this, flowBlock.lastModified); }
a1392dbe-a1ff-4b10-94aa-dd7a3d25e927
1
private boolean keyIsDown(char key) { return keyStatus.containsKey(key) && keyStatus.get(key); }
868e7182-ff69-4468-bc0e-9557e0f8946d
4
public boolean isNear(Point point, int fudge) { if (needsRefresh) refreshCurve(); try { if (bounds.contains(affineToText.inverseTransform(point, null))) return true; } catch (java.awt.geom.NoninvertibleTransformException e) { } catch (NullPointerException e) { System.err.println(e + " : " + bounds...
fba7e0f3-3fac-4750-bbaa-6fe7f03725e9
6
private void run(){ isRunning = true; int frames = 0; long frameCounter = 0; final double frameTime = 1.0 / FRAME_CAP; long lastTime = Time.getTime(); double unprocessedTime = 0; while(isRunning) { boolean render = false; long startTim...
2c292d50-8ed6-4d88-bfd9-4721d9e1b84e
0
public ListIterator(Node<Item> first) { current = first; }
cb794db3-773a-4b20-9cd5-aeb0e5c6bb8c
0
@Override public Product factory() { return new ConcreteProduct2(); }
e9a25f54-1e65-4836-8c74-9e24240e6c66
7
public static <E> void solution1(KAryTreeNode<E> root) { if(root == null) { return; } KAryTreeNode<E> preNode = null; int currentLineNodeCount = 1; int nextLineNodeCount = 0; Queue<KAryTreeNode<E>> queue = new LinkedList<KAryTreeNode<E>>(); queue.offer(root); while(!queue.isEmpty()) { KAryTr...
ba572c9c-e11b-469b-8ad0-76d5bb29c80f
2
public static PGM seuillage(PGM img, int seuil){ PGM result = new PGM(img); ArrayList<Integer> list; list = new ArrayList((ArrayList<Integer>) img.getNiveauxGris()); for (int i = 0; i < list.size(); i++){ if (list.get(i) < seuil){ list.set(i,...
dfb9cd9f-92f2-45c5-904b-5f6858beed15
3
private void delete(CommandSender sender, String[] args) { if (!sender.hasPermission("graveyard.command.add")) { noPermission(sender); return; } if (args.length > 1) { String pointname = GraveyardUtils.makeString(args); if (SpawnPoint.deleteSpawnP...
0e543d2d-6494-4c5e-98c9-070c79f3b1dd
2
public CropImage() throws IOException { int photoHeight; int photoWidth; int ret = fileopen.showDialog(null, "Open file"); if (ret != JFileChooser.APPROVE_OPTION) { System.out.println("Did not select a file"); System.exit(1); } File input = fileo...
214e1c29-5c01-4f34-8500-1c79361a90eb
5
private static void setTema() { try { String tema = OSValidator.getTemaIntegrazione(); String temaClassName = ""; String temaNimbus = ""; boolean temaTrovato = false; for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) ...
82640b04-50d3-4950-ad10-39b6272444fd
3
private void showMainMenu(Graphics2D g2, Font font) { Rectangle2D.Double r1 = DrawText(g2, font, null, "JUGAR VS PC"); Rectangle2D.Double r2 = DrawText(g2, font, r1, "JUGAR EN RED"); Rectangle2D.Double r3 = DrawText(g2, font, r2, "SALIR"); // Check if buttons are pressed if (r1....
9c8c6f24-4423-42f8-b69b-15100397a428
9
public String getMan(String s) { if(s.equalsIgnoreCase("droite")) { return("Tourne votre personnage de 90° vers la droite, affiche votre nouvelle direction(N, S, E, O)"); } if(s.equalsIgnoreCase("gauche")) { return("Tourne votre personnage de 90° vers la gauche, affiche votre nouvelle direction(N, S, E, O)");...
d5e90d2b-ccda-441d-9aaa-c6ce4f0c3f63
0
public void setOrderId(int orderId) { this.orderId = orderId; }
401704d0-b715-498b-a834-cb2ee51cb6ce
1
public void clearSort() { if (clearSortInternal()) { notifyOfSortCleared(); } }
14ee6fe3-48b3-4525-9054-9fca53ba8f14
8
public int fillCell(Turn turn, boolean changeState) throws CellIsFilledException, CellIsEmptyException, IncorrectCellValueException { Cell selectedCell = getCellByIndex(turn.row, turn.column); int gainedPoints = 0; int modulo = 0; try { if(selectedCell == null) throw new IndexOutOfBoundsException("Cel...
0de3e222-bd7a-43ac-9e45-44d454c3c77c
6
public String[] obtenerRespuestasCorrectas(int tamaño){ String csvFile = "dataset/diabetes_prueba_resultados.csv"; BufferedReader br = null; String line = ""; String cvsSplitBy = ","; String respuestas [] = new String [tamaño]; int contador = 0; try { br = new BufferedReader(new FileReader(csvFile))...
302c6e38-e95e-4fce-92bd-17bbc42b5a50
1
private void itmMnu_AtividadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnu_AtividadeActionPerformed if (usuarioLogado.getTipo().equals("Gerente")) { GerenciarAtvidadeFom gerenciarAtvidadeFom = null; gerenciarAtvidadeFom = new GerenciarAtvidadeFom(usuarioLogad...
4a902922-8c18-4177-83b5-7f342795ee82
7
public void onMouseClick(MouseEvent event) { int x = 0, y = 0; //after methods will be a value inside the grid //This is a check of the cordinates to make sure they are in the grid. if (!(event.getX() > (squareSize*s+BUFFER) || event.getY() > squareSize*s+BUFFER || event.getX() < BUFFER || event.get...
1c5bc6ed-e026-4343-9bf1-cdb3f2e959fa
5
@Override public void save(IEmailKontakt emailKontakt) { System.out.println("Save dataset..."); Connection con = null; try { con = initDBConnection(); } catch (SQLException e) { e.printStackTrace(); } ResultSet rs = null; PreparedStatement ps = null; try { con.setAutoCommit(false); if (emai...
c86902fc-8d1e-4232-ae69-789dcc288f0f
2
public static void copyImage(String inFilePath, String outFilePath) { FileInputStream fin; FileOutputStream fout; try { fin = new FileInputStream(inFilePath); fout = new FileOutputStream(outFilePath); byte[] data = new byte[fin.available()]; fin.re...
1dafb675-2786-4d36-8b11-a37ce61f4800
4
public static void sortering(int[] a){ boolean sortert = false; int sistepost = 1; while (!sortert) { for (int i = 0; i < a.length - sistepost; i++) { if (a[i] > a[i + 1]) { int større = a[i]; int mindre = a[i + 1]; ...
7ad7f8b8-2ccb-4e6b-8ea1-0a58bf9aced2
5
final public void setLiteralVariable() throws ParseException { //Token varName, varValue=null; String functionString=null; //List<String> valuePredicates=null; Literal litName,litValue=null; jj_consume_token(SET_LITERAL_VARIABLE); litName = literal(); jj_consume_token(ASSIGN); if (jj_2_65(7)) { ...
b07f3d30-12d8-4aa0-aa75-e7a9974ede06
4
public byte[] init(byte[] token, int s, int l) throws JSchException { try{ // Without setting "javax.security.auth.useSubjectCredsOnly" to "false", // Sun's JVM for Un*x will show messages to stderr in // processing context.initSecContext(). // This hack is not thread safe ;-<. // If t...
dad2bff2-420a-4f01-ba0c-c5f8ec2712e2
6
private ArrayList<String> findUsersForGame(String selfId) { utils.resources.Game gameResource = (utils.resources.Game)Resources.getInstance().getResource("data/game.xml"); ArrayList<String> playersId = new ArrayList<>(); playersId.add(selfId); for (String userId: sessionIdToUserSession....