method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
41bcc68b-b093-4b27-ba5b-c3d432a375e4
8
public TimeLine(final SampleLog log) { this.log = log; this.samples = log.samples; setPreferredSize(new Dimension(samples.size(), 100)); addMouseWheelListener( new MouseWheelListener() { public void mouseWheelMoved(MouseWheelEvent e) { scale += e.getUnitsToScroll() * 0.10f; validateValues(); ...
7bce5936-b541-4652-9ea2-1f71579c9279
6
public void greedyLetterSplit(List<String> motifList) { String substring; for (String s : motifList) { for (int i = 0; i < 4; i++) { substring = s.substring(i, i + 1); switch (i) { case 0: this.A.add(Double....
14b78770-9b18-494a-9124-5b02b57a1e49
6
public boolean valid() { if (actor == null) return super.valid() ; // // TODO: Try to make this whole process more elegant. Establish the // basic harvest-item from the beginning? if (type == TYPE_HARVEST) { if (actor.gear.amountOf(PROTEIN) > 0) return true ; } if (type == TYP...
0ca896b7-bb9b-4b61-8d34-9ef9e514b74c
5
@Override protected ClosingsModel doInBackground() throws Exception { closingsModel = new ClosingsModel(); Document schools = null; try { schools = Jsoup.connect( bundle.getString("ClosingsURL")) .timeout(10000) .get();...
f0e2fbe7-df8b-4d0a-a81a-b3df1f1e9223
5
@SafeVarargs public static final <T> boolean ins(T value, T... array) { if (value == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return true; } } } else { for (int i = 0; i < array.length; i++) { if (value.equals(array[i])) { return true; } } } ...
31bb3ec5-8f86-4c44-b131-44a07024b3b8
7
public String getCurrentDayTime(LocalTime time){ String interpretedDaytime = ""; LocalTime currentTime = time; if(currentTime.isBefore(morningStart)){ interpretedDaytime = "night"; } else if(currentTime.isAfter(morningStart)){ interpretedDaytime = "morning"; if(currentTime.isAfter(forenoonStar...
b17c53e7-a0e3-4d91-9d47-8d46b28caa54
2
public static void main (String[] args) throws IOException, ParserConfigurationException, SAXException { Parser ps = new Parser(); // File indirectory = new File("/home/dharmesh/aditya/author_profiling/pan_author_profiling_training_data/en/"); // File outdirectory = new File("/home/dharmesh/aditya/...
6a73dbae-13f7-40e7-9753-bec7097e3faf
2
public boolean canScroll(Direction scrollDirection) { Point robot = model.getRobotLocation(); int topBorder = Math.abs(panel.getScroll()); int bottomBorder = Math.abs(panel.getScroll()) + panel.getHeight(); switch(scrollDirection) { case DOWN: return robot.y <= (topBorder + 50); case UP: return robot....
5c63d632-22b5-4d17-9fda-00342702eb6e
1
public static void setPointLights(PointLight[] pointLights) { if (pointLights.length > MAX_POINT_LIGHTS) { System.err .println("Error: You passed in too many point lights. Max allowed is " + MAX_POINT_LIGHTS + ", you passed ...
ae39b47b-2d8a-48b6-b451-459450e6b1bd
8
synchronized public void startServer() { try { System.out.println("Server started"); do { Socket accept = server.accept(); protocol = protocol.getClass().getConstructor(Socket.class).newInstance(accept); new Thread(protocol).start(); } while (!isClosed); } catch (NoSuchMethodException ex) { ...
d25d6524-de47-4f02-851f-a0d0268c69de
6
public void clicked() throws RealPlayerException { Player realPlayer = null; try { realPlayer = Game.getInstance().getPlayerManager().getRealPlayer(); } catch (RealPlayerException e) { e.printStackTrace(); return; } Base selectedBases = realPlayer.getSelectedBases(); // 1st case : the player ...
3e6281c8-2aea-49bd-91b1-d3fc78e63b57
4
private int jjMoveStringLiteralDfa34_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 33); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 33); } switch(curChar) { case 53: return jjMoveStringLiter...
3e6a036b-46a9-4729-bd74-0d6c22d079d0
4
public void saveStatus(){ // EDebug.print("I have been called upon"); if (wait){ wait = false; return; } // EDebug.print("\nFirst place"); // for (int i = 0; i < myDeck.size(); i++) // EDebug.print(((LinkedList)myDeck).get(i).hashCode()); // ...
cd48235d-7be8-4c61-a7ca-bfd6e14e963f
9
public static void inspectObject(Object o) { Class clazz = o.getClass(); Field[] fields = clazz.getDeclaredFields(); System.out.println("pola w klaise:"); for(Field f : fields) { System.out.println(f.getName() + " typu: " + f.getType()); ...
5cebc462-7cf5-4a11-b301-be8936e6bb63
2
public List<Room> getRoomList() { List<Room> list = new ArrayList<Room>(); try { PreparedStatement ps = con.prepareStatement("SELECT * FROM rooms"); ResultSet rs = ps.executeQuery(); while( rs.next() ) { list.add(getRoomFromRS(rs)); } ps.close(); } catch (SQLException e) { // TODO Au...
d507b089-7097-4258-a854-9fd103f464f5
3
private void editProjektledare() { int val = JOptionPane.showConfirmDialog(null, "Om du tar bort personen som projektledare kommer alla projekt som denna personen hade att bli projektledarlösa.", "Är du säker?", JOptionPane.OK_CANCEL_OPTION); if (val == JOptionPane.OK_OPTION) { try { ...
a2c33cb3-cbff-4d19-a997-c2f7107dce8b
2
public static BiCubicSpline zero(int nP, int mP){ if(nP<3 || mP<3)throw new IllegalArgumentException("A minimum of three x three data points is needed"); BiCubicSpline aa = new BiCubicSpline(nP, mP); return aa; }
1c80964a-dd54-4fa4-8535-4ea81cc031f8
0
public int getS1() { return this.state1; }
333a2471-4e1e-42c9-ac69-eb3230172b53
3
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean selected, boo...
e50acff0-08e3-4f1d-8190-29524ba58b37
8
protected void compareDatasets(Instances data1, Instances data2) throws Exception { if (!data2.equalHeaders(data1)) { throw new Exception("header has been modified\n" + data2.equalHeadersMsg(data1)); } if (!(data2.numInstances() == data1.numInstances())) { throw new Exception("number of...
dc007b76-4ab5-4f41-8203-8f2774556ce6
1
public Key max() { if (N == 0) throw new RuntimeException("Priority Queue Underflow"); return pq[1]; }
f7e43c59-244d-4657-aa53-0c1ca7fbb019
3
int writeUntilPattern(OutputStream streamOut, byte[] pattern) throws IOException { int indexOfPattern; int bytesWritten = 0; do { int bytesRead = fillFromStream(); indexOfPattern = indexOf(pattern); if (indexOfPattern == -1) { // No patterns in bu...
ccc3cf6a-4525-4d3b-a24c-ed2d561e51ca
7
public void deleteFromCursor(int par1) { if (text.length() == 0) { return; } if (selectionEnd != cursorPosition) { writeText(""); return; } boolean flag = par1 < 0; int i = flag ? cursorPosition + par1 : cursorPosi...
a32d8bc9-7ba5-4e36-b206-20ea7b56e8b9
9
public void processResult(int rc, String path, Object ctx, Stat stat) { boolean exists; switch (rc) { case Code.Ok: exists = true; break; case Code.NoNode: exists = false; break; case Code.SessionExpired: case Code.NoAuth: ...
3a43782f-0f58-4f0f-9137-3d4273756340
5
public static int search(String source, String pattern) { int index = -1; int sLen = source.length(); int pLen = pattern.length(); int i = 0; while (i <= sLen - pLen) { int j = 0; while (j < pLen && source.charAt(i + j) == pattern.charAt(j)) { j++; } if (j == pLen) { return i; } else ...
b9d4306e-93b2-4352-be95-b79062f1267b
0
public void resizeWatcher(){ this.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(ComponentEvent event) { environment.resizeSplit(); } ...
00c0df76-1e99-4624-aa89-5fca2c9fae1a
6
void removeAgent(int memberId, int memberType, String userName) { switch (memberType) { case GameController.passiveUser: case GameController.userContributor: case GameController.userBugReporter: case GameController.userTester: case GameController.userCommitter: case GameController.userLeader: gameContr...
b473d225-7941-47ed-891a-a494df1e051d
2
public static void printBoolVal(String pre, char str, String suf){ if(str == '0' ){ System.out.printf(pre+"false"+suf); } else if(str == '1' ){ System.out.printf(pre+"true"+suf); } else{ System.out.printf("Error occured, printed "+str+"...
9320fad4-5be1-471a-835f-15f86f68d9c9
7
public void renderLevel() { int pixelIndex; for(int y = 0; y < height; y++) { for(int x = 0; x < width; x++) { int xAbs = x + cameraXCoord; int yAbs = y + cameraYCoord; pixelIndex = (x + cameraXCoord) + (y + cameraYCoord) * SpriteSheets.mainStage.getXSheetSize(); if(xAbs > 0 && yAbs > 0 && xAbs <...
36e5905e-9e8a-4370-80e7-86117c3d12de
3
public Polynomial(long[] coeff) { int len = 0; for (int i = coeff.length - 1; i >= 0; i--) { // remove heading zeroes if (coeff[i] != 0) { len = i + 1; break; } } if (len < coeff.length) { long[] new_coeff = new long...
f92d95ff-efbf-4c1e-b269-86e937e99dc6
9
@Override public int isInside(int p_x, int p_y) { for (Rectangle r : rectList) { if((r.getX()<p_x && p_x<(r.getX()+width)) && (r.getY()<p_y && p_y<(r.getY()+height))) { return rectList.indexOf(r); } } if((getX()<p_x && p_x<(getX()+width)) && (getY()<p_y && p_y<(getY()+height))) { return 1...
b0d5ac79-1b86-4c69-91ac-852c93ab851b
5
public static BrazilianAnalyzer getAnalyzer(boolean stopwords, boolean stemming) { if(stemming) { if(stopwords) { return new BrazilianAnalyzer(Version.LUCENE_48); } else { Analyzer a = new SnowballAnalyzer(Version.LUCENE_48, "Portuguese"); if(a instanceof BrazilianAnalyzer) { System.out...
48cd020c-b422-4fc4-adaf-afb022e07c35
3
public JSONArray toJSONArray(JSONArray names) throws JSONException { if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); for (int i = 0; i < names.length(); i += 1) { ja.put(this.opt(names.getString(i))); } re...
cd27276d-f138-433b-8397-ada8a07ebc5c
1
private synchronized static void createInstance() { if (instance == null) { instance = new BookingService(); } }
48e78214-7162-4dd7-be8b-2d94a80a184b
6
private MalformedJsonException jsonError(String msg, boolean printAll){ if(printAll){ //SB for faster error print! Not like that it'd matter... //MAX size (can be smaller): text before current text after \n spaces before ^ StringBuilder err = new StringBuilder(ERR_PRINT_BEFORE + ...
74982b59-0f27-4554-a1f0-fc3da24e44c5
2
public static double viscosity(double temperature){ double[] tempc = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63...
21851c7f-e554-496a-86d0-3cc5a0b270e2
8
public static int getLevenshteinDistance(String s, String t) { if (s == null || t == null) { throw new IllegalArgumentException("Strings must not be null"); } /* The difference between this impl. and the previous is that, rather than creating and retaining a matrix of size s.length()+1 by t.length()+1, ...
3d8f8ad0-4223-408f-992a-2f45012f304c
1
public void override(Identificador id, int nivel) throws IdentificadorJaDefinidoException{ verificarIdPrograma(id); HashMap<String, Identificador> tabelaNivel = tabela.get(nivel); if(!tabelaNivel.containsKey(id.getNome())) throw new RuntimeException("Este identificador não existe para ser sobreescrit...
856aa739-3c46-448f-9f7c-5efda0ef44d6
1
public void testConstructor_ObjectStringEx1() throws Throwable { try { new LocalDateTime("1970-04-06T+14:00"); fail(); } catch (IllegalArgumentException ex) {} }
7e2b67d7-4ce9-4189-8386-a8bd8f8cc9d4
3
public Move chooseMove(State s) { // remember who we are so we can correctly evaluate states me = s.whoseTurn(); // The rest of this function looks a lot like evalMove, except // that it doesn't just track the minimaxvalue, but also the // best move itself. // get a list of possible moves MyList moves = s.find...
d443c97a-ca3e-417b-bfaf-3683ff803e6d
6
public void kill(String target) { if(target.equals("No thx")) { DataOutputStream dOut = this.outputs.get(firstPlayer); String msg = "WHO_FIRST_PLAYER"; Set<Player> pSet= outputs.keySet(); for(Player p : pSet) { if(!p.getName().equals(renfield.getName())) { if(firstPlayer.getName() != p.get...
0826a76e-032e-40ab-b227-b9f810e4fe2e
6
public static void main(String[] args) { // create random bipartite graph with V vertices and E edges; then add F random edges int V = Integer.parseInt(args[0]); int E = Integer.parseInt(args[1]); int F = Integer.parseInt(args[2]); Graph G = new Graph(V); int[] vertices ...
df027416-9f71-407d-947f-8d2794e01882
0
public void setFunAaaa(Integer funAaaa) { this.funAaaa = funAaaa; }
7c60bc74-e189-4c4e-8690-a14e0f5418ed
9
public static Vector<String> getNasdaqSymbols() { String strUrl = "http://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=nasdaq&render=download"; Vector<String> symbols = new Vector<String>(); String line; URL url; InputStream is = null; BufferedReader br; String current...
438c8ab6-8280-4a16-b38b-54f7b8d83f62
2
public Grille incrementGeneration(double nbrGenerations) { while (nbrGenerations >= 1) { generation += 1.0; nbrGenerations -= 1.0; grid = nextGeneration(); } if (generation + nbrGenerations >= Math.floor(generation) + 1) { // Une dernière fois ...
c884dd00-c4a1-40a5-82cf-5221a10767ad
7
public List<Command> compile(String code) { if (!validCharSet(code) || !validBrackets(code)) { System.out.println("Compilation error.\n"); return null; } List<Command> commands = new ArrayList<>(); // output Deque<Cycle> cyclesStack = new ArrayDeque<>(); ...
e7251138-1e59-45e1-b19d-9624477b0c80
4
private void notifyMissingAuthService(String type) { for (ComponentEntry ac : this.accessControllers.values()) { if (ac.activeType.equals(type)) { IAuthorization available = availableAuthorization(ac.preferredType); if (available == null) { available = availableAuthorization(ac.altType); } Mes...
a1a2b97e-0753-4739-90e6-8b8cfa7ac2dd
9
public static boolean isValid( String s ){ if ( s == null ) return false; final int len = s.length(); if ( len != 24 ) return false; for ( int i=0; i<len; i++ ){ char c = s.charAt( i ); if ( c >= '0' && c <= '9' ) continue...
72c579d7-916c-47f0-b54a-55bae5778be5
7
public static Rule_dirClass parse(ParserContext context) { context.push("dirClass"); boolean parsed = true; int s0 = context.index; ArrayList<Rule> e0 = new ArrayList<Rule>(); Rule rule; parsed = false; if (!parsed) { { ArrayList<Rule> e1 = new ArrayList<Rule>(); ...
f55c8be4-c420-4ffe-92aa-2f5ccff2e73f
3
private static void inputgraph() throws FileNotFoundException { // TODO Auto-generated method stub int i=0; File f = new File("src/Prim.txt"); Scanner sr = new Scanner(f); for (i = 0; i < 502; i++) { graph.add(new ArrayList<Integer>()); } sr.next(); sr.next(); int l,m,n; while(sr.hasNext()){ ...
29a9bade-60e4-4b8e-8a08-d04f3d49d685
7
private final boolean cvc(int i) { if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false; { int ch = b[i]; if (ch == 'w' || ch == 'x' || ch == 'y') return false; } return true; }
89134edf-3e3c-4770-bf16-1a24f82a3502
1
public static Duration safeMinus(Duration max, Duration current) { if (max.isShorterThan(current)) { return new Duration(0); } else { return max.minus(current); } }
04f4b8ae-eff2-44d6-b72b-43d91336e862
6
public void paint(Graphics g){ super.paint(g); Graphics2D g2d = (Graphics2D) g; for(int ii = 0;ii<10;ii++){ for(int i=0;i<10;i++){ x=i*BLOCK; y=ii*BLOCK; g2d.drawImage(bia[grid[ii][i]], x,y, this); ...
bdb63981-194a-4d48-9d84-ae7caeefc5b5
9
public static BigInt bigIntegerMult(BigInt x, BigInt y) { /* If one of the numbers is 0, return 0 */ if (x.size() == 1 && x.testCharZero()) { return new BigInt("0"); } if (y.size() == 1 && y.testCharZero()) { return new BigInt("0"); } /* Define result: with proper size and sign */ BigInt result =...
4902f9be-a89c-4928-8936-c27849dff1f8
8
public void create(Servidor servidor) throws PreexistingEntityException, RollbackFailureException, Exception { if (servidor.getComputadoraCollection() == null) { servidor.setComputadoraCollection(new ArrayList<Computadora>()); } EntityManager em = null; try { em =...
6910cdad-ab13-42f4-9e38-5eb19df51a35
4
public static String formatTextAsString(Text text) { StringBuilder sb = new StringBuilder(); for (Sentence textpart : text.getAllElements()) { if (textpart.getClass().equals(Listing.class)) { Listing listing = (Listing) textpart; sb.append(listing.getValue())...
0d83bd3d-12d8-4fce-b76b-262e0212f1b8
9
public void propertyChange(PropertyChangeEvent ev) { if (!isEditing() || getClientProperty("terminateEditOnFocusLost") != Boolean.TRUE) { //NOI18N return; } Component c = focusManager.getPermanentFocusOwner(); while (c != null) { ...
ada38cec-3025-448f-b6b4-701d94b83e70
3
public void setUpComboBoxes(Set<Card> cards) { for (Card card : cards) { String name = card.getName(); if (card.getType().equals(CardType.PERSON)) { peoplePossibilities.addItem(name); } else if (card.getType().equals(CardType.ROOM)) { roomsPossibilities.addItem(name); } else { weaponsPossibil...
03defb2f-0037-4773-b318-39a50be65b6f
2
private void calcNormals(Vertex[] vertices, int[] indices) { for (int i = 0; i < indices.length; i += 3) { int i0 = indices[i]; int i1 = indices[i + 1]; int i2 = indices[i + 2]; Vector3f v1 = vertices[i1].getPos().sub(vertices[i0].getPos()); Vector3f ...
68a2db50-91dd-4861-878e-37449a118ff8
5
private boolean sendFailures() { int event_type; int i,k; int avg_event = 0; logger.log(Level.INFO, super.get_name() + " is sending failures to " + GridSim.getEntityName(resID) + " ..."); List<FailureEvent> events = model.generateFailure(); if(events == null) { ...
acf7f09b-50bf-433e-9c67-75fed6ef6731
7
private ArrayList<String> parseMap(JLD raw, int layer){ ArrayList<String> out = new ArrayList<String>(); String st; out.add(indent(layer) + "{"); layer++; for(String key : raw.keySet()){ st = indent(layer); if(key.contains("\"")) st += "'" + key + "' : "; else st += "\"" + key + "\" : "; O...
bd9ebf7a-ad87-40cd-9def-3cb45a0f499e
3
public static ErrorCode getCodeByName(String name) { if (StringUtils.isEmpty(name)) { return null; } for (ErrorCode code : values()) { if (StringUtils.equals(code.name(), name)) { return code; } } return null; }
3281deac-f4c2-4322-9d24-89b980062912
0
public static void main(String[] args) { Watched watched = new ConcreteWatched(); watched.addWatcher(new ConcreteWatcher()); watched.addWatcher(new ConcreteWatcher()); watched.addWatcher(new ConcreteWatcher()); watched.notified("Observer Test !"); }
84260e60-7948-4aec-88c2-7d51f19e9068
5
public static Categorie creerCategorie(Categorie categorieParent, String nom, Icone icone, Utilisateur utilisateur, Role consultationRoleMinimum, Role reponseRoleMinimum, Role sujetRoleMinimum) throws ChampInvalideException, ChampVideException { if (!categorieParent.peutCreerCategorie(utilisateur)) ...
c57a12e7-ffd1-462c-9919-94d7cb662835
5
public static void main(String args[]) { Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable e) { Log.crash(e, "AMIDST has encounted an uncaught exception on thr...
d4c887d8-e87a-4a11-994a-f478e258e91e
2
MediaElement[] getSelected(JTable table) { if (table == null) table = parentTable; MediaElement[] res = new MediaElement[table.getSelectedRowCount()]; for (int i = 0; i < table.getSelectedRowCount(); i++) res[i] = (MediaElement) table.getModel() .getValueAt(table.convertRowIndex...
5953144a-53e7-4564-9c25-3faf54ff9b88
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...
62ddf177-1842-4ab3-8dbb-2c037f6eb26d
7
@Override public void doEdgeDetection() { if (imageManager.getBufferedImage() == null) return; WritableRaster raster = imageManager.getBufferedImage().getRaster(); double[][] dx = new double[][] {{-1, 0, 1}, {-2, 0, 2}, {-1, 0, 1}}; double[][] dy = new double[][] {{-1, -2, -1}, { ...
3277a405-3db5-44f3-8110-c17f97036d93
0
public startScreen() { Position position = new Position(); setLayout(new GridLayout(0, 1, 0, 0)); JButton btnCurrentDate = new JButton("current date"); btnCurrentDate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { MainFrame.cardLayout.show(getParent(), "Binary...
a7f6afca-d0cb-4105-9e2d-5e6ed126d078
9
@Override public PilotAction findNextAction(double s_elapsed) { MoveDirection move = MoveDirection.NONE; if (is_moving_forward) { if (!is_moving_backward) { move = MoveDirection.FORWARD; } } else if (is_moving_backward) { move = MoveDirection.BACKWARD; } StrafeDirect...
293786d7-4c66-4fcc-becb-e33295b3c7b7
7
public int paintNode(Graphics g, Node node, double timeBegin, int nLeaveAbove) { int y=0; if(node.isLeaf()) { y = (int) ((height-2*yTopBranch)*((double)(nLeaveAbove))/nLeaves)+yTopBranch; if(node.getTime()==0) { g.fillRect(getX(node.getTime()), y-heightBranch/2, widthGeneLabels, heightBranch); //The branc...
977f6a45-28f2-4b98-a37f-85719e5cbcf2
1
public void buildShowWords() { showFrame = new JFrame("All words"); JPanel mainPanel = new JPanel(); allPhrases = new JTextArea(GuiBuilder.numberOfLinesInFile +2, 25); allPhrases.setEditable(false); JScrollPane qScroller = new JScrollPane(allPhrases); qScroller.setHorizon...
1e3b581a-0421-4dac-a6b9-85cc1e78ee3c
7
public void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException { String text; Path pt = new Path("spamlist/spamlist.txt"); //List of known spammers FileSystem fs = FileSystem.get(new Configuration()); BufferedReader in = new BufferedReader(new InputStreamRe...
b56d3f55-cd22-4a40-9975-b45526d1f18a
1
public ScoreList(User[] user){ scores = new Score[user.length]; for (int i = 0; i < user.length; i++) { scores[i] = new Score(user[i]); } }
02f43e13-9154-4aab-8de4-4d034e039902
8
@EventHandler(priority = EventPriority.LOWEST) public void vehiclePlace(PlayerInteractEvent event) { if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { Material clickedMaterial = event.getClickedBlock().getType(); Player player = event.getPlayer(); Material materialInHand = player.getItemInHand().getType(...
4717fc51-111a-446a-b8d7-d7d94c6976a4
9
public void piirraRuutu(int x, int y, RuutuTyyli tyyli, Graphics graph){ switch(tyyli){ case Hedelma: tyyli.drawImage(graph, x, y); break; case IsoHedelma: tyyli.drawImage(graph, x, y); break; case LyhentavaHedel...
8c38687e-7feb-4d26-b19b-de38a4790fa1
8
public synchronized static void buildCategories(){ List<Fingerprint> dataset = HomeFactory.getFingerprintHome().getAll(); for (Fingerprint f : dataset) { if (f == null || f.getLocation() == null || f.getMeasurement() == null) continue; Integer id = ((Location)f.getLocation()).getId(); if (id == null) c...
3b51500e-f6d7-45b3-873c-b36169c7d0ed
2
public static Choice getChoice(boolean check, boolean download) { for (Choice c : Choice.values()) { if (c.equals(check, download)) { return c; } } return null; }
57999ba7-5368-440e-8467-ca46180f5f9c
7
private void addConditional(Vector addTo, Location loc, int x, int y) { int newX = loc.x + x, newY = loc.y + y; if (newX < 0 || newX >= grid.length) { return; } if (newY < 0 || newY >= grid[0].length) { return; } if (grid[newX][newY] == Constants.FULL_NON_PASSABLE) { return; } if (isDiagonal(ne...
ca7159ac-03c3-4570-9933-f566d776e4e2
7
static byte[] scanForOffsets(int firstAtomIndex, int[] specialAtomIndexes, byte[] interestingAtomIDs) { /* * from validateAndAllocate in AminoMonomer or NucleicMonomer extensions * * sets offsets for the FIRST conformation ONLY * (pr...
ba056c12-9858-4554-b744-8c5b0216586d
3
public DoorBlock(int x, int y, int type, int direction, int roomPointer) { super(x, y, type); if (direction == 1) { doorBounds = new Rectangle(getBoundsDoor().x, getBoundsDoor().y, getBoundsDoor().width, getBoundsDoor().height); } if (direction == 2) { doorBounds = new Rectangle(getBoundsDoor().x, getB...
357de9e0-f7b5-49e1-8e30-e85537388830
0
public void setProffession(Proffession proffession) {this.proffession = proffession;}
77e410b0-4652-495a-802c-9dc1ceaa63bf
2
public void reply() { try { ServerSocket server = new ServerSocket(SPORT); Socket client = server.accept(); ObjectInputStream is = new ObjectInputStream(client.getInputStream()); Object o = is.readObject(); if (o instanceof Message) { Message m = (Mess...
0809ef0d-3d34-4cad-bdf2-b728b17f99b1
5
private int[][] subMatrix(final int[][] X, final int[][] Y) { try { int[][] subtraction = new int[X.length][X[0].length]; if (X.length == Y.length) { for (int i = 0; i < X.length; ++i) { if (X[i].length == Y[i].length) { for (in...
c1d86c9e-697f-468e-9abe-582fcdd0cfd8
6
public boolean hitFoldingIcon(Object cell, int x, int y) { if (cell != null) { mxIGraphModel model = graph.getModel(); // Draws the collapse/expand icons boolean isEdge = model.isEdge(cell); if (foldingEnabled && (model.isVertex(cell) || isEdge)) { mxCellState state = graph.getView().getState(...
1e4af485-3201-49cf-9826-10b491e59a9f
8
public double evaluate(){ //returns distance to closest pit to the right if facing right and sim. left if(player.getFalling()) return 0; ArrayList<Block> blocklist = level.getBlocksOnScreen(); double width = 1; double mariobot = player.getYpos()+player.getHeight()/2; ...
10a81fc3-eae3-4e67-82d8-2f8203164699
8
@Override protected int findPrototypeId(String s) { int id; // #generated# Last update: 2007-05-09 08:15:31 EDT L0: { id = 0; String X = null; int c; int s_length = s.length(); if (s_length==7) { X="valueOf";id=Id_valueOf; } else if (s_length==8) { ...
10c18ac8-e8fd-4c3a-b3c8-ee9849c2b82c
4
* The width to be translated to a character index. * @return Returns the given width, translated to a character index. */ public int line_offset_from(int line, int wid) { int ret; String l = code.getsb(line).toString(); int w = 0, lw = 0; for (ret = 0; ret < l.length() && w < wid; ret++) ...
744f8227-c2f6-484e-adb4-4b05f031fba8
0
@Test public void EnsurePathMatchesAllWildCardPattern() { Path path = new Path("alan/likes/warbyparker"); Pattern pattern = new Pattern("*,*,*"); assertTrue(path.match(pattern)); }
7bd8f791-7fa5-45d7-af6f-e316f971a9fc
9
public org.omg.CORBA.portable.OutputStream _invoke (String $method, org.omg.CORBA.portable.InputStream in, org.omg.CORBA.portable.ResponseHandler $rh) { org.omg.CORBA.portable.OutputStream out = null; java.lang.Integer __method = (java.lang.Integ...
d1f90ab1-dce9-4fa3-83f5-4cc8a772f4fb
7
public static boolean[] shortToBoolean(short[] octets) throws SubneterException { if (octets.length != 4) { throw new SubneterException("Invalid IP adress too many or to less octets"); } for (int i = 0; i < 4; i++) { if (octets[i] < 0 || octets[i] > 25...
22011b96-48c7-4e90-b55d-aaf8640cee8b
3
private void rotateRight(Entry<K,V> p) { Entry<K,V> l = p.left; p.left = l.right; if (l.right != null) l.right.parent = p; l.parent = p.parent; if (p.parent == null) root = l; else if (p.parent.right == p) p.parent.right = l; else p.parent....
9565423e-aac3-4f34-9de4-bc025a33c2c4
9
private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) { if (lab_modo.getText().equals("Alta")){ if (camposCompletos()){ if (validarFechas()){ ocultar_Msj(); insertar(); ...
12238f9f-19b5-426b-9839-8347e95e45c1
4
public int GetNPCID(int coordX, int coordY) { for (int i = 0; i < server.npcHandler.maxNPCs; i++) { if (server.npcHandler.npcs[i] != null) { if (server.npcHandler.npcs[i].absX == coordX && server.npcHandler.npcs[i].absY == coordY) { return server.npcHandler.npcs[i].npcType; } } } return 1; }
caf79136-b96c-4cd7-9ca8-675db0694a24
0
@Override public int getNextRound() { return nextScheduledRound; }
44b30700-72b1-42f5-9681-07b256846b0e
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY); if(target==null) return false; if(!(target instanceof Wand)) { mob.tell(L("You can't recharge that...
7653a9c9-55ae-4960-8f3f-d08d02ec5c96
4
private Vector getInitVector() { int random = (int)(Math.random() * 8); switch (random) { case 1: return Vector.UP; case 2: return Vector.DOWN; case 3: return Vector.RIGHT; case 4: return Vector.LEFT; } return Vector.UP; }
e1b83953-8936-412e-9a6c-44484fe094aa
0
public int hashCode() { return super.hashCode(); }
5106a4f3-0bc8-4eb2-96ae-75f8c6461e8b
3
@Override public void handleEvent(Event event) { if (event.getType() == EventType.END_ACTION) endActionUpdate(); else if (event.getType() == EventType.END_EFFECT) if (isValidEndEffectEvent(event)) removeEffect(); }
9897110d-9ecf-4ebf-820f-c4ab77dc0bdd
3
public static int[] sort(int array[]){ for(int i = 1;i < array.length;i++){ int key = array[i]; int j = i-1; while( j>=0 && key < array[j]){ array[j+1] = array[j]; j--; } array[j+1] = key; } return array; }