method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b95f8713-e816-4039-a6f3-a786a7d31e11
2
private String checkUser(String message) { String response; String[] temp = message.split(" "); if (temp.length >= 2) { if (internAccounts.containsKey(temp[1])) { response = "+OK"; userName = temp[1]; } else { response = "-ERR User" + temp[1] + " not found"; } } else { response = "-ERR N...
0dc6c25d-b7ca-4455-b734-ffe5a29c16c6
3
private void init(int version) { //Initializing Game States according to the given Grid in the Spec this.States = new State[6][6]; //i is horizontal X value, j is vertical Y value for(int i = 0; i < this.States.length; i++) { for(int j = 0; j < this.States[0].length; j++) { this.States[i][j] = new ...
17ae5a7d-2083-40fb-8dbb-cc4de802ba4d
6
public void keyPressed(KeyEvent event) { switch (event.getKeyCode()) { case KeyEvent.VK_SHIFT: b1 = true; break; case KeyEvent.VK_CONTROL: b2 = true; break; case KeyEvent.VK_LEFT: bl = true; break; case KeyEvent.VK_UP: bu = true; break; case KeyEvent.VK_DOWN: bd = tr...
cbbfb8e7-b298-4f00-b927-6eeb0cdc1eef
2
public void calcDeriv(){ double p=0.0D,qn=0.0D,sig=0.0D,un=0.0D; double[] u = new double[nPoints]; d2ydx2[0]=u[0]=0.0; for(int i=1;i<=this.nPoints-2;i++){ sig=(this.x[i]-this.x[i-1])/(this.x[i+1]-this.x[i-1]); p=sig*this.d2ydx2[i-1]+2.0; this.d2ydx2[i]=(sig-1.0)/p; ...
ce77e30a-4528-43a3-9441-dc699097071d
7
public String checkName(ArrayList<Customer> c) { boolean taken = true; Boolean secondTest = null; String finalAnswer = null; String proposedFirst = null; String proposedLast = null; while (taken) { boolean notFound = true; System.out.println("Please enter the first name of the customer that you ...
62296ad8-b306-4f21-80eb-e8b5672ea40c
9
public static void drawLine(Graphics g, int x0, int y0, int x1, int y1, Color color) { g.setColor(color); int dx, dy, d, x, y, deltaE, deltaNE, stepx = 0, stepy = 0; dx = x1-x0; dy = y1-y0; if (dx<0) { dx = -dx; stepx = -1; } else if (dx>0) { stepx = 1; } if (dy<0) { dy = -dy; stepy = -...
4eaa6e89-0280-48f5-8822-dcbe1ed15668
6
public static void startupManuals() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/UTILITIES", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ((...
963a8fae-0e4b-4135-99b2-219cb64bf48d
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...
6a6a4e77-8931-4ac5-aefa-e01a64f46b80
0
@Test public void testEquals() throws Exception { Product product1 = new Product('A'); assertTrue(this.product.equals(product1)); product1 = null; product1 = new Product('B'); assertTrue(!this.product.equals(product1)); }
f603251a-b4ff-4492-af9e-83994d418095
0
private IntegrationMethods(String name) { this.name = name; }
15c02e3d-f4cc-4252-a5e4-2e8e86bc7c2e
5
@Override public boolean equals(Object obj) { if(obj instanceof MSet) { MSet that=(MSet)obj; if(this.size()!=that.size()) { return false; } else { for(MSet<T> p=that;p!=null;p=p.next) { if(!this.hasElement(p.a)||(this.getFrequency(p.a)!=that.getFrequency(p.a))) { ...
badb3031-ece0-4d01-bdb6-d3dd3ee2825a
0
public String getNumber() { return this._numer; }
4179952f-d364-483b-bf4a-5d770aa6bfd8
8
public List<Record> handle(Record record) { boolean isPrinting = false; if(record.force()){ //--Case: Force Printing isPrinting = true; } else { //--Case: Filter switch (this.defaultState){ case HIDE_ALL: //--Default False for(Object tag : record.channels(...
3acc9176-5d72-4432-81f4-9b74a617986b
7
MineField() { squares = new HashMap(100); for(int i=0;i<100;i++) { squares.put(new Integer(i),new BlankSquare(i)); } mineLocations = generateRandomNumbers(10); for(Iterator it = mineLocations.iterator();it.hasNext();) { Integer location = (Integer)it.next(); Square mine = new MineSquare(locati...
38c3c628-7dd0-423c-b4b8-a06fb0193f75
6
private List<XTreeExpr> makeList(XTreeExpr expr){ List<XTreeExpr> list; if(expr instanceof XTreeOperator){ XTreeOperator o = (XTreeOperator)expr; if(o.operators.get(0)==XOperator.COMMA){ return o.exprs; }else if(o.operators.get(0).priority>XOperator.COMMA.priority){ list = new ArrayList<XTreeExpr>(...
b0d00c25-de54-4cec-975e-a2dfcf58b825
1
private int[] initializeRandomTable(int size) { r = new Random(); System.out.println("\nGenerating random input..."); int[] randomTable = new int[size]; for (int i = 0; i < randomTable.length; i++) { randomTable[i] = r.nextInt(size); } return randomTable; ...
7e32062d-cfd6-495f-aa6b-7041f45b97d7
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Titre other = (Titre) obj; if (!Objects.equals(this.nom, other.nom)) { return false; ...
2670bba3-6651-4bc8-9734-73724fa7c78f
2
public boolean canEnter(Entity entity) { return entering.size() == 0 && occupying.size() == 0 && leaving.size() == 0; }
1b56c04c-08f7-4cba-b9d5-e5a69970dd8c
2
@Override public void draw(Graphics2D g) { // draw bg bg.draw(g); // draw title g.setFont(titleFont); g.setColor(Color.BLACK); g.drawString("Brawler Game", 75 + 2, 30 + 2); g.setColor(titleColor); g.drawString("Brawler Game", 75, 30); g.drawImage(Images.Button1, 95, 90, null); g.drawImage(Image...
42e7fb01-8927-4331-92b9-e2c40da6e363
7
public boolean equals (Book book) { // equals method to compare books if (title.equalsIgnoreCase(book.getTitle()) && // if all fields match between the 2 books... authorFirstName.equalsIgnoreCase(book.getAuthorFirstName()) && authorLastName.equalsIgnoreCase(book.getAuthorLastName()) && category.equalsIgno...
5bc97578-26f6-4c40-879f-951508c28da0
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { if((msg.amITarget(littlePlantsI)) &&(!processing) &&((msg.targetMinor()==CMMsg.TYP_GET)||(msg.targetMinor()==CMMsg.TYP_PUSH)||(msg.targetMinor()==CMMsg.TYP_PULL))) { processing=true; final Ability A=littlePlantsI.fetchEffect...
95c2d3e8-b420-479f-b475-63bcfdecb9f2
1
public Object[] getArrayItem(String... names) throws ReaderException { Object result = getItem(names); if (result instanceof JSONArray) { return ((JSONArray) result).toArray(); } throw new ReaderException("No key exists with this type, keys: " + _parseMessage(names) + ". In file: " + ConfigurationManager....
3982fcf8-7a7a-4585-a48e-dc1255cd5145
8
@Override public void run() { WatchKey key; while(processing) { try { key = watcher.take(); for (WatchEvent<?> event: key.pollEvents()) { if (event.kind() == StandardWatchEventKinds.ENTRY_MODIFY || event.kind() == StandardWatchEventKinds.ENTRY...
c6dca743-9ba4-415c-ab7c-4fe37a8fd6a9
3
@Override public void reset() { if (input != null) { if (input.getSource() != null) this.setName("trajectory of " + input.getSource().getParent().getName()); xs = new StateTrajectory[input.getDim()]; for (int i = 0; i < xs.length; i++) xs[i] = new StateTrajectory(); } result = null; max...
13947013-3d73-41a0-a59d-3d5204aab99f
6
@Override public void execute(CommandSender sender, String Command, List<String> list) { this.init(sender); MarketSign ms = this.getClicked().get(sender.getName()); if (ms == null) { this.error("Du musst erst ein MarketSign auswählen!"); return; } if (!ms.getOwner().equals(player.getName()) && !player...
fa1b65ba-fa96-45ba-9d8f-3d8ccfb5f7df
1
public static void main(String[] args) { try { int portCapacity = 100; int portLoading = 30; int numberOfBerthes = 2; Port port = new Port(portCapacity, portLoading, numberOfBerthes); ExecutorService portEx = Executors.newFixedThreadPool(port...
fa761a20-7fba-4ccc-8efb-a0881491903f
4
public void set (int option_, int optval_) { if (option_ == ZMQ.ZMQ_MAX_SOCKETS && optval_ >= 1) { opt_sync.lock (); max_sockets = optval_; opt_sync.unlock (); } else if (option_ == ZMQ.ZMQ_IO_THREADS && optval_ >= 0) { opt_sync.lock ()...
d6348d45-9e1b-447b-89cc-c7a5de0967af
3
@Override public User removeUser(String login) { PreparedStatement pStmt = null; User user = null; Integer result; user = getUser(login); if (user != null){ try { pStmt = conn.prepareStatement("DELETE FROM USER WHERE login = ?;"); pStmt.setString(1, login); result = pStm...
8ce4798d-9965-44b4-938b-c80b76be55cd
4
public int getRedScoreFromBlocks() { int r = 0; if (rLoc1.getBlock().getType() == Material.GOLD_BLOCK) r++; if (rLoc2.getBlock().getType() == Material.GOLD_BLOCK) r++; if (rLoc3.getBlock().getType() == Material.GOLD_BLOCK) r++; if (rLoc4.getBlo...
824c6105-c312-4805-a35d-e2d8fcdb15b3
7
public static void main(String[] args) throws Exception { Algorithm algorithm = null; String buffer = ""; WriteFile wf = new WriteFile(OUTPUT_FILE); for (int i = MIN_SIZE; i <= MAX_SIZE; i += 10) { int[] avg = new int[REPEAT]; for (int j = 0; j < REPEAT; j++) { // ***********************************...
f6e6dcb3-7093-43c2-866b-cf93d865e1ff
3
@Override public List<AccessPoint> list() { Process p; ProcessBuilder pb = new ProcessBuilder("/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport", "-s"); List<AccessPoint> result = new ArrayList<AccessPoint>(); try { p = pb.start(); BufferedReader br = new Buffe...
cc0bff12-5021-4816-8838-48472aa58e85
7
private void openNorms(Directory cfsDir, int readBufferSize) throws IOException { long nextNormSeek = SegmentMerger.NORMS_HEADER.length; //skip header (header unused for now) int maxDoc = maxDoc(); for (int i = 0; i < core.fieldInfos.size(); i++) { FieldInfo fi = core.fieldInfos.fieldInfo(i); if...
fd6ba0c7-7b50-4a78-ae93-c465b48ec2f0
2
public int getInt(int index) { Object value = get(index); try { return value instanceof Number ? ((Number) value).intValue() : Integer.parseInt((String) value); } catch (Exception exception) { return 0; } }
b832b974-318e-4d87-b7ca-2e935b8ad8b3
1
@Test public void testQuestion() { String[] stringArray = {"foo", "bar", "test", "temp"}; ArrayList<String> stringList = new ArrayList<String>(); Collections.addAll(stringList, stringArray); ArrayList<String> retList = Question.getParsedStrings(Question.getConcatedString(stringList)); assertEquals(stringList...
684188b0-21ad-40fb-ac08-22d700f57700
2
@Override public void caseAPlusOp(APlusOp node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(Plus"); inAPlusOp(node); if(node.getPlus() != null) { node.getPlus().apply(this); } outAPlusOp(node); }
cdec0d0c-d4cc-40e4-8f50-31fe427086b7
7
public Message<?> process(Message<?> incomingMessage) { ProcessingCriteria processingCriteria = new ProcessingCriteria(); QueryExecutor queryExecutor = new QueryExecutorImpl(); List<QuerySet> acceptedQuerySetsList = null; DBAMessageBuilder dbaMessageBuilder = new DBAMessageBuilderImpl(); if (processingCriter...
9a7a7121-73bb-4a06-a832-279dd51dcc0a
3
public String getClientVersion(String clientPropertyType, String clientVersionPath) { final Properties prop = new Properties(); InputStream input = getClass().getClassLoader().getResourceAsStream(clientVersionPath); try { prop.loadFromXML(input); } catch (IOException ex) { ex.printStackTrac...
dd8e30b6-2d98-4153-91e2-345181720d31
4
@Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (e.getSource().equals(cboLang)) { config.setProperty(PRP_LANGUAGE_CODE, cboLang.getSelectedItem()); changeLanguage(); } ...
a034453a-3d96-4501-83c6-5d4e4c2317ee
4
public void render(Screen screen) { if (level.getTile(x, y - 1) == EmptyTile.instance) { sprites.rotate(Math.PI * 2 * 0.5, true); } else if (level.getTile(x, y + 1) == EmptyTile.instance) { sprites.rotate(Math.PI * 2 * 0.0, true); } else if (level.getTile(x - 1, y) == Emp...
76b6d189-11c3-417d-8157-53b77f1a98c6
3
public static void main( String[] args ) { int port=5000; if( args.length > 1 ) { System.out.println( "Usage: SimpleSocketServer <port>" ); System.exit( 0 ); } if( args.length == 1 ) port = Integer.parseInt( args[ 0 ] ); System.out.println( "Start server on port: " + port ); ServerMain server = ...
ba4fa116-7d76-47b6-b87f-03a6c6a80de4
8
private boolean travel(TreeNode root) { Queue<TreeNode> mainQueue = new LinkedList<TreeNode>(); Queue<TreeNode> visited = new LinkedList<TreeNode>(); List<TreeNode> line = null; TreeNode temp = null; mainQueue.offer(root); line = new ArrayList<TreeNode>(); while(!mainQueue...
da82ed1c-ef60-4076-911a-dfc5312667e5
9
public void schemeEditorDelElement() { if(ce_element.getSelectionIndex() == -1) return; String elementName = ce_element.getText(); String elementType = scheme.getElements().get(elementName); Element element = library.getLibrary().get(elementType); ce_element.remove(eleme...
a624d0a5-1663-4af0-9d03-362cba32314e
3
private void selectedProfile() { try { String name = profileList.getSelectedValue().toString(); con.log("Log","Selected profile " + name); for(int i=profiles.size()-1; i>=0; i--) { Profile p = profiles.get(i); if(name.equals(p.name)){ selProfile = p; //selected profile i=0; lblModsEnab...
3cb38d96-2486-4d95-80f3-af38166956e1
9
private boolean checkMoveToHeating(State state, Set<String> contents) { String ingredientName = topLevelIngredient.getName(); boolean recipeIngHeated = this.topLevelIngredient.getHeated(); ObjectInstance topLevelObj = state.getObject(ingredientName); if (recipeIngHeated && contents.contains(ingredientName) ) { ...
8d61fe2e-dfd1-4e1f-ba77-d9c071ab0661
7
private void createFolder() { boolean isCreated = false; folderName = BASE_FOLDER_NAME; //check if BASE_FOLDER_NAME exists if (manager.hasFolder(folderName)) { return; } //check if BASE_FOLDER1,2,etc exists for (int i = 1; i < MAX_ITERATION; i++) { if (manager.hasFolder(folderName + i)) { ...
a185144d-5c97-4662-8fc9-d8fd690e9dd7
6
public static String escape(String string) { StringBuffer sb = new StringBuffer(); for (int i = 0, length = string.length(); i < length; i++) { char c = string.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; cas...
21118af7-f2c7-4162-bf3c-0e3e746af8ad
6
private void setGrid(int xType, int yType) { // update the axis types setXAxis(xType); setYAxis(yType); // update the number of rows and columns int xNum = xAxisLabel.size(); int yNum = yAxisLabel.size(); gridPanel.removeAll(); // //update the grid panel to reflect the number of columns // gridPane...
0181699e-9523-4e30-afcf-7ebd3c461525
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; User other = (User) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false;...
c0cfd060-2325-4196-8597-07beab604b26
0
public static boolean validateStudent(){ boolean isValid=false; return isValid; }
4b647dbe-ddb3-490d-9b78-4cdacc5bd351
4
public void onNickChange(String oldNick, String login, String hostname, String newNick) { if (players2.changeNick(oldNick, newNick)) { if (players2.isPlaying(oldNick) && !players2.isDead(oldNick)) { bot.sendMessage(gameChan, Colors.DARK_GREEN + oldNick + " has changed nick to " + newNick + "; Player list...
92582e0d-ded5-4746-89ec-5378ee9d97c7
6
final void method3049(ByteBuffer class348_sub49, int i, int i_5_) { do { try { if (i_5_ != 31015) method3140(-77, 55); anInt9433++; int i_6_ = i; if (i_6_ != 0) { if ((i_6_ ^ 0xffffffff) != -2) break; } else { anInt9438 = class348_sub49.getShort(); break; } aBoolean9439 = ...
f4fdf45e-844e-4fbf-b65b-d415d792c0a7
8
public static void main(String[] args) { //file names to be analyzed. String fileName1 = "resources/text1.txt"; String fileName2 = "resources/text2.txt"; //Cache for stemming. HashMap<String, String> cache = new HashMap<String, String>(); long t = System.currentTimeMillis(); //Create a cou...
664b2498-f7b7-45f6-aebc-a406bb1f90fc
4
public void run() { byte[] buf = new byte[BUFFER]; while (true) { try { // wypelnienie zerami Arrays.fill(buf, (byte) 0); // tworzymy nowy datagram DatagramPacket datagramPacket = new DatagramPacket(buf, buf.length); ...
9a1f3377-d9ae-41c4-a6a3-f1dc9027f133
3
private static void processFiles(File folder, List<String> out) { for (File f : folder.listFiles()) { if (f.isDirectory()) { processFiles(folder, out); } else if (!f.getName().equals(importFile)) { out.add("npc: " + f.getPath().substring(_baseFolder.getPat...
0b98c44e-b239-4610-925d-4cf05c00b15a
8
private void writeRow(int numberOfRow, int maxStringRow, LinkedHashMap<Integer, List<String>> strings, boolean flag) throws IOException { String columnType, s; int j; for (int i = 0; i < maxStringRow; i++) { j = 0; for (Column column : columns) { columnTyp...
50cfa88d-a5c2-4f75-bc3e-244f081ced50
5
public static boolean save() { if (Debuggers.size() == 0) { //If queue is empty OR economy is disabled. DebugFile.delete(); return true; } ColorKeys.Log(Level.INFO, "Saving Debuggers..."); try { if (!DebugFile.exists()) { if (!DebugFile.createNewFile()) { ColorKeys.Log(Level.SEVERE, "Error ...
f175b8cd-b55a-4e21-913d-c422e421641c
7
private static <T> Tris<List<KeyInfo>, List<IndexInfo>, List<PropertyDescriptor>> getKeyAndIndexInfo(Class<T> javaType) { List<KeyInfo> keys = new ArrayList<>(); List<IndexInfo> indexes = new ArrayList<>(); List<PropertyDescriptor> properties = new ArrayList<>(); Map<String, PropertyDescriptor> property...
ae9eaa76-d946-448f-9c2f-14a1a3f88a49
9
protected Position getIthLastInFirstApearanceWithRespectToPrefix(List<Itemset> prefix, int i, PseudoSequencePair firstInstancePair){ // ith item of prefix id is : Integer iditem = getIthItem(prefix,i); if(i == getItemOccurencesTotalCount(prefix)-1){ // return the last occurence of that item: for...
24ef77af-b5d4-45d2-ac95-c2c0a266f3b4
1
public double getPropagationValue(int index, double energy) { if (VERBOSE) { System.out.println("Propagation value for index" + index + " and energy " + energy); // System.out.println("" + getPropagationMatrix(index, // energy)[0].abs()); // System.out.println("" ...
26413cc9-cda9-4244-8dc9-ed608553b522
0
@Override public String getGUITreeComponentID() {return this.id;}
6ace9570-d883-427e-beab-8491729bd6b5
5
public mxRectangle getVertexBounds(Object vertex) { mxRectangle geo = graph.getModel().getGeometry(vertex); // Checks for oversize label bounding box and corrects // the return value accordingly if (useBoundingBox) { mxCellState state = graph.getView().getState(vertex); if (state != null) { do...
2d3b7cf4-2881-4ddf-a777-f076bce79b65
0
public static void main(String[] args) { GregorianCalendar[] birthdays = { new GregorianCalendar(1906, Calendar.DECEMBER, 9), // G. Hopper new GregorianCalendar(1815, Calendar.DECEMBER, 10), // A. Lovelace new GregorianCalendar(1903, Calendar.DECEMBER, 3), // J. v...
e90ea8bd-6f21-4fff-93cf-a7e5735aba0a
6
public final boolean getBoolean(String key) throws JSONException { Object o = get(key); if (o.equals(Boolean.FALSE) || (o instanceof String && ((String)o).equalsIgnoreCase("false"))) { return false; } else if (o.equals(Boolean.TRUE) || ...
458abcb3-100f-4cdc-acd6-dba42e81e355
4
public boolean equals(Object other) { if ( (this == other ) ) return true; if ( (other == null ) ) return false; if ( !(other instanceof TrabajaderaId) ) return false; TrabajaderaId castOther = ( TrabajaderaId ) other; return (this.getIdtrabajadera()==castOther.getIdtrabajadera()) && (t...
3e4ce549-9976-4c9e-a6a8-4f8e99d98c54
8
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } ReferenceProperty<?> other = (ReferenceProperty<?...
6536afbb-a0bb-4e80-a97d-f70c5cb1bc5f
2
public static ArrayList<Question> getQuestionsByQuizID(int quizID) { ArrayList<Question> questionList = new ArrayList<Question>(); try { String statement = new String("SELECT * FROM " + DBTable + " WHERE quizid = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, qui...
8105e3bb-d58a-4b96-bbdc-bd96a07199d9
2
public synchronized static void writeAllUserStocks(ArrayList<UserStocks> all) { File f = new File("userstocks.txt"); FileWriter fr = null; try { fr = new FileWriter(f); BufferedWriter br = new BufferedWriter(fr); String s = ""; for (UserStocks e : all) { s += e.getUsername() + " " + e.getTickerna...
d0edad94-40bf-465f-991b-22cac1e4ff4a
0
public void increaseMoveCount() { this.moveCount++; }
39bc0acb-0fca-4a8f-8100-6318cad7668e
6
private void dealCards(){ Deck d = g.getDeck(); Card c; int loop = 4; if(!triple){ p1.setshelf(d.pop(), d.pop(), d.pop(), d.pop()); p2.setshelf(d.pop(), d.pop(), d.pop(), d.pop()); } else{ p1.setshelf(d.pop(), d.pop(), d.pop()); p2.setshelf(d.pop(), d.pop(), d.pop()); p3.setshelf(d.pop(), d.p...
e8c612a0-3405-452c-acea-10aef4a4e793
6
ArrayList<movePair> possibleMoves(Point[] grid, Pair pr) { ArrayList<movePair> possible = new ArrayList<movePair>(); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { Point currentPoint = pointAtGridIndex(grid, i, j); if (currentPoint.value == 0) { continue; } for (Pair d : d...
b68cafa9-48e7-4e1c-a83a-cbef7f7bb7df
5
protected void parseLineName() throws FormatterError { int rc = parseToken(false); boolean inp_line = s.equals("input"); boolean out_line = s.equals("output"); if ((rc != WORD_INDICATOR) || (!inp_line && !out_line)) { throw new FormatterError("parseLineName : Bad line name")...
85552bbe-1e95-4c39-853a-bfd6873bb071
7
@Override public Set<EvaluatedDecision> evaluateDecisions(Set<Decision> ds, State s) { initializeCaches(s); outOfTime = false; Timer t = new Timer(); t.schedule(new TimerTask() { public void run() { outOfTime = true; } }, decision_time); Set<EvaluatedDecision> edsbest = null; int depth = 0; ...
263076d8-2ae6-408c-8c44-fc9d2ed04770
2
public static DAOTemplate getInstance(){ switch(showPersistenceTypeAsk()){ case 0: return DAOFilePersistence.getInstance(); case 1: return DAOMemoryPersistence.getInstance(); default: return null; } }
45f947fc-f9a6-4901-823c-5c059a2c96fd
6
public static double getAngle(double a,double b,double c, double d){ if((a>=c&&b>=d)||(a>=c&&b<=d)) return Math.asin((d-b)/ Math.sqrt(Math.pow((a-c),2)+ Math.pow((b-d), 2))); else if(a<c&&b<=d) return Math.toRadians(90.0)+Math.acos((b-d)/ Math.sqrt(Math.pow((a-c),2)+...
d8f77573-4e22-487c-9c9d-6dc9b6409eef
6
public static double getTimeAvgNumInQueue(String qType) { if (timeAvgNumInQueue.containsKey(qType)) return timeAvgNumInQueue.get(qType); ArrayList<QueueInfo> list = queuesInfoMap.get(qType); int max = 0; int timeAvg = 0; int maxTime = 0; Iterator<QueueInfo> it...
25f9a00c-6957-4f77-a007-407c9247df0e
7
public Player advanceToNextPlayer() { List<Player> playersToRemove = new ArrayList<Player>(); for(Player player : players){ if(player.eliminated()){ playersToRemove.add(player); nameToOutWriter.get(player.toString()).println(Commands.DEFEAT); } } nextPlayer = getNextPlayer(playersToRemove); ...
11b5a77d-a074-4654-b6f1-b107b6a3807a
6
public void damageDetection () { hurt = false; if (character.equals("P1")) { P2AttackArea getHit = (P2AttackArea)getOneIntersectingObject(P2AttackArea.class); if (getHit != null) { hitpoint-= getHit.damageDealt(); hurt = tru...
44b31fbd-610e-424a-b8d5-d0b18a0a8750
6
static final boolean method1796(int i, int i_10_) { if (i < 53) return true; anInt6019++; if (i_10_ != 18 && (i_10_ ^ 0xffffffff) != -7 && i_10_ != 1011 && i_10_ != 13 && i_10_ != 16) return false; return true; }
81d8fe30-579f-4270-86ca-5831fa5a8bc2
5
@Test public void test_mult_matrix_identity() { int dim = 3; Matrix a = new MatrixArray(dim, dim); Matrix identity_matrix = new MatrixArray(dim, dim); for(int i = 1; i <= dim; i++){ for(int j = 1; j <= dim; j++) a.insert(i, j, (double)(2*i-j)); } for(int i = 1; i <= dim; i++){ for(int j ...
240746d8-e47a-4acc-a122-77fd00697cbe
8
public String nextToken() { if (pos >= string.length()) { return null; } boolean isQuoting = false; StringBuilder buffer = new StringBuilder(); StringBuilder result = new StringBuilder(); for (int index = pos; index < string.length(); index++) { bu...
41b27aa2-f592-4483-9a34-58d9adf739b7
3
@Override public void handleEvent(Event event) { if (event.getType() == EventType.END_TURN) endTurnUpdate(); else if (event.getType() == EventType.END_EFFECT) if (isValidEndEffectEvent(event)) removeEffect(); }
a093c7f1-9135-4f7a-ad35-2f075a6dfca9
8
public void run() { try { byte buf[] = new byte[DNSConstants.MAX_MSG_ABSOLUTE]; DatagramPacket packet = new DatagramPacket(buf, buf.length); while (this.jmDNSImpl.getState() != DNSState.CANCELED) { packet.setLength(buf.length); ...
ca56def6-0753-486b-9553-41427980d1f9
7
@Override public void mouseClicked(MouseEvent e) { if(e.getSource()==bNuevo){ System.out.println("Esta en el botonnuevo"); } if(e.getSource()==bGuardar){ System.out.println("Esta en el botonguardar"); } if(e....
c7754c7a-d6c8-433d-8e22-cabfe9f3df0e
3
public void update(float delta) { if (duckDuration > 0 && isDucked) { duckDuration -= delta; } else { isDucked = false; duckDuration = .6f; } if (!isGrounded()) { velY += ACCEL_GRAVITY * delta; } else { y = 406 - height; velY = 0; } y += velY * delta; updateRects(); }
f0fbd5ea-4fb7-413b-9350-dffda263c4c6
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TMasterProductPokari other = (TMasterProductPokari) obj; if (!Objects.equals(this.pcodeSap, other.pcodeSa...
2b8da038-872a-46bd-be38-a755163d60e6
3
public void compute() { this.view.printMaze(this.currentNode, this.closedNodes); // Print the current maze if(openNodes.isEmpty()) { this.view.printFailure(); return; // Exhausted all nodes; NO SOLUTION } this.copyOpen = (ArrayList<Node>) openNodes.clone(); // Prevent concurrent modification // This...
251a077a-0666-4b71-a311-ace70a68e3fe
1
public static Database getInstance() throws Exception { // this enables us to call Database.getInstance() at any // given point in the runtime after initializing the db // once, for example in the Main method (Singleton Pattern) if(Database.db == null) { Database.db = new MysqlDatabase(); } return Databa...
0221121a-cfa0-417a-93b6-c8889786a814
6
public boolean register(IPluggable object) { this.log.debug("register", "Registering new Plug '"+object.getName()+"'...", 0); try { Method[] methods = Class.forName(object.getClass().getName()).getMethods(); for(Method method : methods) { Execute exe = method.getAnnotation(Execute.class); if(exe == nu...
51683910-5ce0-48e0-86ae-b467182f0b3a
8
public boolean stateEquals(Object o) { if (o==this) return true; if (o == null || !(o instanceof MersenneTwisterFast)) return false; MersenneTwisterFast other = (MersenneTwisterFast) o; if (mti != other.mti) return false; for(int x=0;x<mag01.length;x++) ...
875570b5-f69a-4826-a0aa-0ac2757f383b
9
public static MeshPattern reducedPattern(MeshPattern mp, int[] indices) { MeshPattern result = new MeshPattern(mp.p.patternAt(indices)); int[] values = new int[indices.length]; for (int i = 0; i < values.length; i++) { values[i] = mp.p.elements[indices[i]]; } Arrays.s...
ba0beea3-c718-45c6-be96-c81aec27d2bd
7
public static void BigTree(CommandSender sender, String treetype) { Player cmdPlayer = (Player) sender; Block blkTree = cmdPlayer.getTargetBlock(null, 300); Location locTree = blkTree.getLocation().add(0, 1, 0); locTree.getBlock().setType(Material.BEDROCK); if (treetype.equalsIgnoreCase("bigtree")) { cmdPl...
d50a4d26-bc43-4109-85b2-06c52761dbf6
7
int stackMapFrames(int pos, int nth) throws BadBytecode { int type = info[pos] & 0xff; if (type < 64) { sameFrame(pos, type); pos++; } else if (type < 128) pos = sameLocals(pos, type); else if (type < 247) ...
ebbdeb78-ee2e-44e7-a50e-eadd387b7b3a
7
public GeoAdresse call() throws Exception { // -- Coordinates query: this._adresse = this.geometryLocationRequest(_adresse); // -- Query for Nominatim, if desired, and quality of the coordinates is ok: if (this.isAskForLocation() && (this._adresse.getRequestStatus() == GeoRequestStatus.O...
b4efccde-d53f-434c-b730-1b9bb98326b4
4
public double maxProfit(int jthObject, int currentLength, double profitJ, ArrayList<Rod> rods, double[][] table) { double tryToAddObject = 0; double dontTryToAddObject = 0; int currentRodLength = rods.get(jthObject).getLength(); if(currentLength >= currentRodLength) { if(jthObject - 1 < 0) { jthObject = ...
d5b4a0b7-0a50-48cf-861a-2c7347ee8c50
1
private String obten_select_catalogo(String nombre_catalogo) { ConexionBD con = new ConexionBD(); ArrayList<String[]> elementos = con.regresaCatalogoConId(nombre_catalogo); String select = ""; select = "<select id=\"select_" + nombre_catalogo + "\" name=\"select_" + nombre_catalogo + "\...
90fd3ee9-117b-4d5c-88ad-f65cd7496bf4
2
@Test public void manyInsertsResizesArray() { String expected = ""; for (int i = 0; i < 100; i++) { a.insert(new Vertex(i)); expected += i + " "; } String actual = ""; for (int i = 0; i < 100; i++) { actual += a.get(i).getId() + " "; ...
c8cc50eb-9182-4572-9b20-0bb4e506e158
4
public void buildRestore(GluonOutput code, ArrayList<Variable> vars, boolean parameters) { if (!vars.isEmpty()) { boolean first = true; for (Variable var: vars){ if (parameters == var.isParameter()) { if (!first) code.append(", "); else { code.append("\tRESTORE "); first = false;...
6d9a75b9-5d21-4367-889f-5bb09028d64a
5
private List<ChessCoord> getPossibleCoords() { List<ChessCoord> result; if (!this.isActive()) { result = Collections.emptyList(); } else { final int currentFile = this.getCoord().getFile(); final int currentRank = this.getCoord().getRank(); result ...
22f9ab28-c291-4cea-9fe6-0bb5c1063b76
3
public <T> void putArray(T[] x, WriteCallback<T> callback) { if (putIsNotNull(x)) { putUshort(x.length); for (int i = 0; i < x.length; i++) { if (putIsNotNull(x[i])) { callback.write(this, x[i]); } } } }
558373a2-61d5-444a-9db4-52098bef8da0
7
public void nextIteration() { double[][] nextX = new double[N][3]; for (int i = 0; i < N; i++) { for (int k = 0; k < 3; k++) nextX[i][k] = b[i][k]; for (int n = 0; n < 4; n++) { if (R[i][n] >= 0) { int index = R[i][n]; for (int k = 0; k < 3; k++) nextX[i][k] ...