method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2afc3fad-88c5-4309-8870-dc9c86e988be
8
public void removeWeather() { if(side1.contains(FieldCondition.Sun)) side1.remove(FieldCondition.Sun); if(side1.contains(FieldCondition.Sandstorm)) side1.remove(FieldCondition.Sandstorm); if(side1.contains(FieldCondition.Rain)) side1.remove(FieldCondition.Rain); if(side1.contains(FieldCondition.Hail))...
c734254b-22fc-4567-b163-b90c0aa2734c
3
private void decodeParms(String parms, Map<String, String> p) { if (parms == null) { queryParameterString = ""; return; } queryParameterString = parms; StringTokenizer st = new StringTokenizer(parms, "&"); while (st.hasMoreToke...
22139588-696c-4aff-b0ba-6c89c3cbc2f5
2
public void hurt (final Body b) { life--; runnableManager.add(new Runnable() { public void run () { if (b != null) { if (b.getUserData() != null) { System.out.println("hej"); Objects.world.destroyBody(b); b.setUserData(null); } } } }); }
d3a8a1f9-9027-4d0c-9168-934d49d50eb1
4
public List<Integer> getSecondaryGroups(Connection con, String user) { List<Integer> groups = new ArrayList<>(); /* Compose query. */ String SQL_QUERY = "SELECT secondary_group_ids " + "FROM xf_user " + "WHERE username=?;"; /* Execute query. */ try { PreparedStatement stmt = con.prepareStatement(S...
2bbe697d-9a9a-4d8e-81dd-717f0d90dcef
2
@SuppressWarnings("unused") private static void testAllClasses(Hashtable<String, TestCase> tests) throws ClassNotFoundException, IOException, InstantiationException, IllegalAccessException, URISyntaxException { Class<SaraQuestion>[] clazzez = TestRig.<SaraQuestion>getClasses("teach.solve_these"); ...
0f921233-8023-44d7-bff4-3c6a10d31852
4
public void run() { try { ois = new ObjectInputStream(skt.getInputStream()); pkt = (Packet)ois.readObject(); //Casts packet if(pkt instanceof ChatPacket) { // If its a chatpacket - new connections username = ((ChatPacket)pkt).get_message(); // Get username } server.writeServerMessage("Client Connec...
2def2ea7-0fc3-4733-8e05-52156fef597a
1
public static void main(String[] args) { for (int a=1; a<=100;a++){ System.out.println("Jamil Anowari" + a); } }
c3cc3a6f-ffdf-4d7a-b936-5cb74b3b73c3
4
private void calculate(){ int total = 0; for(int count = 0; count < neighborstate.length; count++){ if(count == 4){} else{total += neighborstate[count];} if(total > 1024){total = 1024;} if(total < -1024){total = -1024;} } state = total; }
61d14d32-df43-4041-819e-a048ad6fcdba
4
@Override public Float get(int index) { switch(index) { case 0: return x; case 1: return y; case 2: return z; case 3: return w; default: throw new IndexOutOfBoundsException(); } }
423c6efc-2df4-477d-9e95-c0d590eb5b09
8
public boolean exist1(char[][] board, String word) { if (board == null || board.length == 0) { return false; } if (word == null || word.length() == 0) { return true; } boolean[][] visited = new boolean[board.length][board[0].length]; for (int i =...
00390503-9b90-41e6-93b0-5a2909675e80
6
public void printpaint() { int[] is = new int[8001]; int last = -1; for( int i = 0;i < lptr.size();i++) { Pointer p = lptr.get(i); if( p.r == 0 ) continue; if ( p.color == -1 ) { last = -1; continue;} if ( last != p.color ) { is[p.color]++; last = p.color; } ...
682d996d-9cbe-4388-87f2-4a4b4e6ce52d
2
@Override public void handleEmptyEventQueue() { // TODO Auto-generated method stub super.handleEmptyEventQueue(); if (exec1xTraffic) { TrafficExportImport.changeReabilityModel(); TrafficExportImport.readEvents("./Traffic/" + id_execution + "_traffic_"+ Tools.getNodeList().size() + ".txt"); //Tr...
bddf8ca7-5b92-42c3-82b2-f8e38b3ebd52
9
public static int minPress(String start, String end, String[] forbids) { String ff[][] = new String[forbids.length][]; for (int i = 0; i < forbids.length; i++) { ff[i] = forbids[i].split(" "); } // int a1 = w2i("aaaa"); // int a2 = w2i("zzzz"); // System.out.println("aaaa="+a1+ " =>"+ i2w(a1...
193de3d8-e098-4fb4-87a9-58cb0a9c2bca
6
public static void turnNegationsIntoNegativeMultplication(LinkedList<Token> list) throws MalformedParenthesisException, MalformedDecimalException, InvalidOperandException, MalformedTokenException { //TODO: Add parenthesis around expressions that we modify //Create a parenthetical expression out of these token...
948abff3-5dc6-4e2d-887f-c5b3d333de37
2
public boolean isSizeChange() { return ((toSize != null )||(fromSize!=null))&&(toSize!=fromSize); }
ef0e8a99-a964-4057-a649-6f703e7b951f
3
@Override public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException { timer -= delta; Input input = container.getInput(); TowerGame tg = (TowerGame) game; if (input.isKeyPressed(Input.KEY_SPACE) || input.isKeyPressed(Input.KEY_ENTER) || timer <= 0) { tg.ente...
5f1df0c2-c24d-416e-aa76-2c37f7071bfe
7
public void execute(Object target, String fieldname, boolean refresh) { if (target != null && fieldname != null) { try { Method getter = target.getClass().getMethod( "is" + fieldname); Method setter = target.getClass().getMethod( "set" + fieldname, new Class[] { boolean.class });...
ac5b29e6-ae80-476d-a61e-85b58a77227f
0
public CustomFrame(String title) throws HeadlessException { super(title); }
1c876151-1ae2-44e0-8fc5-e4351fabe1ff
8
public void readFromFileINET(String fileName) { try { Scanner scanner = new Scanner(new File(fileName)); int nodeCount = scanner.nextInt(); scanner.nextInt();//skip edge count for (int i = 0; i < nodeCount; i++) { ASNode node = new ASNode(i); ...
ea18170f-82da-46aa-8e63-b432b011c0e8
2
private String[] deleteEmptyElements(String[] array) { ArrayList<String> dynamicArrayNoEmptyElements = new ArrayList<>(); for (String str : array) { if (!str.isEmpty()) dynamicArrayNoEmptyElements.add(str); } String[] arrayNoEmptyElements = new Str...
a0935f9a-fc1b-4c40-9377-de1041be41c6
6
@Override public void sendFileToBuyer(String buyer, String serviceName, String seller) { loggerNetwork.info("send file to buyer"); long length; int offset, numRead; byte[] fileBytes; String filename = serviceName; File verifyFile = new File(filename); InputStream serviceFile = null; try { ...
32fde515-8a7a-42f6-9bd2-ebca0739bc7a
4
public void setCustomFieldField(String nodeName, String content) { if (nodeName.equals("name")) setName(content); if (nodeName.equals("type")) setType(content); if (nodeName.equals("value")) setValue(content); if (nodeName.equals("shortname")) setShortname(content); }
684d849f-dc94-42fb-91fd-d5c7bdb0ae6f
7
public PetriNet(List<IBlock> blockList) { System.out.println("Creating Analog Computer Petri Net:"); blocks = blockList; // // Number of transitions is the number of blocks: // numTransitions = blocks.size(); System.out.println("Number of transitions: " + numTransitions); // // Count number of...
8466f0df-8a37-49bb-8c98-9c44aed069b1
0
public void mouseClicked(MouseEvent e) { }
3a8b61e5-5e21-43fc-931f-87dcc2da3e0c
7
private void parseArguementsAndSetCountJob(String[] args, Job countJob, Job genJob) throws Exception { for (int i = 0; i < args.length; ++i) { if (args[i].equals("-input")) { FileInputFormat.addInputPaths(countJob, args[++i]); FileInputFormat.addInputPaths(genJob, args[i]); } else if (args[i].equals("-c...
cad25934-78a2-4a20-af4a-ea40289b04ae
9
private void addReplaceFile(COMMAND cmd, boolean isLastMessage, String filename, int dataLength, byte[][] data) { try { File file = null; // Open the file to write if(cmd.equals(COMMAND.A)) { String fileOutputLocation = Server.SERVERDIRECTORIES[0].concat("/" + filename); file = new File(fileOutpu...
604ab788-b097-4ff3-9b93-5ab97e549dd1
6
public void makeMove(Player p){ rollDie(); startTargets(p.currentIndex, die); if(p instanceof ComputerPlayer){ humansTurn = false; ArrayList<BoardCell> roomList = new ArrayList<BoardCell>(); ArrayList<BoardCell> list = new ArrayList<BoardCell>(); boolean hasRoom = false; for(BoardCell cell : ...
8446881e-2c0e-451a-9c97-53ceccfb05f7
8
public static int evalRPN(String[] tokens) { int sLen = tokens.length; int token[] = new int[sLen]; int l=0; for (int i=0; i<sLen; i++) { if (tokens[i].length() > 1) { token[l] = Integer.parseInt(tokens[i]); l++; } else { char ch = tokens[i].charAt(0); if (('0'<=ch) && (ch <=...
9d453005-aea3-4ab7-ab2f-4ec8b815cbac
5
private static String getWebSiteViaProxy(){ // TODO Auto-generated method stub String proxyIp = "intpxy1.hk.hsbc"; int proxyPort = 8080; HttpHost target = new HttpHost("itunes.apple.com", 80, "http"); HttpHost proxy = new HttpHost(proxyIp, proxyPort); CredentialsProvider credsProvider = new B...
faa9f1cf-e3c7-460f-b24f-7781ede3cf2f
3
public int macdFixLookback( int optInSignalPeriod ) { if( (int)optInSignalPeriod == ( Integer.MIN_VALUE ) ) optInSignalPeriod = 9; else if( ((int)optInSignalPeriod < 1) || ((int)optInSignalPeriod > 100000) ) return -1; return emaLookback ( 26 ) + emaLookback ( optInSignal...
06b86b03-b8fb-48a2-b152-85c76975dc46
2
private Map invert(Map map) { Set entries = map.entrySet(); Iterator it = entries.iterator(); Map inverse = null; try { inverse = (Map) map.getClass().newInstance(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); inverse.put(entry.getValue(), entry.getKey()); } } catch (Throw...
a4cce22d-3db5-4473-b3cb-d4a7885846e8
0
public Entity(int x, int y) { this.x = x; this.y = y; }
c6537436-4264-4049-8863-bb4fd32bdbc7
9
public void quickSort(int[] array, int left, int right){ int p = (left + right)/2; int pivot = array[p]; int i = left; int j = right; while(i < j){ while(i < p && pivot >= array[i]){ ++i; } if(i < p){ array[p] = array[i]; p = i; } while(j > p && pivot <= array[j]){ --j; } ...
25820ce2-dc60-4413-8386-499b840abafb
7
private static void snake(int аrray[][]) { int step = 1; int row = (аrray.length / 2); int col = row; System.out.println("Обход по с пирали, начиная с центра :"); while (step < аrray.length) { for (int i = col; i > (col - step); i--) { System.out.print...
e9746929-6376-4470-8d3e-844584274f8c
3
@Override public void deserialize(Buffer buf) { setId = buf.readShort(); if (setId < 0) throw new RuntimeException("Forbidden value on setId = " + setId + ", it doesn't respect the following condition : setId < 0"); int limit = buf.readUShort(); setObjects = new short[lim...
8321e043-4443-408c-8e26-e1371ace887f
1
public ContinueBlock(LoopBlock continuesBlock, boolean needsLabel) { this.continuesBlock = continuesBlock; if (needsLabel) continueLabel = continuesBlock.getLabel(); else continueLabel = null; }
68652bf8-2491-49ae-8c12-108b0decae72
3
public Placeable loadContainer(int x, ArrayList<Drop> drops) { int mapY = 0; Placeable placeable = null; mapY = findFloor(x); placeable = new ItemContainer(this, registry, "Placeables/Placed/ItemContainer", "Placeables/Placed/ItemContainer", x, mapY, Placeable.State.Placed, drops); ...
97613ec2-4a67-4382-a2c1-26ae2f721cf4
4
public void render(FadingSpriteBatch sb){ int marginL = cornerTL.getRegionWidth(), marginD = cornerBL.getRegionHeight(); int d = innerWidth * (side - 1)/2, o = 10; // float z = main.getCam().zoom / Camera.ZOOM_NORMAL; float x = 2*(float) Math.cos(lifetime); float y = 2*(float) Math.sin(lifetime); Vector2 v =...
811e44d2-3d27-447f-891f-3e7cd4c0c21a
3
private void fillConceptList(Student student, JList<String> list) { bookingService = BookingService.getInstance(); DefaultListModel<String> dlm = new DefaultListModel<String>(); list.setModel(dlm); dlm.removeAllElements(); Set<Activity> activities = student.getActivities(); for (Activity a : activities) { ...
e6bd7a10-71dd-4160-a5ac-2986ad7748f0
1
public synchronized ORB getInstance(String initialHost, int initialPort) { if (orb_ == null) { Properties props = new Properties(); props.put("com.sun.CORBA.POA.ORBPersistentServerPort", Integer.toString(initialPort)); props.put("com.sun.CORBA.POA.ORBPersi...
ec02c42d-2e60-4c20-a827-93f0d7057d2c
6
@Override public void shutdown() { if (shutdown) return; super.shutdown(); final Queue<Task<?>> queue = this.queue; while (true) { final Task<?> task = queue.poll(); if (task != null) { task.cancel(false); } else { break; } } for (final Thread thread : threads) { thread.interrupt...
bf8d9953-3fd1-446e-8da8-3e4ea81bd2f3
7
private void drawParticleFeeders(Graphics2D g) { List<ParticleFeeder> particleFeeders = model.getParticleFeeders(); if (particleFeeders.isEmpty()) return; Stroke oldStroke = g.getStroke(); Color oldColor = g.getColor(); Symbol.ParticleFeederIcon s = new Symbol.ParticleFeederIcon(Color.GRAY, Color.WHITE, fa...
daffddc8-4a4a-48a9-8f51-77cb0ccf6e15
7
@Override public String toString() { StringBuilder sb = new StringBuilder(); for (int i = 1; i <= size / 3; i++) { sb.append(array[size / 3 - i] != null && size / 3 - i < stacks.get(StackIndex.FIRST).curr ? array[size / 3 - i] : ".") .append('\t') .append(array[2 * size / 3 - i] != null &&...
5c9a138e-d1c7-4102-8633-5776d52514f1
7
@Override protected void validateConstructor(List<Throwable> errors) { // Get the constructor Constructor<?>[] constructors = this.getTestClass().getJavaClass() .getDeclaredConstructors(); if (constructors.length == 0) { return; } // Search for a valid one for (Constructor<?> c : constructors) { ...
5e29b5b6-7ec4-408d-8968-d92581abba53
1
public void mousePressed(MouseEvent event) { if (getDrawer().getAutomaton().getEnvironmentFrame() !=null) ((AutomatonEnvironment)getDrawer().getAutomaton().getEnvironmentFrame().getEnvironment()).saveStatus(); state = getAutomaton().createState(event.getPoint()); getView().repaint(); }
22f12379-e3d6-480a-b4eb-1f7b683a9a4c
2
private static String nextImmediateLine(RandomAccessFile r) throws IOException { String l; while ((l = r.readLine()) != null && l.startsWith("//")) { //Reading file done in loop condition! } return l; }
f27022c0-57fa-428e-a250-be8d6ccb8396
2
public int getSelectedIndex() { for(int i=0;i<markers;i++) { if(marker[i].isSelected()) { return i; } } return -1; }
8e592e1f-e3e1-458a-8957-ae0dd545a765
9
private final void method3214(int i, ByteBuffer class348_sub49, int i_6_) { if (i_6_ == 60) { if (i != 1) { if ((i ^ 0xffffffff) == -3) { int i_7_ = class348_sub49.getUByte(); ((Class348_Sub42_Sub10) this).anIntArray9566 = new int[i_7_]; for (int i_8_ = 0; (i_7_ ^ 0xffffffff) < (i...
4d86f2d2-34a0-4097-85b9-246d914e6a7b
9
private ArrayList<String> compareOutput(String actOut, String expOut, String otherChannelOut, String channnelId, String otherChannelId) { ArrayList<String> extractedVariables = new ArrayList<String>(); if (expOut.equals("-")) { if (actOut.length() < 1) { fail(); print("expected some output on " + chan...
8c89e603-f769-4f72-9e0c-3be0be0c5edc
7
protected void paintComponent(Graphics g) { // Let UI delegate paint first // (including background filling, if I'm opaque) super.paintComponent(g); g.drawRect(0,0, getWidth() - 1, getHeight() - 1); g.setColor(Color.gray); g.drawLine(colWidth,padding, colWidth, statusTextHeight - padd...
94bde7ae-d1f6-496b-b258-6f283130a9ac
3
@Override public void actionPerformed(ActionEvent e) { while(true) { new Thread(new Runnable() { @Override public void run() { while(true) { new Thread(new Runnable() { @Override ...
2863ed44-a436-4a2c-b0ee-26ca9896ccb8
5
public boolean process(DatagramPacket datagram) { //Let the mailbox know if this session is ending boolean discard = false; try { Scanner in = new Scanner(new DataInputStream (new ByteArrayInputStream(datagram.getData(), 0, datagram.getLength()))); String input = in.nextLine(); String[] tokens ...
2a048680-ebfe-4c74-9ff5-5512c1b7e1c8
8
public void act() { if (state.getState().equals("idle")) { if(dying()) { Main.simulation.removeMapItem(this); Main.taxiService.removeTaxi(this); } } if (state.getState().equals("Collecting Person")) { if(! person.inTaxi()) { setLocation(route.nextPoint(speed/2));...
71fe71f1-48d9-40ee-b93d-8b86fcd544ff
4
public static boolean isUnicode( String s ) { byte[] strbytes = null; try { strbytes = s.getBytes( "UnicodeLittleUnmarked" ); } catch( UnsupportedEncodingException e ) { ; } for( int i = 0; i < strbytes.length; i++ ) { if( strbytes[i] >= 0x7f ) { return true; // deal with non-compres...
669e6496-c907-4000-8af5-f61e7bebe6d4
1
private void anadirCliente(){ boolean especialNew = false; if(especialN.isSelected()){ especialNew = true; } Cliente clienteN = new Cliente(nombreN.getText(), apellidosN.getText(), apodoN.getText(),especialNew); System.out.println(especialNew); GestionarClient...
a4069aba-9e86-4ac2-82b6-d1b219f4f015
3
public static boolean checkRunMode(String testCase){ //for the excel file to read for(int i=2; i<=datatable.getRowCount("Test Cases"); i++){ if(datatable.getCellData("Test Cases", "TCID", i).equalsIgnoreCase(testCase)){ if(datatable.getCellData("Test Cases", "Runmode", i).equalsIgnoreCase("Y")){ ...
ec9bc34d-0d5f-4545-b50b-75afb2bf892a
8
public static void main(String[] ops) { int n = Integer.parseInt(ops[0]); if(n<=0) n=10; long seed = Long.parseLong(ops[1]); if(seed <= 0) seed = 45; RandomVariates var = new RandomVariates(seed); double varb[] = new double[n]; try { System.out.println("Generate "+n+" val...
3a01a058-661d-4a48-b432-b29088d2af60
4
public void run() { while (true) { for (int i = 1; i <= 100000; i++) { d += (Math.E+ Math.PI)/i; if (i % 1000 == 0) Thread.yield(); } if(countDown-- <=0 ) break; println(this.id +":" + this.countDown + ":...
b2759247-4812-4917-8163-ab334cf8963c
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Feature other = (Feature) obj; if (description == null) { if (other.description != null) return false; } else if (!description.equa...
ce0fb1b5-8049-42db-afa1-951955818391
3
public final void visitInnerClass( final String name, final String outerName, final String innerName, final int access) { StringBuffer sb = new StringBuffer(); appendAccess(access | ACCESS_INNER, sb); AttributesImpl att = new AttributesImpl(); att.add...
a6f49294-d4a4-4590-b223-f8ef6e156710
1
@Override public String getEndNode() { int size = connections.size(); if (size > 0) { return connections.get(size-1).getEndNode(); } return null; }
cbce3ee2-3d77-4e60-b4b4-6e4de0cf0a81
5
private int getFrame() { if (!movingX && !movingY) return 0; if (xIndex < 2) return xIndex; if (xIndex == 2) return 0; if (xIndex == 3) return 2; return 0; }
385bf080-5b63-4101-905d-a014990bd47e
1
private String calc(String input) { //Person 1 put your implementation here String n = ""; for(int i = 0; i < input.length(); i++){ char temp = input.charAt(i); temp++; n = n + temp; } return n; }
4667e5da-8ebf-48c3-b2e0-69eacf436da9
2
public boolean isCuboid(HashMap<Integer, Double> solutionFitness) { for(int i = 1; i < 11; i++){ if(i * i * i == solutionFitness.size()){ return true; } } return false; }
fe97ec81-ba76-4df7-8d95-02fd381d33bd
7
@EventHandler(priority = EventPriority.LOWEST) public void onChunkLoad(ChunkLoadEvent e) { if (!Settings.amrs) { return; } if (Settings.world || WorldSettings.worlds.contains(e.getWorld().getName())) { // Iterate through the entities in the chunk for (Entity en : e.getChunk().getEntities()) { fi...
7809bc6c-dc41-47f4-973e-07c437c5a18e
8
public void putSeed(long x) { /* --------------------------------------------------------------- * Use this function to set the state of the current random number * generator stream according to the following conventions: * if x > 0 then x is the state (unless too large) * if x < 0 then the state is obtained ...
97241a2d-4dcd-4e40-af9f-585866f4ba22
5
public List<Branch> getBranchesSummary() { List<Branch> list = new ArrayList<>(); Connection con = null; Statement stmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnectio...
893f35e3-e1f5-4f4c-8311-93bde79901bc
3
synchronized void writeAll(String str) { //ʹ׽Ϣ PrintWriter write=null; Socket socket; for(int i=0;i<size();i++) { socket=(Socket)get(i); // ȡ׽ try { write=new PrintWriter(socket.getOutputStream(),true); // if(write != null) write.println(str); //ͨϢ }catch(Exception e){ e.printStackTrace...
06d20143-51da-49b6-9d92-cc82fb0b1c35
8
private void ingresar() { // Según el permiso de usuario, podrá acceder al sector correspondiente switch (permiso) { case 0: // Usuario Administrador Menu menu = new Menu(conexion, id_personal, this); menu.setVisible(true); brea...
c46464a4-bbff-4341-99f8-4db4f4dbd9d1
9
@Override public void actionPerformed(ActionEvent arg0) { JButton source = (JButton) arg0.getSource(); if (source == deleteGame) { int games_num = list.getSelectedValuesList().size(); if (games_num > 0 && showDialog("You are going to remove " + games_num + " games from SIB. Are you sure about that?")) ...
c40f688e-c7e0-4ab7-8759-6a4a32031eee
6
public static int determinApproporiateDepth(MorrisBoard bd) { int depth = SEARCH_DEP_LIMIT_DEFAULT; int numEmpty = bd.countEmpty(); if ((numEmpty >= HIGH_BOTTOM) && (numEmpty <= HIGH_TOP)) { depth = depthForHigh(numEmpty); } else if ((numEmpty >= MED_BOTTOM) && (numEmpty <= MED_TOP)) { depth = depthF...
0e3013d2-662c-4327-9f47-e2f076d5318a
2
private static int indexOfName(String name, ArrayList list) { for (int i = 0, limit = list.size(); i < limit; i++) { if (name.equals(list.get(i).toString())) { return i; } } return -1; }
44879fb9-ce0d-4dd1-a6a5-f1e7e2d2fba2
3
public IllegalOrphanException(List<String> messages) { super((messages != null && messages.size() > 0 ? messages.get(0) : null)); if (messages == null) { this.messages = new ArrayList<String>(); } else { this.messages = messages; } }
c5bcda4a-bfe2-46fa-85c7-8d8c1d72562c
5
public static void main(String[] args) { String uri = "hdfs://localhost:9000/HFCube/cubeElement/baseCube/1"; Configuration conf = new Configuration(); FileSystem fs = null; try { fs = FileSystem.get(URI.create(uri), conf); } catch (IOException e) { e.print...
11e9ce95-eb49-437d-b420-d6d09703b051
4
public double standardizedItemRange(int index){ if(!this.dataPreprocessed)this.preprocessData(); if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive"); if(!this.variancesCalcu...
8437bebe-2a27-4799-af4e-48db8c1f4b5c
6
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int size = Integer.parseInt(line.trim()); int[] ma...
5a167480-fa4c-43f3-a129-5a8e0d0582ca
3
private static boolean insertValuesInEdge(int idStartNode, int idEndNode, float etx, float rate, float mtm, float ett) { Node startNode = Tools.getNodeByID(idStartNode); Node endNode = Tools.getNodeByID(idEndNode); if(!startNode.outgoingConnections.contains(startNode, endNode)) return false; Iter...
6c138707-9997-4e0a-a806-73d34a1698ec
4
private void limitVelocity() { assert(velocities != null); for(int i = 0; i < velocities.length; i++){ for(int k = 0; k < velocities[i].length; k++){ if(velocities[i][k] < 0 - maxVelocity[i]){ velocities[i][k] = 0 - maxVelocity[i]; }else if(velocities[i][k] > maxVelocity[i]){ velocities[i][k] =...
676ffc0f-ae52-4af5-a42b-b234b5e5c583
0
public List<EventComment> findAllEventCommentsByHallEventId(final Long hallEventId) { return new ArrayList<EventComment>(); }
d8f961aa-899f-4d00-97f2-e8fb2e542aa7
1
public static void main(String argv[]) { int n = new Integer(argv[0]).intValue(); DESRandom prng = new DESRandom(); for (int i = 0; i < n; i++) System.out.println(Long.toString(prng.nextLong(), 16)); }
bd3c9223-2f4c-478d-9152-dad792214883
0
public static void main(String[] args) { java.util.ArrayList list = new java.util.ArrayList(); }
347401ab-904f-4770-8fee-7a5a11ab9251
0
public String toString() { return "Session info \nUser: " + username + "\nDate: " + date + "\nPassword: " + password; }
c6250bdc-2236-4834-a8c1-dd94963e7166
9
public static void main(String[] args) throws Exception{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(in.readLine().trim()); for (int i = 0; i < t; i++) { int n = Integer.parseInt(in.readLine().trim()); int casos = Integer.parseInt(in.readLine().trim(...
bb5610e9-0dc5-480e-b79e-4e90d2a709a2
3
private void doWork() { System.out.println("NewsWorker start to work!"); long start = System.currentTimeMillis(); try { NewsDao.instance().writeToIniFile(); long end = System.currentTimeMillis(); long period = end - start; System.out.println("NewsWorker cost time in millis : " + period); if (perio...
bab699d5-e0a0-42ef-9be7-3e297f053cbd
7
@Test public void testIterator() throws Exception { // first, populate the aggregator via sum over scan1 scan1.open(); StringAggregator agg = new StringAggregator(0, Type.INT_TYPE, 1, Aggregator.Op.COUNT); try { while (true) agg.mergeTupleIntoGroup(scan1.next()); } catch (NoSuchElement...
4ab5eab4-1813-4187-87d1-3c7f7e3a5535
7
public COP_Instance fixItUp(){ if (debug>=3) { String dmethod = Thread.currentThread().getStackTrace()[2].getMethodName(); String dclass = Thread.currentThread().getStackTrace()[2].getClassName(); System.out.println("---------------------------------------"); ...
7b1a2c2b-c535-4cb8-8f33-c223b2f972e7
7
public Object nextContent() throws JSONException { char c; StringBuilder sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new St...
0b7f6fc7-123f-4ce9-bbcc-8f68b8643f11
1
void await() throws InterruptedException { synchronized (lock) { while (count > 0) { lock.wait(); } } }
ded5e300-cd75-4eb1-852f-a44abc6f1e05
2
public CtField lookupFieldByJvmName2(String jvmClassName, Symbol fieldSym, ASTree expr) throws NoFieldException { String field = fieldSym.get(); CtClass cc = null; try { cc = lookupClass(jvmToJavaName(jvmClassName), true); } ...
5aca2d05-4ca6-49e7-965c-20e7550c66c6
2
static void layoutComponent(Component component) { synchronized (component.getTreeLock()) { component.doLayout(); if (component instanceof Container) { for (Component child : ((Container)component).getComponents()) { layoutComponent(child); ...
1d067b01-d8be-45e1-91dc-de5b5a939f1c
6
public static String escape(String string) { char c; String s = string.trim(); StringBuffer sb = new StringBuffer(); int len = s.length(); for (int i = 0; i < len; i += 1) { c = s.charAt(i); if (c < ' ' || c == '+' || c == '%' || c =...
a4e6c56c-53cd-4cde-b54e-985bb7af03af
1
public static User findOne(String field, String value) throws SQLException { ResultSet result = Data._find(User.class.getSimpleName(), field, value); if(result.next()) { return User.createOneFromResultSet(result); } else { return null; } }
a405410e-e16a-4f54-ba24-c62ebc2145fb
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TipoEndereco other = (TipoEndereco) obj; if (this.idTipoEndereco != other.idTipoEndereco && (this.idTipoE...
5cd5c774-5135-4971-90bb-21113478f96b
4
public void Receive() throws ClassNotFoundException, IOException { System.out.println("Entered Recieve"); if (input.hasNext()) { System.out.println("Input got more to recieve"); String message = input.nextLine(); System.out.println("Message: " + message); String option = message.substring(0, 3); ...
31d821ce-3989-4d0c-a18d-40c212d79d3f
3
@EventHandler public void itemClick( InventoryClickEvent e ){ if( e.getCurrentItem() != null ){ if (String.valueOf(e.getCurrentItem().getItemMeta().getLore()).contains("Smeltery I")) { if( e.getInventory().getType() == InventoryType.ANVIL ){ e.setCancelled(tru...
12ce03b6-b79d-47f0-b21e-b2384b232599
1
public String proposeFilename(String filename, Serializable structure) { if (!filename.endsWith(SUFFIX)) return filename + SUFFIX; return filename; }
9dc2bbd5-0491-4a09-b2be-ada63e663f93
6
@EventHandler public void PigZombieFireResistance(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getPigZombieConfig().getDouble("P...
5ddf15dd-e882-45fa-abb6-6306f6f8176a
8
@Override public String[] listAll() throws IOException { Set<String> files = new HashSet<>(); // LUCENE-3380: either or both of our dirs could be FSDirs, // but if one underlying delegate is an FSDir and mkdirs() has not // yet been called, because so far everything is written to the other, // in ...
ca4d7fe0-5961-4084-992a-35a816a26010
0
public ExportFileMenuItem(FileProtocol protocol) { setProtocol(protocol); addActionListener(this); }
17ec8af9-6051-469e-9572-03b323aaf310
5
public static char[][] shift_square(char[][] square,int start,int shift_pos,boolean row) { int total_row=square.length; int total_col=square[0].length; char[][] result=new char[total_row][total_col]; for(int i=0;i<5;i++) { for(int j=0;j<5;j++) { result[i][j]=square[i][j]; } } if(row) { ...