method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9158c89c-177d-4aff-a71f-291b46694479
2
@RequestMapping(value = "/projectForm") public ModelAndView showProjectForm(HttpServletRequest request) { //I need customers list, assignments list and worktypes list !!! ModelAndView modelAndView = new ModelAndView("projectForm"); String method = request.getParameter("action"); if ...
46818e07-0c51-4f98-8997-cfce7f3e4277
0
public JSONStringer() { super(new StringWriter()); }
e0f770f9-a723-4964-91cf-5b736eda5e3a
3
public Set<HTTPHeaderLine> getAll( String name ) throws NullPointerException { if( name == null ) throw new NullPointerException( "Cannot retrieve header lines if the passed key (name) is null." ); // Get the set widht the elements Set<HTTPHeaderLine> set = this.map.get( name ); // make a copy S...
61775109-e086-4e52-b11c-43f3ddcadd3f
1
public void defineModules(String... moduleNames) { fragments.clear(); for (String moduleName : moduleNames) { fragments.add(moduleName); } }
d00dfec1-9f62-4643-b395-893220ac0053
8
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); int times = 1; int[] a = new int[10001]; while ((line = in.readLine()) != null && line.length() != 0) { int[] v ...
36c1670a-6c1e-4ec6-bb8d-5186c3c824e5
2
protected void updateAge() { age++; if (age > maxAge && maxAge != 0) { isAlive = false; } }
8c41bb2a-2079-42d0-863a-470ee8e21f30
8
public static void keyTyped(KeyEvent keyEvent) { Iterator<PComponent> it = components.iterator(); while(it.hasNext()) { PComponent comp = it.next(); if(comp == null) continue; if (shouldHandleKeys) { if (comp.shouldHandleKeys()) ...
5beefd8b-6009-45e0-b0b0-391a0e6004f1
1
public void add( V val,K key){ if (root == null) { root = new BinaryNode<K,V>(val,key,null,null); } else{ root.insert(val,key); } }
32724464-b33d-429a-9191-b508a1d600e9
8
public static int maxSubArray(int[] a){ if (a == null || a.length <0)return 0; int sum = 0; int max = 0; int num = 0; for (int i = 0; i < a.length; i++){ sum += a[i]; //如果sum小于0,则将其置为0,否则负值与后边的数相加会肯定会使总的和变小 if (sum < 0) sum = 0; if ...
72e88bbc-793a-408d-b574-e81bd8521ee4
4
private String wrapText(String text) { int spaceSpace = GenericLabel.getStringWidth(" "); int spaceAvailable = getWidth(); int spaceRemaining = spaceAvailable; String[] words = text.split(" "); String result = ""; for (int i = 0; i < words.length; i++) { int ...
c104179b-c23d-43d7-814f-ef736c335967
4
private Object handleLdsOrdinance(Object tos, boolean isPersonalOrdinance, String tagName) { if ((tos instanceof Person && isPersonalOrdinance) || (tos instanceof Family && !isPersonalOrdinance)) { LdsOrdinance ldsOrdinance = new LdsOrdinance(); ((PersonFamilyCommonContainer)tos).addLd...
8b4fec8d-1fd0-42bc-b8c9-d1385b9e1c22
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
b840ea94-4589-4e07-b2ef-fd57b57d5689
3
private String getModelFileData(){ String modelData = null; FileInputStream fis = null; BufferedReader br = null; try{ fis = new FileInputStream(modelDataFileName); if(fis != null){ System.out.println("aaaaaaaaa"); } br = new Buffere...
6827dcb9-52b1-4b3f-915f-9cb5a8513c38
1
public void deleteElement(String value) { int codeValue = hashCode.hashCounter(value, length); if (exists(value)) { hashTable[codeValue].deleteElement(value); } }
d1da4602-7520-420d-be12-bf40a4cef87c
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Student other = (Student) obj; if (!Objects.equals(this.group, other.group)) { return false; ...
200c28db-741d-4e17-a8ef-d4f7f4c0776f
4
protected final void addItemToPlayersInventory(Player player) throws InvalidActionException { if (player == null) throw new IllegalArgumentException("The given player is invalid!"); if (!(this instanceof Pickupable)) throw new InvalidActionException("The selected item can't be picked up!"); if (player.getRe...
3e785b5c-3eb2-4da2-bf00-0e82d094d994
7
@Override public void run() { long currentTime = System.currentTimeMillis(); //generate report Map<String, StringBuilder> successLogMap = new HashMap<String, StringBuilder>(); Map<String, StringBuilder> failLogMap = new HashMap<String, StringBuilder>(); //collect log for (TestData data : datas) { Abs...
8046648e-ff26-4fc0-8526-527e6d3c5060
3
@Override public void updatePatient(Patient patient) throws Exception { // Get JDBC Connection Connection conn= JDBCManager.getConnection(); PreparedStatement stmt=null; String sql="Update Patient "+ "SET FirstName=?,LastName=?,Gender=?,Age=? "+ "WHERE HealthRecordNumber=?"; try...
50a5b0dd-60d6-427c-ada0-889fde549a97
7
public void keyReleased(KeyEvent e) { keyCode = e.getKeyCode(); if (keyCode == 38) { lastdir = 1; UP = false; } else if (keyCode == 40) { lastdir = 2; DOWN = false; } else if (keyCode == 37) { lastdir = 3; LEFT = fal...
61f56453-dc3e-4546-b441-5c0872c70450
8
public void setFieldValue(_Fields field, Object value) { switch (field) { case ID: if (value == null) { unsetId(); } else { setId((Integer)value); } break; case NOME: if (value == null) { unsetNome(); } else { setNome((String)value); ...
39a797ac-a857-4999-8ded-b79eaac794d1
6
private synchronized void auto_reconnect(){ System.out.println("Attempting Auto-Reconnect..."); //Clean and desrtoy anything that may be left try{mysql_connection.close(); mysql_connection = null;}catch(SQLException e){} //On a sucesufull connection stop retrying ...
5cf2f084-ea1b-43fb-b687-75a5c18b3ba3
4
private JSONObject readObject() throws JSONException { JSONObject jsonobject = new JSONObject(); while (true) { if (probe) { log("\n"); } String name = readName(); jsonobject.put(name, !bit() ? readString() : readValue()); if (!...
3812491f-f254-4b88-8307-088930cc26d0
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; IpAndMask other = (IpAndMask) obj; if (ip == null) { if (other.ip != null) return false; } else if (!ip.equals(other.ip)) return fals...
467fea57-15a2-414e-948b-aa92fe251e7c
6
public Type intersection(Type type) { if (this == tError || type == tError) return tError; if (this == tUnknown) return type; if (type == tUnknown || this == type) return this; /* * We have two different singleton sets now. */ if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)...
52bc151b-b06f-4665-8c61-750fff79ac87
3
public void omniSend(Message m){ rover = head; while(rover != null){ if(rover.status == 1){ rover.sendMessage(m); if(m.header.equals("APPEND GIRL")){ Girl xxx = getGirl(randlist[conn.currgirl]); System.out.print(xxx.name + " "); } System.out.println(m.header + " : " + conn.name + " - "...
a17c1211-92d4-4b83-9318-94e708ecf60a
4
public void run() { logger.finer("Receiving packets..."); isReceiving = true; while(isReceiving) { byte[] bytes = new byte[Packet.MAXIMUM_PACKET_SIZE]; DatagramPacket datagramPacket = new DatagramPacket(bytes, bytes.length); try { socket.receive(datagramPacket); try { Packet packet = Packet....
92705376-5be5-4881-8753-8dc736876954
0
public int getV(){ return velocity; }
2fd04848-8321-46ee-8995-882af2a1e373
8
private void listAmount() { System.out.println("files to process: " + listImg.size()); System.out.println("start convert names... " ); for (int i = 0; i < listImg.size() ; i++) { String oldName = listImg.get(i); Utils.percentCounter(i,listImg.size()); //System.out.println(oldName); String ...
b8eff8c5-648d-4744-93e0-80b1f0e79c67
2
void printMap() { for (int i = 0; i < _map.length; i++) { double[] row = _map[i]; for (int j = 0; j < row.length; j++) { System.out.print(_map[i][j] + "\t"); } System.out.print("\n"); } }
851470ae-059b-4f4c-9860-e40f8cba2a98
9
private void handleIOSERDES(){ // Remove ISERDES/OSERDES for(Instance inst : design.getInstances()){ if(inst.getType().equals(PrimitiveType.ISERDES) || inst.getType().equals(PrimitiveType.OSERDES)){ instancesToRemove.add(inst); } boolean foundBadInstance = false; if(inst.getName().contains("XD...
4cdc25e3-ac33-45ee-9fb6-e2f7e2516ced
2
public void setPosition(int x){ System.out.println(time); if(x < startX){ x = startX; }else if(x > startX + distance){ x = startX + distance; } rect.x = x; this.time = (x - startX) * endTime / distance; System.out.println(time); }
d34def7a-2d0a-4385-b3c0-179ea49f385f
4
public void draw(Graphics g) { g.setColor(new Color(255, 255, 250, 50)); g.fillOval(x + 1, y + 1, size, size); g.setColor(color); g.fillOval(x, y, size, size); g.setColor(new Color(255, 255, 255, 50)); g.fillOval(x + 2, y + 2, size - 4, size - 10); g.setColor(new Color(255, 255, 255, 60)); g.fillOval(x ...
ab4ba08a-8445-4b32-ace0-aaa15987f524
1
public MenuRenderer() { try { Background = ImageIO.read(new File(Main.loc + "/Textures/Menu/Background.png")); Button1 = ImageIO.read(new File(Main.loc + "/Textures/Menu/Button1.png")); Button2 = ImageIO.read(new File(Main.loc + "/Textures/Menu/Button2.png")); } catch (Exception e1) { //JOptio...
14317a59-fefa-4390-917c-b8cd1f45eb67
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(myHost instanceof MOB)) return super.okMessage(myHost,msg); final MOB myChar=(MOB)myHost; if(!super.okMessage(myChar, msg)) return false; if(msg.amISource(myChar) &&(!myChar.isMonster()) &&(msg.sourceMinor()==CMM...
605bf0a9-9e2b-45ca-90bc-01f9a0ef2c61
1
private static double rombergGradoN(double extremoIzq, double extremoDer, Funcion fun, double k, double n){ if (n == 0){ //Si el grado es 0, significa que tengo que calcular trapecio, por lo que me devuelve T(h/2^k) return trapecio(extremoIzq, extremoDer, fun, k); } else { ...
da177e93-7545-4bb9-b392-21d9998589d3
5
public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); String str, textFinal, text; if (action.equals("SAVEMLD")) { String fileName = chooseFile(); if (fileName == null) return; try { PrintStream out = new PrintStream(new FileOutputStream( fileName)); ...
baeab499-edc7-4858-a723-d9a171e16607
2
private static boolean isValueAnArmstrongNumber(int input) { // convert user int value to a String object in order to use the charAt() method StringBuffer valueAsStr = new StringBuffer(String.valueOf(input)); int combinedTotal = 0; // determine the number of digits in the users input ...
27aa46a6-b3b4-45d9-8606-c98aadf6138a
1
public void setMonthlySalary(double monthly) { if(monthly < 0) { monthlySalary =0; } else monthlySalary = monthly; }
74dae50f-298a-44a8-b7cf-4879a8418020
7
public static void main(String[] args) throws Exception { int ponder = 5; if (args.length > 0) ponder = Integer.parseInt(args[0]); int size = 5; if (args.length > 1) size = Integer.parseInt(args[1]); ExecutorService exec = Executors.newCachedThreadPool(); ...
7b458976-9786-4f00-a8b6-5dc5a30546df
5
public void advance() throws ControllerException { try { switch (parser.ttype) { case StreamTokenizer.TT_NUMBER: tokenType = TYPE_INT_CONST; intValue = (int)parser.nval; currentToken = String.valueOf(intValue); ...
8fbdd4d1-d530-44ff-bb2b-adeb3234141c
1
public int getID(Class<? extends APacket> p) { return PList.indexOf(p); }
ae1d95c1-dccd-4f2d-8fc8-bc69c143a053
0
public TaskThread() { // TODO Auto-generated constructor stub }
d3e90d0e-05a4-445c-a88b-be98cb3a0500
7
public void checkCollision() { if (snake.getPosition().equals(food.getPosition())) { snake.tail.add(new Point()); food.reset(); } for (int i = 0; i < snake.tail.size() - 1; i++) { if (snake.getPosition().equals(snake.tail.get(i))) { gameOver = true; } } if (snake.getPosition().getX() < 0 ...
4cf3599f-f9db-4750-81fe-732a13b26c4a
7
private int getTarget() { InfoDetail cil = null; int state; if (this.data != null) { for (InfoDetail o : this.data.getEnemies()) { if (o != null) { cil = o; } } if (cil == null) { state = -1; return state; } int dX ...
c403f6fa-e9b6-473d-a652-ae217222ce62
2
public static final boolean isJava(String fileName) { for (String file : JAVA) { if (file.equals(fileName)) { return true; } } return false; }
9fbc806c-dbfc-446b-9729-0c5765d30521
1
static long nextMonthDay(int index){ long start=startDay.getTime(); start+=index*milliSecondsOnyDay; Calendar calendar=new GregorianCalendar(TimeZone.getTimeZone("GMT")); calendar.setTime(new Date(start)); int thisMonthDay=calendar.get(Calendar.DAY_OF_MONTH); calendar.add...
449ce2f4-3f8c-46b9-94e9-9305d5907871
7
@Override public void processPacket(final Client c, int packetType, int packetSize) { c.walkingToItem = false; c.pItemY = c.getInStream().readSignedWordBigEndian(); c.pItemId = c.getInStream().readUnsignedWord(); c.pItemX = c.getInStream().readSignedWordBigEndian(); if (Math.abs(c.getX() - c.pItemX) > 25 || Math....
6b9988a8-a0ba-4991-9ba7-24005455a43d
6
private void find(ArrayList<Integer> current, HashMap<Integer, Boolean> diagonal1, HashMap<Integer, Boolean> diagonal2, ArrayList<String[]> result, int n) { if (current.size() == n) { result.add(getFormartStrings(current)); } else { //find available column ...
263eb614-8770-4f47-903a-074cfb1225b6
2
public AcyclicLP(EdgeWeightedDigraph G, int s) { distTo = new double[G.V()]; for (int i = 0; i < G.V(); i++) distTo[i] = Double.NEGATIVE_INFINITY; distTo[s] = 0; edgeTo = new WeightedDirectedEdge[G.V()]; Topological topological = new Topological(G.digraph()); for (Integer v : topological.order()) re...
ee63f084-9a9a-4a6b-9511-e59e94bbf600
0
public Integer getErrorType() { return this.errorType; }
146729f6-728f-487d-82ab-3220256959f6
4
private void play() { Player[] pList = new Player[playerNumber]; ArrayList<Color> factions = Faction.allFactions(); ArrayList<PlayerInfo> infoList = new ArrayList<PlayerInfo>(infos.length); for(PlayerInfo info : infos) { infoList.add(info); } Random random = new Random(); int index = 0; while(...
f46972cb-bb9f-483b-8038-9a4cfd4752c0
8
public String formatHTMLTable(StatCollector stat){ add("<!doctype HTML>"); add("<html>"); add("<body>"); add("<table border=1>"); add("<tr>Server statistic:"); // Total requests add("<tr><td>Total requests<td>"); add(stat.getRequests()); // Unique requests number add("<tr><td>Unique IP requ...
1bfcefec-d0af-4387-b55c-b8300ca21e69
8
public void saveGame() { File file = new File("Saved_Games.txt"); FileWriter writer; boolean flag = false; ArrayList<String> data = new ArrayList<String>(); ListIterator<String> iterator; String currentPuzzle = getCurrentPuzzle(); try { Scanner s = new Scanner(file); while(s.hasNextLine()) { dat...
ceaf7e33-fe78-4281-bc19-c95a30df76fd
0
public TaskWithResult(int id) { this.id = id; }
82960d33-fe3b-47ae-800f-aa19950400f0
2
static public HashMap<String, String[]> loadDomain(){ try{ @SuppressWarnings("resource") BufferedReader csvFile = new BufferedReader(new FileReader("parserResult/authorDomain.csv")); String[] dataArray; String target; while((target = csvFile.readLine())!= null){ dataArray = target.split(","); domai...
e387af63-65b5-4cbb-84f9-1d4064d26929
7
private int maximised_triangles() { int a; int b; HashMap<Integer,Integer> store = new HashMap<Integer,Integer>(); for(a = 1; a < 1000; a++) { for(b = 1; b < 1000; b++) { double c = Math.sqrt(IntMath.pow(a, 2) + IntMath.pow(b, 2)); if(Math.floor(c) == ...
4bdc17a7-536b-40be-89c4-48fdabe57b78
5
private static void EnemyMoveChoice(){ if(opponentHealth > 0){ Random rng = new Random(); int move = 1 + rng.nextInt(4); //move = 2; switch(move){ case 1: System.out.println("Zubat used Tackle!"); System.out.print("\n"); // line break playerHealth = DealDamage(playerHealth, tackle); br...
907db2a6-c90a-460a-b020-d856e61a2453
5
@EventHandler(priority = EventPriority.HIGH) public void registerAccount(PlayerJoinEvent event) { final Player player = event.getPlayer(); final User user = EdgeCoreAPI.userAPI().getUser(player.getName()); if (user == null) return; if (!Economy.isAllowAccounts()) return; try { if (Ec...
2201afdb-1bda-4ad4-984e-5df4fbae71f2
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...
e65724f2-273a-4fb6-a920-b931ff78dc87
1
public void startBall() { _isBallStart = false; for (int i = 0; i < _gameField.balls().size(); i++) { _gameField.balls().get(i).setSpeed(0, -0.3); } }
4f44a368-8f7f-4708-a938-db2eac272421
7
public boolean canCastle(Castle castle) { if(!castle.isValid(this)) { return false; } Move kingMove = castle.getKingMove(); Move rookMove = castle.getRookMove(); if(get(kingMove.getFrom()).hasMoved() || get(rookMove.getFrom()).hasMoved()) { return false; ...
0c6bab5a-506b-4a1a-8a32-ff7d829b1317
3
@Override public String processCommand(String[] arguments) throws SystemCommandException { String guid = facade.getCurrentUserGUID(); if (guid == null) throw new SystemCommandException("No current user set."); Date start = DateUtil.parseArgumentDate(arguments[1], arguments[2]); Date stop = DateUtil.par...
56547681-760d-4a0d-afd7-4009b2129791
9
public NamiBeitragConfiguration(File configFile) throws ConfigFormatException { // Lese Konfigurationsdatei ein (inkl. Validierung) Document doc; try { XMLReaderJDOMFactory schemafac = new XMLReaderXSDFactory(XSDFILE); SAXBuilder builder = new SAXBuilder(schem...
97e7f143-2b0a-4957-9bd6-09da8adee7ce
5
public static void saveProperties(Properties props, File propertyFile, String headerText) { OutputStream out = null; try { out = new FileOutputStream(propertyFile); if (StringUtils.isNotBlank(headerText)) { props.store(out, headerText); } } ca...
322933d7-8e02-4e84-86d7-6a4977cf724f
9
private String determinePixelSymbol(int intensity) { String result = null; if (intensity > 240) { result = " "; } else if (intensity > 200) { result = "."; } else if (intensity > 160) { result = "^"; } else if (intensity > 120) { result = "*"; } else if (intensity > 90) { result = "&"; ...
d75c9c43-7341-4dcf-9db9-5796c99023b1
0
@Override public void modifiedStateChanged(DocumentEvent e) {}
b7d90e69-3697-4aa0-be3a-0f8247089961
1
private void saveXMLFile(ArrayList<String[]> data) { String xml = createXMLString(data); File xmlfile = new File("ports.xml"); // OutputStreamWriter to enable forcing UTF-8 encoding. OutputStreamWriter writer = null; try { writer = new OutputStreamWriter(new FileOutputStream(xmlfile), Charset.forNa...
e18b3f1d-5de1-4413-84b9-c479590d3b87
2
private String collectionsAsString(List<String> list) { String str = "( "; Iterator<String> iterator = list.iterator(); while (iterator.hasNext()) { String s = iterator.next(); str += s; if (iterator.hasNext()) { str += " ,"; } ...
05d34c26-6fa5-468c-bc0d-ad114da72200
2
public void updateStatus(String text) { if (text.length() + statusText.length() > MAX_STATUS_SIZE) { // Remove the last line statusText.delete(statusText.lastIndexOf("\n"),statusText.length()); } // Update the master text statusText.insert(0, text+"\n"); // And then add it to the text area if...
29b81134-1a1a-4fd9-bceb-dc748491eee3
1
public int getSize() throws IteratorException { int size = 0; if (list != null) { size = list.size(); } else { throw new IteratorException(); //No Data } return size; }
dfbef4bb-7c50-40d7-b79f-e4ca85b988b9
7
public JSONNode addArrayElement(Object value) { NodeType type; if (getNodeType() != NodeType.ARRAY) return null; type = null; if (value != null) { if (value instanceof Boolean) type = NodeType.PRIMITIVE; else if (value instanceof Integer) type = NodeType.PRIMITIVE; e...
2fdf264e-c27d-49f2-91e9-81320f021b1b
1
public static void addPreLive(final String name) { if (CallGraph.preLive == null) { CallGraph.init(); } CallGraph.preLive.add(name); }
4b579eeb-03d9-442f-b52a-f021383182f7
9
private void zoom(double upperLeftX2, double upperLeftY2, double utmWidth2, double utmHeight2, boolean zoomIn, double x1utm2, double x2utm2, double y1utm2, double y2utm2) { if(zoomIn) { if(x1utm2 > x2utm2) { //If x1 > x2 then switch double temp = x1utm2; x1utm2 = x2utm2; x2utm2 = temp; } if(y...
0f4e0933-c4e2-4f64-be1c-4d0e63cfff2e
2
public String getCreditByUID(Statement statement,String UID)//根据用户名获取信用度 { String result = null; sql = "select credit from Users where UID = '" + UID +"'"; try { ResultSet rs = statement.executeQuery(sql); while (rs.next()) { result = rs.getString("credit"); } } catch (SQLException e) { ...
1836bf1e-003f-42db-b0ce-9ebab41526c8
7
private void addIgnore(long l) { try { if(l == 0L) return; if(ignoreCount >= 100) { pushMessage("Your ignore list is full. Max of 100 hit", 0, ""); return; } String s = TextClass.fixName(TextClass.nameForLong(l)); for(int j = 0; j < ignoreCount; j++) if(ignoreListAsLongs[j] == l) ...
7880d215-6e52-4340-bccd-e1fb3bce1cdd
3
@Override public GameState doAction(GameState state, Card card, int time) { if(time == Time.DAY) { state = beggarDayAction(state, card); } else if(time == Time.DUSK) { PickTreasure temp = new PickTreasure(); state = temp.doAction(state, card, time); } else if(time == Time.NIGHT) { //Do noth...
155e4c59-6799-4dde-ae6a-94894283ed17
0
public Person3(String pname){ name = pname; }
5c39f42a-37b4-4a25-8bfc-927abeacd6a3
1
private void printRow(String header, String[] cells) { printCell(header); for (String cell : cells) { printCell(cell); } System.out.println(); }
cddf89e5-8ff6-4b4c-a52d-43d6d26983c0
1
private int readCodeBit() throws IOException { int temp = input.read(); // read one digit after freq in inputBitstream if (temp != -1) return temp; else // Treat end of stream as an infinite number of trailing zeros return 0; }
2965ae17-6649-424b-9cbf-003be582b783
6
public static String unescape(String string) { int length = string.length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; ++i) { char c = string.charAt(i); if (c == '+') { c = ' '; } else if (c == '%' && i + 2 < length) { ...
e65a3606-05f1-4f02-8674-a1a1150a795d
5
protected void searchByName(String mask) { if (mask.isEmpty()) { searchFromIdx = 0; return; } try { Pattern p = Pattern.compile(mask); ArrayList<CourseRec> all = courseModel.getFilteredCourses(); for (int i = searchFromIdx; i < all.size(); i++) { CourseRec cr = all.get(i); if (p.matcher(cr....
0f41def3-8be2-4278-a4e2-1b8ef4e07c4a
5
private boolean isCrossWin(){ if(model.getField().getCell(1, 1)==Field.DEFAULT_VALUE) return false; if( (model.getField().getCell(1, 1) == model.getField().getCell(0, 0) && model.getField().getCell(1, 1) == model.getField().getCell(2, 2)) || (model.getFiel...
910b9ab8-7ac9-4943-b3de-146fe5937cdb
0
@Override public String toString(){ return "id= "+this.getId()+", "+this.getName()+"\n"+getTime()+"\n"+"Ребро: "+this.getEdge()+"\n"+"Высота: "+this.getHig()+"\n"+"Сумма рёбер: "+this.getSum()+"\n"+" Площадь грани: "+this.getArea_surf()+"\n"+"S=: "+this.getArea()+" V=: "+this.getVolume()+"\n"; }
f1e2b604-6499-4d76-a7cf-d8862c91eb0f
2
public static String[] concatenateStringArrays(String[] array1, String[] array2) { if (SpringObjectUtils.isEmpty(array1)) { return array2; } if (SpringObjectUtils.isEmpty(array2)) { return array1; } String[] newArr = new String[array1.length + array2.length]; System.arraycopy(array1, 0, newArr, 0, arr...
71aeb2ed-a631-47a5-be5d-9c21da6da600
4
public Matrix plus(Matrix B) { Matrix A = this; if (B.M != A.M || B.N != A.N) { throw new RuntimeException("Illegal matrix dimensions."); } Matrix C = new Matrix(M, N); for (int i = 0; i < M; i++) { for (int j = 0; j < N; j++) { C.data[i][j...
b91712ed-02ab-4537-88da-8a87af596b22
6
public static void main(String[] args) throws Exception { int ponder = 5; if (args.length > 0) ponder = Integer.parseInt(args[0]); int size = 3; if (args.length > 1) size = Integer.parseInt(args[1]); ExecutorService exec = Executors.newCachedThreadPool(); Chopstick[] sticks = new Chopstick[size]; for (...
41cf69f5-90a3-4f0a-b026-1ea992eb9fb9
0
public List<ParkBoy> getBoyList() { return boyList; }
8881b603-daa3-48b8-829e-1903fdbc54cc
5
public void hits() { if (getState() != STATE_HIT) { setCanHitEnemy(false); setSpeed(0f); setState(STATE_HIT); switch (getFacing()) { case Entity.UP: moveY(-50); break; case Entity.DOWN: moveY(50); break; case Entity.LEFT: moveX(-50); break; case Entity.R...
882e2462-238e-488c-8254-1a8ed299967c
3
public void cliqueDeclin() { if( etape == 0 && joueurEnCours.getPeupleDeclin() == null && Game.getInstance().askConf("Confirmer le passage en déclin ?") ){ //joueurEnCours.getPeuple().decliner(); //joueurSuivant(); tempEnDeclin = true; setEtape(2); miseEnMain(); Game.getInstance().showTe...
4347b1cf-d2ce-4770-b3ff-c69daf68d879
5
public void run() { edge.addElement(GridCell.getStartCell()); int attempts =0;// variable to count how many attempts int state=NOT_FOUND; while(state==NOT_FOUND && attempts<maxSteps)//while a path hasnt been found and the whole grid hasnt been checked { attempts++; ...
c06b541a-44f2-4d69-850f-0d822fbc2bbf
8
public LocalLog(String className) { // get the last part of the class name this.className = LoggerFactory.getSimpleClassName(className); Level level = null; if (classLevels != null) { for (PatternLevel patternLevel : classLevels) { if (patternLevel.pattern.matcher(className).matches()) { // if leve...
92343c05-c8ca-4bf0-abf8-395f265fe5d9
4
@Test public void testGetDefaults() { List<String> keys = new ArrayList<String>(); List<String> args = Arrays.asList("get"); String scriptResult = ""; try { scriptResult = (String) _luaScript.callScript("config.lua", keys, args); } catch (LuaScriptException e1) { System.out.println("Exception: " ...
02f52212-2d40-4489-9c39-d2d93be4b0ef
4
public static boolean isOpp(ChipColor color1, ChipColor color2) { if((color1 == BLACK && color2 == WHITE) || (color1 == WHITE && color2 == BLACK)) return true; else return false; }
05ae097d-f144-45da-a8db-d2fd1253a2c3
4
public void savePlayerMap(boolean resetValues) { if (resetValues) { for (Player Player : PlayerMap.values()) { resetPlayerData(Player); } } checkFile(); try { FileOutputStream fos = new FileOutputStream(getFile()); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(PlayerM...
d7cbf4e4-1847-425e-8e2c-982c92e16189
6
public void maxHeapify(int[] A, int len, int n) { while (n <= len / 2) { int max = n; int left = n << 1; if (left <= len && A[max] < A[left]) { max = left; } int right = (n << 1) + 1; if (right <= len && A[max] < A[right]) {...
e61f5771-cce3-45cf-9c01-5338ad6fb4a1
9
public Shape select(int qx, int qy) { for (int i = shapes.size() - 1; i >= 0; i--) { Shape shape = shapes.get(i); if (shape instanceof Square) { if (testInSquare((Square) shape, qx, qy)) { System.out.println("Square selected!"); return shape; } } else if (shape instanceof Circle) { i...
4a6056b1-75cc-4b94-bec7-8f7243ddf333
0
public VueComptesRendus getVue() { return vue; }
96850782-02f6-41de-84d3-8c767fdd5c63
0
protected void interrupted() { end(); }
1f788b31-5656-45a6-aefd-f334bee25f37
1
private void invokeInsn(final int opcode, final Type type, final Method method) { String owner = type.getSort() == Type.ARRAY ? type.getDescriptor() : type.getInternalName(); mv.visitMethodInsn(opcode, owner, method.getName(), method.getDescriptor()); }
fec41728-ce23-4dcb-962a-6a4eb4c5c94b
6
public String toString() { if (x!=0 && y>0) { return x+" + "+y+"i"; } if (x!=0 && y<0) { return x+" - "+(-y)+"i"; } if (y==0) { return String.valueOf(x); } if (x==0) { return y+"i"; } // shouldn't get...