method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1a9e33f6-c330-4389-98ba-5d9fd1701a60
1
private int[] createBowl(int [] platter) { int[] bowl = new int[NUM_FRUITS]; int sz = 0; while (sz < bowlsize) { // pick a fruit according to current fruit distribution int fruit = pickFruit(platter); int c = 1 + random.nextInt(3); c = Math.mi...
32df06ee-6f4f-43a0-be3d-98c2fde6c0af
7
public static int svm_check_probability_model(svm_model model) { if (((model.param.svm_type == svm_parameter.C_SVC || model.param.svm_type == svm_parameter.NU_SVC) && model.probA!=null && model.probB!=null) || ((model.param.svm_type == svm_parameter.EPSILON_SVR || model.param.svm_type == svm_parameter.NU_SVR) &&...
b8658669-48f2-41ff-8098-5aeb2534cc8a
1
public static void Connect() { try { final int port = 6066; final String hostName = "localhost"; Socket clientSocket = new Socket(hostName, port); System.out.println("You connected to: " + hostName); chatClient = new Client(clientSocket); PrintWriter output = new PrintWriter(clientSock...
ef0bdbe5-7abf-41a5-9345-9a7bc1cbd1fe
0
public String getFile() { return this.file; }
859bc10d-b79b-4de0-ae1c-4c67f4b5291a
1
public void setEndDate(String endDate) { if (endDate == null) this.endDate = DEFAULT_TEXT_FOR_NULL; else this.endDate = endDate; }
1bdbd9ea-15d1-43eb-a0e6-0bdb5902fd3b
3
public double[][] getSortedEigenVectorsAsRows(){ if(!this.eigenDone)symmetricEigen(); double[][] ret = new double[this.numberOfRows][this.numberOfRows]; for(int i=0; i<this.numberOfRows;i++){ for(int j=0; j<this.numberOfRows;j++){ ret[i][j] = this....
1d405b20-d28b-4b4b-9094-9628819c3ae0
7
public static void main(String... args) throws IOException { MyScanner sc = new MyScanner(); int n = sc.nextInt(); int m = sc.nextInt(); int[] w = new int[n]; for (int i = 0; i < n; i++) { w[i] = sc.nextInt(); } int[] d = new...
7e811f8e-0093-48fb-9420-d74a27cc9ad1
8
public void onEnable(){ instance = this; getLogger().info("MaxPvP starting"); saveDefaultConfig(); reloadConfig(); File pf = this.getDataFolder().getAbsoluteFile(); if(pf == null || !pf.exists()){ pf.mkdir(); } this.db = new Database(this, "stats"); try{ if(!db.hasTable()){ db.creat...
aed37205-8ba4-4d4d-b244-2af5caf599c2
2
public static Vector3f parsePosition(String data) { String[] lines = data.split("\n"); for (String line : lines) { String[] parts = line.split(":", 2); if (parts[0].equals("p")) { return ParseVector3f(parts[1]); } } return null; }
99216313-93c3-4dff-adfa-1048df465964
4
public static LambdaTransitionChecker getLambdaChecker(Automaton automaton) { if (automaton instanceof automata.fsa.FiniteStateAutomaton) return new automata.fsa.FSALambdaTransitionChecker(); else if (automaton instanceof automata.pda.PushdownAutomaton) return new automata.pda.PDALambdaTransitionChecker(); ...
4c436ac6-c420-4078-8949-49bb7b980d89
8
public List<String> getLabelValueList(String xml, String label1, String label2) { List<String> labelValueList = new ArrayList<String>(); if(xml==null || xml.trim().length()<1 || label1 == null || label1.trim().length()<1 || label2 == null || label2.trim().length()<1) { return labelValueList; } Stri...
6435cd96-2e31-4920-bc3c-25a70af24e14
4
@Override public void register() throws ServiceRegistrationException { try { POA rootPOA = POAHelper.narrow(orb_.resolve_initial_references("RootPOA")); SimulationHandlePOA simulationServant = provider_.get(); rootPOA.activate_object(simulationServant); String...
1a7468bc-76a7-45ce-adf1-a74b67de1bd8
8
private void initGUI() { boxs = new BoxLabel[SDK_SIZE][SDK_SIZE]; for (int i = 0; i < SDK_SIZE; i++) { for (int j = 0; j < SDK_SIZE; j++) { BoxLabel box = new BoxLabel(i, j); // ve cac duong ngang if (i == 3 || i == 6) box.setBorder(BorderFactory.createMatteBorder( 1, 0, 0, 0, Color.GRAY)...
99eb0984-5f20-4383-889e-ded15c72ad64
4
protected static Ptg calcEven( Ptg[] operands ) { if( operands.length != 1 ) { return PtgCalculator.getNAError(); } double dd = 0.0; try { dd = operands[0].getDoubleVal(); } catch( NumberFormatException e ) { return PtgCalculator.getValueError(); } if( new Double( dd ).isNaN() ) // Not a...
abcc64d1-c269-4acc-bda5-21b8ce398274
1
public static NewExpr makeObjectArray(ASTList className, ASTList arraySize, ArrayInit init) { NewExpr e = new NewExpr(className, arraySize); e.newArray = true; if (init != null) append(e, init); return e; }
a884b17b-b0be-481c-8904-f0518150147a
6
private boolean valid() { Contact _client; if (clientBox.getSelectedItem() instanceof Contact) { _client = (Contact) clientBox.getSelectedItem(); } else { String clientname = (String) clientBox.getSelectedItem(); _client = Database.driver().getClientsAlphabeti...
fa67ae12-88cc-40cd-b8a6-c05f8bc3ef55
6
static final boolean method1110(int i, int i_0_, int i_1_, byte i_2_, int i_3_) { anInt4916++; if (!Class348_Sub40_Sub23.aBoolean9307 || !Class23.aBoolean351) return false; if (Class225.anInt2946 < 100) return false; if (!aa_Sub2.method164(i_1_, i_3_, (byte) -97, i)) return false; int i_4_ =...
e90fb149-1939-4d4c-ac25-f161e4a7a380
9
private static void printMBeanInfo(MBeanServer mbs, ObjectName mbeanObjectName, String mbeanClassName) { echo("\n>>> Retrieve the management information for the " + mbeanClassName); echo(" MBean using the getMB...
81448924-5514-4a29-978e-abc4e2df1ed1
5
public String[] getPathBinWindows() { String[] pathArray; String binPath = System.getenv("PATH"); int countCommata = 0; int i = 0; while(i<binPath.length()) { if((binPath.charAt(i))== ';') countCommata++; i++; } i=0; pathArray = new String[countCommata+2]; //set default values to "" for...
9ef8814a-c81e-4931-a723-9a20dddcb239
4
private void preloadProvHistory(int start, int end) { GenericObject hist; for (int id = start; id < end; id++) { hist = historyCache.get(id); if (hist == null) { String histFile = resolver.getProvinceHistoryFile(id); if (histFile =...
d56bdeca-7e9b-4391-8860-eb0f30c1941b
8
private void moveDay(int numberToMove) { if (DEBUG) log("Beginning moveDay(int numberToMove) method"); if (DEBUG) log("1. Clone today"); if (DEBUG) log(" Current date: " + date(currentCalendar)); Calendar temp = (Calendar)currentCalendar.clone(); if (DEBUG) log("2. Add " + numberToMo...
40c4dbd8-8292-437e-9ddc-8f6e5d10c9f3
4
public void resetTItems(int WriteFrame) { outStream.createFrameVarSizeWord(53); outStream.writeWord(WriteFrame); outStream.writeWord(playerTItems.length); for (int i = 0; i < playerTItems.length; i++) { if (playerTItemsN[i] > 254) { outStream.writeByte(255); // item's stack count. if over 254, writ...
f1605583-c901-4788-abbc-a9570f11965b
4
@FXML private void handleMenuReportTotal(ActionEvent event) { FXMLLoader fxmlLoader = new FXMLLoader(PosApplication.class.getResource("ReportTotal.fxml")); final Region reportDetail; try { reportDetail = (Region) fxmlLoader.load(); } catch (IOException e) { th...
1488608a-5a86-4a97-bb61-c45f70fb3072
9
public void Padd(String cid){ //get all input; Scanner scan = new Scanner(System.in); Scanner scan0 = new Scanner(System.in); while(true) { if(cid.equals("CSC440")) System.out.println("What is this homework based on?\n 1.Database Fundamentals\n 2.ER Design\n 3.Security and Authorization"); else ...
ccd1fefc-77e4-4daf-9803-098277dda8bf
3
@Override public String[] userServices(String username) { List<String> userServicesList = new ArrayList<String>(); String serviceName, userType, table; ResultSet rs; try { // get table according to user type userType = userType(username); // check if the user actually exists if (userType == nu...
a235a2aa-2a4a-48e1-a29c-02a201e6b77a
6
public static OS getPlatform() { String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("win")) return OS.windows; if (osName.contains("mac")) return OS.macos; if (osName.contains("solaris")) return OS.solaris; if (osName.contains("sunos")) return OS.solaris; if (osName...
251a1983-e594-41f4-b76c-b4cb134ca19f
5
public boolean valid() { for (Saveable o : signature) if (o instanceof Target) { final Target t = (Target) o ; if (! t.inWorld()) return false ; } if (actor != null && ! actor.inWorld()) return false ; return true ; }
17fa7ca4-bf8d-45b8-8930-333e8caaf09b
3
@Override protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { DatabaseManager manager=DatabaseManager.getManager(); try { ServletResult.sendResult(response, manager.getUserDao() .deleteById(Integer.parseInt(request.getParameter(ID)))==1 ? S...
f98576b1-fda5-45fd-9794-cc6f699a9377
3
public static AbstractAttribute loadElement(DataInputStream mainInput, LinkedList<CONSTANTPoolElement> pool) throws IOException, FrameException { int attr_name_index = mainInput.readUnsignedShort(); // (short) int attr_len = mainInput.readInt(); CONSTANTPoolElement tempName = po...
ad4b0214-f65d-4e58-84fc-0b57040ad4d6
4
@Override public void deserialize(Buffer buf) { oldCellId = buf.readShort(); if (oldCellId < 0 || oldCellId > 559) throw new RuntimeException("Forbidden value on oldCellId = " + oldCellId + ", it doesn't respect the following condition : oldCellId < 0 || oldCellId > 559"); newCel...
a2fde67f-98c5-4e7e-9d16-736e2257a62c
7
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { config = plugin.getConfig(); if (args.length == 0){ if (sender instanceof Player) { if (sender.hasPermission("darkcommand.ragequit")){ Player player = (Player) sender; if (commandLabel.equalsIgnoreCase...
8201a908-a844-4ee8-a0a6-6d3351bbfd31
8
public void run() { computePremices(); Set<Entity> detectedEnemies = detectEnemies(); // If dps is too high to win the battle : flee if (currentTotalDpsTaken > ship.getMaxDpsInflictable()) { LOGGER.debug("If I do not flee, the battle will end in a loss or a draw (" + currentTotalDpsTaken + "/" + ship.g...
58f1886b-c40f-4161-a28d-feb71872bfcc
0
@Override public void mousePressed(MouseEvent m){ super.mousePressed(m); }
e3d532d0-d7e5-4998-90cf-44ab5915059b
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int n = to.length(); char[] circle = new char[n]; /* * First fill the circle buffer with as many characters as are in the * to string. If we...
37dd47a2-ea2e-4a36-a03b-55cec9c7bc10
2
private static void addData(ArrayList<String> list, String data) { for (int i = 0; i < list.size(); i++) { if (list.get(i).equalsIgnoreCase(data)) return; } list.add(data); }
d1e8b389-6e7f-4946-a2ab-790a691d646a
2
public void captureAudio() { // request name of file to be captured wavName = JOptionPane.showInputDialog(null, "enter name of file to be recorded:"); try { // Get and display a list of // available mixers. Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo(); System.out.println("Available mixers...
f2997006-4646-4a6e-8d49-c0f35afcd740
6
public FileEncryptor() { // find relative folder tmp saveDir = new File("tmp/"); // if not exist create one if (!saveDir.isDirectory()) saveDir.mkdir(); // if the defaultkey hasn't been created, create one if (FileEncryptor.defaultKey == null) { try { KeyGenerator keyGen = KeyGenerator.getInstance...
7b6979dd-294f-469a-b787-5a067a1e14cd
5
public janProvaTitulos() { initComponents(); ListCellRenderer lcr = new ListCellRenderer(); jComboBoxCandidato.setRenderer(lcr.createListCellRenderer(Candidato.class, "getNome")); DefaultComboBoxModel<Candidato> candidatosModel = new DefaultComboBoxModel<>(); List<Candidato> ca...
bd360f64-b2a5-4284-b961-9c4703bddf7a
0
public FileSystemReplace() { crawler = new DirectoryCrawler(); }
1cc3b527-06b1-4ec8-983f-a410eb68dc42
1
private void atVariableAssign(Expr expr, int op, Variable var, Declarator d, ASTree right) throws CompileError { int varType = d.getType(); int varArray = d.getArrayDim(); String varClass = d.getClassName(); if (op != '=') atVari...
e31a9b12-4272-4be2-ada4-e719245579f7
6
public RateGUI() { //Get size of screen without taskbar screenSize = Toolkit.getDefaultToolkit().getScreenSize(); screenMax = Toolkit.getDefaultToolkit().getScreenInsets(rateDialog.getGraphicsConfiguration()); taskbarSize = screenMax.bottom; screenWidth = (int)screenSize.getWidth(); screenHeight = (int)scre...
c970d0e7-cbb0-4214-b3ec-c3dd7cea7547
9
public static void directoryHandler(HttpExchange xchg) { { String uripath = HttpExchange.getRequestUriPath(xchg); PropertyList options = HttpExchange.getHandlerOptions(xchg); String path = ((StringWrapper)(options.lookup(Http.KWD_PATH))).wrapperValue; String directory = ((StringWrapper)(options.lo...
1947109f-1c5a-4164-867d-f0a700ca322d
2
public void bufferedContent(){ if(this.isBuffered.compareAndSet(false, true)){// 如果已经做的缓存就不做处理了 this.currentByteBuffer = null;// 将当前缓冲区置空 this.currentBufferQueue = new ConcurrentLinkedQueue<ByteBuffer>();// 当前正在处理的缓冲区队列 ByteBuffer headerBuffer = processBuffered(this.header); ByteBuffer bodyBuff...
df829e28-02f9-4f08-b233-5afb222fb61e
5
@Override protected boolean canRun(ClassNode node) { if (!node.superName.equals(classNodes.get("Node").name) || classNodes.containsKey("CacheableNode")) return false; int countSelf = 0; ListIterator<FieldNode> li = node.fields.listIterator(); while (li.hasNext()) { ...
57c0559c-133c-435b-901a-55fcb5a57619
2
public void load(String source) { try { this.source = source; if (source.startsWith("http://")) image = ImageIO.read(new URL(source).openStream()); else image = ImageIO.read(new File(source)); label.setIcon(new ImageIco...
4d32845b-a7f4-4ae3-ac0c-60fd8d9c0d38
4
@Override public void setCarryFlag(boolean flagIsOn) { try { Image img; if (flagIsOn) { img = ImageIO.read(getClass().getResource("/resources/vdk-light-colour.png")); if (!CECIL_RESOLUTION.equals(CECIL_RESOLUTION_HIGH)) { img = img.getScaledInstance(ICON_SMALL.width, ICON_SMALL.height, Image.SCALE...
b389d91d-a5c4-40f9-9272-e6587b32dca4
6
public void frame1() { //synchronized(c) { for(int i = 0; i < Config.MAX_PLAYERS; i++) { if(Server.playerHandler.players[i] != null) { Client person = (Client)Server.playerHandler.players[i]; if(person != null) { if(person.getOutStream() != null && !person.disconnected) { if(c.distanceTo...
50b3f156-9cf4-4312-8954-8b516b489904
3
@Override public int hashCode() { int hash = 5; hash = 11 * hash + (this.player != null ? this.player.hashCode() : 0); hash = 11 * hash + (this.until != null ? this.until.hashCode() : 0); hash = 11 * hash + (this.reason != null ? this.reason.hashCode() : 0); return hash; ...
13a5b6d1-66c4-41db-9564-6e1251f7a893
1
public void keyReleased(KeyEvent e) { GameAction gameAction = getKeyAction(e); if (gameAction != null) { gameAction.release(); } // make sure the key isn't processed for anything else e.consume(); }
b2e825a6-c2f9-4ca0-a292-9ad762473da2
3
public static String subEntities(String input) { String sub[][] = {{"&", "&amp;"}, {"<", "&lt;"}, {">", "&gt;"}, {"'", "&apos;"}, {"\"", "&quot;"}}; String output = input; int index = 0; if (input == null) return ""; for (int i = 0; i < sub.length; i++) { while (output.indexOf(sub[i][0], index) != ...
bc35b1ed-bd6f-4c7f-8cfc-c0e8e20d0de9
7
static void convertFieldBytecode2Js(JavaClass classBytecode, PrintWriter print, ArrayList<String> toConvertClasses) throws ClassFormatException, ...
6b698911-52d9-47c6-b879-94ef4504c266
5
private boolean verticalAligned(int i, int j) { int height = grid.getHeight(); int width = grid.getWidth(); if (i < 0 || j < 0 || i >= height || j >= width-2) return false; if (grid.casesEqual(grid.getCase(i, j), grid.getCase(i, j + 1), grid.getCase(i, j + 2))) return true; return false; }
d5ab6195-57b5-4ada-a4a8-b7f593af8db0
6
public Product_Frame() { /* 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.oracle.com/...
40a09fcf-1d51-4da9-a205-3d83339e6d9a
0
public final int getOutgoingQueueSize() { return _outQueue.size(); }
cb97f169-cc36-4575-9e09-e6ce6afc8142
2
public void setValue(int value) { if ((value > 16) || (value < 1)) { throw new IllegalArgumentException(); } else { this.value = value; } }
419e2886-4e3a-4bda-8805-3942898cdfa7
4
public static void main(String[] args) throws ClassNotFoundException { //Get JDBC sqlite driver Class.forName("org.sqlite.JDBC"); Connection connection = null; try { //connect to DB connection = DriverManager.getConnection("jdbc:sqlite:C://Users//" + System.getPr...
46a6880e-965d-4ec8-86f4-861cfe916ec8
6
@Override public void paintComponent(Graphics g) { super.paintComponent (g); boardRep = g; // amount of cols and rows cols = CELL_AMOUNT; rows = CELL_AMOUNT; // paint for (int i = 0; i < cols; i++) { int cellcol = ( i * rectSize ) + 1 + LEFTLEGEND_SPACE; for (int j = 0; j < ro...
81c4702b-b262-45fb-9a8f-dfa085ef07f0
4
public void load() { player = new Player(this); if(!gameFile.equals("newgame")){ JsonSerializer.loadGameState(gameFile); scene.setRayHandler(rayHandler); setSong(scene.DEFAULT_SONG[dayState]); music.pause(); scene.create(); narrator = (Mob)Entity.getMapping(Vars.NARRATOR_SCENE_ID); charact...
3c95c4b2-f96f-4361-bd50-ff735cb55bee
0
public static Filter any() { return new Any(); }
a1f4c28a-b540-40bf-9e9e-e495436b8fb3
8
public List<Double> getDoubleList(String path) { List<?> list = getList(path); if (list == null) { return new ArrayList<Double>(0); } List<Double> result = new ArrayList<Double>(); for (Object object : list) { if (object instanceof Double) { ...
4f451620-df30-449a-a93c-43c0fb28a5f2
4
public void showReset(String account, Player controller, boolean console) { Player player = iConomy.getBukkitServer().getPlayer(account); if (player != null) { account = player.getName(); } Account Account = iConomy.getAccount(account); iConomy.getTransactions().insert(account, ...
17083ad9-6cfb-4807-aa41-28e722014251
7
public static boolean SLOT_REPRESENTS_TAGP(Slot slot, XmlObject tag, boolean useTypeP, boolean useParametricTypeP) { { String name = tag.name; if (Stella.stringEqlP(name, slot.slotName.symbolName)) { return (true); } if (useTypeP || useParametricTypeP) { { Surrogate slot...
056519d6-f9a5-460f-9122-7b92a416b265
2
@NodePopupMethod(menuText = "Send SMS to...") public void sendSMS() { Tools.getNodeSelectedByUser(new NodeSelectionHandler() { public void handleNodeSelectedEvent(Node n) { if(n == null) { return; } String text = JOptionPane.showInputDialog(null, "Please enter the SMS text to send"); if(text ...
fb31447b-c12b-4c17-9ed1-5481c069a093
9
private JMethod generateZclCommandSignature(JDefinedClass jZclClass, JClass jParentClass, ZclCommandDescriptor zclCommandDescriptor, boolean addContext) throws Exception { if (zclCommandDescriptor.isResponse()) return null; // FIXME: the return type depends on the returned response!!!! JType jReturnType =...
728aa769-f4ec-4a42-9d05-47a2826a38a1
5
public Object [][] getDatos(){ Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length]; //realizamos la consulta sql y llenamos los datos en "Object" try{ if (colum_names.length>=0){ r_con.Connection(); String c...
b2f764f0-3b39-4734-a670-385a0e148929
7
public UserRegistrationDialog(JFrame parent) { super(parent, "Register", Dialog.ModalityType.DOCUMENT_MODAL); setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE); setBounds(100, 100, 450, 300); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); get...
c99ca678-6f9e-444b-a8e7-c0a55a08a1f0
8
public EncerrarAplicacao() { int dialogButton = JOptionPane.YES_NO_OPTION; int dialogResult = JOptionPane.showConfirmDialog(null, "Deseja mesmo encerrar a aplicação?", "Sair", dialogButton); if (!DadosGerais.placasEntrada.isEmpty() && dialogResult == 0) { JOptionPane.showMessageDia...
96f0de6a-2341-4357-89f4-847e9ac0016a
0
public void setDesc(String value) { this.desc = value; }
cc670f7a-4464-4efb-a44b-eca448119609
5
private void initRef(){ File f = new File(PATH_RESSOURCE+REFERENCE_ACCENT); FileReader fr; try { fr = new FileReader(f); BufferedReader b = new BufferedReader(fr); int i = 0; int tmp = b.read(); while(tmp != -1){ if(tmp != 44 && tmp != 10){ //44 = ',' et 10 = '\n' referenceAccent[i] = (cha...
995750b3-732f-482c-86cc-9dcb5da41904
2
public void load(InputStream in) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line; while ((line = reader.readLine()) != null) { if (line.charAt(0) == '#') continue; int delim = line.indexOf('='); String key = line.substring(0, delim); String ...
40ec723c-ba9c-459f-ad51-0cd98935e47b
3
@Override protected Element getSpecificDataXML() { if (getProperty("mediaLink") == null) return null; //no saving track data if no track present Element e = new Element("Track"); setProperty("title", getTitle()); for (String key: Arrays.asList(XMLCacheDataKeys)) { String value = getProperty(key); if (va...
484e2d37-103a-4720-b366-919b31292a86
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && ...
4415d280-2d27-4d6b-8cc5-4126b4cbafca
8
public int NeutronFreeSpaces() { int result=0; if (board[neutron_x-1][neutron_y-1]==EMPTY) result++; if (board[neutron_x-1][neutron_y ]==EMPTY) result++; if (board[neutron_x-1][neutron_y+1]==EMPTY) result++; if (board[neutron_x ][neutron_y ]==EMPTY) result++; if (board[neutron_x ...
5fa92042-7f6d-4a3e-b313-c9d028364378
7
protected Item makeResource(String name, int type) { Item I=null; if(((type&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_FLESH) ||((type&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_VEGETATION)) I=CMClass.getItem("GenFoodResource"); else if((type&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_LI...
0c12de33-e961-493b-8b69-62f4ff26df86
2
static void bzero(byte[] foo){ if(foo==null) return; for(int i=0; i<foo.length; i++) foo[i]=0; }
4c51f12f-6159-4ef8-8580-7a085830b207
2
public static void main(String[] args) throws Exception { MyPriorityQueue<Integer> intQueue = new MyPriorityQueue<Integer>(); // enqueue some numbers intQueue.enqueue(5, 1); intQueue.enqueue(10, 0); intQueue.enqueue(15, 3); // dequeue them and print to console w...
ad96f122-b27b-4308-a50f-e8d1390cf8fe
7
public Element handle(FreeColServer server, Player player, Connection connection) { ServerPlayer serverPlayer = server.getPlayer(connection); Unit unit; try { unit = player.getFreeColGameObject(unitId, Unit.class); } catch (Exception e) { ...
1668f084-8b2f-4d44-9870-39c43b952e7b
6
@Test public void testRoundOne(){ //Init bei startGame Testen PlayerData data = player[0].getData().lastElement(); PlayerOrderPool playerOrderPool = player[0].getPlayerOrderPool(); assertEquals(0, playerOrderPool.getAcceptedOrders().size(), 0); assertEquals(0, playerOrderPool.getFinishedOrders().size...
f796481d-eb76-482a-a1ee-b0dfb607f08a
7
public void claimChunk(ChunkyChunk chunkyChunk) { ChunkyPlayerChunkClaimEvent event = new ChunkyPlayerChunkClaimEvent(this, chunkyChunk, AccessLevel.UNOWNED); event.setCancelled(false); Chunky.getModuleManager().callEvent(event); if (event.isCancelled()) return; if (Permissions.C...
e48398fb-0d1a-4d52-9faf-e557dcc21e28
1
public ArrayList<Peer> requestPeers(TorrentHandler handler) { // TODO try { getPeers(handler); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return peers; }
6e3451f7-2f58-4ae7-b8a4-2b6a7cee6a3b
1
public boolean isEmpty() { if (name.equals("")) { return true; } else { return false; } }
24c83145-b40f-4d4f-a76c-a241cbf563c0
7
public int canCompleteCircuit(int[] gas, int[] cost) { int gasCostMin = 0; int gasMinIndex = -1; int totalGas = 0; int totalCost = 0; for(int i=0; i<gas.length; i++){ if((gas[i]-cost[i]) < gasCostMin){ gasCostMin = gas[i]-cost[i]; gasMi...
77eda818-c3fe-427b-9a30-7c7185c426f5
4
public int pick_victim() throws BufferPoolExceededException, PagePinnedException { // The current frame in the Buffer Table FrameDesc frame; // num is used to determine how many times we have iterated through the state array int num = 0; // numBuffers is the size of the ...
05a2a12a-524f-42e4-a94c-65aedf093ad4
4
public static byte[] sendMessage(String message, int type, int Tabid){ PDU rawdata = null; try { byte[] msgByte = message.getBytes("UTF-8"); switch(type){ case 1: msgByte = compress(msgByte); break; case 2: ...
d0da4161-09ca-4a03-bb86-825f7a2b9826
6
public OnDemandData getNextNode() { OnDemandData onDemandData; synchronized(aClass19_1358) { onDemandData = (OnDemandData)aClass19_1358.popHead(); } if(onDemandData == null) return null; synchronized(nodeSubList) { onDemandData.unlinkSub(); } if(onDemandData.buffer == null) return onDeman...
f4f4456b-03f0-4444-a052-2951b4809806
3
public static void main(String[] args) { final int smallSizesIters = 10; int initial_power_of_two_exp = 27; int final_power_of_two_exp = 32; int length = final_power_of_two_exp - initial_power_of_two_exp + 1; long[] smallSizes = new long[length]; for (int i = 0; i < l...
68716e51-384d-42b9-8aff-2de948830511
0
public Automaton getAutomaton() { return (Automaton) getSource(); }
fccd0ef5-e410-42d7-89d8-99d321e0b501
1
public java.security.cert.X509Certificate[] getAcceptedIssuers() { java.security.cert.X509Certificate[] chain = null; try { TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); KeyStore tks = KeyStore.getInstance("JKS"); tks.load(this.getClas...
c5bfa71d-8d27-46bc-aa97-ce9e98250d1f
8
public static final int typeID(Class c) { final int NUM_SPECIAL_PRIMITIVE_TYPES=10; // ^^^ it is the number of primitive types out of special ones if (c==null) return 8; if (c.isPrimitive()) { int i; for(i=0;(i<NUM_SPECIAL_PRIMITIVE_TYPES) && (specialTypes[i]!=c);i++); if (Debug.enab...
123df6bd-de1c-4754-a5c0-e6fd785c73f9
3
public Identifier getIdentifier(Reference ref) { if (referenceCache.containsKey(ref)) return (Identifier) referenceCache.get(ref); String clName = ref.getClazz(); if (clName.charAt(0) == '[') /* Can't represent arrays */ return null; ClassIdentifier clazzIdent = getClassIdentifier(clName.substring(1, ...
93038ee8-f9f4-48dd-a241-47421be55f4d
1
public NameMapping(final String file) throws IOException { InputStream is = null; try { is = new BufferedInputStream(new FileInputStream(file)); load(is); unused = new HashSet(keySet()); } finally { if (is != null) { is.close(); } } }
5d048212-0221-4844-801d-ca969dfc3a0d
3
@EventHandler private void onInventoryClose(InventoryCloseEvent c) { if (plugin.currentAuction != null) { if (c.getInventory().getTitle().equals(AuctionHouse.currentAuction.getInventoryAuction().getTitle())) { ItemStack[] tmpIS = c.getInventory().getContents(); for (ItemStack item : tmpIS) { System....
21792da8-5f14-446e-a3d4-0ac1f4a5a3d6
6
public static void main(String[] args) { System.out.println(OSValidator.toMessage()); if (is32bit()) { System.out.println("This is 32 bit"); } else if (is64bit()) { System.out.println("This is 64 bit"); } else { System.out.println("bit size unknown"); } if (isWindows()) { System.out.prin...
7816e6f9-5bec-4b0a-809c-a0d94d05b8f7
5
public static Match readMatch(){ Match match = null; FileInputStream freader = null; ObjectInputStream objectInputStream = null; try { freader = new FileInputStream(MATCH_FILE); objectInputStream = new ObjectInputStream(freader); match = (Match) objectInputSt...
f5e0797e-5f02-4591-8e68-d99f4a46555e
5
private void skipQuotedValue(char quote) throws IOException { // Like nextNonWhitespace, this uses locals 'p' and 'l' to save inner-loop field access. char[] buffer = this.buffer; do { int p = pos; int l = limit; /* the index of the first character not yet appended to the builder. */ ...
0c2d857e-e48e-4ce1-ab4a-106476ebf264
7
private static Image getImage(String filename) { if (isVisualizer) return null; // to read from file ImageIcon icon = new ImageIcon(filename); // try to read from URL if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) { try { ...
04bc3a8d-d822-4992-9c12-51b5d66a6d32
5
@Override public void actionPerformed(ActionEvent event) { if(event.getSource() == open){ JFileChooser fc = new JFileChooser(); fc.setFileFilter(new FileNameExtensionFilter("Text Files (*.txt)", "txt")); int val = fc.showOpenDialog(textArea); if(val == JFileChooser.APPROVE_OPTION){ currentFile = fc.g...
ab3e9e46-5d8c-40ed-a84e-7fd3c83c4c77
0
public void setDefendingNow(boolean isDefendingNow) { this.isDefendingNow = isDefendingNow; }
9326eda2-20b4-443e-9350-114c29fe1a7e
5
public boolean collision(int x, int y) { if ((player.getX() + x) < 0 || (player.getX() + x) >= tilemap.width || (player.getY() + y) < 0 || (player.getY() + y) >= tilemap.height) { return true; } if (tilemap.tiles[player.getY() + y][player.getX() + x] == 0) { ...
bef1f9b0-4d02-4099-a245-42d9fb036fec
4
public static void main(String[] args) throws IOException { if (args.length > 3) { System.err.println(USAGE_MESSAGE); System.exit(1); } Test.copyStream(args.length < 2 ? System.in : new FileInputStream(args[1]), new ArithCodeOutputStream(args.length < 3 ? (OutputStream) System.out : new FileOutputStream...