method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9369ecdc-9d4a-478c-97a6-6492bc1164eb
7
public TokenInfoDictionary buildDictionary(List<File> csvFiles) throws IOException { TokenInfoDictionary dictionary = new TokenInfoDictionary(10 * 1024 * 1024); for (File file : csvFiles){ FileInputStream inputStream = new FileInputStream(file); InputStreamReader streamReader = new InputStreamReader(inputStr...
e36e2d2c-486a-4765-9926-0d5e3d503e58
4
public void render() { Game.updateShader(transform.getTransformation(), transform.getPerspectiveTransformation(), material); geometry.draw(); for(Door door : doors) door.render(); if(monsters.size() > 0) sortMonsters(0, monsters.size() - 1); for(Monster monster : monsters) monster.render();...
4d9ad7ae-ce84-4d94-aaa9-783f70740813
0
public boolean isAlive() { return alive; }
ae2886c5-9d06-4038-b5d8-8bb37af333aa
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the...
17dffe49-7dec-475f-9f3e-ea9bd25c38d8
0
public boolean addData(DataOut obj){ return listDataOut.add(obj); }
0a62dad3-da5e-42f0-b9e1-e6484be98666
6
private static boolean isPrime(int n) { if (n < 10) { return n == 2 || n == 3 || n == 5 || n == 7; } int end = (int) Math.ceil(Math.sqrt(n)); for (int i = 2; i <= end; i++) if (n % i == 0) return false; return true; }
90448739-e321-4cb1-897f-f0b83171303f
7
public static void main(String[] args) throws IOException { if(args[0].equals("skeleton")){ ReadFrom r; switch (args[1]) { case "ios": r=new IOSParser(); break; case "android": r=new AndroidParser(); break; default: throw new IllegalArgumentException("unknown : "+args[1]); } ...
c13c9fdc-4b6e-4a49-8d6b-5669a74b51ed
1
public void setShutdownFonttype(Fonttype fonttype) { if (fonttype == null) { this.shutdownFontType = UIFontInits.SHDBTN.getType(); } else { this.shutdownFontType = fonttype; } somethingChanged(); }
8c372921-0013-4e47-9001-00ac623a1cae
3
@Override public void paintOverlay( Graphics2D g ) { if( selection.isSelected() ) { Color color; switch( selection ){ case PRIMARY: color = primary; break; case SECONDARY: color = secondary; break; default: return; } Rectangle bounds = parent.getBoundaries(); int ...
9122e50b-8fc0-469a-971f-dc4680697e0c
2
@Override public FractalValue mul(FractalValue val) throws FractalException { if (! val.isNumber()) { throw new FractalTypeException(FractalTypes.REAL, val.getType()); } else if (val.isInt()) { return new FractalInt(intValue() * val.intValue()); } else { r...
7b560716-b647-480a-9c74-b1b846e14337
4
public static void main(String[] args) { long count = 0; int count2 = 0; long i = 1; while(true) { count += i; count2 = 0; for(int j = 1; j <= count/2; j++) { if(count % j == 0) count2++; } count2++; System.out.println(count + " " + count2); if(count2 > 500...
9d32f871-ac2e-4b02-97f9-0dfc098b0e27
6
public List<OSMWay> handle(OSMMap map, OSMCoordinate coordinate, SpaceUsageRule sur) { // Initialisiere Ergebnisvariable List<OSMWay> result = new ArrayList(); // Initialisiere Suchergebnisse OSMNode nearestNode = null; double nearestDistance = Double.MAX_VALUE; ...
c47edb54-1a93-4eb7-b472-3397330d837d
0
private String calc(String input) { //Person 5 put your implementation here return input.substring(2, input.length()) + input.substring(0, 2); }
fb2bf71d-4021-4e03-af6f-b28ea47b808c
7
private void executeCommand(CommandSender sender, CommandHandler commandHandler, String rawLabel, String[] rawArguments) { Command command; if (rawArguments.length > 0) { command = new Command(sender, rawLabel, rawArguments[0], new ArrayList<String>(Arrays.asList(rawArguments)).subList(1, r...
b1b07166-a7aa-4932-a1d2-40304201aef5
6
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == btnAddLink) { if (addingLink) { linkAdded(); } else { addingLink = true; btnAddLink.setSelected(true); btnEditLink.setSelected(false); btnRemoveLink.setSelected(false); ((MapEditor) getParent()).setM...
ee1d63ec-9368-410a-87f2-ff04ab5e8a6e
3
protected boolean placeLibre(EnvironnementWator environment){ for (int y = 0; y < environment.taille_envi; y++) { for (int x = 0; x < environment.taille_envi; x++) { if(environment.grille[x][y] == null) return true; } } return false; }
376417bb-03e8-47ab-b3db-ea65958d2023
3
public boolean exist(ValueType value) { if (!isEmpty()) { for (ValueType current : this) { if (current == value) { return true; } } return false; } return false; }
eec5fb2f-d511-407c-94df-6c91c182fdb4
1
@Override public void removeLayoutComponent(Component comp) { if (comp instanceof DockLayoutNode) { remove((DockLayoutNode) comp); } }
41f00b58-2723-41b5-8bdd-432491a7071e
3
@Command(aliases = { "cleanchunk" }, desc = "Chunk Unloader") @CommandPermissions({ "mho.admin.chunk" }) public void chunk(CommandContext args, CommandSender sender) { for (World world : Bukkit.getWorlds()) { Chunk[] chunks = world.getLoadedChunks(); int unloaded = 0; for (Chunk chunk : chunks) { if (c...
22188a4d-58fc-4ad7-80e1-e03e6377ce9d
1
public void writeIndentation() { for (int i = 0; i < mIndent; i++) { print('\t'); } }
02f28596-e2d2-4984-bcb4-be433889a50e
7
@Deprecated @SuppressWarnings("unused") private List<Class<?>> processDirectory(File directory, String append) { final List<Class<?>> classes = new ArrayList<Class<?>>(); String[] files = directory.list(); for (String fileName : files) { String className = null; ...
fd1b803f-4893-4d81-ac9b-093eb4ede12b
6
public int getNumberExcess(Organism organism2) { int E = 0; int maxNumberShortGenome; if (organism2.getLastGeneInovNumber() > this.getLastGeneInovNumber()) { //this - short genome maxNumberShortGenome = this.getGenome().lastGeneInovNumber(); for (int i = 0; i < organism2....
ded89947-483a-4a6e-99d9-2a472e7a8fbf
2
public void actionPerformed(ActionEvent event) { JFrame frame = Universe.frameForEnvironment(environment); if (environment.getAutomaton().getInitialState() == null) { JOptionPane.showMessageDialog(frame, "Conversion requires an automaton\nwith an initial state!", "No Initial State", JOptionPane.ERROR_M...
a8eac689-5f2d-440f-90e3-a87e76877184
3
private static void buildRows(TreeRoot model) { model.addRow(new TreeTestRow("First")); //$NON-NLS-1$ model.addRow(new TreeTestRow("Second, but with a really long piece of non-pre-wrapped text.")); //$NON-NLS-1$ model.addRow(new TreeTestRow("Third, but with a\nreally long piece\nof pre-wrapped text.")); //$NON-NL...
aa733609-33ea-4052-b876-4d2fa3d46153
3
public int maxOpponentLife(Player player) { int life = 0; for (Player p : this.players) { if ((!p.equals(player)) && p.getLife() > life) { life = p.getLife(); } } return life; }
c5850215-d103-49b0-8e83-ecc808777a52
6
public static int longestValidParentheses(String s){ if(s == null || s.length()<2){ return 0; } char[] c = s.toCharArray(); int last = -1; int maxLen = 0; Stack<Integer> stk = new Stack<Integer>(); for(int i=0;i<s.length();i++){ if(c[i] == '('){ stk.push(i); }else{ if(stk.isEmpty()){ ...
a6c6baa7-341f-43eb-aede-0bd654dec066
5
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (taskId >= 0) { return true; } // Begin hitting the se...
c7dcf56b-f9c5-4439-9a2f-1ab7be870a67
1
private void tick(){ if(State == STATE.GAME){ game.tick(); } }
901019fc-026f-4bce-b388-2e21766fe6d2
6
public void update() { // Move the ball. setLocation(getX() + getXVelocity(), getY() + getYVelocity()); // Then do any corrections that result from collisions. // Each of these are negative if a collision occurs int distanceFromLeft = getX() - this.radius; int distanceFr...
c9319e2b-539e-40d7-9a10-3c6438559a12
8
private static void createNewObject(Statement stmt) { System.out.println("What do you want to create?\nItem: 1\nEquipment: 2\nWeapon: 3\nRoom: 4\nSkill: 5\nShop: 6\nNPC: 7\nMonster: 8\n"); int input = scan.nextInt(); scan.nextLine(); switch (input) { case 1: ...
b2c4f92c-b2a1-4453-aeb2-fc156ae4c224
4
public static List<? extends Writable> readListFieldsFromByteArray(byte[] byteArray, Class<? extends Writable> writableClass, Configuration conf) { try { DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(byteArray)); int size = inputStream.readInt(); List<Writable> writableList = new...
5d6b6bbc-7105-495c-a935-8ed2a0d96e5f
3
private MouseListener mouseListener(){ return new MouseAdapter() { @Override public void mousePressed( MouseEvent e ) { if( factory != null ){ if( onlyButtonOne( e )){ startConnectingAt( e.getX(), e.getY() ); } } } @Override public void mouseReleased( MouseEvent e ) { if...
52fbdf5a-068d-4b49-b52d-b3eeb4266de0
8
private static void renderThyris() throws IOException{ File artidx = new File(uopath + "artidx.mul"); File artmul = new File(uopath + "art.mul"); File staidx0 = new File(uopath + "staidx0.mul"); File statics0 = new File(uopath + "statics0.mul"); File map0 = new File(uopath + "map0.mul"); File tiledatamul = ...
1520af3d-4a53-4eb3-bf41-d7d63a2372ae
2
public static boolean getKeyOnce(int key) { return (key < keys.length) ? keys[key] && !lastKeys[key] : false; }
7cfaca27-83b4-4622-a6bd-a7087401d25a
4
void stop() throws IOException { if (in != null) in.close(); if (out != null) out.close(); if (clientSocket != null) clientSocket.close(); if (serverSocket != null) serverSocket.close(); }
6e10f52c-d875-4a2f-ad4b-0fd063b04f0c
2
private void giveBirth(List<Actor> newRabbits) { // New rabbits are born into adjacent locations. // Get a list of adjacent free locations. Field field = getField(); List<Location> free = field.getFreeAdjacentLocations(getLocation()); int births = breed(); for(int b =...
d82bc64f-97b1-402b-af3e-88e7832f7cb0
8
*/ public void moveOnAxisY(Direction direction) { if (direction.equals(Direction.UP_LEFT) || direction.equals(Direction.UP_RIGHT)) { if (this.position.getY() + moveStep <= desert.height && !isHurdle(this.position.getX(), this.position.getY() + moveStep)) { this.position.y += move...
5a703668-02a4-43f2-bce3-66d79060a6fc
1
@Override public Object getValueAt(int rowIndex, int columnIndex) { if (columnIndex == 0) { return sectionNameMap.get(rowIndex+1); } else { return "0"; } }
f31c6e78-d3b6-444c-ab5c-c85dbe3713de
6
public void DDZZ() { if(IsAttackingNPC && playerEquipment[playerWeapon] == 15156 && (misc.random(3) == 1)) { SpecDamgNPC(35); DDS2Damg = true; DDStimer = 1; resetAnimation(); teleportToX = absX; teleportToY = absY; SpecDamgNPC...
80d5b3ac-340c-4762-81d7-a3e4182d9eea
4
@Override public ParserResult specialCheckAndGetParserResult(ParserResult result, SyntaxAnalyser analyser) throws GrammarCheckException { boolean allConditionIsOk = result.getAggregateFunctionName() == null && result.getConditions().size() == 0 && result.getDimensionLevelInfo().size() == 2 && result.g...
faef0fbc-d549-4fcc-8868-464fbe966b0c
2
public MarginPerceptron() { linearParam = new FeatureVector(); online_learning_rate = 1.0; if (CommandLineUtilities.hasArg("online_learning_rate")) { online_learning_rate = CommandLineUtilities.getOptionValueAsFloat("online_learning_rate"); } iters = 5; if (CommandLineUtilities.hasArg("online_training_it...
2f198f20-b993-4c22-b25d-aceb163c4697
4
private void endMidi(String to) { if (to.equals("slide")) slide.addEntity(midi); else if (to.equals("quizslide")) quizSlide.addEntity(midi); else if (to.equals("scrollpane")) scrollPane.addEntity(midi); else if (to.equals("feedback")) quizSlide.addFeedback(midi); }
2891f15b-ba2b-4ba2-a5ee-89f6c71bd48c
5
public static String resourceToString(String name) { InputStream input = Monarchy.class.getResourceAsStream("/" + name); Writer writer = new StringWriter(); char[] buffer = new char[1024]; if (input != null) { try { int n; Reader reader = new BufferedReader(new InputStreamReader(input)); while (...
0375fe60-6171-4b8a-b79a-bfdcd9bd3c7a
2
public static boolean isSkeletonWarriorIron ( SkeletonWarriorIron MMSkeletonWarriorIron) { if (MMSkeletonWarriorIron instanceof Skeleton) { Skeleton SkeletonWarriorIron = (Skeleton) MMSkeletonWarriorIron; if (SkeletonWarriorIron.getEquipment().getChestplate() ...
c2187085-c055-4ad3-845e-6dc6de7c1469
0
public boolean isLoaded() { return loaded; }
0f54e69d-e5c8-4347-8b7b-7869e0c48885
5
public boolean onCommand(Player player, String[] args) { File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml"); FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language); if(player.hasPermission(getPermission())){ if(args.length ...
5e883783-ca65-4754-b464-3e95a44a0c1c
8
public static double contFract(double a, double b, double x) { double aplusb = a + b; double aplus1 = a + 1.0D; double aminus1 = a - 1.0D; double c = 1.0D; double d = 1.0D - aplusb * x / aplus1; if (Math.abs(d) < Stat.FPMIN) d = FPMIN; d = 1.0D / d; double h = d; double aa = 0.0D; double del = 0.0D;...
06c52872-3b31-48df-b1a3-6815758aab04
8
@Override protected void read(InputBuffer b) throws IOException, ParsingException { services = getMessageFactory().parseNodeServicesMessage(b); b = b.getSubBuffer(services.length()); byte[] ipBytes = b.get(0, 16); try { if (isIpv4(ipBytes)) { ip = InetAddress.getByAddress(Arrays.copyOfRange(ipBytes, 1...
35b8e7e4-e188-4343-8551-fb815ef4c085
5
@Override public void add(Integer id, String type) { try { connection = getConnection(); ptmt = connection.prepareStatement("INSERT INTO User_types(id_user, type) VALUES(?,?);"); ptmt.setInt(1, id); ptmt.setString(2, type); ptmt.executeUpdate(); ...
a929c4b7-d51a-404b-99d2-dd1ab800ae6e
8
@Test public void testCleanSweepUpdate() { System.out.println("Test cleanSweepUpdate()"); VirtualHouse vh = new VirtualHouse(true); CleanSweepRobot robot = new CleanSweepRobot(vh); SensorInterface si = new SensorInterface(); direction n = direction.NORTH; direction e = direction.E...
2e55450f-4f7e-4c59-aefe-a0a8b7b02e48
9
@Override public void run() { DataInputStream in = null; try { socket.setSoTimeout(1000); } catch (SocketException e) { } while (areAlive()) { if (panic) { messageHandler.handlePanic(new Message(Message.Type.Panic, "", node.getListenP...
939fe3fa-c28b-4107-bbce-b916c1a217c8
8
static final void method2336(ObjectDefinition class51, int i, int i_1_, int i_2_, int i_3_) { anInt3940++; if (i_3_ > -126) anInt3941 = 15; for (Class348_Sub9 class348_sub9 = (Class348_Sub9) Class218.aClass262_2859.getFirst(4); class348_sub9 != null; class348_sub9 = (Class348_Sub9) Class218....
62e80403-0233-4cab-a23f-9f7a277109ad
9
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if(msg.amITarget(this)) { final MOB mob=msg.source(); switch(msg.targetMinor()) { case CMMsg.TYP_EAT: if((!msg.targetMajor(CMMsg.MASK_HANDS)) ||(mob.isMine(this...
988dcd9f-a97f-4d73-ab8a-e1056d9cfd6d
9
public Symbol matchSymbol (String token) { switch (token) { case "main": return Token.MAIN; case "end": return Token.END; case "if": return Token.IF; case "else": return Token.ELSE; case "endif": return Token.ENDIF; case "while": return Token.WHILE; case "endwhile": re...
bb348649-9817-495e-8d42-4e97551e94f7
3
private Fontstyle getUnderlineFontstyle(boolean selected, Fontstyle oldValue) { Fontstyle ret = null; if (selected) { if (oldValue == Fontstyle.SHADOW) { ret = Fontstyle.SHADOWUNDERLINE; } else { ret = Fontstyle.UNDERLINE; } } ...
e9b9e536-abd7-44b1-aced-1a65997c0f27
6
public String parseComment () throws XmlReaderException { StringBuffer s=new StringBuffer(); Enumeration e=getContent(); while (e.hasMoreElements()) { XmlTree tree=(XmlTree)e.nextElement(); XmlTag tag=tree.getTag(); if (tag.name().equals("P")) { if (!tree.haschildren()) s.append("\n"); else { ...
3352889a-8ed8-4d41-9255-57a34d71270a
6
private static PluginCommand getCommand(String name, Plugin plugin) { PluginCommand command = null; try { Constructor<PluginCommand> c = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class); c.setAccessible(true); command = c.newInstance(name, plugin); } catch (SecurityException e...
35160aa0-14d3-4315-940a-9441e7748f4b
7
public void loadLevel( String file_name ) throws IOException { InputStream is = Level.class.getResourceAsStream( "resources/" + file_name ); BufferedReader br = new BufferedReader( new InputStreamReader( is ) ); String line = br.readLine(); int cell_pos_x = 0, cell_p...
f9220cb1-4013-40e9-9f72-95c476aff70d
3
private void updateDimension() { Rectangle2D newSize = getBounds(); if(size == null || newSize.getWidth() != size.getWidth() || newSize.getHeight() != size.getHeight() ) { size = newSize; insets = getInsets(); interior = new Dimension( (int)size.getWidth() - insets.left - insets.right ,(int...
b76ad022-b146-4bb9-8de0-41941f92ebed
2
private String GetMovieLink(String movieSearch) throws Exception { movieSearch = movieSearch.replaceAll(" ", "+"); String url = "http://www.csfd.cz/hledat/?q=" + movieSearch; WebPage page = WebPage.loadWebPage(url, ENCODING); Document doc = Jsoup.parse( page.getContent() ); Stri...
9508f1d3-9115-4705-b75e-89bbceedf62d
1
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); oContexto.setVista("jsp/alumno/form.jsp"); AlumnoBean oAlumnoBean; AlumnoDao oAlumnoDao; oAlu...
aa11cb03-c37f-4733-b245-0b0621282792
0
public void setFirstName(String firstName) { this.firstName = firstName; }
863ad548-1e40-48f2-8993-24b76d3712e1
5
public MyNeuronNetwork(int inputs, int outputs,IMyNeuronFunction<U> calcFunc) throws Exception { if((inputs & (inputs - 1)) != 0)// if not power of two { throw new Exception("input number must be a power of two"); } if((outputs & (outputs - 1)) != 0 && outputs !=1)//if no...
ec8ae6dd-78aa-4f97-bc8f-412f6e93bdbf
3
@Test public void testSingle () { Rectangle2D rx = new Rectangle2D.Double (0, 0, 1, 1); tree.load (Collections.singletonList (rx)); MBR mbr = tree.getMBR (); assertEquals ("odd min for mbr", 0, mbr.getMinX (), 0); assertEquals ("odd min for mbr", 0, mbr.getMinY (), 0); assertEquals ("odd max for mbr", 1, mbr....
ac247b2c-7c70-4222-9a8f-82488f5d5ca6
2
private void render() { BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } int xScroll = player.x - screen.width / 2; int yScroll = player.y - screen.height / 2; level.render(screen, xScroll, yScroll); for (int i = 0; i < pixels.length; i++) { pixels[i...
83a7cdad-791b-4ae7-9aa6-a2935a3f819c
8
private void run() { properties = new MavenProperties(mavenSettingsPath); try { properties.fetchProperties(); } catch (SAXException e) { e.printStackTrace(); return; } catch (IOException e) { e.printStackTrace(); return; ...
c7ba6b10-4fe4-444d-bd9f-80c55f65adab
3
private JSONWriter end(char mode, char c) throws JSONException { if (this.mode != mode) { throw new JSONException(mode == 'a' ? "Misplaced endArray." : "Misplaced endObject."); } this.pop(mode); try { this.writer.write(c); } catch (IOExcepti...
adc68112-3303-4625-b786-37cda7665255
9
static void importDo() { boolean success = false; String lastDir = null; File[] selectedFiles = null; if (!isWindows) { if (fileGetter == null) buildFileGetter(); int wasGot = fileGetter.showOpenDialog(mainGUI.w); if (wasGot == JFileChooser.APPROVE_OP...
44ec0521-93b3-49e4-ae70-bf1f572dfde3
9
public Model method202(int i) { if(stackIDs != null && i > 1) { int j = -1; for(int k = 0; k < 10; k++) if(i >= stackAmounts[k] && stackAmounts[k] != 0) j = stackIDs[k]; if(j != -1) return forID(j).method202(1); } Model model = Model.method462(modelID); if(model == null) return null; ...
3f6869cc-ddf7-4097-9134-ab5a9bada3fd
3
public void openDevice(int index) { // Opens the device takes in index you // want to use deviceIndex = index; // Sets the index to the parameter try { // beginning of a try catch block captor = JpcapCaptor.openDevice(devices[index], 1028, false, 20); // Opens // the ...
24f55a81-cd60-4963-95d4-b02561212785
7
public Dimension getPreferredSize() { Graphics g = getGraphics(); FontMetrics fm = g.getFontMetrics(); Dimension d; Insets insets = getInsets(); int width = 0; int height = 0; int w; if (stateNameText != null) { d = stateNameTe...
5414dfeb-a1e8-4caa-9a2e-61cadfde1980
6
private ListNode mergeSortList(ListNode head, int len) { if(len <= 1) { return head; } int leftLen = len/2; int rightLen = len - leftLen; //find middle pointer ListNode middle = head; for(int i=0; i<leftLen-1; i++) { middle = middle.next; ...
65f09120-e482-4db5-a72c-6f73ed7b09c4
7
@Override public void PerformAction(ActionEvent Event) { if (Event.getSource() == this.MenuAbout) new SPopup(new SPopupData("Sneek", "Version: " + UpdateHelper.GetCurrentGameVersion(), "Copyright 2013: team Sneek").SetTitle("About Sneek")); if (Event.getSource() == this.MenuLogin) this.LaunchSpecialPlayer.LaunchL...
309901b6-bb58-40a4-91ce-36cc88a0d671
5
private void ackClientRequestForUpdatedFile() throws Exception{ try { InputStream is = null; OutputStream os = null; ArrayList<String> updatedFileName = new ArrayList<String>(); is = s.getInputStream(); this.dataReader.setDataInputstream(is); ...
732bc5ba-8643-4bcb-9d8b-b355497d91e3
0
public String getGoTo() { return goTo; }
29d89eff-ac3d-43a4-9630-1c1331a6ab42
4
private void addMouseListener() { this.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { int particleAmount = settings.getGraphicalDetailLevel() * 10 + 10; //10 for Low, and 10 more for each subsequent level switch (settings.getParticl...
76454b6c-3a25-4d35-a510-bf5c99051f44
3
private void buildDocumentAttributes(JoeTree tree, String lineEnding, StringBuffer buf) { Iterator it = tree.getAttributeKeys(); if (it != null) { while (it.hasNext()) { String key = (String) it.next(); Object value = tree.getAttribute(key); boolean isReadOnly = tree.isReadOnly(key); buf.app...
5693f6f3-426c-4ef3-9495-475cca5a7631
5
public boolean updateSkillScore(String employeeId, String skillName, int ratingId) { String sql = SELECT_SKILL_SCORE + employeeId + "' and skill_id=" + CommonUtil.getSkillId(skillName); Connection connection = new DbConnection().getConnection(); PreparedStatement preparedStatement = null; ResultSet resul...
1e7ca400-3bc0-4227-be29-afde08df973b
1
public static double getPearsonCorrelation(double[] scores1,double[] scores2){ double result = 0; double sum_sq_x = 0; double sum_sq_y = 0; double sum_coproduct = 0; double mean_x = scores1[0]; double mean_y = scores2[0]; int min_len = Math.min(scores1.length,scor...
7149a62c-16d8-4a79-a035-d544118205e6
4
public void visitSource(final String file, final String debug) { buf.setLength(0); if (file != null) { buf.append(tab).append("// compiled from: ").append(file) .append('\n'); } if (debug != null) { buf.append(tab).append("// debug info: ").append(debug) .append('\n'); } if (buf.length() > 0...
53a61e30-6a21-4309-aecf-7ff44d128153
9
public static boolean isBST(Node<Integer> root, int min, int max) { boolean success = false; if(root.data > min && root.data <max ){ success = true; if(root.left!=null){ if(root.data>root.left.data) { success = success && isBST(root.left, min,r...
dd5d1265-8588-4246-b36b-3862aec1b48e
6
public StringBuilder readFromFileMethod(String fileName) { try { // Initialize the file input stream FileInputStream fstream = new FileInputStream(fileName); data = new StringBuilder(); // Get DataInputStream object in = new DataInputStream(fstream); ...
9675319a-e68f-455d-a3ca-9ac8d1765a2c
7
public Object getConstant(int i) throws ClassFormatException { if (i == 0) throw new ClassFormatException("null constant"); switch (tags[i]) { case ConstantPool.INTEGER: case ConstantPool.FLOAT: case ConstantPool.LONG: case ConstantPool.DOUBLE: return constants[i]; case ConstantPool.STRING: retur...
211c1088-a339-487b-b6c0-2f8d40d7b7ee
9
@Override public void Execute() { Bowler.setBallsBowled(1); Batsman.setBallsFaced(1); if((Type == BallType.NoBall || Type==BallType.Wide) && Bowler.getPenaltyBalls()>=1){ Runs+=3; } else if (Type == BallType.NoBall || Type==BallType.Wide) { Runs +=1; } switch(Type){ case NormalBall: b...
2061a72d-529b-4ab1-8a1d-462eecef3fbc
6
public static Stella_Object accessInputStreamSlotValue(InputStream self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Stella.SYM_STELLA_ECHO_STREAM) { if (setvalueP) { self.echoStream = ((OutputStream)(value)); } else { value = self.echoStream; }...
0fb60b06-650d-4732-83e9-141cbe6d0214
9
protected int[] filterPixels( int width, int height, int[] inPixels, Rectangle transformedSpace ) { int index = 0; int[] argb = new int[9]; int[] r = new int[9]; int[] g = new int[9]; int[] b = new int[9]; int[] outPixels = new int[width * height]; for (int y = 0; y < height; y++) { for (int x = 0; x ...
6de5462c-d880-4aea-968d-cbda3643417f
4
private void closeObjects() { try { if (out != null) out.close(); if (in != null) in.close(); if (socket != null) socket.close(); } catch (IOException e) { System.out.println("Error trying to close objects"); e.printStackTrace(); } isOpen = false; }
ddcb9ee2-f3f4-42db-b377-d87643ddf240
1
public void resetcam() { if (cam != null) { cam.reset(); } }
f93b44fa-9f3d-4a67-b16b-b57c2f53973b
6
public MapPanel(ArrayList<Rectangle> solidRects, ArrayList<Rectangle> flatRects, ArrayList<MapGridArray> map, Dimension size) { setBackground(Color.BLACK); bi = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB); setPreferredSize(new Dimension(800, 600)); if(size != null) { setPreferredSize(size); ...
c9a370d3-312c-4149-9f2e-8868217c6010
7
private void eval_exp3(DPNumber result) { //System.out.println("exp3"); String op; DPNumber temp=new DPNumber(0.0); eval_exp4(result); while(getopcode(op = token)==std_MUL || getopcode(op)==std_DIV || getopcode(op)==std_MOD) { get_token(); eval_exp4(temp); switch(getopcode(op)) { cas...
c23d4baf-3a52-4167-937d-3a28211cf352
8
public void updateTable(UIDataInterface data) { StatisticsInterface stats = data.getStats(); PlayerInterface[] players = data.getPlayers(); // round number int rn = stats.getCurrentRoundNo(); // roundnumber since start int rnst = rn - stats.getStartingRoundNo() + 1; ...
fa4c673e-d81e-46be-8fa1-855d8885ccb3
8
public void update(Graphics g) { Graphics2D g2 = (Graphics2D) g; dim = getSize(); if (isOpaque()) { g2.setColor(getBackground()); g2.fillRect(0, 0, dim.width, dim.height); } g2.setColor(getForeground()); g2.setStroke(ViewAttribute.THICK); int period = dim.width / 2; int zerox = dim.width / 10...
136d93c7-65a5-4007-b6dc-89de2bc39e39
8
public static Vector<Container> getSheaths(MOB mob) { final Vector<Container> sheaths=new Vector<Container>(); if(mob!=null) for(int i=0;i<mob.numItems();i++) { final Item I=mob.getItem(i); if((I!=null) &&(!I.amWearingAt(Wearable.IN_INVENTORY)) &&(I instanceof Container) &&(!(I instanceof Drink)...
808dfc17-926b-4375-a674-218905c4de42
0
public void setUnprocessedInput(String input) { myUnprocessedInput = input; }
43289042-98ef-4a17-99db-d269f19387d5
8
@Override public void init() { /* 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://download.o...
807df61b-fc94-470d-bd0d-833154ed954f
8
private axel getBlockAxel(blockNode block, connectedEdge edge) { //now we can use the other constuctor to create a rotated block //If the top edge is connected to, switch height and width around int width = 0; int height = 0; switch (edge) { case Top: case...
9c66b2dd-888d-498f-a5b5-98777bed1538
4
@Override public void minePlacer(int wIndex, int hIndex) { int i; int j; for (int iter = 0; iter < this.bombNumber; iter++) { i = (int) (Math.random() * (width)); j = (int) (Math.random() * (height)); if (i != wIndex || j != hIndex) { State...
2daa8ae6-a422-4b85-823a-748393cf1140
4
public static Object toReflectType(String typeSig, Object value) { switch (typeSig.charAt(0)) { case 'Z': return new Boolean(((Integer) value).intValue() != 0); case 'B': return new Byte(((Integer) value).byteValue()); case 'S': return new Short(((Integer) value).shortValue()); case 'C': return ne...
1997a049-8306-47c9-b6f2-5da9c380f303
6
public static Cons javaYieldInstanceVarTree(StorageSlot slot, Stella_Class renamed_Class) { { Symbol slotname = Symbol.trueSlotName(slot.slotName, renamed_Class.classType); StandardObject slottype = (slot.slotContextSensitiveP ? Stella.SGT_STELLA_OBJECT : ((StandardObject)(slot.computeReturnTypeSpec(renamed_C...
bbc80a55-bdcd-48bb-8b01-34d585bf1ec8
8
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking,tickID)) return false; if(((--tickDown)<=0) &&(!CMSecurity.isDisabled(CMSecurity.DisFlag.EMOTERS)) &&((!(ticking instanceof MOB))||(canFreelyBehaveNormal(ticking)))) { tickReset(); for(int v=0;v<triggers.length;v++...