method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d989445e-98db-4bce-b6d0-2ad59a449662
3
public State parseState(CharSequence content) { boolean isDoubled = false; Matcher doubledMatcher = DOUBLED.matcher(content); if(doubledMatcher.matches()) { isDoubled = true; content = doubledMatcher.group(1); } Map<String, String> styles = new HashMap<St...
8242aee0-2647-4c56-8386-7cdc8565cad9
7
public void run() { ArrayList<ClientThread> clientTheads = this.clientThreads; try { /* * Create input and output streams for this client. */ inputStream = new BufferedReader( new InputStreamReader(clientSocket.getInputStream())); outputStream = new PrintStream(clientSocket.getOutputStream()); ...
01ab570f-0e4a-4569-bf3c-6fa0ce0c0f0f
7
public RectControls(Redrawable redrawable, Rectangle rect) { super(); this.rectangle = rect; this.redrawable = redrawable; setPadding(new Insets(10,10,10,10)); setVgap(5); int line = 0; //W add(new Label("Width"),0,line); width = new Slider(1, 200, rect.getW()); add(width,1,line);...
d2e11589-27c2-41c0-b238-d9b2e97453fc
4
@Test public void testDeity(){ Connection conn; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", ""); System.out.println("success"); } catch (ClassNotFoundException...
2f515c18-58b7-4f65-8179-e834610a24a1
5
private String[][] getContent(int teamNumber) { FileScanner teamFileScanner = new FileScanner(); Extracter extract = new Extracter(); String currentDir = Main.currentDir; String workspaceFolderName = Main.workspaceFolderName; String teamFolderName = Main.teamFolderName; ...
1a363d21-9321-479b-b20c-8f21e62d73ab
6
@Override public void onPluginMessageReceived(String channel, Player player, byte[] message) { if (this.permissionsManager == null) return; ReplicatedPermissionsContainer query = null; try { query = ReplicatedPermissionsContainer.fromBytes(message); } catch (Exception ex) {} if (query != nul...
b27c9541-6b0c-4446-9442-e39a7a7f833d
0
public Populator() throws SQLException { this.generators = new Generators(); this.metaDataDao = new MetaDataDao(); }
65f4e1d5-36b1-4bcc-bc74-042f6a8f403e
6
public int read(List<String> buf) { if (buf == null) { return 0; } buf.clear(); if (exists()) { BufferedReader bfReader = null; try { FileReader flReader = new FileReader(this); bfReader = new BufferedReader(flReader); String line = null; while ((line = bfReader.readLine()) != null) { ...
0d42be7d-d2fa-428f-97b5-41ea447b728c
2
public void testPropertyPlusNoWrapSecond() { LocalTime test = new LocalTime(10, 20, 30, 40); LocalTime copy = test.secondOfMinute().addNoWrapToCopy(9); check(test, 10, 20, 30, 40); check(copy, 10, 20, 39, 40); copy = test.secondOfMinute().addNoWrapToCopy(29); che...
ef760cc3-18e4-4157-bd30-64f68835014d
0
public int getCantidad() { return cantidad; }
4009bbe6-dccb-414a-a8a8-327c4ebcef8c
1
public int getAttributeSize(String name) { Attrib a = attrib(name); return a != null ? a.size : -1; }
dd7a3219-bb88-447d-82d9-91ec9b478566
4
public User connect(List<User> users) { // User input. List<String> words = this.getParser().getInput(); if (words.size() > 1) { for (User u : users) { // If the user is in the list, the connection succeed. if (u.getFirstName().equalsIgnoreCase(wor...
5527461c-c112-463c-ac90-220ad6f4599a
4
public static void make(String path,String[] files){ try { byte data[] = new byte[BUFFER]; FileOutputStream dest = new FileOutputStream(path); BufferedOutputStream buff = new BufferedOutputStream(dest); ZipOutputStream out = new ZipOutputStream(buff); out.setMethod(ZipOutputStream.DEFLATED); ou...
2ed32c0f-6de6-4b4a-8946-47f1db914e73
9
public void processClick(int x, int y) { Node p = getNode(x, y); if (p != null) { if (p.getPlayer() == getTurn() || p.getPlayer() == 0) { if (getGridValue(p) != 0) { if (getSelectedNode() != null) { if (!hasInAttack()) { addChangedGuti(selectedNode, p); deSelectNode(selectedNode); ...
124bf06a-ee90-4a9a-b4dd-d9887ecab41c
1
private boolean jj_2_30(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_30(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(29, xla); } }
53f3f90c-a29f-4174-868f-2318060ab79c
7
private CucaDiagramFileMakerResult createPng(OutputStream os, List<String> dotStrings, FileFormatOption fileFormatOption) throws IOException, InterruptedException { final StringBuilder cmap = new StringBuilder(); double supX = 0; double supY = 0; try { final GraphvizMaker dotMaker = populateImagesAndCrea...
88a18767-7add-4d86-99de-d8392f123bd9
7
public void query(String query) { boolean col=true; int colNum = 0; rowCount = 0; try { String date; Statement st = con.createStatement(); ResultSet rs = st.executeQuery(query); ResultSetMetaData rsmd = rs.getMetaData(); numberOfColumns = rsmd.getCo...
8aa0aa52-8a24-43f0-8509-b1d89b980c34
2
public Row getChild(int index) { return index >= 0 && index < getChildCount() ? mChildren.get(index) : null; }
2a333065-ccc4-420a-842f-76e10cd3377d
6
public static <T extends Comparable<T>, E> void print(Map<String, String> content, String testName, Node<T,E> root, boolean printHeader, boolean printFooter){ if(printHeader) printHeader(testName); if(content!=null) for(String str : content.keySet()){ System.out.print(str); for(int i=0; i<(30 -s...
10d673cb-da80-463c-87fd-457a26ff20dc
0
public String GetActionToBeTaken() { return action; }
4c686422-5311-4456-a6b6-3a87dd322c7e
8
public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int m = Integer.parseInt(st.nextToken()); int p = ...
e979cace-f83f-4500-89ac-7dfd125baba6
8
public static Stella_Class nativeStorageSlotHome(StorageSlot slot, Stella_Class renamed_Class) { { StorageSlot slotwithknowntype = null; loop000 : for (;;) { if (Surrogate.unknownTypeP(slot.type())) { break loop000; } slotwithknowntype = slot; renamed_Class = Surroga...
eb545a7a-907b-45b4-8462-2bf79f835750
9
public static int sizeOfRawVarLong(final long value) { if ((value & (0xffffffffffffffffL << 7)) == 0) { return 1; } if ((value & (0xffffffffffffffffL << 14)) == 0) { return 2; } if ((value & (0xffffffffffffffffL << 21)) == 0) { return 3; } if ((value & (0xffffffffffffffffL << 28)) == 0) { retu...
b9b2bb2b-a611-45e5-88c4-d9b514622035
6
public String getURLString() throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder(); for (Entry<String,String> entry : data.entrySet()){ if(entry.getKey() != null && entry.getValue() != null && entry.getKey().length() > 0 && entry.getValue().length() > 0 ) encoding.encodeDataPair(s...
d3b549b3-d97e-4591-8f9f-cb27f3474b35
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...
412af9e7-60ed-4b51-adc0-8737028ea89a
4
private static void isAnagram(String first, String second) { if (first.length() == second.length()) { int[] charCount = new int[NUMBER_OF_ASCII]; for (int i = 0; i < first.length(); i++) { charCount[(int)first.charAt(i)]++; charCount[(int)second.charAt(i)]--; } for (int i = 0; i < char...
30374fae-d253-49ca-a2eb-9310b3fe6d38
0
protected void setFoodLevel(int foodLevel) { this.foodLevel = foodLevel; }
8c4d1846-3f92-4e69-9845-7ad7e6e50843
3
public static String join(Iterable<?> items, String glue) { StringBuilder sb = new StringBuilder(); boolean first = true; for (Object item : items) { if (!first) { sb.append(glue); } first = false; sb.append(item); } ...
bbe35c49-c84b-4b5f-a249-d34373913515
7
public static void addNewRow(JTable table, Container controlsContainer) throws Exception { Object[] row = new Object[controlsContainer.getComponentCount()]; Component comp; String item = null; Object objItem; JTextField textField; JComboBox comboBox; for (int i =...
0445abe2-11aa-4361-9b9a-0097772fac8d
6
private String getDigEmptySpace(BoardViewer board, String digIndex) { if (digIndex.equals("\\")) { for (int relativePosition=0; relativePosition < board.getBoardSize(); relativePosition++) { String position = Integer.toString(relativePosition * (board.getBoardSize() + 1)); ...
bcf573f8-f471-4625-b2bf-5bf40401263b
1
public int divide(int _a, int _b) throws DivideByZeroException { if(_b == 0) { throw new DivideByZeroException("Simple.java: Tried to divide by 0."); } return _a / _b; }
f352751e-3cfb-40f4-970a-0d759182663e
0
@Override public boolean propertyDefaultExists(String key) { return default_values.containsKey(key); }
48fb267c-629c-42f8-a842-75ffc25d1821
1
public Object pop() { if (this.top == null) { return null; } else { Object item = top.getHead(); this.top = top.getTail(); return item; } }
6ac1d7b2-ea46-4cfc-96e8-29d1022ae270
2
public void testForFields_time_m() { DateTimeFieldType[] fields = new DateTimeFieldType[] { DateTimeFieldType.millisOfSecond(), }; int[] values = new int[] {40}; List types = new ArrayList(Arrays.asList(fields)); DateTimeFormatter f = ISODateTimeFormat.forFields(t...
ffbc2c5f-fc90-402a-819a-f0ffea6ecba4
0
public OutputFile(String fileName) { //set the config file filename this.fileName = fileName; //open the file for output OpenFile(); }
242701d9-e007-41b4-b60c-3dd6d25b8efd
2
public void setTokenType(int newTokenType) { boolean isValidType = 0<newTokenType && 10>newTokenType; if(isValidType) { this.tokenType = newTokenType; } }
13ddbd7e-408e-423c-bebb-bc93ec1634ce
2
@Override public User findUser(String name) { // TODO Auto-generated method stub for (User user : fdb.getUsers()) { if (user.getName().equals(name)){ return user; } } return null; }
71e8807c-6bbf-4d53-975f-0bda4129adce
0
@Override public Iterable<PlanTicket> filter(Iterable<PlanTicket> source, final TicketPoolQueryArgs args) throws Exception { return Queries.query(source).where(new Predicate<PlanTicket>(){ @Override public boolean evaluate(PlanTicket ticket) throws Exception { long t1 = ticket.getSeat().getSeatTyp...
e93a891e-3018-4268-ad7b-a6d8dac399ce
1
public MemorySourceJavaFileObject(String name, String code) { super(createUriFromName(name), Kind.SOURCE); if (code == null) { throw new NullPointerException("code"); } this.code = code; }
fc054d76-b8d4-4ea2-adfe-37eeca3af1ca
9
private void readLuminance() { int type = sourceImage.getType(); if (type == BufferedImage.TYPE_INT_RGB || type == BufferedImage.TYPE_INT_ARGB) { int[] pixels = (int[]) sourceImage.getData().getDataElements(0, 0, width, height, null); for (int i = 0; i < picsize; i++) { int p = pixels[i]; int...
10e88962-5090-4994-8128-8d839d24e377
6
private void generateLabyrinth(Node2 node) { node.visit(); int x = node.getX(); int y = node.getY(); ArrayList<Node2> surroundingNodes = new ArrayList<Node2>(); if (x > 0) surroundingNodes.add(nodeNetwork[x-1][y]); if (y > 0) surroundingNodes.add(nodeNetwork[x][y-1]); if (x < width - 1) surroundingNodes.a...
e11007d6-0823-43b8-9e36-f2ad8306b7ec
0
public void setNazwisko(String nazwisko) { this.nazwisko = nazwisko; }
e91895e3-b0b8-48af-8fa9-dfa345cdf966
6
private Trainer getTrainerFromCurrentRow(ResultSet results) { Integer id = extractNumber(results,"idEntity"); String valueEntity = extractString(results, "valueEntity"); Trainer t = new Trainer(valueEntity); t.setId(id); ResultSet rs = this.getResultsOfQuery("SELECT ...
12d6a35a-46ff-4b3b-b6dc-f697db93b73d
8
private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 1155, 900); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(null); ImageIcon refreshImage = new ImageIcon(getClass().getResource("ref.png")); JButton btn_Refresh = new JButton("", refreshImage); btn_Refr...
71369a27-b4c7-4bab-b39d-10e27aa45e7d
6
public static void main(String[] args) { CFG.INTERNET = Assistant.isInternetReachable(); Settings.loadSettings(); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e1) { e1.printStackTrace(); } // -- UniVersion & Reporter initialization -- // UniV...
417dd840-e5d5-4e6d-b557-f0d03e0e9217
7
static final String encode(final String s) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == '\\') { sb.append("\\\\"); } else if (c < 0x20 || c > 0x7f) { sb.append("\\u"); if (c < 0x10) { sb.append("000"); } else if (c < 0x10...
91afbe9f-a51c-4c5b-bf6b-92390dd52cd2
7
private int countCharacterInNumber(int pN){ int count = 0; int lastTwo = pN%100; int hundreds = (pN%1000-lastTwo) / 100; int thou = (pN%10000 - hundreds - lastTwo) / 1000; if(lastTwo < 20 && lastTwo > 9){ int toTranslate = lastTwo%10; System.out.println(lastTwo); count+=teens[toTranslate]; } else {...
94fe6bf9-d5f0-4c05-b073-d045a726eb0c
9
public static void main(String[] args) throws IOException { DataTuple[] trainingData = DataSaverLoader.LoadPacManData(); // We have 10 input neurons double[][] pacmanTrainingInput = new double[trainingData.length][]; /* * We'll have four outputs, each for one of possible movement. * The order of ...
1d626287-628d-4331-8ff5-cfb4808d1960
5
public static void setSize(int width, int height) { System.out.println("Target: " +width +", " +height); //get preset screen size int nw = Display.getDesktopDisplayMode().getWidth(); int nh = Display.getDesktopDisplayMode().getHeight(); System.out.println("Native: " +nw +", " +nh); try { //derive big...
a61e57b0-25d8-45b1-b298-c71cc036940c
3
private boolean outOfBounds(int var1, int var2) { return var1 < 0 || var1 >= 32 || var2 < 0 || var2 >= 32; }
d86b2351-f879-4ed3-a713-13c5c7dac9b2
5
public ArrayList<Element> arrangeElement() { ArrayList<Element> operator = new ArrayList<Element>(); int max = elementArray.size(); int Eleindex = 0; int opeindex = 0; for(int i = 0; i < max; i++){ if(elementArray.get(i).elementTrue == true){ arrangeElementArray.add(elementArray.get(i)); Eleindex++...
cfa73151-cfd2-4c6d-8c61-ec92e87f59b4
3
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (qName.equals("currentTime")) getResponse().setCurrentTime(getDate()); else if (qName.equals("cachedUntil")) getResponse().setCachedUntil(getDate()); else if (qName.equals("error")) error.setError(getSt...
d8a22244-0d83-4ce1-8176-ab1c05990864
2
public void doReply(InputStream in, OutputStream out, String cmd) throws IOException, BadHttpRequest { if (cmd.startsWith("POST /rmi ")) processRMI(in, out); else if (cmd.startsWith("POST /lookup ")) lookupName(cmd, in, out); else super.doReply(in,...
87e01dba-98e3-4409-87ca-0685e387edb6
7
@Test public void testDescendingIterator() { ThriftyList<Integer> list = new ThriftyList<Integer>(); Iterator<Integer> ri = list.descendingIterator(); Assert.assertFalse(ri.hasNext()); try { ri.next(); Assert.fail(); } catch (NoSuchElementException e) { } try { ri.remove...
0dadfd82-9f6a-4fcb-a1d1-3c6d1f4c5d46
8
public ArrayList<Integer> searchOR(String str){ int lg = str.length(); int indexOfAnd = str.indexOf(" OR "); String firstElement = str.substring(0 , indexOfAnd); String secondElement = str.substring(indexOfAnd+4,lg); ArrayList<Integer> rs1 = search(firstElement); ArrayLi...
bb4ed4dc-9897-4437-a59f-2c5114c063ef
2
public int[] bytesEnInt(byte[] octets){ int aRetourner[] = new int[octets.length*8]; int curseurInt = 0; for(int i = 0;i<octets.length;i++){ for(int j=0;j<8;j++){ aRetourner[curseurInt] = recupererBit(octets[i],j); curseurInt++; } } return aRetourner; }
cc07844b-e6db-4665-b4c3-d945183f15b2
3
private void _initStreamsterApiInterfaceProxy() { try { streamsterApiInterface = (new com.novativa.www.ws.streamsterapi.StreamsterApiLocator()).getStreamsterApiPort(); if (streamsterApiInterface != null) { if (_endpoint != null) ((javax.xml.rpc.Stub)streamsterApiInterface)._setProperty...
5c7fdc4a-2888-4bb2-9bfe-8173c595647e
8
private static void hamilton(int node, int level) { // Add the current node in the cycle currentCycle[level] = node + 1; if ((START_NODE == node) && (level > 0)) { if (level == GRAPH_SIZE) { // the cycle is hamilton with min sum minSum = curSum; ...
db5c3e36-30c2-4e55-84c8-4bb21e0e9e2b
1
public static void insert(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { // Abort if node is not editable if (!currentNode.isEditable()) { return; } tree.clearSelection(); Node newNode = new NodeImpl(tree,""); int newNodeIndex = currentNode.currentIndex() + 1; Node newNodeParent = c...
9286d8fc-2bbf-47f6-b85f-aa9643094590
5
public void paintComponent(Graphics aGraphics) { int width = this.getWidth(); int height = this.getHeight(); aGraphics.setColor(Color.white); aGraphics.fillRect(0,0,width,height); BufferedImage picture = (BufferedImage)this.createImage(width,height); Graphics aGraphicsBuffer = picture.getGraphics(); aGr...
35541b26-bd96-401f-b813-86a285e6fe3d
1
public int[] nextInts(int n) throws IOException { int[] res = new int[n]; for (int i = 0; i < n; ++i) { res[i] = nextInt(); } return res; }
8965f690-e61f-4d96-a2ac-92794a4f2d9e
3
@Override protected Void doInBackground() throws Exception { Client loginClient = new Client(4096 * 2, 4096 * 2); loginClient.getKryo().register(PacketLogin.class); loginClient.getKryo().register(PacketLoginResponse.class); loginClient.getKryo().register(PacketRequestCaptcha.class);...
b4beb2a6-4d76-4a7f-9a28-55ea4cf35bc5
5
private final int method433(Class39_Sub2 class39Sub2, int i, short word0) { int j = class39Sub2.xPositions[i]; int k = class39Sub2.yPositions[i]; int l = class39Sub2.zPositions[i]; for (int i1 = 0; i1 < anInt2818; i1++) { if (j == xPositions[i1] && k == yPositions[i1] && l ==...
791e4cc4-1734-466f-9904-92ead9d4562a
9
public LogisticRegression(PdfFeatureAwareLogisticRegression pdf, double[] instanceWeights, double[][] featureValues, int[] labels, String type, //Bijection featureMapping, Bijection labelMapping, double[] regularizationWeights, double[] regularizationBiases, double LBFGS_TOLERANCE, int L...
f959327d-b417-47b4-afda-bf800634ba18
4
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); JLPaciente = new javax.swing.JLabel(); JTFPaciente = new javax.swing.JTextField(); JLPerio...
3c43fbde-0af4-4480-ae4a-88184cb110b8
0
public void setEspecialidad(String especialidad) { this.especialidad = especialidad; }
3b1cbdeb-10d9-418d-9a65-7864e8ea37c2
2
@Override public State nextState(Random random) { State newState; int value = random.nextInt(100); if (Utils.isBetween(value, 0, P_MU)) { newState = new Unmodified(); } else if (Utils.isBetween(value, P_MU, P_MD)) { newState = new Deleted(); } else { newState = new Modified(); } return new...
6c555748-8d90-44e7-ba4b-f13a0e5cd8a5
7
public void actionPerformed(ActionEvent ae) { String act = ae.getActionCommand(); this.repaint(); if (act.compareTo("Start") == 0) { b2.setBackground(Color.red); b1.setVisible(false); b2.setVisible(true); b1.setDisplayedMnemonicIndex(0); t = new webserver(); if (t.isRuning()) { t.setRuning...
d9788e0d-ad81-4544-9538-e589beac5664
3
@Override public void mousePressed(MouseEvent event) { if (isEnabled() && !event.isPopupTrigger() && event.getButton() == 1) { mInMouseDown = true; mPressed = true; repaint(); MouseCapture.start(this, Cursor.getDefaultCursor()); } }
f6cd7a7f-f1ff-4584-8ba1-88529dfd529d
5
public static void main(String[] args) { //Bonus problem is worked out below all commented text //Part 1a: Experimenting with if /*Scanner keyboard = new Scanner(System.in); System.out.print("Please enter your age: "); int age = keyboard.nextInt();*/ /* if (age > 20) // no semicolon here!!! { ...
c21f9e7b-57f6-4443-ae1a-d89c2dd7a18e
1
public void testNegated() { Months test = Months.months(12); assertEquals(-12, test.negated().getMonths()); assertEquals(12, test.getMonths()); try { Months.MIN_VALUE.negated(); fail(); } catch (ArithmeticException ex) { // expected ...
586717ea-1217-41be-8970-011b0aa8ba1f
8
public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List) { int var4 = MathHelper.floor_double((par2AxisAlignedBB.minY - World.MAX_ENTITY_RADIUS) / 16.0D); int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxY + World.MAX_ENTITY_RADIUS) / 16.0D); ...
780d76c5-76c4-4f53-80ef-3b1e2168aca3
3
@Override public String execute() throws Exception { try { Map session = ActionContext.getContext().getSession(); Campaign camp = (Campaign) session.get("campa"); CampaignDemography campdemo = new CampaignDemography(); campdemo.setCampaign(camp); ...
6d15a91b-bd09-4481-a1f3-54b8376d011b
2
public void checkMailFiles() { // Order, in dem die Mails liegen File mailDirectory = Proxy.MAIL_STORAGE_PATH.toFile(); // Ordner und Datein im Mailordner File[] mailFiles = mailDirectory.listFiles(); // Auswerten, ob die Dateien, die direkt im Mailordner liegen, bereits // bekannt sind, sonst hinzufuegen. ...
97295c88-a7af-47f5-8d7d-427c614c148e
4
private void chooseStartingTile(Match match, int number) throws RuntimeException { // whoops - must set tile Tile[][] tiles = match.getTiles(); int height = tiles.length; int width = tiles[0].length; if (number == 0) { tile = tiles[0][0]; } else if (number == ...
a0b3e59f-e4f9-460e-8440-e46dff781ee5
9
@Override public boolean equals( Object other ) { if ( other == this ) { return true; } if ( !( other instanceof TDoubleList ) ) return false; if ( other instanceof TDoubleArrayList ) { TDoubleArrayList that = ( TDoubleArrayList )other; if ( that....
776128b7-48fa-4837-b435-1f88166db728
3
int checkFitness(RoomScheme chromo){ Subject subject; int fitness = 0; ArrayList<Integer> subjectsChecked = new ArrayList<>(); //Check conditions for 1 Subjects for(int a=0; a<5; a++){ for(int b=0; b<6; b++){ subject = chromo.rooms[a][b]; if(subj...
c2141587-0e94-4f98-ac4e-6970a0fb3c9e
3
public void reserveBook(int idNumber, String userName) { int numberOfBooksChecked = 0; for (Book item : books) { numberOfBooksChecked++; if ( item.getIdNumber() == idNumber) { AddBookIdAndUserToReservedList(idNumber,userName); myView.th...
152ee73e-fc61-4b58-9277-6575d6a3cd92
1
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String FirstName = request.getParameter("FirstName"); String LastName = request.getParameter("LastName"); String Pho...
ac3b68a4-4244-46eb-8518-2aa05f99eef8
7
private String addOptionalsToLaTex() { String palautettava = ""; if (volume != 0) { palautettava += "VOLUME = {" + volume + "},\n"; } if (series != null) { palautettava += "SERIES = {" + parser.parse(series) + "},\n"; } if (address != null) { ...
c8788a41-f771-461c-afe0-51d09f8fa6f8
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (; ;) { c = next(); ...
466838a2-0826-4c6e-8802-f894a6de12fc
3
public String find(int n) { int ans = 0; int a; while(true){ a = find_f(n); if(a == n)break; ans++; n = n - a; } if(ans % 2 == 1){ return "John"; }else{ return "Brus"; } }
c7803308-25f6-4ea7-bae1-df4fe7b7ba01
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final StockPK other = (StockPK) obj; if (!Objects.equals(this.Pcode, other.Pcode)) { return false; ...
32203069-fecc-41bf-b7e4-7283931202bd
8
private static void show_Statistics(War war) { int hit = 0; int damage = 0; int launched = 0; int intercept = 0; int destroyed_launcher = 0; for (EnemyMissile missile : war.getAllMissiles()) { if (missile.getMode() == EnemyMissile.Mode.Hit) { hit += 1; launched += 1; damage += missile.getDama...
49564636-42d0-4eb5-9daf-275c99521947
9
@Override public int loadGame(String name) throws IOException{ XStream xstream = new XStream(); File file = new File("saves/" + name + ".xml"); ServerModel game = (ServerModel) xstream.fromXML(file); ArrayList<Road> roads = game.getMap().getRoads(); ArrayList<Settlement> settlements = game.getMap().getSet...
4a03a319-b907-4850-b6b6-0c8e9505f80c
2
public Display getActiveDisplay() { for(Display display : displays) { if(display.isActive()) { return display; } } return null; }
8c3d8b24-fc97-4973-ab24-d7467c6b084f
4
public boolean quizTaken(int week, User user) { PreparedStatement statement = null; Connection connection = null; try { try { connection = data.getConnection(); statement = connection.prepareStatement("SELECT week FROM UserQuiz WHERE week = ? AND userName = ?")...
5cef0fc2-d735-41cf-abfa-9db6345c66e7
0
public boolean getOpenHr(int i, int j){ return openHr[i][j]; }
ea14225b-301f-4bf2-ad85-b9a813171302
9
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { Vector<String> origCmds=new XVector<String>(commands); if(CMLib.flags().isSleeping(mob)) { CMLib.commands().doCommandFail(mob,origCmds,L("You are already asleep!")); return false; } final Roo...
95a0ec94-fdb8-4c09-bcbd-f203d4a6b788
2
private void push(JSONObject jo) throws JSONException { if (this.top >= maxdepth) { throw new JSONException("Nesting too deep."); } this.stack[this.top] = jo; this.mode = jo == null ? 'a' : 'k'; this.top += 1; }
e0b9e22d-426a-4a09-a041-6aa4e71d63e0
8
public boolean PerformTestNav() { if (AboutUsTest() && TestImage(0)) { driver.get(baseUrl); if (MenuTest() && TestImage(1)) { driver.get(baseUrl); if (ServicesTest() && TestImage(2)) { driver.get(baseUrl); if (ContactTest() && TestImage(3)) { driver.get(baseUrl); return true; ...
d3a03d57-8d83-4d8e-863f-d2736c38da41
2
@Override public void setPlayers(PlayerInfo[] value) { //set header label indicating how many players are still needed String labelText = ""; if(value.length == NUMBER_OF_PLAYERS){ labelText = "This game is ready to go!"; //addAiButton.setEnabled(false); } else{ labelText = ("Waiting for Players: Ne...
4570ed34-9666-4d22-8381-58af1b262b62
5
public static RenderMaster getRenderMaster() { if(renderMaster != null) { return renderMaster; } try{ Display.setDisplayMode(new DisplayMode(800, 600)); Display.create(); } catch (Exception e) { System.out.println("RenderMasterFactory Failing hardcore " + e); System.exit(-1); } i...
0f5b07a4-cd5e-46f7-af61-f46be3480dcf
4
@Override public void keyTyped(KeyEvent e) { if(keyBind[0]){ SubTerra.getLevel().p.move(0, -1); } if(keyBind[1]){ SubTerra.getLevel().p.move(0, 1); } if(keyBind[2]){ SubTerra.getLevel().p.move(1, 0); } if(keyBind[3]){ ...
f9ee43e0-a508-439f-8067-a8ca2fbc1505
7
public boolean checkFields(JTextField name, JTextField direction, JTextField speed, JTextField rowField, JTextField columnField) { if (name.getText().equals("") || direction.getText().equals("") || speed.getText().equals("") || rowField.getText().equals("") || columnField.getText().equals("")) { ...
698e7704-8e1b-4b86-bdb6-3d6860298093
1
public boolean setShutdownmenuButtonHeight(int height) { boolean ret = true; if (height < 0) { this.buttonShutdownmenu_Height = UISizeInits.SHDMENU_BTN.getHeight(); ret = false; } else { this.buttonShutdownmenu_Height = height; } somethingCha...
9855419c-1017-46d5-8525-08678ee72b72
0
public void setCompany(Company company) { this.company = company; }
d803abd5-d0e2-44e1-920f-020917754a4e
2
private void initializeFilter() throws CustomFilterException { String regExFilter = this.configuration.getRegExFilter(); if (regExFilter == null) { String[] customFilter = this.configuration.getCustomFilter(); if (customFilter == null) { this.logger.setFilter(null); } else { CustomFactory filterFac...
2741b869-ad28-4135-9199-ae97c19f5486
1
public void afficherVisiteur(Visiteur unVisiteur){ this.vue.getjTextFieldNom().setText(unVisiteur.getNom()); this.vue.getjTextFieldPrenom().setText(unVisiteur.getPrenom()); this.vue.getjTextFieldAdresse().setText(unVisiteur.getAdresse()); this.vue.getjTextFieldCP().setText(unVisiteur.get...
71399a7d-9164-479e-bc01-4bf7454c8b54
7
private void jButtonGuardarNovoFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGuardarNovoFornecedorActionPerformed // BOTAO GUARDAR NOVO FORNECEDOR -> JANELA NOVO FORNECEDOR String nome = jTextFieldNomeFornecedor.getText(); String morada = jTextFieldMoradaFor...