method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4f5e9cf6-885a-41a8-a59a-c44904dec682
1
public static void main(String[] args) { String s = ""; s += "37107287533902102798797998220837590246510135740250"; s += "46376937677490009712648124896970078050417018260538"; s += "74324986199524741059474233309513058123726617309629"; s += "91942213363574161572522430563301811072406154908250"; s += "2306758820...
8af9267a-2565-42c1-9091-c6439eba8fd3
2
public void updateFile() { ArrayList<Product> products = new ArrayList<Product>(); try { //products.clear(); Statement s = connection.createStatement(); // ((org.postgresql.jdbc3.AbstractJdbc3Statement)s).setQueryTimeout(1); String sql = "select * from stock"; // ResultSet // resultset=((org.post...
ab4f5f2d-fb67-482c-beaa-a30775ac9308
0
public void moveUndo(int dx, int dy) { ((Rectangle) shape).x += dx; ((Rectangle) shape).y += dy; updateCornerRects(); canvas.repaint(); }
851592f7-4daf-4bbb-abad-61739168f0c3
1
public void makeNameUnique() { LocalInfo li = getLocalInfo(); String name = li.getName(); if (!li.isUnique) { li.name = name + "_" + serialnr++ + "_"; li.isUnique = true; } }
0bb85f8c-4511-4783-a66a-b4a09ab281d2
7
public List<InetAddress> discoverHosts (int udpPort, int timeoutMillis) { List<InetAddress> hosts = new ArrayList<InetAddress>(); DatagramSocket socket = null; try { socket = new DatagramSocket(); broadcast(udpPort, socket); socket.setSoTimeout(timeoutMillis); while (true) { DatagramPacket packet ...
0b4dd1a8-39d3-4873-88a6-7d041fc8c719
6
public void checkInputs(List inputs) throws IllegalArgumentException { Object [] list = inputs.toArray(); // check that we've got the right number of arguments if (list.length != 2) throw new IllegalArgumentException("map requires two inputs"); // now check that we've got t...
ee5a62b4-b8a7-4860-a3d5-2d80ed4add96
0
@Column(name = "NOV_CODIGO_CONCEPTO") @Id public String getNovCodigoConcepto() { return novCodigoConcepto; }
b4185374-bd3e-439b-8848-082414cbb706
3
public final PathNode previousSnake() { if (isBootstrap()) return null; if (!isSnake() && prev != null) return prev.previousSnake(); return this; }
c8da56c7-510c-40ee-8849-af017b8cde11
6
void checkInFieldAccess() { for (Access in : ca.inputs()) { if (!in.getData().isValid()) { throw new ComponentException("Invalid Access " + in + " -> " + in.getData().access()); } } for (ComponentAccess w : oMap.values()) { for (Access in : w.inputs()) { if (!in.isValid()) { ...
250e56e0-685b-4836-bcee-81898caa8b27
3
public static Graph<Vertex, Edge<Vertex>> FileToWeightedGraph(String dat, boolean directed) { int[][] GArray = FileToWeightedGraphArray(dat); int n = GArray[0][0]; int m = GArray[0][1]; Graph<Vertex, Edge<Vertex>> G = new Graph(n); // Knoten hinzufuegen for (int i = 0; i < n; i++) { G.add...
c3925db3-4086-4fe5-88f5-642e5c2e9bf5
3
public boolean containsOption(String opt){ if (opt == null) return false; for (String tmp : options) { if (opt.equals(tmp)) return true; } return false; }
a3fe4a7b-5d9a-49dd-b163-dc99085ee2e9
0
public Hashtable<String, VectorClock> getClockGroup() { return clockGroup; }
2f5f0ad2-10e2-46dd-a479-c85ccb7a20f0
4
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 ...
4c16832f-56f0-4080-b17e-9864c2d3f1fa
9
public static void main(String[] args) { Scanner scanS = new Scanner(System.in); Scanner scanI = new Scanner(System.in); System.out.println("Digite o nome da pessoa 1:"); String nome1 = scanS.nextLine(); System.out.println("Digite a idade da pessoa 1:"); ...
b23a7a0c-e4c4-4526-8b49-d948956b0a77
6
@FXML private void handleBotaoLinha(ActionEvent event) { Button bt = (Button) event.getSource(); String nome = bt.getText(); switch (nome) { case "010": this.recebeDados("http://localhost:8080/MeuTransporte/webresources/ponto/ponto10/"); this.tabel...
a008c81a-5ed3-4326-8187-96bc716dc6ff
6
public Tile getTile(int x, int y) { if (x < 0 || y < 0 || x >= width || y >= height) { return null; } if (tile[x][y] == null || tile[x][y].tex == null) { return new Tile(true); } return tile[x][y]; }
aaf5ae71-d38f-40e7-b7e0-09eb07391a58
5
public ModelBounds getModelBounds() { if (modelIds == null || modelIds.length == 0) return null; Model[] models = new Model[modelIds.length]; for (int i = 0; i < modelIds.length; ++i) { Model cur = ((RT6CacheSystem) getLoader().getCacheSystem()).modelLoader.load(modelIds[i]); if (modelOffsets != null && ...
9548150a-194d-4555-b409-22bc9e30bb21
3
public void run() {// 重写的run方法 try { ss = new ServerSocket(9999);// 监听到9999端口 } catch (IOException e1) {// 捕获异常 e1.printStackTrace();// 打印异常信息 } while (flag) {// 进入主循环 try { System.out.println("==========ServerThread============"); Socket sc = ss.accept();// 阻塞式方法,等待用户连接 System.out.println(...
1b462784-f8e9-487a-8a16-ced73272000d
0
public EventTypes getEventType() { return eventType; }
338f207b-45e3-4e95-87c2-de410ba6657b
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; JAgoraEdgeID other = (JAgoraEdgeID) obj; if (originID == null) { if (other.originID != null) return false; ...
df70bc0d-6dd6-4628-886c-0e6da1c3054f
9
public static void selectCheckbox(WebDriver driver, String identifyBy, String locator, String checkFlag) { /** * Method to check checkbox values * * Accepts: * - driver: the current test's WebDriver * - identityBy: the type of locator to use (ie: xpath, id, etc.....
cb3a2db5-4ed5-40aa-bb4f-ef8d9bb622a3
2
protected void runMainLoop() { for( int i=0; i<10; i++ ){ // here be the main client thread loop try { sleep( rand.nextInt(1000) ); // now generate a block SignedBlock newBlock = new SignedBlock(null, identity); // and broadcast it broadcaster.broadc...
1ea7c712-d85c-41ee-bd71-c2193eafef8d
9
private boolean interfaceEnabled(Interface component) { // interfaceIsSelected if (component.valueCompareType == null) { return false; } for (int i = 0; i < component.valueCompareType.length; i++) { int j = extractInterfaceValues(component, i); int k = compone...
43919c94-3288-4127-a31a-4dccdbeeb005
9
public void mouseMoved(MouseEvent evt) { evt.consume(); if (!blnLoaded) { return; } if (evt.getComponent() == frame.pnlGraphics) { int x = evt.getX(); int y = evt.getY(); //Find coordinates of mouse on map int sx = frame.scrollHorz.getValue(); int sy = frame.scrollVert.getValue(); ...
98b2a501-589f-4971-b53f-af4a6cb3091a
6
public static Tuple testSet(File fi){ int sizeX = 10; int sizeY = 10; int entityX = 0; int entityY = 0; TileMultiton.type[][] t = new TileMultiton.type[sizeY][sizeX]; //Creates an array of tiles sizeX by sizeY if statement specifys what coordinate entity will be placed. for(int y = 0;y<sizeY;y++){ f...
4c31e1e9-8f4e-4d5c-8df3-f9502c3f877a
0
*/ private JPanel initRightPanel() { JPanel right = new JPanel(); right.setLayout(new BoxLayout(right, BoxLayout.Y_AXIS)); initEditingGrammarTable(); mainLabel.setAlignmentX(0.0f); directionLabel.setAlignmentX(0.0f); right.add(mainLabel); right.add(directionLabel); right.add(new JScrollPane(editingGram...
3b77b1f5-b7db-4d8c-8d61-0b94b2113c2f
9
public void insertMember(HttpServletRequest request, HttpServletResponse response, String folderPath) { // 이미지 파일 제한 용량 (mbytes, bytes) int maxMbSize = 1; int maxByteSize = maxMbSize * 1024 * 1024; // File File file = null; File rename = null; // 파라미터로 전송된 값 저장 String id; String pwd; S...
d544923c-fb2f-4053-af3c-36bfe92fd7ee
6
public char get(int addr) { if (addr < 65536) return ram[addr & 0xFFFF]; if (addr < 65544) return registers[addr & 0x7]; if (addr >= 131072) return (char)addr; if (addr == 65544) return sp; if (addr == 65545) return pc; if (addr == 65552) { return ex; } ...
afe0bf4a-3361-4c8f-a187-bbc700ccf753
8
@Override public void getDatas() throws IOException, SAXException, ParserConfigurationException { try { XMLInputFactory inputFactory = XMLInputFactory.newInstance(); InputStream input = new FileInputStream("src/main/resources/candyBox.xml"); XMLStreamReader streamReader =...
85113ee0-9652-4ee0-8760-9d81f6ae979a
3
public void brutalForceCount(int lowIndex, int highIndex) { //System.out.println("Brutal force:"); for (int i = lowIndex; i <= highIndex; i++) { for (int j = i + 1; j <= highIndex; j++) { if (this.array[j] < this.array[i]){ //System.out.println(this.array[i]+":"+this.array[j]); count++; } } ...
04625488-3276-4a36-94a4-847ead8e501f
1
public int startElement(String name) { // if(oState == null) // { // oState = new MiniXMLState(nextState++, getTokenID(name)); // return oState.getStateID(); // } oState = oState.getChild(nextState, getTokenID(name)); int state = oState.getStateID(); if (state == nextState) nextState++; return stat...
e68bd86a-e437-4b9d-887b-30122bba998a
0
public Integer getRecordTime() { return this.recordTime; }
b25b9a05-6f97-45ec-bcb6-8152a4475142
5
private boolean everyFourthLine(int i, int j,int length, int height) { return (j%3==0 && j>4 && j<height-5) && i>5 && i<length-5 && holesEverySecond(i,j,length,height) ; }
dc786444-e01b-4836-a061-011638b7c3a5
4
public int Winner() { Set<Integer> remainingPlayers = new TreeSet<Integer>(); for (Planet p : planets) { remainingPlayers.add(p.Owner()); } for (Fleet f : fleets) { remainingPlayers.add(f.Owner()); } switch (remainingPlayers.size()) { case ...
5febc1fc-9f1e-4e24-93bc-4037300c34af
2
private void reverse() { Element tmpf = firstElement; Element tmps = firstElement.getNextElement(); Element tmpt = firstElement.getNextElement().getNextElement(); tmpf.setNextElement(null); while (tmpt.getNextElement() != null) { tmps.setNextElement(tmpf); tmpf = tmps; tmps = tmpt; tmpt = tmpt.get...
26e735d5-b1f1-4786-b172-99dec30eef33
7
public static Class<?> findCommonElementType(Collection collection) { if (isEmpty(collection)) { return null; } Class<?> candidate = null; for (Object val : collection) { if (val != null) { if (candidate == null) { candidate = val.getClass(); } else if (candidate != val.getClass()) { ...
755ceb48-b801-4f63-bd7f-b161fedf6e19
2
@Override public void move(double x, double y, double z) { for (Path3D p : line) p.move(x, y, z); for (Path3D p : cross) p.move(x, y, z); }
53f1c1b9-73cc-4dac-9750-bb0db188e971
8
private static Unwrapper getSpecificUnwrapper(Class<?> type) { // See if we're already determined this if (unwrapperCache.containsKey(type)) { // We will never remove from the cache, so this ought to be thread safe return unwrapperCache.get(type); } try {...
c05e1823-b7fd-4de2-8f07-e7dfff9cf64d
7
public void addAxesToDraw(List<Integer> userSelectedAxisList) { numSelected++; Axis[] currentAxes = getAxesFromList(currentDrawnList); Integer[] currentAxesArray = new Integer[currentDrawnList.size()+1]; currentAxesArray= currentDrawnList.toArray(currentAxesArray); int firstAxis = userSelectedAxisList.get...
fe5b9a8a-b73b-48db-8154-c5b9723fd9e7
5
void onDispose (Event event) { if (isDisposed ()) return; if (ignoreDispose) return; ignoreDispose = true; notifyListeners(SWT.Dispose, event); event.type = SWT.None; for (int i = 0; i < itemsCount; i++) { items [i].dispose (false); } for (int i = 0; i < columns.length; i++) { columns [i].dispose (false); ...
479e137a-c8a3-42b9-82f0-b9c48e74255a
9
public boolean isDirectory(String filename) { String localFileName = (java.io.File.separatorChar != '/') ? filename .replace('/', java.io.File.separatorChar) : filename; for (int i = 0; i < dirs.length; i++) { if (dirs[i] == null) continue; if (zips[i] != null && zipEntries[i] == null) fillZipEntr...
57006a16-34c2-417a-b4ac-ed70bc655459
3
public long skip(long n) throws IOException { long skipped = 0L; while (skipped < n) { int avail = ensureDataAvailable(); if (avail <= 0) { if (skipped > 0L) return skipped; else return -1; } ...
850b2c4b-a094-4032-98d1-a3698d170c89
6
public void handleAddStateButton() { String state = startView.getStateTextField().getText().trim(); if((state.length() > 0) && (startView.getStateItems().contains(state) == false)){ startView.getStateItems().addElement(state); startView.getStateTextField().setText(""); startView.getS...
46258f4f-cd4c-44cf-a0c2-d2d49c407c73
1
public static void Initialise(MainPlugin plugin) { _plugin = plugin; _chatManager = new ChatManager(); _worldManager = new WorldManager(); if(WorldUtils.GetWorld(Core._survivalWorldName) != null) { WorldUtils.MovePlayersFromWorld( Core._survivalWorldName, Core._spawnWorld, true); WorldUtils.RemoveWorld...
84d2fda4-a4b4-4aed-9376-fda426ccd4af
4
public boolean isMouseUsed(){ if (maction == "SRect"){return false;} if (maction == "SRaction"){return false;} if (maction == "Mirsel"){return false;} if (maction == "None"){return false;} return true;}
6e6ab23f-e4b0-40fe-8422-529565a314a1
7
public void updateScrollPane(int points, int dimensions, ArrayList<String> savedPoints) { pointPanel.removeAll(); ((GridLayout)pointPanel.getLayout()).setRows(points+1); ((GridLayout)pointPanel.getLayout()).setColumns(dimensions); for(int i = 0; i < dimensions; i++) { JLabel jL = new JLabel("D" + (i+1)); ...
834525c4-aa9d-4584-900c-ac8972a091e2
9
public static void display(String tableName){ Statement stmt = null; ResultSet rs = null; String sql; try{ stmt= conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); if(tableName.toLowerCase().equals("patients")){ sql = "SELECT * FROM PATIENTS"; rs = stmt.exec...
cb82f587-e704-440d-8e72-ffbd9a8faf40
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Pessoa other = (Pessoa) obj; if (this.idPessoa != other.idPessoa && (this.idPessoa == null || !this.idPes...
6cd547c4-b36d-4074-919a-ce2fbde8772d
4
private TaggedImage findImage(Reference ref) { if (ref == null) return null; for (int i = allImages.size()-1; i >= 0; i--) { TaggedImage ti = (TaggedImage) allImages.get(i); if (ti.getReference() != null && ti.getReference().equals(ref)) return ti; ...
3e345a51-219b-4d37-ad68-3969d38a5287
0
public void setFilename(String filename) { this.filename = filename; }
ec4c546f-6999-4809-bdf2-812c92351529
9
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { ServletOutputStream out; res.setContentType("text/html"); out = res.getOutputStream(); out.println("<html><head>" + "<link rel='stylesheet' type='text/cs...
25d8ec6f-a468-439b-bdc8-1fe76b3f0080
4
public boolean canPlayYearOfPlenty(int playerIndex, ResourceType firstResource, ResourceType secondResource) { //Checks status, players turn, has player already played dev card, if the player has a year of plenty card, //and that the bank has the two resources requested. if (generalDevCardPreconditions(playerInde...
9cec458d-c9c8-47fd-a3fc-ddf8407055ba
9
public static void DFSTest(WUGraph g, WUGraph t, DFSVertex[] vertArray) { int[][] maxOnPath; Neighbors neigh; int i, j; System.out.println("Testing the tree."); maxOnPath = new int[VERTICES][VERTICES]; for (i = 0; i < VERTICES; i++) { for (j = 0; j < VERTICES; j++) { vertArray[j]...
848c30d5-90e2-40d9-8cae-9c833695547f
9
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == open){ int returnVal = fileChooser.showOpenDialog(UI.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); //This is where a real application ...
e6c12370-8708-4cb0-9a1a-24019df3b511
9
public int estimateLimits(long size1, long size2) { if (0 > size1 || 0 > size2) throw new IllegalArgumentException("Negative image size: " + (0 > size1 ? size1 : size2)); // make size1 the smaller if (size1 > size2) { long temp = size1; size1 = size2; size2 = temp; } // size limit: larger image...
5a2fb436-7b2d-43d1-a9a3-970d21b3750c
0
public static IrcUser New_ParseSource(String source) { IrcUser user = new IrcUser(); user.Source = source; String[] source_nicksplit = source.replaceFirst(":","").split("!"); user.Nick = source_nicksplit[0]; String[] source_hostnamesplit = source_nicksplit[1...
55930651-9f8a-4f91-97e4-f6455517076f
7
private synchronized boolean waitForContent() throws InterruptedIOException { if (_buffer!=null) { if (_buffer.hasRemaining()) return true; // recycle buffer recycle(_buffer); _buffer=null; } ...
e15f7970-f8ae-436c-9a8d-74ed7900d553
5
@Override public void setProperties(Properties properties) { String property = properties.getProperty(SPLIT_EXPRESSION_PROPERTY); if (property != null) { splitter = new RegexpSplitter(property); } property = properties.getProperty(DELIMITER_PROPERTY); if (property...
e1460ba7-45f5-4410-82f8-a5e4eccc142e
0
@Override public void addClientConnectListener(ConnectOnServerListener listener) { clientConnectListenerList.add(ConnectOnServerListener.class, listener); }
8ed4bab8-2efd-4d2f-812b-c1b0d2324302
0
private void reset() { cards = getCardsArray(); toStringT.setText(""); }
3eb30a97-6b68-48b0-84e2-38f306214827
3
public void createTable(JComponent frame) { this.model = new DefaultTableModel(); this.table = new javax.swing.JTable(this.model); this.frame = frame; // this.table.setFont(new Font("Verdana", Font.BOLD, 11)); // this.table.setBackground(new Color(200, 200, 200)); // this.table.setForeground(new Color(10, 10, ...
dc6d938d-d611-4b33-a9f8-a654aacae4df
2
public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs(); if (otherArgs.length != 2) { System.err.println("Usage: BinaryFilesToHadoopSequenceFile <in Path for url f...
d00577cb-ab5e-4266-a17b-3dd31d08192b
6
private void createPanel() { setSize(415, 400); setTitle("Edit Teams"); setLocationRelativeTo(getParent()); setIconImage(Images.EDIT_TEAM_ICON); contentPanel.setLayout(null); lblChooseTeam.setBounds(32, 34, 69, 14); contentPanel.add(lblChooseTeam); teamChooser.addActionListener(new ActionListener() {...
e9ac5213-eac0-4d1f-a6e1-d6acd2953a1a
2
private void doCollapseChildren(List<Node> nodes) { for (Node node : nodes) { System.out.println(node); if(node instanceof TitledPane){ TitledPane tPane = (TitledPane) node; tPane.setExpanded(false); } } }
0a6a344f-d3d2-48eb-82db-d3be93164c9a
4
public static List<String> generateUnifiedDiff(String original, String revised, List<String> originalLines, Patch<String> patch, int contextSize) { if (!patch.getDeltas().isEmpty()) { List<String> ret = new ArrayList<String>(); ret.add("--- " + original); ret.add("+++ " + revised); List<Delta<Strin...
13302d17-07ad-42e9-8e5a-4d3bd013f3c0
9
@Override public void actionPerformed(ActionEvent e) { switch (this.ActionFLag) { case 0://编译默认源程序 filePath = getValidFileName(Config.DEFAULTSOURCEFILEPATH); new LexicalAnalysis(filePath); showDialog(); break; case 1://编译自定义源程序 JFileChooser chooser = new JFileChooser(); chooser....
ef3f0399-85ed-4e60-a037-b8ae5b501098
0
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { filechooser = new javax.swing.JFileChooser(); jScrollPane1 = new javax.swing.JScrollPane(); editorarea = new javax.swing.JTextArea(); ...
4c9a1085-dc81-4499-a0a2-836e39fdd1a7
4
public JSONWriter key(String string) throws JSONException { if (string == null) { throw new JSONException("Null key."); } if (this.mode == 'k') { try { this.stack[this.top - 1].putOnce(string, Boolean.TRUE); if (this.comma) { ...
ed5d5537-48e3-4aa3-afc0-f2359b6bf48c
8
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String type = request.getParameter("type"); if (type == null) { response.sendRedirect(response.encodeRedirectURL(request.getContextPath() + "/main")); ...
0b18586a-afd9-42e5-b3b9-8609dad61d08
6
private String computeMaxInfoGain(Instances instances, List<String> attributes, List<String> attributesTested) { // get list of attributes String[] attribute = attributes.toArray(new String[attributes.size()]); // initialize int maxIndex = -1; double maxInfoGain = -1; // compute maximum information gain ...
90f2395c-d2a7-4be2-b8d1-14dbb5b3bffc
9
public UserDetails loadUserDetails(OpenIDAuthenticationToken token) { String id = token.getIdentityUrl(); CustomUserDetails user = registeredUsers.get(id); if (user != null) { return user; } String email = null; String firstName = null; String lastN...
8b3129d4-4b44-4fa9-8e7a-0a9f11ae8ea4
4
private static void describe(Object o) { if (o instanceof Set) { System.out.println("Set:"); Set s = (Set) o; for (java.util.Iterator it = ((Set)o).iterator(); it.hasNext(); ) { System.out.println("\t" + it.next()); } } else if (o instance...
adb0e939-1aea-471e-88c5-d77a98f3a910
0
public Integer getTimeLimit() { return this.timeLimit; }
e45f7647-0b1b-4f52-ab21-7b3d58a32eb2
6
public Note nextNote(Note lastNote, MeasureOptions options, NoteLengthEnum noteLength, Note[] elligibleNotes, Random r) { int percent = r.nextInt(100); int chance = r.nextInt(options.getTotalChance()); int noteTone = 0; int runningChance = 0; Note note = null; if(null ==...
6a9d656c-4efd-4b5f-882a-ec328ed1a40b
4
private JSONRPC2Response parseReceivedString(String jsonString) { JSONRPC2Message reqIn; try { reqIn = JSONRPC2Message.parse(jsonString); } catch (JSONRPC2ParseException e) { //TODO: Seems not to work for some reason... e.printStackTrace(); retur...
0985df7a-d806-42f9-8ff1-d93dbf5797f5
7
private static void getMethods0(HashMap h, CtClass cc) { try { CtClass[] ifs = cc.getInterfaces(); int size = ifs.length; for (int i = 0; i < size; ++i) getMethods0(h, ifs[i]); } catch (NotFoundException e) {} try { CtClass...
c9a88ddd-a886-4834-b05a-e2eb3e9ee22b
0
public String getMimeType() { return mimeType; }
002c82a1-9570-4292-bfaa-29a6af0723e8
4
public Select columns(String... columns) { int counter = 0; //int added = 0; for (String column : columns) { if (column != null && column.length() != 0) { if (!column.contains("`")) { this.columns.add(column); //added++; } else { db.writeError("Column " + column + " in SELECT statement c...
f02e000f-222a-4276-84b0-30a8bdfd7df5
9
@Override protected void initializeSegment(SegmentConfig segment) { super.initializeSegment(segment); if (segment.getXmlName() == null) { segment.setXmlName(segment.getName()); } String type = segment.getXmlType(); if (type == null) { segment...
ae34ba56-661f-409e-8fda-adefb99a8f62
3
@Test public void testToString() { try { GameState state = new GameState(); for(int x = 0; x < 3; x++) { for(int y = 0; y < 5; y++) { state.getOurGrid()[x][y] = new Unit(x, y, 0, x, y); state.getTheirGrid()[x][y] = new Unit(x, y, 0, x, y); } } System.out.println(state); } catch(Ex...
623bafbd-c340-4dd1-b5ce-61821cfe7b4c
0
@SuppressWarnings("unchecked") public List<Lat> findAll() { return em.createQuery("select l from Lat l").getResultList(); }
682b6293-5ffb-471a-b7ee-a333bb21b7b3
5
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton3ActionPerformed {//GEN-HEADEREND:event_jButton3ActionPerformed if (!gameover) { if (rule.turn()) { if (rule.check(2, 0)) { rule.pressed(2, 0); if ...
20683649-ebd5-4f4e-9797-9a292cea9ed2
5
@Override public void onUpdate(World apples) { if (!apples.inBounds(X, Y)||apples.checkCollision(X, Y)) { alive = false; //apples.explode(X, Y, 32, 8, 16); } for (Player p:apples.playerList) { if (maker!=p.ID&&p.checkCollision((int)X, (int)Y)) ...
f53ae85c-31e3-45ae-80cd-c7f9af75cf6b
7
@Override public void run() { SceneObject Chest = SceneEntities.getNearest(Bank.BANK_CHEST_IDS); if (Chest != null) { InteractionsEX.objectInteract(Chest.getId(), "Use"); Utils.sleep(1000); } else { switch (Random.nextInt(0, 3)) { case 1: ...
56abc78a-19fd-4e13-a052-ae41449bcd44
9
public static void main(String[] args) { TeamManagement tmn = new TeamManagement(); int op=0; Scanner lea = new Scanner(System.in); do{ System.out.println("1- Adicionar Equipo"); System.out.println("2- Listar Equipos"); System.out.println("3- ...
d5632176-5b96-4144-83fe-4293d6f6acb8
3
public void body() { int resourceID = 0; String resourceName; LinkedList resList; ResourceCharacteristics resChar; // waiting to get list of resources. Since GridSim package uses // multi-threaded environment, your request might arrive earlier // before one o...
9a7c7ed6-8469-42ae-a355-1ab837ee45f6
5
public int findMin(int[] num) { int b = 0; int e = num.length - 1; int m = 0; while(b<e){ // System.out.println(b + ":" + m + ":" + e); m = (b+e)/2; if(m==b || m==e) return num[b]<num[e] ? num[b]: num[e]; if(num[m] > num[e]) b = m; else{ e = m; } ...
0e71a7de-acfb-4ea3-8cb7-f68f2222d655
2
public LinkedHashMap<Integer, Compra> leerCompraJAXB(String rutaFichero) { rutaFichero = rutaFichero + ".xml"; LinkedHashMap<Integer, Compra> compras = new LinkedHashMap<>(); try { JAXBContext jaxbContext = JAXBContext.newInstance(MapPersona.class); Unmarshaller jaxbUnmar...
ce03803f-b474-49dd-8768-543e13a90c4b
6
public static void sendData(String message, String IP, int PORT){ String multicast = IP; int port = PORT; Logger logger = LoggerFactory.getLogger(DaemonStorageProcess.class); InetAddress group = null; try { group = InetAddress.getByName(multicast); } catch (...
cbf12f8d-3b5a-4c73-bc9d-841632f4d31b
5
public double getForce(SpringAttachable ball) { double force = 0; if ((a_end == null) || (b_end == null)) return force; if ((ball != a_end) && (ball != b_end)) return force; double a_pos = getAendPosition(); double b_pos = getBendPosition(); double stretch = Math.ab...
e86a4cdc-dffc-4001-a740-14ddca63fa19
9
private void handleBattleFeedback(BattleFeedbackEnum feedback, Player attacker, Player defender, boolean aiFeedback) { switch (feedback) { case SHIP_DESTROYED: attacker.getShip().restoreAllComponents(); endBattle(); playerKilled(defender); attacker.getWall...
91175b8b-855d-4a8b-a206-562ad14eeb28
1
public static void play(String file) { QSound.play(file); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } }
2bc22c6a-ff07-4db7-a305-fa29c66f830b
8
static double test(double[] w) { int success = 0; int trials = 0; for (int example = 5000; example < (int) I.size(); example++) { // valitetaan vain + ja - -luokista. if (I.elementAt(example).characterClass != targetChar && I.elementAt(example).chara...
a747e6ad-a69f-4367-a155-b3bb34aa1357
1
private void createSimulator() { if(gravityInteraction[numObjs] != 0) { PhysicsGravity pGravity = new PhysicsGravity(sourceGravity[numObjs]); simulators.add(pGravity); } }
b7a20ae0-6789-4cea-b7aa-c6c0b290f81e
4
public static BookmarkReader predictSample(String filename, int trainSize, int sampleSize, boolean userBased, boolean resBased, int dVal, int beta, CalculationType cType ) { //filename += "_res"; BookmarkReader reader = new BookmarkReader(trainSize, false); reader.readFile(filename); List<Map<Integer, Double>...
3363a570-e2d6-4267-a1b1-44937fda1aa9
1
public void setBagCount(int bagCount) { if(bagCount < 0) { throw new IllegalArgumentException( "bag count must be greater than or equal to zero"); } this.bagCount = bagCount; }
98b15dc5-03d1-45dd-ad6c-20873b42fd9c
7
int length(){ int len=4; if((flags&SSH_FILEXFER_ATTR_SIZE)!=0){ len+=8; } if((flags&SSH_FILEXFER_ATTR_UIDGID)!=0){ len+=8; } if((flags&SSH_FILEXFER_ATTR_PERMISSIONS)!=0){ len+=4; } if((flags&SSH_FILEXFER_ATTR_ACMODTIME)!=0){ len+=8; } if((flags&SSH_FILEXFER_ATTR_EXTENDED)!=0){ len+=4; ...
9269e138-2ab4-482c-8e55-8d321f402f1c
6
public static void genericContainerRemoval(World var0, int var1, int var2, int var3) { IInventory var4 = (IInventory)var0.getBlockTileEntity(var1, var2, var3); if (var4 != null) { for (int var5 = 0; var5 < var4.getSizeInventory(); ++var5) { ItemStack ...
040eb807-c120-41f2-8c46-e23622e62f90
6
@Override public List<Player> loadData() { Connection conn=null; PreparedStatement stmt=null; ResultSet rs=null; List<Player> players=new ArrayList<Player>(); try { conn=DriverManager.getConnection(dbUrl,dbUser,dbPwd); stmt=conn.prepareStatement(LOAD_SQL); rs=stmt.executeQuery(); while(rs.next())...
4b1cbf3c-3e8b-489b-ae8f-80557a958f58
8
public void create(UserEntity userEntity) throws PreexistingEntityException, RollbackFailureException, Exception { if (userEntity.getProjectEntityList() == null) { userEntity.setProjectEntityList(new ArrayList<ProjectEntity>()); } EntityManager em = null; try { ut...