method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
19bf9755-1e11-48cc-bafb-9640b5caf17d
1
public void testParseInto_simple() { MutableDateTime expect = null; expect = new MutableDateTime(2004, 6, 9, 11, 20, 30, 0, LONDON); MutableDateTime result = new MutableDateTime(0L); assertEquals(20, g.parseInto(result, "2004-06-09T10:20:30Z", 0)); assertEquals(expect, result); ...
bc1a6e10-c881-4c46-8e79-e8f8342e655e
2
private static void checkedException() { FileOutputStream out = null; try { out = new FileOutputStream(new File("/tmp/file.txt")); System.out.println("File opened"); } catch (FileNotFoundException e) { e.printStackTrace(); } finally { try { out.close(); } catch (IOException e) { e.printSt...
cce13ae3-01f9-405a-b0c7-b328be8b5e5f
3
private ASPlayer setLastActivity(ASPlayer data, TableType table, int value) { switch(table) { case DAY: data.lastDay.activity = value; break; case WEEK: data.lastWeek.activity = value; break; case MONTH: data.lastMonth.activity = value; break; default: plugin.severe("Invalid Type in setLastActivity")...
99416db4-6552-4140-aee9-46deff2cc57e
3
private static Connection innitializeDB(String URL, final String TABLES) { Statement stmt = null; Connection conn = null; try { conn = DriverManager.getConnection(URL); } catch (SQLException e) { e.printStackTrace(); } try { stmt = conn.createStatement(); } catch (SQLExce...
5157a515-a8aa-46ad-b308-834e36d9e13c
8
public void actionPerformed(ActionEvent e) { if (e.getSource() == trocaMusica) { //System.out.println("Entrou aqui"); if (m_flagPlayStop){ somDaMensagem.interrupt(); m_flagPlayStop = false; } else { somDaMensagem = new ExecutarSom( "musicas/hedwigsTheme.wav"...
8a8a9427-36db-428a-869a-1c788c1e42bd
7
@Override public Individual getParent(List<Individual> population) throws Exception{ Random rand = new Random(); List<Individual> local = new ArrayList<Individual>(); Individual best = null; //Form the sample group while(local.size() < tournamentSize){ int random ...
6803b25f-3323-4fff-9c66-0d36366db75f
8
protected void handleEvilPopupMgrBackup() { if (RegKey.POPUP_MGR.type != null) return; // this will return String (REG_SZ), int (REG_DWORD), or null if the key is missing RegKey.POPUP_MGR.type = WindowsUtils.discoverRegistryKeyType(RegKey.POPUP_MGR.key); Class<?> backupPopupMgrType = discov...
a9f61d48-7e1f-462e-8a8e-5aaf0a17d71c
3
private void begin () { long t__send, dt; double rate; _t_send = System.currentTimeMillis(); while (++times <= Utils.MAX) { broadcast("TEST", String.format("%d", System.currentTimeMillis())); if (times % Utils.STEP == 0) { t__send = System.currentTimeMillis(); dt = t__send - _t_send; if (dt > 0) ...
bcefbefd-addf-48ae-bdad-4899e35050e8
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Positie positie = (Positie) o; if (x != positie.x) return false; if (y != positie.y) return false; return true; }
77df9e6b-4ff1-485f-acf0-041e21542734
5
private void connectToServer() { if(iptf.getText().equals("")) { JOptionPane.showMessageDialog(SwitchServerWindow.this, "The IP can't be blank!", "Error", JOptionPane.ERROR_MESSAGE); }else { if(connect == null || !connect.isAlive()) { connect = new Thread( new Runnable() { @Override pu...
df71f145-f874-4f38-8656-442ceee86901
5
public void visitLocalExpr(final LocalExpr expr) { // Determines whether or not the LocalExpr in question is the this // pointer. If the LocalExpr resides within an InitStmt, and the // LocalExpr is the first variable defined by the InitStmt, it is // the this pointer. if (thisPtr != null) { return; } ...
d4d54c0a-3094-4990-befd-b18254b3bb4e
1
String arrayName(String component, int dims) { // Using char[] since we have no StringBuilder in JDK4, and StringBuffer is slow. // Although, this is more efficient even if we did have one. int i = component.length(); int size = i + dims * 2; char[] string = new char[size]; ...
4bfe94f0-5c58-472f-bbd1-c4d51741c607
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof CcsTest)) { return false; } CcsTest other = (CcsTest) object; if ((this.id == null && other.id != null) || (thi...
0d6631c6-1538-4932-9005-2a50f4ffd45a
5
@Override public boolean touchRobot() { boolean touch = false; for (int i = 0; i < Board.robots.size(); i++) { if (Board.robots.get(i) != this.owner) { ArrayList<Line2D.Double> linies = Board.robots.get(i).getBoundLines(); for (int j = 0; j < linies.size(...
d2246800-4164-4274-95b9-e85eef3f40a7
2
public static ChunkyWorld getChunkyWorld(String worldName) { ChunkyObject object = getObject(ChunkyWorld.class.getName(), worldName); if (object == null) { World world = Bukkit.getServer().getWorld(worldName); if (world != null) { object = new ChunkyWorld(); ...
eed972c5-d7d6-44b6-851b-134760745a47
1
public void run() { int here = monitor.stop(); while (true) { liftView.moveLift(here, monitor.move()); here = monitor.stop(); } }
c704062b-7353-4206-be71-730e6ad818fa
9
public static boolean simulate(double height, double v, double angle, double maxX, double[] targetY){ if(parameterCheck(height, v, angle, maxX, targetY)==false){//is the input bad? return false;//stop } y0 = height; v0 = v; a = angle; targetX = maxX; h...
aa6984cb-1aa3-449a-948d-c2949e5da63e
2
public static void main(String[] args){ Boat.createBoat("RaceBoat"); Boat boat = Boat.getInstance(); try{ System.out.println("Setting sail to 0 degrees."); boat.com.sendMessage("set sail 0"); Thread.sleep(5000); for(int i = 10; i <= 360; i += 10){ System.out.print("Setting sail to " +i+" degrees....
dfdef992-6042-4ed4-a5b6-1ad2a0fe33ab
4
public static StandardUnit addStandardUnit(String name, String typeName, String systemName, double factorToReference) { StandardUnit createdUnit = null; if(!listUnits.containsKey(name) && listTypes.containsKey(typeName) && listSystems.containsKey(systemName)) { Type...
2927c680-9923-432a-850c-44a5b78ec9bf
5
public static void loadNewsInfo() throws IOException { checkUSB(); System.out.println("start to load news info from usb"); String rootPath = USBConfig.drivePath; String initnewFolder = rootPath + USBConfig.INI_NEW_FOLDER + "\\"; File folder = new File(initnewFolder); if(!folder.exists()){ folder.mkdirs()...
37c0c65b-1b48-4b50-945b-1fa2188aefdb
0
public void setFacOracleDAO(FacOracleDAO casurOracleDAO) { this.facOracleDAO = casurOracleDAO; }
c4280484-7bea-4287-8d34-48831fea697c
0
@Override public boolean isCellEditable(int row, int col) { return false; }
314298fc-7e1d-4384-9371-6de433f61a62
2
private void makePack(List<Card> cardList) { for (Card.Suit suit : Card.Suit.values()) { for (Card.Rank rank : Card.Rank.values()) { cardList.add(new Card(suit, rank)); } } }
ecd32dae-d1e7-41c9-b376-22ce7c5a8458
8
@Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) { if (ELEMENT_PROPERTY.equals(qName)) { try { String class_name = atts.getValue(ATTRIBUTE_CLASS); String property_name = atts.getValue(ATTRIBUTE_NAME); String property_value = atts.getValue(A...
aca26aa7-1eef-4641-a136-7a363ffba7f1
1
public int compareTo(Object o) { return (equals(o) ? 0 : -1); }
9c0ab8f5-f916-4654-8881-bcc384ed23a3
2
protected Class getClass(final Type t) { try { if (t.getSort() == Type.ARRAY) { return Class.forName(t.getDescriptor().replace('/', '.'), false, loader); } return Class.forName(t.getClassName(), false, loader); ...
72747d24-87f1-484f-adbe-393b09d26de4
2
@Override public boolean isTypeOf(Property p) { if(p==null) return true; if(equals(p)) return true; return this.superType.isTypeOf(p); }
a26ba85b-7727-467a-9358-062bb8611756
9
public static void readTemplates(String fileName, boolean resampledFirst, ArrayList<Template> templates){ try { Scanner sc = new Scanner(new File(fileName)); String curTemplate = ""; ArrayList<Point> curPoints = null; while(sc.hasNext()){ String cur = sc.next(); if(cur.charAt(0) == '#'){ i...
a1acdd94-d8d4-4dd3-a0d5-a960eb15d23a
9
boolean checkMyType(Object object) { if (object == null || !(object instanceof MyType[]) || ((MyType[])object).length == 0) return false; MyType[] myTypes = (MyType[])object; for (int i = 0; i < myTypes.length; i++) { if (myTypes[i] == null || myTypes[i].firstName == null || myTypes[i].firstName.length() =...
973771c9-8ba8-49c2-8cfb-9cbff4bf6d36
1
@Override public Grid clone() { Grid ret = new Grid(width, height, intelligentX, intelligentY, targetX, targetY); ret.setCurrentCells(Arrays.copyOf(currentCells, currentCells.length)); for (Integer i : intellingentMovementHistory) { ret.getIntellingentMovementHistory().add(i); } return ret; }
c9c73feb-229e-4dfc-9d2d-1e300a398528
7
public void commandAction(Command command, Displayable displayable) { String commandLabel = command.getLabel(); try { if (PlaygroundApp.ROOM_SELECTED_COMMAND.equals(commandLabel)) { launchRoomScreen(); } else if (PlaygroundApp.TURN_ON_LIGHT_COMMAND.equals(commandL...
f27b5c64-cae3-4a12-b288-ef1ae329b54f
7
private BufferedImage process(BufferedImage old) { int w = old.getWidth(); int h = old.getHeight(); BufferedImage img = new BufferedImage( w, h, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = img.createGraphics(); g2d.drawImage(old, 0, 0, n...
5eb5a686-dcba-426b-92cd-2657f8dc2e8c
2
public boolean removerDependente(String nomeDependente){ for(String d: dependentes){ if( d.equalsIgnoreCase(nomeDependente) ){ dependentes.remove(nomeDependente); return true; } } return false; }
49ad8c84-f42a-48bd-bdd8-1090fa3052da
8
public List<Integer> getFrequents(int[] nums) { // Find all the high frequency candidates for (int num : nums) { Integer count = counters.get(num); if (count != null) { // If it's one of the counters, increment counters.put(num, ++count...
63d53641-090d-4ac1-a258-81be2acd103f
2
public static Filter annotatedWithType( Class<? extends Annotation> annotationType ) { if ( annotationType == null ) { throw new IllegalArgumentException( "Parameter 'annotationType' must not be null" ); } checkForRuntimeRetention( annotationType ); return new A...
aabbf104-1fb7-4e5d-8040-d6846ed95dfc
4
@Override public void learnNetworkRules(List<Pair> learningDataset, int startRuleNum, int endRuleNum, int epochPerRule) { double smallestError = 0; int bestRuleCount = 0; for (int r = startRuleNum; r <= endRuleNum; r++) { createRules(r); double iterError = 0; System.out.println("=======...
d67eb12a-d5a8-4aa2-9a87-5de13408bb9f
8
public void set_Intcon_value(int s) { if ((s & 0b00000001) == 1) { label_58.setText("1"); } else { label_58.setText("0"); } if ((s & 0b00000010) == 2) { label_57.setText("1"); } else { label_57.setText("0"); } if ((s & 0b00000100) == 4) { label_56.setText("1"); } else { label_56.setTex...
ced6b1c3-49c7-402a-80df-087a3e9816cb
2
public int addLoadParameters(CtClass[] params, int offset) { int stacksize = 0; if (params != null) { int n = params.length; for (int i = 0; i < n; ++i) stacksize += addLoad(stacksize + offset, params[i]); } return stacksize; }
f171912c-fa8c-420b-b4cc-96281901256c
3
private static String changeFirstCharacterCase(String str, boolean capitalize) { if (str == null || str.length() == 0) { return str; } StringBuilder sb = new StringBuilder(str.length()); if (capitalize) { sb.append(Character.toUpperCase(str.charAt(0))); } else { sb.append(Character.toLowerCase(str....
a89bd7e7-758b-4349-ae1c-de4fa4823257
5
@Override public void run() { while(true){ if(engine.getSide().equalsIgnoreCase("None")){ serverTick(); clientTick(); } else if(engine.getSide().equalsIgnoreCase("Client")){ clientTick(); } else if(engine.getSide().equalsIgnoreCase("Server")){ serverTick(); } try { Thr...
30f5b341-356d-49ae-966a-5c2a0a6dea75
6
@Override //Quick and dirty implementation, needs some hard revision public AbstractStochasticLotSizingSolution solve( AbstractStochasticLotSizingProblem problem, boolean[] setupPattern) throws SolvingInitialisiationException, ConvolutionNotDefinedException { //Check inputs if (problem.getPeriods().le...
aede3e61-3d00-4314-8722-ef799205e617
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...
e5ebf1fe-e7ff-4ba8-a3f5-0c7cf2976854
0
public void processMouseEvent(MouseEvent event) { transformMouseEvent(event); super.processMouseEvent(event); }
a85189d7-a3fd-4bd5-a2f3-93b9f91af0bc
3
boolean isAttackPlaceHorizontallyRightNotHarming(int position, char[] boardElements, int dimension, int rightPosition) { while (rightPosition > 0) { if (isPossibleToPlaceRight(position, dimension, rightPosition) && isBoardElementAnotherFigure(boardElements[position + rightPositio...
25f8d545-e76f-4b74-a275-59b681d89d63
4
public LinkedList<Integer> searchForPattern(String pattern, String context) { LinkedList<Integer> foundPatternList = new LinkedList<Integer>(); int patternLength = pattern.length(); int contextLength = context.length(); for(int contextIndex = 0; contextIndex <= contextLength - patternLength; contextIndex++) { ...
7a7033f2-5382-4a0c-a388-218cd5aecc86
3
public void visitForceChildren(final TreeVisitor visitor) { if (visitor.reverse()) { target.visit(visitor); } for (int i = 0; i < operands.size(); i++) { final LocalExpr expr = (LocalExpr) operands.get(i); expr.visit(visitor); } if (!visitor.reverse()) { target.visit(visitor); } }
f0158138-aa18-4e7b-b42b-367bb9fc92f1
8
public static void weekPrediction(String inputFile) throws FileNotFoundException, IOException{ String line, season = null, jornada = null; ArrayList<String> matchs1 = new ArrayList<>(); ArrayList<String> matchs2 = new ArrayList<>(); Boolean primera = false, segunda = false; ...
1db3192c-0c45-49d0-80d3-d338ecf5ac00
3
public static Throwable unwrap(Throwable e) { Throwable unwrapp = e; while (true) { if (unwrapp instanceof InvocationTargetException) { unwrapp = ((InvocationTargetException) unwrapp).getTargetException(); } else if (unwrapp instanceof UndeclaredThrowableException) { unwrapp = ((UndeclaredThrowableEx...
9b66adc1-8918-4c3b-8398-52ae2e44a0f2
3
private int evalRPNHelper( List<String> los ){ // trivial case if ( los.size() == 1 ) { return Integer.parseInt(los.get(0)); } // non trivial case // 1. process the los List<String> ret = new ArrayList<>(); int i = 2; // index while ( i < los.size() ){ if ( isOperator( los.get(i)) ){ ...
b282bd2c-8a9b-46b8-9b4b-fd8574e88594
7
public void readAndParse() throws IOException { String currentLine; int i = 0; Map<Character,Set<Tile>> layoutToUse = wholeLayout1; try{ while((currentLine = cleanLine(lineReader.readLine())) != null) { if(currentLine.length() > 0) { if(currentLine.charAt(0) == '*' && layoutToUse == wholeLay...
e03a99df-863d-4749-bf1e-d5331e0d52aa
0
public EncryptedDataType getEncryptedValue() { return encryptedValue; }
a17c16bc-174e-4d7e-9c75-3320a3b91736
2
public void Logar() { //cria duas variaveis para receber os dados de login do usuario String login = txtLogin.getText(); String Senha = txtSenha.getText(); //Verifica se a senha digitada estar cadastrada no banco de forma criptografada //hash sha-256 criptografiaUtil cr...
10e26ff0-5daf-466b-8b46-59ac3c5d8633
1
private void fireNewPeerConnection(Socket socket, byte[] peerId) { for (IncomingConnectionListener listener : this.listeners) { listener.handleNewPeerConnection(socket, peerId); } }
45481033-df29-4f57-8398-b0357c378489
4
public void setPlayer1Name(JLabel label) { boolean test = false; if (test || m_test) { System.out.println("Drawing :: setPlayer1Name() BEGIN"); } m_player1Name = label; if (test || m_test) System.out.println("Drawing:: setPlayer1Name() - END"); }
e4f9c386-fe2b-4786-8c75-6b2852e51341
7
public void run() { // Make the initial map data, convert to PIT format String parts[] = gameData.split("\\|"); String planets[] = parts[0].split(":"); String planetData[]; StringBuilder map = new StringBuilder(); StringBuilder planet; for (String p : planets) { planetData = p.split("\...
bec7c61d-7ddb-43fc-b773-b2a094a62ccd
6
public boolean chunkExists(int par1, int par2) { if (!this.canChunkExist(par1, par2)) { return false; } else if (par1 == this.lastQueriedChunkXPos && par2 == this.lastQueriedChunkZPosition && this.lastQueriedChunk != null) { return true; } ...
e9e7c6eb-9db7-480f-a708-e0206202fe20
2
public int getNumberOfZombie(){ int res = 0; for (Being being: beings){ if (being.isZombie()){ res++; } } return res; }
ed63da2d-242b-44da-a010-180b4215635d
2
public URIMatcher setPort(Integer port) { this.port = port==null?null:(port <= NO_PORT ? NO_PORT : port); return this; }
4e994e98-7935-4b9a-8ecc-64874dcefb61
2
public LocalInfo getLocalInfo() { if (shadow != null) { while (shadow.shadow != null) { shadow = shadow.shadow; } return shadow; } return this; }
bc09d80f-6738-4dec-b2cf-63f7c1c00f9c
7
@Override public synchronized void addReliable(int connectPort) throws RemoteException { try { ServentDescriptor elem = new ServentDescriptor(InetAddress.getByName(RemoteServer. getClientHost()), connectPort, 0); boolean found = false; for (int i = 0; i < reliableServents.size(); i...
af284c4d-13c9-4ce4-a48e-7eaa1d3de1fc
0
public String getSort() { return sort; }
45441de4-b881-49ab-9e02-6bbc23414ddf
3
@Override public <E extends ApiResponse> E execute(ApiRequest request, AbstractContentHandler contentHandler, Class<E> clazz) throws ApiException { ApiConnector connector = getConnector(); URL url = connector.getURL(request); Map<String, String> params = connector.getParams(request); InputStream inputStream = ...
bb1e4c92-b225-433f-b3a7-3f64682e532b
6
public void paintExpression(Graphics g, Expression e, double xmid, double xfactor, double ymid, double yfactor) throws UnresolvedNameException { HashMap<String, Double> h = new HashMap<String, Double>(); double lastX = 0, lastY = 0; boolean hasBegan = false; for (double x = xbl; x < xbh...
6ac8f5e7-e0fc-4afd-9e92-1222ff944674
7
private void eltran(double[][] a, double[][] zz, int[] ordr, int n) { int i, j, m; for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { zz[i][j] = 0.0; zz[j][i] = 0.0; } zz[i][i] = 1.0; } if (n <= 2) { return; } for (m = n - 1; m >= 2; m--) { for (i = m; i < n; i++) {...
f6c1085b-c646-4fbe-ae4e-a3c3ac736f70
9
protected void readChild(XMLStreamReader in) throws XMLStreamException { if (in.getLocalName().equals(Colony.getXMLElementTagName())) { settlement = updateFreeColGameObject(in, Colony.class); } else if (in.getLocalName().equals(IndianSettlement.getXMLElementTagName())) { settleme...
0c548c1f-9c5b-481f-a3c4-b9ab05a6452f
5
OutputInformation report_table_layout() { OutputInformation infos = new OutputInformation(); infos.add_parameter("V", "discretization", discretizer); if (predefinedFirstThreshold == null || predefinedSecondThreshold == null) { infos.add_parameter("P", "requested P-value", pvalue); } if (prede...
eb109cf8-f8ae-4630-a2d1-38d94b09e89d
3
public static void main(String[] args) { Scanner input = new Scanner(System.in); //fuori dal try input.useLocale(Locale.US); boolean done = false; while(done!=true) { try { // Scanner input = new Scanner(System.in); //nel try // input.useLocale(Locale.US); /* perchè quando catturo InputMismatch...
07420515-f296-468f-9578-35f8bc6c814c
8
public void printTransactions(boolean writeHeader, String fileNameTransactions){ try{ String outputFileName = folder + fileNameTransactions; FileWriter writer = new FileWriter(outputFileName, true); if (writeHeader){ writer.write("moHFT;mo;loHFT;lo;tradeTime;F...
2a239152-2c41-4c9c-8dac-84c233a0b12e
8
public static int returnMax(int[] arr, int start, int end, int n) { int mid = start + (end - start) / 2; // only one element if (mid == 0 && mid == n - 1) return mid; if ((mid == 0 || arr[mid - 1] <= arr[mid]) && (mid == n - 1 || arr[mid + 1] <= arr[mid])) ...
72f79cb3-4b32-4ef0-8649-ee0a4ed5551e
4
@Override public void run() { while(running) { try { String s = reader.readLine(); if(s != "" && s != null) { Log.info(s); Message m = new Message(s); m.parse(); } } catch (IOException e) { Log.error(e); } } }
db94c3e5-7004-4d38-889c-e93c4dd79d94
9
public static void main(String args[]) { String filename; File f; if (args.length == 1) { f = new File(args[0]); try { parser = new LogoParser(new java.io.FileInputStream(f)); } catch (java.io.FileNotFoundException e) { e.prin...
58aedf33-937f-48b4-a55d-ad6c68c271e1
8
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
50c953eb-11d1-4761-9ac7-987bcf237e05
8
protected Object getPrimitive(Element node) throws Exception { Object result; Object tmpResult; Class cls; cls = determineClass(node.getAttribute(ATT_CLASS)); tmpResult = Array.newInstance(cls, 1); if (cls == Boolean.TYPE) ...
416c48a2-41c2-4698-872a-627cefdbf709
0
public void setAccessToken_secret(String accessToken_secret) { this.accessToken_secret = accessToken_secret; }
fbf9edfb-11ee-42ec-9d8c-8e9b7b3421b5
1
public String getYearStr() { if (year <= 0) { return ""; } return String.valueOf(year); }
713ec381-7330-4275-ab6c-87a7ca62df47
1
public void clearProxies() { for (OutlineProxy proxy : mProxies) { mModel.removeListener(proxy); } mProxies.clear(); }
219a3ded-b969-4a45-9eea-c0dd209273b8
4
public String toMachineString() { String machineString; if (OPCODE.getValue() == 13 || OPCODE.getValue() == 10) { //For HALT and SKZ instructions with no fields return OPCODE.toString(); } if (OPCODE.getValue() > 7 && OPCODE.getValue() < 10) { //For branch instructions with only one field machineString...
e16ac5ba-d405-4f92-b8e3-18fa33d1383a
6
@Override public void execute() throws MojoExecutionException, MojoFailureException { final InputStream license = OverMapped.class.getResourceAsStream("/COPYING.HEADER.TXT"); if (license != null) { try { getLog().info(new String(ByteStreams.toByteArray(license), "UTF8")); } catch (final IOException ex) {...
c5431f55-9a97-4943-8823-1fc4efd326d9
2
@EventHandler(ignoreCancelled = true) public void onInventoryClick(InventoryClickEvent e) { HumanEntity human = e.getWhoClicked(); if(!(human instanceof Player)) { return; } Player p = (Player)human; Dodgeball m; if((m = mm.getPlayerMinigame(p.getName())) ...
67fa6871-9e8e-4af9-9694-67d9d1ae5d56
9
public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new FileReader("msched.in")); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("msched.out"))); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.pars...
7364a86b-0f29-4848-9c5f-29130a403d8f
8
public static void main(String[] args) { int n = 20; for(int j = 1; j < MAX_NUMCHANGE; j++){ for(double eP = 0.5; eP < 1; eP+=.1){ eP = ((double)(Math.round(eP * 10)) / 10); int sig = 0; int before = 0; int total = 0; long start = System.currentTimeMillis(); System.out.println("eP: " + eP + " numCha...
77e69aa8-eddc-4dd8-8b13-cb4b401827f3
3
public boolean isBypassable(Player player) { String name = player.getDisplayName(); if (owner == null) { Citadel.severe(String.format("isBypassable(%s) encountered unowned reinforcement: %s", name, toString())); sendMessage(player, ChatColor.RED, "This ...
d19f1d79-97e5-44f2-9a0f-63ec4791190a
7
@RequestMapping(value = "/uploadFile.vpage", method=RequestMethod.POST) String uploadFile(@RequestParam("filedata") MultipartFile file,Model model, HttpServletResponse response) throws IOException { String originalFileName = file.getOriginalFilename(); String contentType = file...
0559cc27-330a-4daa-9486-6c72ba699eb0
3
public void updateEffects() { for(int var1 = 0; var1 < 4; ++var1) { for(int var2 = 0; var2 < this.fxLayers[var1].size(); ++var2) { EntityFX var3 = (EntityFX)this.fxLayers[var1].get(var2); var3.onUpdate(); if(var3.isDead) { this.fxLayers[var1].remove(var2...
3ef6a008-274d-4ecf-9280-34c0c6d74d98
1
public void analyzeIdentifier(Identifier ident) { if (ident == null) throw new NullPointerException(); toAnalyze.add(ident); }
a365ceb2-b14b-490e-aef8-efa4ec90e823
9
public void play() throws IOException { String response; if (isMultiplayer) { while (true) { response = in.readLine(); if (response.startsWith("LEGAL_MOVE")) { currentButton.setText(team); } else if (response.startsWith("...
d5e7ba63-7177-491d-86eb-1520533b5686
3
@Override public void deserialize(Buffer buf) { presetId = buf.readByte(); if (presetId < 0) throw new RuntimeException("Forbidden value on presetId = " + presetId + ", it doesn't respect the following condition : presetId < 0"); symbolId = buf.readByte(); if (symbolId < ...
0ff346ca-4517-4437-b34c-99d429bc3c14
7
protected int[] determineIndices(int numAttributes) throws Exception { int[] result; Vector<Integer> list; int i; StringTokenizer tok; String token; String[] range; int from; int to; list = new Vector<Integer>(); // parse range tok = new StringTokenizer(m_N...
17f08967-4174-4270-9602-7bdc6e8af072
2
private String preMakeRoom(javax.swing.JTextArea Area) { String bs = ""; int act = Area.getCaretPosition(); try { String ant = Area.getText(act - 1, 1); if (!ant.equalsIgnoreCase("\n")) { bs = "\n"; } } catch (BadLocationException ex) {...
e4aa4be9-88c0-4f7f-a38a-832bafb06059
6
public static void main(String[] args) { try { Logger logger = LoggerFactory.newLogger(LoggerFactory.CONSOLE); logger.connect(); logger.log("test message #1"); logger.disconnect(); } catch (CannotConnectException cce) { System.err.println("cannot connect to console-based logger"); } catch (NotConne...
bde15f86-f5a7-4892-a2d4-5374fa0fdf8a
4
public pair ge_add_expression(TextArea area,SimpleNode node,String prefix)throws SemanticErr{ SimpleNode left = (SimpleNode) node.jjtGetChild(0); int ex_num = node.jjtGetNumChildren(); if(ex_num==1) return ge_mul_expression(area, left, prefix); else { pair left_p...
6e51dcb9-68da-41b0-a9a3-0cb0955b94f7
2
private ArrayList<Integer> getNineInvertedDigits(int value) { ArrayList<Integer> result = new ArrayList<Integer>(); if (value == 0) result.add(0); else while (value > 0) { int digit = value % 9; result.add(digit); value = va...
1ca7dbf9-6ebd-4d43-8ee0-fba20a8ee749
3
public boolean equals(Object other) { // standard two checks for equals() if (this == other) return true; if (!(other instanceof TPoint)) return false; // check if other point same as us TPoint pt = (TPoint)other; return(x==pt.x && y==pt.y); }
8e9bcabd-b54b-4d69-9bef-4c0e8bd950e9
2
public void service(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { //String st=request.getParameter("name"); //int i=Integer.parseInt(st); String str=request.getParameter("name"); /*String str1=request.getParameter("option1"); String str2=request.getParameter(...
4e9cc096-d77d-48f7-9179-36787e03b01c
7
private static boolean isAlnumUline(char ch){ if(ch > 'a' && ch < 'z' || ch > 'A' && ch < 'Z' || ch > '0' && ch < '9' || ch == '_'){ return true; } return false; }
11557edd-d62c-4fff-8939-80b4d75e5feb
9
public String formatOrganization_name(String value) { String[] delimiterlist = {" ", "-", "_", "'", "."}; String[] abbreviationlist = {"ag", "bvba", "cv", "cvba", "cvoa", "esv", "nv", "pvba", "vzw"}; boolean first = true; boolean afterdelimiter = false; int index = 0; Str...
5d2d96d4-8e5b-4e80-be9c-87e5576aa195
7
private void drawNode(No no, Graphics g) { g.drawRoundRect(no.getX(), no.getY(), no.computeSize(), hNo, 25, 25); if (no==busca){ int pos=0; for(int i=0 ; i < no.getN() ; i++){ if(no.getChave().get(i)==keyBusca) pos=i; } ...
ebb6c829-6ca0-4d1a-be85-e26976a3aa9a
6
public void plot(ArrayList<DatasetPattern> dataset,ArrayList<Cluster> clusters){ XYSeriesCollection datasetCollection = new XYSeriesCollection(); for (int i = 0; i < clusters.size(); i++) { Cluster c = clusters.get(i); if(!c.getIsActive()) continue; ArrayList<DenseRegion> regions = c.getRegions(); ...
27710923-17c8-4dba-b8ff-394746e88590
9
public boolean match(String pattern) { Queue<Entry<String, NfaNode>> queue = new LinkedList<>(); queue.addAll(start.getAllTransitions()); if (finalStates.contains(start) || epsilonTransitionsToFinal(start)) queue.add(createEntry("~", start)); Entry<String, NfaNod...
005a090d-9b5f-4c98-88df-443692037aa8
2
private static String formatTime(long time){ // Given time in seconds. int sec = (int)(time / Framework.milisecInNanosec / 1000); // Given time in minutes and seconds. int min = sec / 60; sec = sec - (min * 60); String minString, secString; if(min <= 9) ...