method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
71329db6-a485-4d2a-acc5-e6492bce4130
4
@Override public boolean update(Particulier x) { Statement stm = null; try { String req = "UPDATE particulier SET \n" + "email=\""+x.getEmail()+"\",\n" + "motdepasse=\""+x.getMotDePasse()+"\",\n" + "nom=\""+x.getNom()+"\",\...
dd95b9b8-d03d-4ffa-9ed9-5c8bcc636ea2
3
public void level() { level++; System.out.println("You are now level " + level + "!"); String choice = ""; while (!choice.equals("intelligence") && !choice.equals("strength")) { System.out.println("Increase intelligence or strength: "); choice = input.next().toLowerCase(); } System.out.println("Pick ...
828d10fc-738e-45c8-9603-fe9297c8cfca
1
private double calculateWavedX(double x1, double x2, double x3, double f1, double f2, double f3) throws ArithmeticException{ double r23 = Math.pow(x2, 2) - Math.pow(x3, 2), r31 = Math.pow(x3, 2) - Math.pow(x1, 2), r12 = Math.pow(x1, 2) - Math.pow(x2, 2), ...
d4c43082-f4c7-473c-ab64-1902e2446cff
5
@Override public DataTable generateDataTable (Query query, HttpServletRequest request) throws DataSourceException { DataTable dataTable = null; try (final Reader reader = new FilterCsv (new BufferedReader (new InputStreamReader (new URL (this.urlYahoo).openStream())))) { TableRow row = new TableRow (); ...
5122b25f-7d1e-4ac9-bf14-c1528ca073fc
4
static public void main(String args[]) { String[] argv; long start = System.currentTimeMillis(); int argc = args.length + 1; argv = new String[argc]; argv[0] = "jlc"; for(int i=0;i<args.length;i++) argv[i+1] = args[i]; jlcArgs ma = new jlcArgs(); if (!ma.processArgs(argv)) System.exit(1); Con...
e3a958db-5806-4509-a719-4617a53188c4
2
private static ClassSignature parseSig(String sig) throws BadBytecode, IndexOutOfBoundsException { Cursor cur = new Cursor(); TypeParameter[] tp = parseTypeParams(sig, cur); ClassType superClass = parseClassType(sig, cur); int sigLen = sig.length(); ArrayList ifArray ...
bea03fd6-9f24-4e7d-9fee-1ef92ab8d1d5
8
private boolean r_perfective_gerund() { int among_var; int v_1; // (, line 71 // [, line 72 ket = cursor; // substring, line 72 among_var = find_among_b(a_0, 9); if (among_var ...
f9d72dac-f741-4e5c-8251-8358efccc38b
0
public void generate(){ }
cfb0ae23-d065-405e-bb40-d8029aee9314
2
@SuppressWarnings("StringConcatenationMissingWhitespace") private void writeObjectToStream(Object obj, Types t, String name, DataOutputStream os) throws IOException { //Write Name os.writeUTF(name); //Write Type os.writeInt(t.ordinal()); //Write Value switch(t) { case OBJECT_ARRAY: case ISAVEABLE: {...
b13cbb17-6b2a-4022-96ce-24899c09f08d
6
public static void Edmonds(Graph input) { input.setState(States.ARR_ADJ); Log.print(Log.system, "Edmonds algorithm:"); // init... n = input.getVertexCount(); used = new boolean[n]; blossom = new boolean[n]; mt = new int[n]; p = new int[n]; q = new int[n]; base = new int[n]; Arrays.fill(mt, -1); ...
8e38722b-2fee-42a8-b494-9675b8367a48
5
public void createMaze(String filePath) { try { reader = new BufferedReader(new FileReader(filePath)); int i = 0; while ((line = reader.readLine()) != null) { parts = line.split("\\s"); for (int j = 0; j < MicromouseRun.BOARD_MAX; j++) { ...
853cad1a-93bf-42a9-bcfe-dacb815f8237
0
public BubbleSorter() { // TODO Auto-generated constructor stub }
c86c2870-7929-4b76-97e3-1b929f9b2413
1
public JPanel getBrandingMenu() { if (!isInitialized()) { IllegalStateException e = new IllegalStateException("Call init first!"); throw e; } return this.brandingMenu; }
19b0f9db-a968-4620-b421-1663a73b6214
8
public ComparisonResult findGenes(Chromosome other) { ComparisonResult comparisonResult = new ComparisonResult(); // знаю имя координаты нужного гена, найти нужный домен comparisonResult.sizeGenes = other.intervals.size(); System.out.println(other.intervals.size()); for (Interval domain:...
a1dbebbf-ab8e-45e4-977f-5e1581243195
7
@SuppressWarnings("CallToThreadDumpStack") private ArrayList<FieldCandidate> split_line(ArrayList<FieldCandidate> candidates, int start, int maxFields) { ArrayList<FieldCandidate> selectedCandidates = new ArrayList<>(); try { for (int posList = start; posList < candidates.size(); posLi...
4af946d3-b1a0-48a6-9d58-d475f4e4c842
0
private void startGame() { Timer.getInstance().start(); SoundManager.getInstance().playStartSound(); }
a3ac07b6-7124-4976-8985-64f105b0a25c
2
public static List<ClienteDTO> convertToDTOList(List<Cliente> lsClientes){ if(lsClientes == null){ return new ArrayList<ClienteDTO>(); } List<ClienteDTO> lsClientesDTO = new ArrayList<ClienteDTO>(); for(Cliente cliente : lsClientes){ lsClientesDTO.add(convertToClienteDTO(cliente)); } return l...
c6198485-753c-46de-ab74-d73e192e686c
0
public void setSkill(int skill, String name, int value, int cost, String description) { assert numOfSkills > skill; this.skillNames[skill] = name; this.skillValues[skill] = value; this.skillCosts[skill] = cost; this.skillDescriptions[skill] = description; }
453344f4-512d-4a40-a7b5-054027aa3037
3
@Override public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((firstName == null) ? 0 : firstName.hashCode()); result = PRIME * result + ((id == null) ? 0 : id.hashCode()); result = PRIME * result + ((lastName == null) ? 0 : lastName.hashCode()); return result; ...
23fccf09-0539-44da-9404-7c5470fec327
4
public String tileIDToStr(int tileid) { if (tileid==0) return ""; StringBuffer tilestr = new StringBuffer(""+(char)(tileid&255)); if (tileid >= 0x100) tilestr.append( (char)((tileid/0x100)&255)); if (tileid >= 0x10000) tilestr.append( (char)((tileid/0x10000)&255)); if (tileid>=0x1000000) tilestr.append( (char...
9aea23a9-8108-446c-9d2c-9b7e9d18d784
9
public List<Interval> merge(List<Interval> intervals) { if (intervals == null || intervals.size() < 2) return intervals; // First need to sort all the intervals based on the start time. // Sort with comparable. Collections.sort(intervals, new Comparator<Interval>() { @Override public int compare(Interv...
c960bff5-1d38-4d13-a6bc-2f1f361ad4d9
5
public int maxProfit(int[] prices) { int length = prices.length; if(length == 0) return 0; int[] history = new int[length]; int[] furture = new int[length]; int maxProfit=0; int valley = prices[0]; int peak = prices[length-1]; for(int i =0 ; i<...
f825b1c7-3dbf-48e8-a019-32cfc913237e
0
public LockEventListener(LockManager manager){ this.manager = manager; }
052d7bfd-e5dc-4d66-b71f-a47212803ac1
9
private java.util.ArrayList<Binding> getBindings(String PortBinding){ NodeList Definitions, ChildNodes; NamedNodeMap attr; String BindingName, BindingType, BindingStyle, BindingTransport; Binding Binding = null; java.util.ArrayList<Binding> arrBindings ...
8980d5ec-c733-46e2-bcf4-d3b6ed7a1d0c
1
public static boolean Refill(PatientProfilePage pProfileP) { prescIDL=new JLabel("Prescription ID"); prescID = new JTextField(10); MyPanel = new JPanel(); MyPanel.add(prescIDL); MyPanel.add(prescID); int n = JOptionPane.showConfirmDialog( null,MyPanel, ...
70929527-39f9-4137-a416-fd0dbc8a918c
5
@Override public JTable search(String searchTerm) { displaysearch = new String[result.length][result.length]; int n = 0; for(int i = 0; i < result.length; i++){ for(int j = 0; j < result[i].length; j++){ if((result[i][j].toLowerCase()).contains(searchTerm)){ displaysearch[n]= result[i]; ...
8a023d05-cef8-438c-ae4f-feced80bb18f
3
protected static boolean buscarPalabraDescripcion(String buscar){ boolean aux=false; //buca en cada linea del fichero si en la "casilla " descripcion hay la cadena que se esta buscando //si encuentra alguna coincidencia imprimira toda la linea try{ BufferedReader stdin=Files.newBufferedReader(path,java.n...
16123cdb-5ece-4349-b10f-7db775996436
7
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = "", data[]; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int test = Integer.parseInt(line.trim()); ...
a806df67-c5e6-48a6-87e6-2e8383abf1f0
9
private boolean checkColumns(Player player) { boolean isWinner = false; if ((board[0][0].equals(player.getMark()) && board[0][1].equals(player.getMark()) && board[0][2].equals(player.getMark()))) { winnerCombination[0] = "0 0"; winnerCombination[1]...
7b51ee1d-59bb-4318-940a-b377c7271e79
8
public int candy(int[] ratings) { assert (ratings != null) : "Please input ratings!"; int len = ratings.length; if (len == 0 || len == 1) return len; int[] dp = new int[len]; // left -> right for (int i = 1; i < len; i++) { if (ratings[i] > ratings[i - 1]) { dp[i] = dp[i - 1] + 1; } } /...
f4fd1e04-1308-4c08-99ca-08987700ea63
7
public int numDecodings(String s) { if (s == null || s.length() == 0) { return 0; } int[] nums = new int[s.length() + 1]; nums[0] = 1; nums[1] = s.charAt(0) != '0' ? 1 : 0; for (int i = 2; i <= s.length(); i++) { if (s.charAt(i - 1) != '0') { nums[i] = nums[i - 1]; } int twoDigits = (s.char...
a3cc407e-5c8a-4e6a-8292-cc6486583604
8
@SuppressWarnings("unchecked") private void parseQuery(String query, Map<String, Object> parameters) throws UnsupportedEncodingException { if (query != null) { String pairs[] = query.split("[&]"); for (String pair : pairs) { String param[] = pair.split("[=]"); String key = null; String value ...
06a0aeb3-d62e-47cb-bed1-170400fcc4cd
9
public int largestRectangleArea(int[] height) { if (height.length == 0) return 0; int max = 0; int[] f,g; f= new int[height.length]; g= new int[height.length]; f[0] = -1; g[height.length-1] = height.length; for (int i = 1;i< height.length;i++) { ...
003d6b61-eddb-4026-97de-1ecc1bc7d1f3
8
public void updatePosition() { if (xPos < xDestination) xPos++; else if (xPos > xDestination) xPos--; if (yPos < yDestination) yPos++; else if (yPos > yDestination) yPos--; if (xPos == xDestination && yPos == yDestination && isMoving==...
d5422152-84f6-4943-9e32-48f76d0455bb
2
public static void main(String[] args) { Display display = Display.getDefault(); Shell shlCmss = new Shell(); shlCmss.setSize(562, 236); shlCmss.setText("CMSS"); Group group = new Group(shlCmss, SWT.NONE); group.setText("Current crisis"); group.setBounds(10, 10, 544, 194); Button button = new B...
251b1f55-25bb-4b70-902c-4638704f6d6b
0
@Override public double getHig() { return hight; }
38c346e5-d193-499b-bcf7-e49891130251
0
Xpp3Dom createResult(final TestState testState) { return createElementWithText("result", testState.getState()); }
2cec2361-21a6-4746-975e-2ef8f2c6ae37
8
public static String writeObj(final Object object) { String result = null; if (object instanceof Long) { Long longObj = (Long) object; result = writeInt(longObj); } else if (object instanceof Integer) { Integer intObj = (Integer) object; result = w...
f25c000c-bfc8-480b-a71c-fce06a02ab2e
4
private OutputStream getOutputStream(final String s) { return new OutputStream() { StringBuffer o = new StringBuffer(); boolean done = false; @Override public void write(int b) throws IOException { if (b == '\n' && !sync) { sy...
ffe89b6d-90b7-4fd1-9f23-ae46bd7ef65a
1
public void testConstructorEx9_TypeArray_intArray() throws Throwable { int[] values = new int[] {3, 0}; DateTimeFieldType[] types = new DateTimeFieldType[] { DateTimeFieldType.dayOfMonth(), DateTimeFieldType.dayOfWeek()}; try { new Partial(types, values); fail...
fabda362-8b93-407b-807f-200f96ea2563
4
@Override public void visitTypeInsn(final int opcode, final String type) { Item i = cw.newClassItem(type); // Label currentBlock = this.currentBlock; if (currentBlock != null) { if (compute == FRAMES) { currentBlock.frame.execute(opcode, code.length, cw, i); ...
c0a004a5-9205-4e30-8a08-64181cbef279
2
public void addContestant(Contestant c) throws InvalidFieldException { if (allContestants.size() == numInitialContestants) { System.out.println("Too many contestants."); return; } if (isContestantIDInUse(c.getID())) { throw new InvalidFieldException( InvalidFieldException.Field.CONT_ID_DUP, "C...
fd57fbfd-c5ae-40be-8070-27d4e6652a06
1
public void addToggleButtonListener(ActionListener listener){ toggleBtn.addActionListener(listener); if(disableAction != null) disableAction.addActionListener(listener); }
4ea6a4b5-9b6e-4c8c-b391-e144cc0b3775
0
@Test public void runTestActivityCommunication1() throws IOException { InfoflowResults res = analyzeAPKFile("InterAppCommunication_ActivityCommunication1.apk"); Assert.assertEquals(1, res.size()); }
8e6de816-002c-4c14-9c72-a214490cb5a0
0
public void setState(String state) { this.state = state; }
245a6455-d221-42f9-9a25-f3056858fa7f
1
public void setStoredValueAsString(String storedValueAsString) { this.storedValueAsString = storedValueAsString == null ? "" : storedValueAsString; }
21153ba5-427b-43d2-8f22-07f6886c008a
1
public Type getCanonic() { int types = possTypes; int i = 0; while ((types >>= 1) != 0) { i++; } return simpleTypes[i]; }
e7e57f47-7c37-4161-b1df-6ab101f986e0
0
public Term getTerm() { return term; }
417519e3-457d-4ea4-84ac-8f7a3f5c4978
6
public Point getSideLocation(TileColor face) { Point offset = new Point(150, -25); if (face.equals(TileColor.orange)) return new Point(offset.x, frameSize.height / 2 - squareSize / 2 + offset.y); else if (face.equals(TileColor.white)) return new Point(offset.x + squareSize, frameSize.height / 2 - squareSize...
dffaae69-b6c8-404e-91a2-e892be473231
0
public String getIpaddress() { return ipaddress; }
432047e3-8466-4419-9c39-78d2d5fa259c
7
public void addAll(Profile[] p, byte gameID){ Game g = GameFactory.getGameFromID(gameID); for(int i=0; i<p.length; i++){ if(profiles.length == size) profiles = Arrays.copyOf(profiles, size+3); // Check if the profile is already in use ...
495363d6-551d-4ecc-b828-8905e604fd7d
9
public void refineTree() throws Exception { int nniCount = 0; switch( ntype ) { case OLS: if ( btype != balance.OLS ) T.assignAllSizeFields(); T.makeOLSAveragesTable(D,A); nniCount = T.NNI(A,nniCount); T.assignOLSWeights(A); break; case BAL: ...
fd70b1da-2dcb-489e-be89-4a11832a5c63
4
public static <T> boolean binarySearch(ArrayList<T> list, T item, Comparator<? super T> cmp) { int comparison= cmp.compare(list.get(list.size()/2), item); if(comparison != 0) { //If we go to the bottom of the tree and there is like roots that are unequal then its not in the list. if(list.size() <= 1) ...
5623a5b4-5a74-47e5-9fac-9f253945b351
3
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (fsin.getPos() < end) { if (readUntilMatch(startTag, false)) { try { buffer.write(startTag); if (readUntilMatch(endTag, true)) { value.set(buffer....
c0f47ad5-459b-4bf7-a29b-7e31e1b62b31
3
public void setRight(PExp node) { if(this._right_ != null) { this._right_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); ...
76da7080-6a63-436b-a265-6f009c3ff514
0
public T getSecond() { return second; }
adca4b03-3688-49b6-bf26-43b50ef142df
4
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: List<String> pelaajat = new ArrayList<String>(); if(!jTextField2.getText().isEmpty()) { pelaajat.add(jTextField2.getText()); } ...
997bb833-9e00-456e-80c3-1669f273258b
1
@Override public boolean setFromString(String value) { this.strings=value.split("\\x00"); if(strings.length==0) { this.strings=null; } return true; }
bb35dce0-2ee4-4142-8e92-fee9bcdcb345
8
public void testInvariants() { assertTrue(!(moteur.estFini() && !((moteur.combat().alex().estVaincu() && moteur .combat().ryan().estVaincu()) || moteur.combat().slick() .estVaincu()))); assertTrue(!(moteur.resulatFinal() == Resultat.GAGNEE && !(moteur .combat().slick().estVaincu() && (!moteur.combat().a...
e0b67a7a-a1e9-467c-97ee-0184211a8f9b
4
public boolean fill() { Random rand = new Random(); boolean modified = false; for (int i = 0; i < height; i++) { for (int j = width - 1; j >= 0; j--) { if (contentGrid[i][j] instanceof EmptyCase) { if (j == 0) { contentGrid[i][j] = listOfContents.get(rand .nextInt(listOfContents.size()))...
e73ceff1-5758-4e9e-b1ab-caebe175576c
3
public int getResponseCode() throws IOException { int code = 0; try { code = con.getResponseCode(); } catch (FileNotFoundException fnfex) { code = HttpConnection.HTTP_NOT_FOUND; } catch (IOException ioex) { if (ioex.getMessage().starts...
9ddd71c5-1b73-4c67-bcb6-2e1b27081621
9
public boolean birthChecker() { switch (state) { case NONE: // If leftHand is below leftElbow which is below leftShoulder (or right) if (GestureInfo.gesturePieces[GestureInfo.LEFT_HAND_DOWN] && GestureInfo.gesturePieces[GestureInfo.RIGHT_HAND_D...
ffe1d49a-548f-4426-a1ad-49261a2b7f41
8
@Override public void mouseClicked(MouseEvent arg0) { PictureLabel label = (PictureLabel) arg0.getSource(); if (SwingUtilities.isLeftMouseButton(arg0)) { switch (label.getText()) { case "Quest": for(int i = 0; i < Main.begin.getSize(); i++){ Main.begin.getCards()[i].getName(); Main.be...
c808eb6d-4532-471a-96c8-763be8cb0ab9
0
public void setSocketListen(ServerSocket socketListen) { this.socketListen = socketListen; }
4b8940aa-e288-4d39-bbc2-b4a9379db073
3
public static void asm_rlf(Integer befehl, Prozessor cpu) { // TODO Integer f = getOpcodeFromToBit(befehl, 0, 6); Integer d = getOpcodeFromToBit(befehl, 7, 7); Integer result = cpu.getSpeicherzellenWert(f); result = result << 1; if(result > 255) { result -= 256; if(cpu.getStatus().getBit(bits.C)) { ...
e42e7508-3e68-4a5e-bea6-a631a9e42af7
5
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) { Type type = typeToken.getType(); Class<? super T> rawType = typeToken.getRawType(); if (!Map.class.isAssignableFrom(rawType)) { return null; } Class<?> rawTypeOfSrc = $Gson$Types.getRawType(type); Type[] keyAndValueTyp...
bcc33c19-81bc-42fe-a606-4e699da5297f
0
public Object clone()throws CloneNotSupportedException { throw new CloneNotSupportedException(); }
496271cb-ef2d-4f12-9617-3dbf8102fe7a
9
private void closeOpenReport() throws Exception { LedgerOverview ledgerOverview = getLedgerOverview(); if (ledgerOverview == null) { throw new Exception("Could not find ledger overview."); } String ledgerUri = null; for (String uri : ledgerOverview.uris) { ...
643007fb-12cd-406c-95d0-f4593a9829ec
6
public void mouseMoved(MouseEvent e) { MouseCoords = Board.fromScreenSpace(e.getPoint()); if (engine != null) engine.mouseChanged(); if (!editable) return; if (!boardBox.contains(e.getPoint())) return; Rectangle2D testPt = new Rectangle2D.Double(e.getX() - 5, e.getY() - 5, 8, 8); boolean hit = ...
3ac27c8d-53f0-4212-8253-062f0ea1f249
3
public static String remove(String s, char c) { //Quick corner case maybe not needed if(s.length() == 0) { return s; } StringBuilder sb = new StringBuilder(); for(int i=0; i< s.length(); i++) { if (s.charAt(i)!= c) { sb.append(s.charAt(i)); } } return sb.toString(); }
1a4e6d71-21ab-4c65-ab10-2096ce8f6f69
2
public void buyPickaxe() { if (this.game.chestOpen && this.chestWood >= 10) { // unlock stone this.pickaxe = true; this.chestWood -= 10; } }
1e483d33-66bc-43b9-bc73-3e1ca46bf44b
1
public Class<?> getReturnType() { return this.returnParam; }
6e3b6cdf-acd9-4c53-97aa-afbc0cc51472
3
public static String fastaSimpleRead(String fastaFile) { StringBuilder sb = new StringBuilder(); BufferedReader inFile; try { // Open file (either 'regular' or gzipped) inFile = Gpr.reader(fastaFile); if (inFile == null) return ""; // Error opening file String line = inFile.readLine(); // Discard fi...
22143d36-7c8f-4ae2-9a34-4ca398baa4af
1
public void testConstructor_8int__PeriodType3() throws Throwable { try { new Period(1, 2, 3, 4, 5, 6, 7, 8, PeriodType.dayTime()); fail(); } catch (IllegalArgumentException ex) {} }
e6ab8bd2-0f4b-4b7a-9b06-27ae1b30aa44
2
public boolean removeGeneric(String generic_name){ Generic sgl; boolean item_found = false; for(int i=0;i<generics.size();i++){ sgl = (Generic) generics.get(i); if (sgl.name.equals(generic_name)){ item_found = generics.remove(i) != null; break; } } return item_found; }
70740787-4530-4302-99d7-9997552db5b5
2
public static NotificationType get(int typeID) { for (NotificationType notificationType : values()) { if (notificationType.getId() == typeID) return notificationType; } return UNKNOWN; }
d93c1f09-d3ff-4616-9540-faea5ab2fd3e
5
public void genera() { iDir = ((int) (Math.random() * 5 + 1)); Objeto objFire = new Objeto(0,0,imaFire11); switch (iDir) { case 1: //Fire1 objFire.setX(400); objFire.setY(550); objFire.setImagen(imaFire11); b...
487e4c62-319b-4331-9e41-695784e9bcbe
2
public void run() { try { while (true) { monitorThreadPool(); Thread.sleep(monitoringPeriod * 1000); } } catch (Exception e) { log.error(e.getMessage()); } }
7fd71ad0-bff0-4e29-88dd-3e8ac6ba4937
0
public void reinforce() { }
d4962206-cb08-4b79-8d91-e4c0688ffccc
2
public void readPic(int width, int height, int startFrame, int framesToBeCoded, ArrayList<Picture> picList) { int widthC = width >> 1; int heightC = height >> 1; for (int framesNo = startFrame; framesNo < startFrame + framesToBeCoded; framesNo++) { Picture picTemp; if (startFr...
1d921cc4-53a5-488d-b4cb-1227a74d7b97
1
public static void setMaxAge(int max_age) { if (max_age >= 1) Grass.max_age = max_age; }
e94fd0be-9883-4ff4-9dd9-cac2b65825c2
6
public static void main(String[] args) { LOG.log(Level.FINE, "start aplikacji"); List<Klient> klienci = load(); Scanner sc = new Scanner(System.in); while(true) { pokazMenu(); int i = czytajLiczbeZKlawiatury(sc); ...
7448f40c-85c9-4091-bac7-256dda5842ec
4
private HashSet<Integer> calcTargets(int start, int steps, HashSet<Integer> targets, HashSet<Integer> visited) { // This is our recursive function that creates the targets list. steps = steps - 1; visited.add(start); if(getCellAt(start).isDoorway()) { targets.add(start); } else if(steps == 0) { targets....
5e44b441-64dc-4d4f-9910-243ce5e2ad26
6
@Override public void paint(Graphics g) { super.paint(g); for (Entry<State, Point> node : statePositionList.entrySet()) { for (State followingState : node.getKey().getFollowingStates()) { Point followingPosition = statePositionList.get(followingState); g.setColor(Color.BLACK); drawArrow(g, calcula...
719de228-ef4a-4eed-a237-20d0ff0f70db
5
@Override public void OnTimerTick(Room Room, RoomUser PetUser) { int timenow = Room.Environment.GetTimestamp(); if(timenow < NextThink) return; int r = Room.Environment.GetRandomNumber(1, 35); if(r == 1) { PetUser.MoveTo(Room.Environment.GetRandomNumber(1, Ro...
51f152b6-3755-4cfa-880b-f5d46c7eb1ba
0
public SimpleStringProperty addressTypeProperty() { return addressType; }
a30a53f7-869a-4be0-a4ed-24c62d31bc88
2
public String _toString () { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("toString", true); $in = _invoke ($out); String $result = $in.read_string (); return $result; ...
7e6ea6a2-cf42-4b4d-82d1-6f6353a21233
3
public String getTypeString(Type type) { if (type instanceof ArrayType) return getTypeString(((ArrayType) type).getElementType()) + "[]"; else if (type instanceof ClassInterfacesType) return getClassString(((ClassInterfacesType) type).getClassInfo()); else if (type instanceof NullType) return "Object"; ...
d5da13d8-e191-4341-826d-478769012172
9
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(affected instanceof MOB)) return super.okMessage(myHost,msg); final MOB mob=(MOB)affected; if((msg.amITarget(mob)) &&(CMath.bset(msg.targetMajor(),CMMsg.MASK_MALICIOUS)) &&(msg.targetMinor()==CMMsg.TYP_CAST_SPELL) &...
41bafc69-e613-4e84-a8e5-b9166b506037
7
private int[] generateRow(int[] input) { LinkedList<Integer> checkList = new LinkedList<Integer>(); Random r = new Random(); int row[] = new int[9]; for(int i=1; i<10; i++) checkList.add(i); for(int i=0; i<9; i++){ int num = Math.abs(input[i]); if(num>9||num==0) row[i]=0; else{ row[...
4c7e60e1-abb3-4f0d-afbe-13eac4d9a154
5
public static void main(String[] args) { Scanner in = new Scanner(System.in); char grade = in.next().charAt(0); switch (grade) { case 'A': System.out.println("Excellent"); break; case 'B': System.out.println("Good");...
af9c3b9d-61fe-4bd4-a23f-0022a3c00c24
5
public void renderLights(){ for(LightSource source : lightSources){ calculateShadows(source); } for(Player e : players){ if(e.light != null) calculateShadows(e.light); } for(Mob e : mobs){ if(e.light != null) calculateShadows(e.light); } }
dd66bdb4-02ed-4011-b8ce-6858fec6ecfd
0
@Override public String toString() { return this.file + "" + this.rank; }
c7f0b5f4-1801-42d4-ac03-c73cb0f16f09
4
private static GridResourceWithFailure createGridResource(String name, double baud_rate, double delay, int MTU, int totalPE, int totalMachine, int rating, String sched_alg) { // Here are the steps needed to create a Grid resource: // 1. We need to crea...
2a7e778e-3e4d-476a-8577-b0a27260aec0
1
public boolean hasNext() throws Exception { if (!tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(reader.readLine().trim()); return hasNext(); } return true; }
6e58cd53-234e-4db0-a336-c10c86de1101
8
@Override protected boolean execute(Widget widget, MouseEvent event) { final Widget c = parent != null ? parent : widget; switch (event.getID()) { case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_RELEASED: pressedPoint = null; initialXOffset...
04cdf459-e262-4fa6-b295-c4027d6c3e37
3
public Tablero(){ super(); setBackground(new Color(0,0,0)); tortuga =new Tortuga(); liebre = new Liebre(); pista = new Pista(); setLayout(null); ltortuga=new JLabel(""); ltortuga.setForeground(new Color(126,176,175)); ltortuga.setLocation(30,100); ltortuga.setSize(400, 25); lliebre=new JLabel("...
ebc3e436-2675-49af-a285-bffcb4c276b2
1
public void reset(){ Object[] data; try { data = Parser.parse(Constants.LEVEL_FILENAME); world = new World((List<Entity>)data[0], (List<Tile>)data[1], (List<PickUpObject>)data[2], (Player)data[3]); player = (Player)data[3]; lastJump = 0; lastRedraw = 0; cam = new Camera(); hud = new HUD(); w...
32b5d7ce-0705-4d54-b146-3be9e963c48a
3
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(false); double totaal = 0; if (session != null) { @SuppressWarnings("unchecked") Map<Integer, Integer> mandje = (HashMap<Integer, Integer>) session....
ea05b3a1-104e-4d97-8de0-8152df23c274
9
private void resetTargetsIfNeeded() { if(runawayTarget[0] == x && runawayTarget[1] ==y){ runawayTarget[0] = -1; runawayTarget[1] = -1; } if(foodTarget[0] == x && foodTarget[1] == y){ foodTarget[0] = -1; foodTarget[1] = -1; randomTarget[0] = -1; randomTarget[1] = -1; } if(foodTarget[0]>0 && f...