method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f752bafe-56d6-481a-8d58-ffe60eb21061
2
public void onEnable() { this.file = new File(getDataFolder(), "config.yml"); ruChat.cfg = YamlConfiguration.loadConfiguration(file); this.loadCfg(); ruChat.modes = new HashMap<Player, ChatMode>(); this.log = Logger.getLogger("Minecraft"); this.plugin = getServer().getPlu...
59c0d781-faf0-4096-aa4e-c18101d5f1f0
0
private void registerService() throws Exception { ServiceManager .getServices() .initializeServices(new Object[] { new TestRailwayRepository(), new TestTicketPoolManager()}); }
b5192a81-3d26-4c25-9937-a30d09ee9971
1
public static void main(String[] args) { if (args.length < 1) { System.out.println("Usage: java Parser [input]"); System.exit(0); } Parser p = new Parser(args[0]); }
27209efa-6aca-43a3-979b-92939165d949
1
@RequestMapping(value = "/saveCustomer", method = RequestMethod.POST) public String saveCustomer(@ModelAttribute("customer") Customer customer, BindingResult result) { System.out.println("customer id:" + customer.getCustomerId()+ "name" + customer.getName()); if (customer.getCustomerId() == null) ...
3edeffbd-493f-4191-a6e6-c2ec1da85439
3
@Override public void delete(Staff obj) { PreparedStatement pst = null; try { pst = this.connect().prepareStatement("DELETE FROM Staff where id=?;"); pst.setInt(1, obj.getId()); pst.executeUpdate(); System.out.println("suppression...
9d2ac0c1-cc31-49e2-856d-aed66f93d381
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; NeuronPair that = (NeuronPair) o; if (n2.equals(that.n2) && n1.equals(that.n1)) return true; if (n2.equals(that.n1) && n1.equals(that.n2)) retur...
20f82f47-f120-43c6-9c22-8b76712c7f28
3
* @return True, if the contents of this statement list changed. */ public boolean removeAll(final Collection c) { boolean changed = false; if (c == this) { changed = size() > 0; clear(); } else { final Iterator iter = c.iterator(); while (iter.hasNext()) { changed = remove(iter.next...
f83383e5-681d-4a4f-a9aa-aabf8bb08bec
0
public int getSearchNumLinks() { return _searchNumLinks; }
3e9eb1cf-57d4-472a-afe4-e2f963df902a
1
@Before public void setUp(){ d = new DataArrays<int[]>(); for(int i = 0; i<5; i++){ int[] a = new int[10]; Arrays.fill(a, i); d.addToKit(a); } }
688e70e2-8c8a-4cdc-beee-b5729253cabe
5
public void filtroClientes(String dni, String apellidoPaterno, String apellidoMaterno, String nombre, String email, String telefono, String celular, String fechaContacto) { // Busqueda secuencial por strings falta comparar mas campos. for(Cliente cliente : clientes) { if(clie...
2e2fd857-26df-4e12-8c3c-8be09231a24c
2
public void placeNumbers(BoardModel boardModel) { for (Cell[] cells : boardModel.getBoard()) { for (Cell cell : cells) { cell.setContent(checkNeighborsForMines(boardModel, cell.getPosition())); } } }
4b9bc80e-6642-4200-8161-924019ed42a7
8
public void move() { Random generator = new Random(); double a = generator.nextDouble(); if (a < 0.25) { xCoordinate -= 25; if (isOutOfBounds()) { xCoordinate += 25; } } else if (a < 0.5) { xCoordinate += 25; if ...
7a5a7825-f80d-4cbf-ac37-a266ab1c6616
6
public static Config readDefaultArchive() throws ZipException, IOException, JSONException { loadNetworkShapes(); Config c = new Config(new JSONObject(new JSONTokener(new InputStreamReader(NetworkIO.class.getResourceAsStream("data/source.json"), "UTF-8")))); HashSet<String> taken = new HashSet<String>(); for (Co...
e14744a4-2ba1-4180-a06a-432c40d5fc88
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
3d1785e6-b836-4dc1-ae0b-483fe948a690
5
public Object[][] getData() { try { MCQ_DAO mcq_DAO = new MCQ_DAO(); FIB_DAO fib_DAO = new FIB_DAO(); Essay_DAO essay_DAO = new Essay_DAO(); //get question //get question ArrayList<MCQ> mcqs = mcq_DAO.getList("question_ID not in (select que...
e86960fa-9982-4a30-98c6-b5326c8eb507
1
private boolean isAuthenticated(HttpServletRequest paramHttpServletRequest) { Object result = paramHttpServletRequest.getSession().getAttribute(SESSION_ATTR_IS_AUTHENTICATED); if (result != null) { return (Boolean)result; } return false; }
305a3d9e-bde1-414f-8701-4e8a77457e7b
3
public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); System.out.println("Value of n is"+n); for (int count=0;count<n;count++){ for(int i=n-1;i>count;i--){ System.out.print(" "); } for(int j=0;j<=...
27e863e0-d897-4db9-9884-1b3e2f783fdc
3
public static void sortNumBubble(int[] num) { int j; boolean flag = true; // set flag to true to begin first pass int temp; //holding variable while(flag) { flag = false; //set flag to false awaiting a possible swap for(j = 0; j < num.length -...
cc03a970-0651-4fb4-93ec-31e3f862abe7
0
public static void main(String[] args) { HashMap map = new HashMap(); map.put("a","zhangsan"); map.put("b","zhangsan"); System.out.println(map); System.out.println("-------------"); String str = new String("lisi"); map.put("a",str); map.put("b",str); System.out.println(map); }
d6b7b0f7-c340-4c6e-9f99-b39f02d49040
3
public void focusGained(FocusEvent e) { JTextField textField = (JTextField)e.getComponent(); String text = textField.getText(); double value; try { NumberFormat format = NumberFormat.getInstance(Locale.getDefault()); Number number = format.parse(text.toString().trim()); value = number.doubleValue()...
6b4898a2-a9aa-40ad-bbef-0a275d122f33
7
public void startMinecraft(String player, String server, String mppass, int port, String skinServer, boolean fullscreen) { // Set up Minecraft instance MCraftApplet applet = new MCraftApplet(); MinecraftCanvas canvas = new MinecraftCanvas(); minecraft = new Minecraft(canvas, applet, ful...
e61c4889-44f9-439d-bb41-4d9f04f756b3
2
public static void cleanUp() throws IncorrectUsageException { Throwable t = new Throwable(); StackTraceElement[] elements = t.getStackTrace(); String className = elements[1].getClassName(); String methodName = elements[1].getMethodName(); //@formatter:off if (!className.e...
45bdad02-b53b-4f34-a576-bbafc1e2fae2
7
@Override protected int drawUnselectedText(final Graphics g, int x, int y, int p0, int p1) throws BadLocationException { // Copied, with a few changes final Font boldFont = g.getFont().deriveFont(Font.BOLD); final Font plainFont = g.getFont().d...
02446fd4-2d0f-49c9-b410-f2675a1f4d88
1
public void dumpInstruction(TabbedPrintWriter writer) throws java.io.IOException { writer.print("return"); if (instr != null) { writer.print(" "); instr.dumpExpression(writer.IMPL_PAREN, writer); } writer.println(";"); }
a2bec378-830a-4897-bd6d-c5909b03a847
5
private static List<Temporal> generateTemporalSegments(Collection<Long> timestamps, Collection<Long> instances) { List<Temporal> segments = new ArrayList<Temporal>(); if (null == timestamps) return segments; if (null == instances) instances = new TreeSet<Long>(); int c = 0; long timeIntervalStart = 0; for (...
3b1c6c30-b178-456c-8a29-7bd97c17e647
7
public static void registerDirectory(File directory) { // ensures that the specified File is a directory and that it isn't // currently registered if (directory.isDirectory() && !registeredDirectories.contains(directory)) { if (!running) start(); ...
f82f9fb0-86e1-4f4a-9991-ca7251785052
5
public boolean removeUser(String firstName, String lastName, String concordiaID){ int index = 0; for(ConcordiaMembers member: concordiaMembers){ if(member!=null){ if(member.getFirstName().equals(firstName) && member.getLastName().equals(lastName) && member.getConcordiaID().equals(concordiaID)){ conc...
e5b87170-e3b6-4c67-903d-703a612d868b
0
@Override public Car driverCar() { return new BmwCar(); }
2f210b4c-6f5f-40dd-bcf5-32cdba4aa802
5
public Piece computeNextRotation() { // arraylist of TPoints to hold the rotated blocks TPoint[] rotatedPts = new TPoint[body.length]; for (int i = 0; i < body.length; i++) { int x = body[i].x; int y = body[i].y; // apply CC rotation matrix to [x, y] vector: R = [0 -1; 1 0] int x_p = x * 0 + y * (...
2375a973-3129-4b36-b388-84928e838b68
6
public static String getCoastlineCoding(Game game, Position center) { char[] coding = {'0','0','0','0' }; int row = center.getRow(), col = center.getColumn(); Position p; int offsetRow[] = { -1,0,+1,0 }; int offsetCol[] = { 0,+1,0,-1 }; // iterate over the four compas directions // for...
8a720681-ffe0-4c02-8902-e26d02ff1bdd
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
ea4bafb0-571b-40f0-a471-8e6f342eb3e4
9
public final static void evaluateStats() { logger.info( "[ " + System.currentTimeMillis() + " ] evaluating stats on " + stats.name + " ..." ) ; sentenceMap.entrySet().stream().parallel().map((entry) -> entry.getValue()).forEach((s) -> { final int _tokenCount = s.tokens.length; st...
a79569be-bf9b-4cfe-86b2-bd558d92c791
6
@EventHandler(priority = EventPriority.HIGHEST) public void onBlockDamage(BlockDamageEvent event) { Sign sign; if (!event.isCancelled() && event.getBlock() != null && (event.getBlock().getType() == Material.WALL_SIGN || event .getBlock().getType() == Material.SIGN_POST)) { si...
bbf22da2-9450-4d0b-a123-ae22b3c1f9ec
2
@Override public Visiteur getOne(Integer idVisiteur) throws DaoException { Visiteur result = null; ResultSet rs = null; // préparer la requête String requete = "SELECT * FROM VISITEUR WHERE ID_VISITEUR=?"; try { PreparedStatement ps = Jdbc.getInstance().getConnexi...
966ae784-e7c2-458e-b658-e539609008c2
5
public void drawMap() { for (int i = 0; i <= width; i++) { print(" _"); // boarder of map } print("\n"); for (int j = higth; j >= 0; j--) { print("|"); // boarder of map for (int i = 0; i <= width; i++) { if (nodes[i][j].isWalkable...
421ca73c-1ba5-4875-89c1-7cebb48f9f96
2
public User signup(String mail, String name, String username, String pass, String forumId) { for (int i = 0; i < forums.size(); i++) { if (forums.get(i).getId().equals(forumId)) return forums.get(i).signup(mail, name, username, pass); } return null; }
073e6292-9c4d-4eb1-a8bc-c8e0dbca145d
2
public static GUI getGUIById(String id){ for (GUI gui: Engine.getScreen().getGUILayer()){ if (gui.getId().equals(id)) return gui; } new RugieError(new Object(),"could not find a GUI with id: " + id + ", will return an empty gui").show(); return new GUI("ERROR_...
1da79039-8fc4-4b03-964b-a6f58f5467bb
4
public boolean isTriangular(int[][] matrix){ for(int i = 0; i < matrix.length-1; i++){ for(int j = 0; j < matrix[0].length-1; j++){ if(i > j){ if(matrix[i][j] != 0){ return false; } } } ...
11816308-ed16-40a2-8a9e-8f154acd3c7c
3
public double getTotal() { double ret = 0; if(items != null) for(Item i : items) ret += i.getCount() * i.getPrice(); return total == 0 ? ret : total; }
8d1f3432-0f89-4c15-a96f-b90b18b21a33
8
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte) { ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks( this, par1, par2, par3ArrayOfByte, null); MinecraftForge.EVENT_BUS.post(event); if (event.getResult() == Resul...
4ad377eb-a5f2-497a-a5c8-587d8476b961
8
public static String getPluginParams(String jarFileName) { String params = ""; try { JarFile jarFile = new JarFile(jarFileName); JarEntry je = jarFile.getJarEntry("plugin.conf"); InputStream in = jarFile.getInputStream(je); BufferedReader reader = new BufferedReader(new In...
13b67b92-0c33-4f3e-8447-2b0fdf576ddd
4
public void autonomousInit() { isAuton = true; //autonMode = (String) autoChooser.getSelected(); //postMode = (String) postChooser.getSelected(); // schedule the autonomous command (example) if (autonomousCommand != null && auton == "Left") autonomousCommand.start(); else if (secondAuton != null && auto...
a6a61748-d834-41fa-8b51-f15bcb883dca
3
public static void copyFromTopicQueueToTopicQueue(RabbitMQRequestParams rabbitMQRequestParams) throws Exception { RabbitMQTopicQueueConsumer consumer = new RabbitMQTopicQueueConsumer( rabbitMQRequestParams.getSourceHost(), rabbitMQRequestParams.getSourcePort() , rabbitMQRequestParams.getSourceUsername(), rabb...
652d67d8-6ccb-46ca-9f76-b58a18c3e122
3
private boolean isCellOutOfField (Point adjoiningCell) { return adjoiningCell.x < 0 || adjoiningCell.y < 0 || adjoiningCell.x >= width || adjoiningCell.y >= height; }
9481c2c2-4ebb-484d-9246-27818c751866
3
private CtBehavior compileMethod(Parser p, MethodDecl md) throws CompileError { int mod = MemberResolver.getModifiers(md.getModifiers()); CtClass[] plist = gen.makeParamList(md); CtClass[] tlist = gen.makeThrowsList(md); recordParams(plist, Modifier.isStatic(mod)); md...
d700ae2f-a1e0-453d-9457-c3844634f1dd
7
public Hashtable<String,Neo4jCluster> perform(DatasetLoader datasetHandler, Neo4jHandler neo4jHandler, double similairtyThreshold, int softClusteringThreshold) throws Exception { Hashtable<String,Neo4jCluster> clustersList = new Hashtable<String,Neo4jCluster>(); Hashtable<String, Document> docsHash = datasetHandler...
a3ecb4ad-d673-47bc-8167-b6087f66deb9
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Person other = (Person) obj; if (Double.doubleToLongBits(height) != Double .doubleToLongBits(other.height)) return false; if (id != othe...
485bff8d-8abc-46ce-8a72-c2734d2eca4b
6
public AddFile(java.awt.Frame parent, FileEntry curr, String currVersion, List<String> versions, String currCategory) { super(parent); initComponents(); if(curr!=null) { setTitle("Edit Entry"); jButton2.setText("OK"); item = curr; jTextField1.setTe...
c0764df7-ad5f-4f5a-9e76-ac12a4f2d79e
6
public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception { HashMap<String, HashMap<String, Integer>> map = new HashMap<String, HashMap<String,Integer>>(); BufferedReader reader = filePath.toLowerCase().endsWith("gz") ? new BufferedReader(new InputStreamReader( ...
655ab9a8-59c0-41ab-b86e-9860ef4e93a9
2
@Override public void findClasses() { try { InputStream inputStream = new FileInputStream(classFile); byte[] buffer = new byte[1024]; int count; ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); while ((count = inputStream.read(buffer)) != -1) byteArrayOutputStream.wr...
fa05a5f7-ba40-4dad-a021-1d8ec7155a52
8
public static Object escape(Object original) { if (original instanceof Character) { char u = (char) ((Character)original); int idx = "\b\t\n\f\r\"\'\\".indexOf(u); if (idx >= 0) return "\\"+"btnfr\"\'\\".charAt(idx); if (u < 32) re...
f058d73c-493a-4252-972c-37a8dd0e35d2
9
private boolean checkPropertyFile(File propertieFile) { boolean properFileFlag = true; Properties props = new Properties(); String reqKey = ""; boolean foundConversionPattern=false; try { FileInputStream fis = new FileInputStream(propertieFile); // read th...
6d3a6e09-8fa2-46f1-8a23-5bf3fc7ab5b0
6
@Override public Object getValueAt(int row, int col) { User user = (User) globalData.get(row); switch (col) { case INDEX_ID: return user.getID(); case INDEX_FIRSTNAME: return user.getFirstName(); case INDEX_LASTNAME: return user.getLastName(); case INDEX_POINTS: return user.getPoints(); ...
08e53460-f080-4e02-8458-1a9a711e37c2
7
public String iterativeWay(String[] strs) { if (strs == null || strs.length == 0) return ""; StringBuilder result = new StringBuilder(); int index = 0; while (true) { if (strs[0].length() <= index) break; char global = strs[0].charAt(index); for (int i = 1; i < strs.lengt...
ae402005-2de5-4233-b459-e2d6a5c74d34
3
public JSONObject putOnce(String key, Object value) throws JSONException { if (key != null && value != null) { if (opt(key) != null) { throw new JSONException("Duplicate key \"" + key + "\""); } put(key, value); } return this; }
bdb908d9-2d59-484f-ab21-265b343cae08
8
public static boolean startsWithIgnoreCase(String s,String w) { if (w==null) return true; if (s==null || s.length()<w.length()) return false; for (int i=0;i<w.length();i++) { char c1=s.charAt(i); char c2=w.charAt(i); ...
5379432c-0882-4299-bc8d-396eba507b68
4
@EventHandler(priority = EventPriority.HIGHEST) private void onAdministratorCommand(PlayerCommandPreprocessEvent e) { Player sender = (Player) e.getPlayer(); if (isOpen()) { String cmd = e.getMessage().toLowerCase(); if (cmd.startsWith("/stop")) { sender.sendM...
5c100f5b-ad6f-4912-a878-ca39100b1b78
0
public void resetId() { quizTriggerId=0; }
c59d0547-0686-43e2-90f9-3fdda54f513f
3
private int[] getNeighborsFor(AsciiImage img, int x, int y) { int[] neighbours = new int[9]; int current = 0; --x; --y; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { if (!img.isInsideBounds(x + i, y + j)) neighbour...
6071c63b-5623-4d23-89ff-ff3b8f7debbc
9
static double[] train(int steps) { Random rand = new Random(); double[] w = new double[28 * 28]; for (int step = 0; step < steps;) { step++; while(test(w)>0.1){ int r = rand.nextInt(5000); double[] x = I.get(r).vec; double ...
d473561a-9ac0-44fc-a558-ddeea24cf7c1
3
@Test public void testRemoveAllPreferencesClient() { List<Product> productAux = null; Product book = new Product("Book", 1234, 2.30, 100); Product table = new Product("Table", 4321, 3.00, 100); facade.addProduct(book); facade.addProduct(table); Client client1 = new Client("Diego", "111", "diego.sousa@d...
aa02f941-16f7-44ba-bae1-50b37a5f5c79
6
private Token matchNumber() { SourcePosition pos = new SourcePosition(lineNo, columnNo); StringBuilder sb = new StringBuilder(); boolean decimal = false; int character = lookAhead(1); while ((character >= '0' && character <= '9') || character == '.') { if (decimal && ...
29adbca0-18e8-4d89-98d3-00f3beb9fb5c
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(ID())!=null) { mob.tell(target,null,null,L("<S-NAME> already <S...
9140d798-07e1-42ed-8bb9-0d35ed65813a
7
private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked if(jButton3.isEnabled()){ jButton3.setEnabled(false); if(evt.getButton() == 1){ System.out.println("im clicked"); try{ System.out.p...
697b5a27-4549-4df1-959b-4d9e3f7e1b77
9
public static HashMap login(String userID, String password) { MessageLogger.logSecurityLoggingMessage(userID + " : LoginService -> login \r\n"); HashMap map = new HashMap(); String message = null; try{ Timestamp currdateTime = new Timestamp(Calendar.getInstance().getTime().getTime()); // for de...
d786cf38-00f0-41d2-94d9-887a2b25e4aa
6
private boolean checkField() { IPlayer player = game.getCurrentPlayer(); IField field = game.getMap().getField(player.getCoordinates()); if (field == null) { return false; } if (field.getZombie() != null) { game.setState(new FightState(window)); ...
b087279b-2bb7-49d3-a974-192f22d73990
8
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed String type = txtFieldType.getText(); lblError.setText(""); boolean dbResult = false; int capacity = -1; int planeNumber = -1; String ErrorMessage = ""; t...
fa01a3be-be94-4358-9d8f-19d858b4b0f2
7
private void initialize() { frmSearchEngine = new JFrame(); frmSearchEngine.setTitle("Search Engine"); frmSearchEngine.setBounds(100, 100, 550, 500); frmSearchEngine.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.rowWeights = new double...
8c6270fc-2b46-4ede-bcf6-7b58d45e9c2f
2
@Override public void mouseMoved (MouseEvent e) { if (index != -1) { int newIndex = locationToIndex (e.getPoint()); if (newIndex != index) { setIndexHovered (index, false); index = newIndex; setIndexHovered (index, true); } } }
45475eee-e165-4d2a-b18f-ceadc155358c
7
private static String escapeChar(char input, char usedQuote) { if (input == usedQuote) return "\\" + usedQuote; switch (input) { case '\\': return "\\\\"; case '\b': return "\\b"; case '\f': return "\\f"; case '\n': return "\\n"; case '\r': return "\\r"; case '\t': return "\\t"; ...
bdba7991-3f16-4704-8a9d-13c8fd484122
8
public void sendText(String text){ try { if(this.sendAllJson){ if(text.length() >= 3 && text.substring(0, 3).equals("ERR")){ text = "{\"ok\":false,\"message\":\"" + text + "\"}"; } else if(text.equals("Welcome to Bukkit, please authenticate.")){ text = "{\"ready_for_auth\":true}"; } e...
606c2637-6934-448a-884b-b3e9a036df29
1
private void createConfigs(){ if(!jobsfile.exists()){ this.saveResource("jobs.yml", false); } saveDefaultConfig(); }
dbc7297e-1707-437b-adfe-43321977aade
0
public void setPersonId(int personId) { this.personId = personId; }
537b38df-e863-40d3-8ae1-4c22ed3f4168
2
private void linearize_recursive(ArrayList<LUSTree> seq, boolean use_combos){ if (card != 0){ //If getting all combinations, recurse without adding if (use_combos) linearize_recursive_single(new ArrayList(seq), use_combos); seq.add(this); } linearize_recursive_single(seq, use_combos); }
74653806-f0c6-4f56-8da9-2008a4d9b55a
0
@Test public void addingEdgesWorks() { Vertex a = new Vertex(0); Vertex b = new Vertex(1); Edge e = new Edge(a, b); g.addVertex(a); g.addVertex(b); g.addEdge(a, b, 1); assertTrue(g.getEdges().get(0).equals(e)); }
fd1636de-bcd5-47ff-bea9-54dc76e826c8
8
private static <T extends Comparable<? super T>> void quicksort(T[] a, int lo, int hi) { if (hi <= lo) return; int i = lo; int j = hi; T partitionItem = a[lo + (hi-lo)/2]; while (i<=j) { while (isLess(a[i], partitionItem)) i++; while (isLess(partitionItem...
6f64e8ff-a290-4de7-a1ba-0ad3ef1226c3
4
public boolean search(File file) { try { Scanner in = new Scanner(new FileInputStream(file)); boolean found = false; while (!found && in.hasNextLine()) { String line = in.nextLine(); if (line.contains(keyword)) found = true; } ...
e7f7dbe4-44eb-4184-b126-636d7642e273
0
public static void main (String[] arg) { // start server on port 1500 new GameServer (1500); }
451feea8-84e5-46cd-b8ed-1d182e967040
8
public void accounts(MOB mob, List<String> commands) throws IOException { mob.location().showOthers(mob,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> wave(s) <S-HIS-HER> hands around the heavens.")); PlayerAccount theAccount = null; String oldName = null; if(commands.size()==2) { theAccount=mob.playerStats().get...
bb2e2fb8-7226-4ab2-8189-65abcf05a9b6
6
static public boolean openFile(Object obj) { File f = coerceFile(obj); if (f == null) { return false; } else if (WIN && f.isDirectory()) { try { Process proc = Runtime.getRuntime().exec("explorer /root," + f.getAbsolutePath()); try { ...
c7a23161-60e3-437d-a92f-c7560e890ce2
8
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) { this.plugin = plugin; this.type = type; this.announce = announce; this.file = file; this.id = id; this.updateFolder = plugin.getServer().getUpdateFolder(); final File pluginFile = plugin.getDataFolder().getParentFile();...
6bcf8f41-fc7f-4719-8be8-2a972b7e4e5a
8
@Override public String buscarDocumentoPorFechaPago(String fechapago1, String fechapago2) { ArrayList<Compra> geResult= new ArrayList<Compra>(); ArrayList<Compra> dbCompras = tablaCompras(); String result=""; Date xfechapago1; Date xfechapago2; Date f; ...
e1062c65-3807-43c8-a334-851d5e27bbb4
9
public static String decodeTPCI(final int tpci, final KNXAddress dst) { final int ctrl = tpci & 0xff; if ((ctrl & 0xFC) == 0) { if (dst == null) return "T-broadcast/group/ind"; if (dst.getRawAddress() == 0) return "T-broadcast"; if (dst instanceof GroupAddress) return "T-group"; return "T-i...
bbacfa52-3183-4e85-ae02-533ade9e22ea
7
public Rational root(BigInteger r) throws NumberFormatException { /* test for overflow */ if ( r.compareTo(MAX_INT) == 1 ) throw new NumberFormatException("Root "+r.toString()+" too large.") ; if ( r.compareTo(MIN_INT) == -1 ) ...
295c29d7-3cf3-478b-8c25-58819da690b3
9
public Location getAdjacentLocation(int direction) { // reduce mod 360 and round to closest multiple of 45 int adjustedDirection = (direction + HALF_RIGHT / 2) % FULL_CIRCLE; if (adjustedDirection < 0) adjustedDirection += FULL_CIRCLE; adjustedDirection = (adjustedDirect...
eec0af0c-69ee-4a99-9654-c0d0746c8307
1
public void actionPerformed(ActionEvent e) { if (e.getSource().getClass() == MenuView.MenuButton.class) { ChangeState( (((MenuView.MenuButton)e.getSource())).getState() ); } }
3513bc7f-cb83-4042-adb2-0a1773f6a253
2
public static void init() { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder; try { dBuilder = dbFactory.newDocumentBuilder(); doc = dBuilder.parse(Set.class.getResourceAsStream("/sets.xml")); } catch (SAXException | IOException | ParserConfigurationExce...
f0d2ed42-7fe0-4473-b626-9e26a12521d2
3
public String toString() { if (this == UNINITIALIZED_VALUE) { return "."; } else if (this == RETURNADDRESS_VALUE) { return "A"; } else if (this == REFERENCE_VALUE) { return "R"; } else { return type.getDescriptor(); } }
7e90ef17-4ba1-4a9b-a4e0-5932670824b7
3
private static void put(HandTypesMap map, HandTypesKeyImpl key, HandTypesImpl value, int i, boolean flag) { final int k = i; key.setBoolean(flag); key.setInt(k); value.setBoolean(flag); value.setInt(k); int size = map.size(); map.put(key, value); if (size + 1 != map.size()) { map.p...
3243ae8d-9817-48f0-a0e2-bd54149d8b76
1
public ASTList sublist(int nth) { ASTList list = this; while (nth-- > 0) list = list.right; return list; }
054c6291-36fd-4f58-be36-0794c2f71b97
1
public static void add(Quest q){ if(!isFull()) questLog.add(q); }
bb666579-90f2-40af-807c-a2f4840bc330
7
protected void actionPerformed(GuiButton par1GuiButton) { if (par1GuiButton.enabled) { if (par1GuiButton.id < 100 && par1GuiButton instanceof GuiSmallButton) { this.options.setOptionValue(((GuiSmallButton)par1GuiButton).returnEnumOptions(), 1); ...
c79b173b-3cb7-490b-ab17-6f16e66d983b
3
public void sort(double[] input) { int n = input.length; boolean swapped = true; for (int end = n; swapped; end--) { swapped = false; for (int i = 1; i < end; i++) { if (!Helper.less(input, i - 1, i)) { Helper.exch(input, i - 1, i); swapped = true; } } } }
0472cce0-eace-4494-b9ff-d0205e6b5d31
4
public Color getDefaultRowForeground(int position, boolean selected, boolean active) { if (selected) { Color color = UIManager.getColor("List.selectionForeground"); //$NON-NLS-1$ if (!active) { Color background = getDefaultRowBackground(position, selected, active); boolean isBright = Colors.isBright(col...
7351c45a-53a8-4ed2-ab9c-16ee01c1aabb
3
public boolean validate(String str) throws Exception { if (str == "") { throw new Exception("login is not found"); } str = str.toLowerCase(); String pattern = "^[a-z][a-z0-9\\.,\\-_]{5,31}$"; // Create a Pattern object Pattern r = Pattern.compile(pattern); ...
fa4e1dcc-8874-478d-8a37-625f1fd6486b
8
public String translateStateFormula(StateFormula formula) { String translation = ""; if (!formula.isEmpty()) { for (StateLiteralClause cl : formula.getClauses()) { if (translation != "") { translation += "& ("; } else { translation = "("; } Iterator<StateLiteral> iterator = cl.getL...
166d5927-0bfa-4b55-a990-168aa9743d30
4
private void textNombreKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textNombreKeyTyped // TODO add your handling code here: if (!Character.isLetter(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && !Character.isWhitespace(evt.getKeyChar())) { ...
89ba1a1a-b16c-4be8-a016-0fb06c7922b0
6
public void setTroup(Troop newTroup){ //we remove the territory to the old owner if the troups is not its if(troop!=null && (newTroup==null || newTroup.getFamily()!=troop.getFamily())){ troop.getFamily().removeTerritory(this); } this.troop=newTroup; if(newTroup!=null){ owner=newTroup.getFamily(); own...
ecf05045-9f97-4589-824a-656a843e5e44
8
public void messages(){ int numMessages = Integer.parseInt(outputFromServer()); System.out.println(outputFromServer()); //Show the messages that this account has received for(int i = 0; i < numMessages; i++){ System.out.println(outputFromServer()); System.out.println(outputFromServer());...
3d04fff5-40f7-4e8b-9483-8e9007739425
3
private void reload() throws IOException { try { Properties properties = new Properties(); File propFile = new File(PROPERTIES_NAME); if (propFile.exists()) { properties.load(new FileInputStream(propFile)); } else { InputStream propFileStream = Thread.currentThread() .getContextClassLoade...