method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e7b056e1-52f6-462b-b6fb-106aeb46db17
3
public void draw ( Graphics2D g ) { float xArrivee = vT.getDestViewX(); float xDepart = vT.getOrigViewX(); float yArrivee = vT.getDestViewY(); float yDepart = vT.getOrigViewY(); float yg = abs(yDepart - yArrivee); float xg = abs(xDepart - xArrivee);...
1c220d87-d6f1-467c-a594-f83590cd79ff
8
public void run(Game game) { boolean playOn=true,MoveColor=true; int player1Score=0, player2Score=0; Scanner userInput = new Scanner(System.in); while (playOn) { System.out.println("Please enter the x-coordinate of target square"); userInput = new Scanner(System.in); int targetX= userInput.nextInt(); ...
af681f71-46c3-4a14-b23c-22a433471572
1
public static ResultSet DBQuery(PreparedStatement stmt) { ResultSet rs = null; try { rs = stmt.executeQuery(); } catch (SQLException e) { e.printStackTrace(); } return rs; }
4862f278-b5e3-4e60-81fe-9a72da2dc2b5
6
@Override public void onSpawnTick(SinglePlayerGame game) { EntityType toSpawn = game.getEntityType(spawnID); Set<Location> existing = game.getEntityLocations(toSpawn); if (existing != null && existing.size() < cap) { Set<Location> entityLocations = game.getEntityLocations(this); ...
4ea2d59f-4ce7-486e-bb56-43724b7b892d
5
public void move(Direction direction) { if(direction.equals(dir)) return; tale = body.removeFirst(); Cell head = body.getLast(); System.out.println(body.size()); if(direction.equals(Direction.moveToRight)){ body.addLast(new Cell(head.getX(), head.getY() + 1, head.getValue())); dir = Direction.move...
1598bc41-3cb3-4919-a488-67fd2880407a
7
public int[] plusOne(int[] digits) { if(digits==null) return null; int carry = 0; for(int i=digits.length-1;i>=0;i--){ if(i==digits.length-1){ digits[i] += 1; }else { digits[i] += carry; } if(digits[i]>=10){ carry = 1; }else{ ...
33bca5d3-7bf6-495d-8a35-1185833ec51d
2
public boolean hasEdge(int v, int w) { for (int a : adj(v)) if (a == w) return true; return false; }
c9b722b9-62c4-4895-9c71-53819402cdeb
0
public DriverThread(Vector<File> imageQueue) { this.imageQueue = imageQueue; }
30f2dd4d-1c86-4db5-a845-c3a5e290e4e7
4
public boolean save(ArrayList<Layer> drawings, String name) { //todo //open the file try { File file = new File(name + "." + Variables.EXTENSION); // if file doesn't exists, then create it if (!file.exists()) { file.createNewFile(); ...
83278f5c-c96f-4e89-974d-b5f99529d2f8
6
public byte[] encryptBlock(byte[] input, byte[] key) { isKeyValid(key); if (input.length < 16) { throw new IllegalArgumentException("Cannot encrypt input shorter than 16 bytes(block)."); } byte[] result = new byte[16]; byte[][] expandedKey = keyExpansion(key); ...
38f02b61-950d-4137-b33a-e4109272ac59
2
public InverseGamma(double alpha, double beta) throws ParameterException { if (alpha <= 0 || beta <= 0) { throw new ParameterException("InverseGamma parameters alpha > 0, beta > 0."); } else { this.alpha = alpha; this.beta = beta; gamma = new Gamma(alpha, beta); } }
6e9aa2c3-6127-45a6-bbe6-94b4469e2309
0
public void setDexterity(double dexterity) { this.dexterity = dexterity; }
72d5e242-79fc-4690-9092-300a8454e963
0
public static String uncapitalize(String str) { return changeFirstCharacterCase(str, false); }
65b57b2a-6557-4442-85b6-b30b50b86702
8
private void mayoroigual() throws Exception{ op2 = pila.pop(); if (op2.getValor().equals("null")) throw new Exception("Una de las variables esta sin inicializar!"); op1 = pila.pop(); if (op1.getValor().equals("null")) throw new Exception("Una de las variables esta sin inicializar!"); Elem resultado = n...
d488e6c8-0b34-41d5-be53-94be77360895
5
public void scroll(int amount, int maxKeep) { index += amount; if (index < 0) index = 0; if (index == 0 || container.size() <= maxKeep) return; if (index >= container.size()) index = container.size() - 1; if (index > container.size() - maxKeep ...
3a23aa54-d2b5-4a77-a309-fe6d1737eeab
3
public static int convertDirY(DirectionY diry) { int r; switch (diry) { case DOWN: r = 1; break; case NOTHING: r = 0; break; case UP: r = -1; break; default: r = 0; break; } return r; }
2015f686-29d6-4a08-bf00-81580541e56f
8
private void thisYear(Team team, Positions posi) { int nofPlayers = team.getNofPlayers(); for (int i = 0; i < nofPlayers; i++) { Player player = team.getPlayer(i); if (player.getHealth().getInjury() < 3) { // long injured player are not considered if (player.getNation() != team.getNation()) { pos...
57fb6759-0062-44dc-8c2c-fdd67d2aef43
7
private static<T extends Comparable<? super T>> void merge(ArrayList<T> theArray, ArrayList<T> tempArray, int first, int mid, int last) { // initialize the local indexes to indicate the subarrays int first1 = first; //beginning of first subarray int last1 = mid; //end of...
b14d1c8b-beb4-4c8f-89ca-9b6574fc4a9f
6
public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); // Make sure we are responding to the right event. if (propertyName.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) { File selection = (File)e.getNewValue(); Strin...
634f555c-3ffc-41b9-a8c0-12f319ef6576
1
public void schemeEditorAddOutput() { if(ce_output.getText().length() == 0) return; String outputName = ce_output.getText(); scheme.getOutputs().add(outputName); ce_output.add(outputName); Contact contact = new Contact(outputName, -1); ce_drain.add(contact.toString()); ...
55c736ee-ecfb-4058-8131-537e43575699
5
static SourceCode Source (String inputName, String fileExtension) { short fileIndex = 0; short cacheSpace = 50; //Array space allocated at start of method. boolean indexIsValid = true; //Tracks if the file continues. String line [] = new String [cacheSpace]; SourceCode input; line [0] = " "; try ...
1787aa95-cd7a-4b38-ba56-707c3e4e7454
0
public void setFile(File file) { this.doc = null; this.file = file; }
357743a8-2e1f-4982-bd61-5254e4d46680
3
public IterationsActivity() { System.out.print("The array is: "); for (int i = 0; i < data.length; i++) { System.out.print(data[i] + ", "); sum += data[i]; product *= data[i]; max = data[i] > max ? data[i] : max; min = data[i] < min ? data[i] : min; } average = sum / data.length; System.out.pr...
d30ab70e-3725-4bef-9ac2-00c679e6ef8e
3
public static void FileListArray(File Directory) { // Array to hold files. File[] FileList = Directory.listFiles(); for(int i = 0; i < FileList.length; i++){ if(FileList[i].isFile()){ File1 = FileList[1].getName(); File2 = Fil...
1fa5d549-d3bd-4241-9d1b-9499d2b663f1
4
public void cubicSpline(){ if(this.nAnalyteConcns<3)throw new IllegalArgumentException("Method cubicSpline requres at least 3 data points; only " + this.nAnalyteConcns + " were supplied"); this.methodUsed = 0; this.sampleErrorFlag = false; this.titleOne = "Cubic spline "; if(!thi...
f89ce13a-f1e7-487d-a524-89caa6d6fa18
9
public synchronized void checkActivationCodeInXML(String code, String attrType) throws Exception { /* NOTE: THIS FUNCTION IS SYNCHRONIZED, ONLY ONE CLIENT HAS ACCESS TO THE XML FILE AT ANY GIVEN TIME, OTHERS WILL HAVE TO WAIT */ if(null == code) { throw new IllegalArgumentException("The activation code provi...
71345974-8179-461d-8d04-a648294666ff
7
public static Map<Property,RDFNode> getPotentialBindings(Module module, RDFNode[] values) { Map<Property,RDFNode> results = new HashMap<Property,RDFNode>(); for(Argument argument : module.getArguments(false)) { Property argProperty = argument.getPredicate(); if(argProperty != null) { Resource argType = ar...
b755fa83-7636-44e7-8929-2d2085c55547
7
public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String s = in.next(); int c = in.nextInt(); c = c%26; StringBuffer sb = new StringBuffer(); for(int i=0; i < n; i++) { char t = s.charAt(i); if (t <= 'z' && t >= 'a') { if ((int)t + c <= (i...
88c6294b-39ee-4ed4-b1e0-0d88a7ab4e05
9
@Override public void keyReleased(KeyEvent e) { switch(e.getKeyCode()) { case KeyEvent.VK_SPACE: spacePressed = false; messageAdvanced = false; break; case KeyEvent.VK_W: wasdKeys[0] = false; break; case KeyEvent.VK_S: ...
9e03f708-8d19-4906-8d66-199e4014bea4
1
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) { int vHeight = fontHeight + 2; if (vHeight % 2 == 0) { vHeight += 1; } return vHeight; }
29864628-2f8a-4f05-9138-2c175bdc0a85
4
@Override public void caseAAccessIdxExp(AAccessIdxExp node) { inAAccessIdxExp(node); if(node.getRSq() != null) { node.getRSq().apply(this); } if(node.getIdx() != null) { node.getIdx().apply(this); } if(node.getLSq() != null)...
7380de03-13fa-4b58-b968-925f2bf7f2de
9
public static void main(String[] args) throws Exception { Options plumeOptions = new Options(TestIsolationDataReader.usage_string, TestIsolationDataReader.class); plumeOptions.parse_or_usage(args); // Display the help screen. if (showHelp) { plumeOptions.print_usage(); return; ...
0a827d87-a36f-4dfb-8283-1dc290cba762
3
public void countUnique() { for (String x : uniqueWords) { uniqueCounter.put(x, 0); } for (String x : totalWords) { String check = x.toLowerCase(); if (!uniqueCounter.containsKey(check)) { uniqueCounter.put(check, 1); } else { int currentCount = uniqueCounter.get(chec...
6a914ee9-e11f-4e65-84e9-479a6712aebc
9
@Override public Object getMetaPacket(Object watcher) { Class<?> DataWatcher = Util.getCraftClass("DataWatcher"); Class<?> PacketPlayOutEntityMetadata = Util.getCraftClass("PacketPlayOutEntityMetadata"); Object packet = null; try { packet = PacketPlayOutEntityMetadata.getConstructor(new Class<?>[] { int.c...
3d071671-138a-4bd7-8570-35dc7d2e2494
3
public static String errorOf(ArrayList<Clause> clauses) { String error = "not a complete sentence"; boolean independent = false; for (Clause c : clauses) { if (c.isIndependent()) { independent = true; } } if (independent) { retu...
6323551f-4126-43f3-aba5-25517f15004a
7
public LinkedList<ASemester> uniformCostSearch() { LinkedList<ASemester> optimalSemesterList = new LinkedList<ASemester>(); if ( directoryOfClasses == null ) { System.err.println( "Error: directoryOfClasses does not exist"); System.exit(1); } // instantiate the root semester, which contains any courses...
272b0f35-1032-4419-86ea-ca897496a70f
8
public Program read(String[] args) throws Exception { if (args.length == 0) Util.userError("no input files"); if (args.length != 1) Util.userError("input type \"auto\" accepts only one file at a time."); String n = args[0]; int offset = n....
5fb8ca6b-cdf5-4afa-92c4-ef5b2daefeda
1
@Override public boolean isWrapperFor(Class<?> arg0) throws SQLException { return false; }
5fcb08ac-1a85-49f3-be9a-be0df6ac7799
9
public boolean equals(Object otherO) { if (otherO == null) { return false; } if (!(otherO instanceof Picture)) { return false; } Picture other = (Picture) otherO; if (image == null || other.image == null) { return image == other.image; } if (image.getWidth() != other....
5e277043-d062-4d91-9626-88bc4b3e466b
5
private static double[] getResistPoints(int lineNumber, double[] highPrices) { double[] rPoints = new double[lineNumber]; for(int i =0;i<lineNumber-1;i++){ double price = 0; for(int j=-5;j<=0;j++){ if((i+j>=0) && (i+j<lineNumber-1) && highPrices[i+j]>price){ ...
b4bb872e-33d3-4275-8b86-8a061854a782
5
public String decode() { StringBuilder message = new StringBuilder(); long RBG; for(int i = 0; i < this.width; i++) { RBG = this.picture.getRGB(i, 0); //System.err.printf("You are at pixel %d, 0; RBG is %d\n", i, RBG); if (RBG >= 32 && RBG < 127) { message.append((char) RBG); } else { RBG = Ma...
e8d97910-4044-4148-9569-d413306257ec
4
@Override public IMatrix nMultiply(IMatrix other) { /* * da bi se dvije matrice mogle pomnožiti, moraju biti ulančane; * ulančanost podrazumijeva da je broj stupaca prve matrice jednak broju * redaka druge matrice; * rezultantna matrica ima broj redaka jednak broju redaka prvoj matrici, * a broj stup...
f81425de-9dea-4117-a352-3e2519a9d65e
6
private void parse() { if (isLiteralText()) { elements = new String[0]; return; } if (expression.startsWith("${") || expression.startsWith("#{")) { if (expression.endsWith("}")) { String temp = expression.substring(2, expression.length() - 1)...
03e9d73e-0ebd-401a-befb-38b1fdc4afd1
1
public void addPlayers(int numOfPlayers) { // Debug line for verification of Starting addPlayer() method this.numOfPlayers = numOfPlayers; this.users = new ArrayList<User>(); Scanner input = new Scanner(System.in); for (int i = 0; i < numOfPlayers; i++) { User tempUser = new User(); log.info("Alright...
35ca8b20-1484-4492-b889-ae63483d84c7
1
public List<Class<? extends Pet>> types() { return types; }
d92a3076-e19d-4f14-811e-8ed948c12eed
5
public boolean Select(String ticket, String lastName) throws Exception { try { //Load the MySQL driver Class.forName("com.mysql.jdbc.Driver"); //Setup the connection with the database conn = DriverManager.getConnection("jdbc:mysql://" +dbHost+ ":" +dbPort+ "/" +dbName, dbUser, dbPass); ...
04a1ae8f-2db7-421c-890f-157cc9761a36
6
@EventHandler(priority = EventPriority.HIGHEST) public void onEntityDamageEvent(final EntityDamageEvent e) { Entity p = e.getEntity(); Fruit f = null; if(p instanceof Player) { if(FruitManager.getInstance().checkIfPlayerIsDFUser((Player) p)) { f = FruitManager.getIns...
35d0bd8a-46ae-4c89-a78a-44d967555b54
1
@Test public void testExist() { List<String> list = new List<>(); list.addToEnd("test1", 1); list.addToEnd("test2", 3); list.addToEnd("test3", 5); for (String current : list) { assertTrue(list.exist(current)); } }
565045c2-7588-43fe-a62e-bf0cedab9233
2
public final void writeCompactLength(int len) { byte b = (byte)(len & 0x7F); if (len <= 0x7F) { writeU8(b); } else { writeU8(b | 0x80); b = (byte)(len >> 7 & 0x7F); if (len <= 0x3FFF) { writeU8(b); } else { writeU8(b | 0x80); writeU8(len >> 14 & 0xFF); ...
b5457821-1b43-42ee-8105-f5c9ea15f866
6
protected boolean canMoveToPosition(Player player, Grid grid, Position pos) { if (pos.getxCoordinate() < 0 || pos.getyCoordinate() < 0 || pos.getxCoordinate() >= grid.getHorLength() || pos.getyCoordinate() >= grid.getVerLength()) return false; List<Element> elements = grid.getElementsOnPosition(pos); ...
686b45d5-5931-496e-a69c-7e4fb3b17489
1
public void visitLabel(final Label label) { checkStartCode(); checkEndCode(); checkLabel(label, false, "label"); if (labels.get(label) != null) { throw new IllegalArgumentException("Already visited label"); } labels.put(label, new Integer(labels.size())); mv.visitLabel(label); }
9d6a9aa9-dd60-46f4-a286-7e879a1c56c7
9
public static boolean isAtLeastJavaVersion(int major, int minor, int release) { if (JAVA_VERSION_ARRAY.get(0) != null && major != -1) { int currentMajor = ((Integer) JAVA_VERSION_ARRAY.get(0)).intValue(); if (major > currentMajor) { return false; } } if (JAVA_VERSION_ARRAY.get(1) != null && mino...
6c833129-b861-4b53-9708-0478eea3c63e
9
public DensitePopulation(FenetreTaillePixel fen) throws SQLException, IOException{ this.fen=fen; tableaux=fen.getTableauTailles(); srids=FenetreTaillePixel.getSridss(); srids2=FenetreTaillePixel.getSridss(); for(int f=0;f<srids.size();f++){ System.out.println("sridss "+ srids.get(f)); } for(int f...
f18d2561-7033-44bd-8ae8-9661b65553f1
8
public JComponent createCell_Alignments() { JTabbedPane tabbedPane = new JTabbedPane(); // Horizontal MigLayout hLM = new MigLayout("wrap", "[grow,left][grow,center][grow,right][grow,fill,center]", "[]unrel[][]"); JPanel hPanel = createTabPanel(h...
32d4671c-1752-4d09-85fc-9255bb8aac96
5
public void set(LuaValue key, LuaValue value) { if (key.isint()) { int i = key.toint() - 1; if (i >= 0 && i < Array.getLength(m_instance)) Array.set(m_instance, i, CoerceLuaToJava.coerce(value, m_instance.getClass().getComponentType())); else if (m_metatable == null || !settable(this, key, value)) er...
b016986f-d7d5-42df-a14c-ecaf88e18781
4
@Override public int hashCode() { int hash = 5; hash = 79 * hash + (this.node != null ? this.node.hashCode() : 0); hash = 79 * hash + (this.character != null ? this.character.hashCode() : 0); hash = 79 * hash + (this.leftChildren != null ? this.leftChildren.hashCode() : 0); hash = 79 * hash + (this.rightChil...
2c3f72e1-a0a0-4589-8883-22d68d7eafef
8
private int obtenerCuadrante(int x, int y) { int retorno=0; if(x<=2) { if(y<=2) { retorno=1; } else if(y<=5) { retorno=2; } else { retorno=3; ...
f13d7cf3-b34e-42cd-957c-883638def1bf
9
public void readString() throws ParseException { StringBuffer val = new StringBuffer(); while (column < line.length()) { char c = line.charAt(column++); if (c == '"') { value = val.toString(); return; } if (c == '\\') { c = line.charAt(column++); switch (c) { case 'n': ...
90fcd060-dce7-4eb1-9e66-0ec78e4fef4b
1
private static boolean hasABlockChild(Element elm) { Elements list = elm.select("ul,ol,dl,dd,li"); if (list.size() > 1) { return true; } return false; }
2d4e74c4-4e2b-41cc-90c2-d43bf18adf94
3
double rate(Board board) { int maxHeight = 0; int minHeight = board.getHeight(); for(int x = 0; x < board.getWidth(); x++) { int height = board.getColumnHeight(x); if(height > maxHeight) //record the height of highest colo...
19b00770-0628-4b53-92c3-fec70d428dd5
8
public boolean hasPermission(CommandSender sender, String node) { String has = getPlugin().getLocaleManager().getString( "DebugHasPermission"); String lacks = getPlugin().getLocaleManager().getString( "DebugLacksPermission"); String debugMode = getPlugin().get...
870e5fa0-1692-45f1-9ae2-3f5a49352ebd
5
public static String toMapleCode(SquareMatrix m) { String output = ""; if (1 == ID) { output += "restart; with(GraphTheory):\n"; } output += "G" + ID + ":=Graph(<"; ID++; for (int col = 0; col < m.getNumberOfColumns(); col++) { output += "<"; for (int row = 0; row < m.getNumberOfRows(); row++) {...
b0efc4e7-bc77-4c98-a765-b144a1cec3a5
3
public static String rhex(byte[] in) { DataInputStream data = new DataInputStream(new ByteArrayInputStream(in)); String str = ""; try { for (int j = 0; j < in.length; j++) { String tmp = Integer.toHexString(data.readUnsignedByte()); if (tmp.length() == 1) { tmp = "0" + tmp; } str ...
9e0ade3c-53f3-49bc-8523-01bd3dd46e93
5
private static PPMNode lookup(PPMNode node, byte[] bytes, int offset, int length) { if (length == 0) return node; for (PPMNode child = node._firstChild; length > 0 && child != null; ) { if (bytes[offset]==child._byte) { if (length == 1) return child; node = child; child = child._firstChild; ++offset; -...
4ca27530-2fe6-4a6d-b9ad-359b0a8a19d6
4
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { StringBuilder reason = new StringBuilder(); if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + NAME + "This command my only be run as a player!"); } else { if (!(args.length <= 1)) { ...
f51c0ae0-769a-4834-9896-549ffb52df47
2
@Override public void layoutContainer(Container scrollbarContainer) { JScrollBar scrollbar = (JScrollBar) scrollbarContainer; switch (scrollbar.getOrientation()) { case JScrollBar.VERTICAL: layoutVScrollbar(scrollbar); break; case JScrollBar.HORIZONTAL: layoutHScrollbar(scrollbar);...
baf5dfa6-8e23-4917-8c72-8b1f697f4377
3
public Stream<String> placeFiguresOnBoard(String initialBoard) { int numberOfKings = figureChain.extractA(KING.toString()); int numberOfQueens = figureChain.extractA(QUEEN.toString()); int numberOfBishops = figureChain.extractA(BISHOP.toString()); int numberOfRooks = figureChain.extractA...
4394ff35-792f-4cd5-bf3d-33b93b05f541
7
public int getMaximumFreeDistance(Direction dir, int length) { Rectangle rectangle = getRect(); for(int distance = 1; distance <= length; distance++) { switch (dir) { case NO_MOVE: return 0; case TOP: ...
6ccd6b25-81c0-46d8-bbd4-ae0dec1ba93b
5
private void eventStart() { eventCount++; if(eventCount == 1) { transition.clear(); transition.add(new Rectangle(0, 0, GamePanel.WIDTH, GamePanel.HEIGHT / 2)); transition.add(new Rectangle(0, 0, GamePanel.WIDTH / 2, GamePanel.HEIGHT)); transition.add(new Rectangle(0, GamePanel.HEIGHT / 2, GamePanel.WIDT...
27679868-e554-42b6-8432-bea0856f325d
6
public void playerSwitch() { //shipList.get(currentSelectable.get(h.getSelected())).setSelected(false); for(ShipComponent sh : shipList) { sh.setSelected(false); } if(player == 1) { ...
dd80b186-21b2-4f60-ba42-5cca71d9858f
7
private void go() throws IOException { // Create a new selector Selector selector = Selector.open(); // Open a listener on each port, and register each one // with the selector for (int i=0; i<ports.length; ++i) { ServerSocketChannel ssc = ServerSocketChannel.open(); ssc.configureBlocki...
3c3fdbab-2542-42eb-9373-2ade37482326
0
public static void main(String[] args) { Set<String> ss = new TreeSet<String>(); String[] sa = {"a", "d", "B", "b", "c", "A", "D", "C"}; Collections.addAll(ss, sa); System.out.println(ss); System.out.println(Double.compare(1.0, 1.1)); System.out.println(1.0<1.1); }
54fdae70-8385-41f6-8c9c-60dc7473e1b0
1
private void clearDragState() { if (mDragOverNode != null) { repaint(getDragOverBounds()); } mDragDockable = null; mDragOverNode = null; mDragOverLocation = null; }
a1cb36c1-d5b7-407d-85c8-d42560714fc7
6
private void getSpontaneousBivalents(int maxBivalents) { int firsth = 0; int secondh; while (firsth < popdata.ploidy-1 && bivalentcount<maxBivalents) { //search next spontaneous bivalent: while ( firsth<popdata.ploidy-1 && ( hsdone[firsth] || ...
bd716ff6-b999-44fe-89b0-57182b147b8e
5
public ArrayList<Node> generateCompleteGraph(int numberOfNodes){ ArrayList<Node> nodes = new ArrayList<>(); int linkCounter = 0; for(int i=0;i<numberOfNodes;i++) { Node n = new Node(i); nodes.add(n); } Node N; for(int n =0;n<nodes.size();n+...
1b2c2b23-f62f-4bc8-bcef-82ab3d69eaf4
6
public String getNamespaceURIOnPath(String nsPrefix) { if (nsDeclarations != null) { for (Map.Entry<String, String> nsEntry : nsDeclarations.entrySet()) { String currName = nsEntry.getKey(); if (currName.equals(nsPrefix) || ("".equals(currName) && nsPrefix == null)) {...
af370edf-22f4-4129-9757-9b06b2e92928
4
private void analyseLineSecondPass(String assemblyLine) throws AssemblerException { if (assemblyLine.equals(".data")){ atData = true; atText = false; } else if (assemblyLine.equals(".text")) { atData = false; atText = true; } else if (atData) populateDataSecondPass(assemblyLine); ...
4e947e47-981e-42f3-a092-4754c08da2bf
9
private void benjamin() { int benjaminRoll = (int) (Math.random () * 5); if (benjaminRoll == 1) { game.addText ("A Wild Benjamin Has Appeared!"); if (p1.isAlive() && (!p1.getName().equals ("Nan"))) { game.addText ("Benjamin slays " + p1.getName() + "!"); game.addText ("Benjamin wins...
0a296eba-617a-4dce-a6da-262d6ac9bdb5
5
public void split( Object... objects ) { if ( children != null ) return; children = new QuadTree[4]; children[TYPE_NW] = new QuadTree( this, TYPE_NW, null ); children[TYPE_NE] = new QuadTree( this, TYPE_NE, null ); children[TYPE_SW] = new QuadTree( this, TYPE_SW, null ); children[TYPE_SE] = new QuadTree( t...
2859a57f-3638-4fbc-8fca-fa8fd9158ab6
9
public String[] getUserAddreses() { FileOutputStream out = null; PrintWriter writer = null; File file = new File("UserInfo.txt"); try { out = new FileOutputStream(file); writer = new PrintWriter(out); } catch (Exception ex) { System.out.println...
aa187d94-a7da-4a7a-be07-31181b59a4a5
6
static void sourceCode (SourceCode toSave, String destination, String extension) //All-purpose file to output file input back to a file. { int size = toSave.line.length; int i = 0; String newLine = Settings.newLine; ErrorLog.debug ("Saving source code. Size =" + size + ". Last element is: " + toSave.line[s...
cf56d229-f789-4a40-91d4-c8078df2b4e1
8
@Override public void attack(ArrayList<Player> players, boolean server) { ArrayList<Player> attackedPlayers = players; for (Player p : attackedPlayers) { p.setHealth(p.getHealth() + (Math.random() * -10) + p.getInHand().getDefense() - getDamage()); if (p.getHealth() <= 0) { if (!p.getName().equalsIgnoreC...
528caee7-5059-4d4d-8c65-045dbb4b4613
4
public void input() { if(Input.getKeyDown(Keyboard.KEY_UP)) System.out.println("We've just pressed up!"); if(Input.getKeyUp(Keyboard.KEY_UP)) System.out.println("We've just released up!"); if(Input.getMouseDown(1)) System.out.println("We've just right clicked ...
5b409e62-81e5-4121-bb81-cde7e382286c
0
public void mouseWheelMoved(MouseWheelEvent e) { //System.out.println("============= Zoom camera ============"); zoomCamera(e); }
4df235ef-d905-4ea3-89fd-a6ac4d8890bb
5
public InputStream toBytes() throws IOException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); DataOutputStream outputStream = new DataOutputStream(buffer); outputStream.write(HEADER); checkIsShort(mRootObjects.size()); outputStream.writeShort(mRootObjects.size())...
428c40a7-ab82-4924-93f8-a083ebe4e8c3
0
public BaseDO save(final BaseDO baseDO) { this.getEntityManager().persist(baseDO); return baseDO; }
24ae18a5-0e65-4bb1-bc5e-c0b60be2f47c
7
float clutching(SensorModel sensors, float clutch) { float maxClutch = clutchMax; // Check if the current situation is the race start if (sensors.getCurrentLapTime()<clutchDeltaTime && getStage()==Stage.RACE && sensors.getDistanceRaced()<clutchDeltaRaced) clutch = maxClutch; // Adjust the cur...
f00f9deb-985b-4bd5-992d-81e8ec961bc8
8
public boolean equals(Object aObject) { if (this == aObject) { return true; } else if (aObject instanceof Juiz) { Juiz lJuizObject = (Juiz) aObject; boolean lEquals = true; lEquals &= ((this._nome == lJuizObject._nome) || (this._nome != null && this._nome.equals(lJuizObject._nome))); lEquals &= (...
bfd89fae-e29c-46cf-b02f-f9aa4532c6e6
1
public void visit_if_icmpeq(final Instruction inst) { if (longBranch) { final Label tmp = method.newLabel(); addOpcode(Opcode.opc_if_icmpne); addBranch(tmp); addOpcode(Opcode.opc_goto_w); addLongBranch((Label) inst.operand()); addLabel(tmp); } else { addOpcode(Opcode.opc_if_icmpeq); addBranc...
c1adeb2f-3ab3-4326-a2d7-76d852f5890c
3
public ArrayList send(int command, int multiplier, char[] params_raw) throws Exception { this.open(); /* Создание строки параметров */ String params = Math.ByteToString(this.ADMIN_PASS); if (params_raw.length > 0) for(int b = 0; b < params_raw.length; b++) ...
6f4e0cf0-1582-4769-ae99-f77295a3b035
5
private void clearTimeT() {//sets all values of timeT to null for (int i = 0; i < DataBase.timeT.length; i++) { for (int j = 0; j < DataBase.timeT[0].length; j++) { for (int k = 0; k < DataBase.timeT[0][0].length; k++) { for (int l = 0; l < DataBase.timeT[0][0][0].length; l++) { if (DataBase....
d9094d1e-2ed1-4200-82ed-b9080ae73a1b
3
public static ArrayList<bDefeito> getSintomas(String arg_prod, Integer arg_sintoma) throws SQLException, ClassNotFoundException { ResultSet rs; ArrayList<bDefeito> sts = new ArrayList<bDefeito>(); Connection conPol = conMgr.getConnection("PD"); if (conPol == null) { throw ne...
78f63de9-dd44-402a-b4fd-e38dcb6ef2ea
3
public static int sendAndWait(byte[] b, int num, int t, InetAddress ip, Integer p, DatagramSocket d) throws IOException { int ack = 0; byte[] receiveAck = new byte[3]; try { // Send packet DatagramPacket packet = new DatagramPacket(b, b.length, ip, p); d.send(packet); // Wait for acknowledgment ...
99703bfe-a35e-4a1c-ac9e-3804eb5a54ef
1
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser(); if(user != null) { List<ParisModel> parisNotFinish = DataStore.getAllTeamParisByUser(use...
f94c7f25-81e1-4999-bc7a-634a659da75c
5
public void draw(GOut g) { long[] ttl = new long[prof.hist.length]; for (int i = 0; i < prof.hist.length; i++) { if (prof.hist[i] != null) ttl[i] = prof.hist[i].total; } Arrays.sort(ttl); int ti = ttl.length; for (int i = 0; i < ttl.length; i++...
4225a3b2-d38b-4fbe-a72f-795456cfa43c
3
void printFullNode( Node node ) { int start, end; if ( node != null ) { // calculating the beginning and ending of the last edge start = node.edgeLabelStart; end = getNodeLabelEnd( node ); // stopping condition - the root if ( node.father != root ) printFullNode( node...
ee8c4a96-2ee1-448a-a0a1-196b9b1ca7d3
3
public static String addNewLines(String message) { BreakIterator boundary = BreakIterator.getLineInstance(); boundary.setText(message); int start = boundary.first(); String result = ""; String currLine = ""; String temp = null; // loop till no more possible line breaks for ...
d1691558-e08f-4b4d-9d57-ba6b3160df68
5
public static void main(String[] args) { if (args.length < 2) { System.err.println("Your input is wrong!"); return; } int countThreads; countThreads = Integer.parseInt(args[1]); if (countThreads < 1) { System.err.println("Your input is wrong!"); return; } String inputFile = args[0]; try...
3dceeb72-b143-4967-a795-335d69cc9f25
2
public void update() { x += speedX; r.setBounds(x,y,10,5); if (x > 800) { visible = false; } if (x < 800){ checkCollision(); } }
6bb2f986-3469-4bc7-be14-4a7f5b96e182
3
public void remove(Item item) { if (!contains(item)) { System.out.println("You do not have " + item.getName()); } else { boolean gone = false; int i = 0; while (gone) { if (inventory[i].getName().equals(item)) { inventory[i] = inventory[items - 1]; inventory[items - 1] = null; items--...