method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8e559695-0013-4802-b188-45fa65420920
4
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Token)) { return false; } Token token = (Token) other; return type.equals(token.type) && lexeme.equals(token.lexeme) && position == token.position; }
4b28dfa2-5a3f-44e7-b1e9-da6968961af6
6
public static void vectorDinheritUnnamedDescription(Vector arguments, Description description, boolean defaulttrueP) { { Cons propositions = null; KeyValueMap mapping = null; { Object [] caller_MV_returnarray = new Object[1]; propositions = Logic.inheritDescriptionPropositions(arguments, descr...
7824f1a1-a339-4786-9f5b-9dc2f7882d71
6
public void bulkPut2( ByteChunk[] keys, ByteChunk[] values, int offset, int count ) { int size = 0; int[] sizes = new int[count]; int[] offsets = new int[count]; int[] indexSubPos = new int[count]; for( int i=0; i<count; ++i ) { offsets[i] = size; size += (sizes[i] = encodedPairSize( keys[offset+i], va...
29a6a319-7706-4c5e-a48f-9b74c5b52923
7
public int minimumTotal(ArrayList<ArrayList<Integer>> triangle) { // Start typing your Java solution below // DO NOT write main() function int rows = triangle.size(); if (rows == 0) { return 0; } int[] minSum = new int[rows]; for (int i = 0; i < rows; i++) { int[] temp = new int[rows]; ArrayList...
f9398048-64e3-4e5f-8f3e-970e3f9f576b
4
@Override public int loop() { if(startscript) { if(task == null || !task.hasNext()) { task = container.iterator(); } else { final Node curr = task.next(); if(curr.activate()) { curr.execute(); } } } return stop; }
f50b6d26-8909-44d6-85d0-26bf39b39307
1
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); BacklogParam oBacklogParam = new BacklogParam(request); BacklogBean oBacklogBean = new BacklogBean(); Usuario...
133dcc05-63c1-4e3c-8e7c-5d1827c1c495
6
public static void main(String args[]) { /* 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://down...
29d8e2a4-dc80-4b8f-b877-21cd57dddc60
3
public void copy_info(FrameData fd){ int fs = frequencies[h_version] [h_sample_frequency]; int bitrate = bitrates[h_version] [h_layer - 1] [h_bitrate_index]; int channels = 2; String mode = "stereo"; switch (h_mode) { case JOINT_STEREO: mode =...
c5503eb5-5adc-40cc-91e0-e64fd1f425d4
2
public ArrayList<String> onlineList() throws IOException { String file = "C:\\Users\\aawor_000\\workspace\\TCPServer\\src\\Status\\Online.txt"; ArrayList<String> names = new ArrayList<String>(); BufferedReader br = new BufferedReader(new FileReader(file)); String line = null; // Read from the origina...
dc20d4e7-12e6-4e70-a0d6-7be686ad8eb8
6
@Override public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(); QuestState st = player.getQuestState(qn); if (st == null) return htmltext; switch (st.getState()) { case Quest.STATE_CREATED: if (player.getLevel() < 76) { player.sendMessage("Low lvl, c...
c640d7b3-4fcf-43cf-ab47-0a578ab96b93
7
private void sendTotalOrderAnycastMessage(List<Address> destinations, Message message) { boolean trace = log.isTraceEnabled(); long startTime = statsCollector.now(); long duration = -1; final boolean deliverToMySelf = destinations.contains(localAddress); if (destinations.size(...
57a12fc5-b067-4e66-90bc-d2a4655c9adf
2
public void setPaused(boolean paused) { if (this.paused != paused) { synchronized (pausedLock) { this.paused = paused; if (!paused) { // restart sounds pausedLock.notifyAll(); } } } }
e1c61803-5b91-47d6-a8b2-d6d714d5bae9
2
public void loadFromFile() { File file = new File(FILE); if (!file.exists()) return; // Exit if file doesn't exist ContestTime o = null; try { FileInputStream fileIn = new FileInputStream(FILE); ObjectInputStream in = new ObjectInputStream(fileIn); o = (ContestTime) in.readObject(); in.close(); ...
223ba517-6af6-46bd-9be8-0855a9fe491a
9
private static void supprimer(Collection collection) { Scanner entree = new Scanner(System.in); boolean stop = false; while(!stop){ System.out.println("--------------------------------------------------------------------------"); System.out.println("Entrez le numero de la carte a supprimer (0 pour revenir a...
bf51462f-94dd-4a44-b044-480aef2674fa
8
private Object applyGetters(Object target, String getters) { if (getters == null || getters.equals("")) { return target; } int firstDot = getters.indexOf('.'); if (firstDot == -1) { firstDot = getters.length(); } String first = getters.substring(0,...
98fe4e40-90ad-4398-b4ad-4c65738f4a8e
4
public boolean actionCheckMeltdown(Actor actor, Generator reactor) { float diagnoseDC = 5 + ((1 - meltdown) * 20) ; final int FB = structure.upgradeLevel(FEEDBACK_MONITORS) ; diagnoseDC -= FB * 5 ; boolean success = true ; if (Rand.yes()) { success &= actor.traits.test(FIELD_THEORY, diagn...
5ef56884-ad1f-4661-9edc-90993555ab66
6
@Override public void handleClick(int x, int y) { if((x >= (2 * Sidebar.HORIZONTAL_SPACING)) && (x <= (getWidth()))) { double topY = getHeight() - Sidebar.VERTICAL_SPACING; double height = (getHeight() - (3 * Sidebar.VERTICAL_SPACING)) / 2; if((y < (topY)) && (y > (topY - height))) { double pos =...
3ad826d8-7af0-4e22-ade4-986b49a1aee5
2
public int getNowMonth() { int nowMonth = 0; for (int i = 0; i < 12; i++) { if (sysNowTime[1].equalsIgnoreCase(stringMonthEn[i])) ; nowMonth = i; break; } return nowMonth; }
6f457144-3e88-42e7-bebb-7104415a72c9
5
public void mouseClicked(MouseEvent e) { Component c = e.getComponent(); switch(c.getClass().getName()){ case "Menu.BodypartSummaryPanel": this.upgradePanel.removeAll(); showMatchingBodyparts(((BodypartSummaryPanel)c).getBodypart().getType()); this.activeBodypartSummaryPanel = (BodypartSummaryPanel)c; ...
78be7ce6-f59b-49ae-9e9b-058b583da9f8
0
public Layer getL() { return l; }
c7cff745-51ef-42e8-92e1-77e261f43ecb
7
public boolean valid(int location, int start, int end) { for (Iterator<Traffic> it = map.get(location).iterator(); it.hasNext();) { Traffic i = it.next(); if (end == -1 || i.end == -1 || (i.start <= end && i.end >= start) || i.start == end || i.end == start) { return false; } } return true; }
71268ac4-81ad-4477-9787-e74ef0c72319
3
public static int findNumDays(String fileName) { int lineNumber = 0; String line; try { BufferedReader br = new BufferedReader( new FileReader(fileName)); while( (line = br.readLine()) != null) { lineNumber++; ...
605a33c2-ea95-4fb5-a962-a00682334731
4
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(name + "["); sb.append(inVarTypes.length); sb.append(":"); sb.append(outVarTypes.length); sb.append("]"); sb.append("IN:("); for (int i = 0; i < inVarTypes.length; i++) { sb.appe...
28d2c75e-940f-4799-b5cf-a37009020fc8
5
void update(int delta) { super.update(delta); if (!targetTower.isAlive()) { stateMachine.changeState(StateName.toCastle); } if (stateMachine.isHeroWithinAggroRangeAndReachable()) { stateMachine.changeState(StateName.toHero); return; } else if (!stateMachine.isSomeTowerWithinAggroRangeAndReachable()...
8775611b-6c77-4048-8276-d3bee52bfb21
3
public static void main(String[] args) { int cont = 0; while(cont < 5){ System.out.println(cont); cont++; } int cont1 = 0; while(cont1 < 5){ System.out.println(cont1); cont1++; } int cont2 = 0; while(cont2 < 5){ System.out.println(cont2); cont2++; } }
2679743c-0780-49ca-bd30-b1ac7eee1c0b
6
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed try { generarTabla(); //cargo Parametros del Reporte Map parametros = new HashMap(); parametros.put("name_empresa", r_con.getRazon_social())...
0e8a6e0a-9c06-4d7c-89f2-2c9990fe22c3
9
@SuppressWarnings("rawtypes") public List<Debate> getDebateList() { List<Debate> debateList = new ArrayList<Debate>(); Element root = document.getRootElement(); Element debateElement; Debate debate; for (Iterator i = root.elementIterator("debate"); i.hasNext();) { debateElement = (Element)i.next(); ...
3c7ff79a-ff48-4df3-8945-35a25f5290a7
2
public static void main(String[] args){ DeviceXMLBuilderFactory factory = new DeviceXMLBuilderFactory(); String filename = (args.length > 0) ? args[0] : "data.xml"; try { AbstractXMLBuilder builder = factory.createBuilder("sax"); logger.info(String.format(Messages.getString("using_builder"), build...
67784359-aa28-443e-af19-71f9c971d054
2
public static void main(String[] args) throws IOException { String filename, line; Scanner keyboard = new Scanner(System.in); System.out.print("Enter the name of the file you will read from: " ); filename = keyboard.nextLine(); File file = new File(filename); //Creates a file object that al...
07eabc39-116b-4274-a418-a4750ea43691
7
public void generateNewGeneration() { //Halt all of the ImageManager threads from the previous generation to prevent slow-downs in the current // generation ImageManager.interruptThreads(); //Add the old generation to the Stack of old generations if this is not the first generation ...
2601b109-e642-43b1-bea3-ed798c14c642
0
@Test(expected = IndexOutOfBoundsException.class) public void findBestDistanceArrayIndexException(){ List<ArithmeticQuantity> quantity_list = new ArrayList<ArithmeticQuantity>(); assertEquals(Quantity.best(quantity_list), new ArithmeticQuantity(4, Distance.YARDS)); }
929ee863-eda4-4100-a687-91f6aa5447a2
4
protected void AlustaNoodit(boolean onkoKuva) { //Kaksinkertainen looppi, eli täytetään kolumni kerrallaan for (int i = 0; i <= leveys; i++) { for (int j = 0; j <= korkeus; j++) { noodit[i][j] = (T) new Noodi(i,j); if (onkoKuva) { //Jos on ...
6f8e93c2-7dc4-492d-a92f-6d58595e7a46
4
public List<VgerItemData> getSimpleItems() { makeConnection(); items = new ArrayList<VgerItemData>(); if ( getItemIDs() != null && getItemIDs().length != 0 ) { for ( String id : getItemIDs() ) { try { VgerItemData theItem; theItem = ...
39b8137b-a4c0-44ee-b711-f9281d27d07c
5
public void writeContents() { PrintWriter printer; ObjectOutputStream oOS; try { printer = new PrintWriter("run" + this.runNumber + "/Machine" + (this.id + 1) + "Inventory.txt"); printer.println("Machine " + this.id); printer.println(new Date().toString()); for (int i = 0; i < this.dispensers.size(...
a04c6c1f-0062-4bd6-931e-6a1ac53d08bb
2
public static void toStringList(List<Element> a) { int size = a.size(); for (int i = 0; i < size; i++) { System.out.print(a.get(i).getValue()); if (i < size - 1) { System.out.print(", "); } else { System.out.println(""); } ...
57e52548-02b6-4996-98a6-39e38f4c577b
6
public static String getPirateName(Color faction) { if(faction.equals(RED)) { return "Ignatius Bell"; } else if(faction.equals(YELLOW)) { return "Jason Swallow"; } else if(faction.equals(WHITE)) { return "Stanley Rackum"; } else if(faction.equals(GREEN)) { return "Damien Le Maugeois";...
dfa31d2d-67b1-4b1e-b784-68c158e13ccd
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Position other = (Position) obj; if (col != other.col) return false; if (row != other.row) return false; return true; }
92b98db8-92d7-4de3-8c83-b4c4795f6a98
7
private void generateLevel() { ArrayList<Vertex> vertices = new ArrayList<Vertex>(); ArrayList<Integer> indices = new ArrayList<Integer>(); for(int i = 0; i < level.getWidth(); i++) { for(int j = 0; j < level.getHeight(); j++) { if((level.getPixel(i,j) & 0xFFFFFF) == 0) continue; flo...
eb61b475-4758-4069-9fd1-71f9606b237e
2
public int other(int v) { if (v == to) return to; else if (v == from) return from; throw new RuntimeException("Illegal endpoint"); }
67c1a0db-5b0f-44ed-853a-3a8914e3e73e
4
private void endActionUpdate() { decrementLifetime(); if (getLifetime() == 0 && getGrid().getElementPosition(this) != null) { getGrid().removeElement(this); } else if (getLifetime() == -1) { final Position newPos = getNewPosition(); if (getGrid().validPosition(newPos)) getGrid().addElementToPosi...
9ef12e71-67cb-438b-a2af-a090bbc2e0d7
5
public int login(String name, String password){ if (name.equals("") || password.equals("")) return -1; int id = db.getUserId(name); if(id != -1){ if(db.getPassword(id).equals(password)){ if (!MFServer.SERVER.isClientOnline(id)){ return id; ...
f338d2d9-a6ef-4642-a9dc-3eb8ce48e853
0
public String toString() { return "Title: " + titleInt + "\n" + "Duration: " + durationInt + "\n" + "Auction type: " + auctionTypeInt + "\n" + "Description: " + descInt + "\n" + "Image: " + imgInt + "\n" + "Lowest Price Accepted: " + lowPriceInt + "\n" + "Start Price: " + startPriceInt + "\n" + "Buyou...
6600fd62-84bb-45fe-b97d-eb7a822afda8
2
public void paintComponent(Graphics graphics) { if (selected) { Graphics2D graphics2D = (Graphics2D) graphics; graphics2D.setPaint(Color.white); graphics2D.fillRect(0, 0, getWidth(), getHeight()); GradientPaint gradientPaint; if (answerS...
310871c6-c71c-4185-9335-24dc29cbefce
4
public void createBuckets() { int minStart = Integer.MAX_VALUE; int maxStart = Integer.MIN_VALUE; for(Racer r : racers) { if(minStart > r.getStart()) { minStart = r.getStart(); } if(maxStart < r.getStart()) { ...
2822099d-7a56-4406-b76f-e9afa7748fe2
5
public boolean Create(int historySize, int keepAddBufferBefore, int matchMaxLen, int keepAddBufferAfter) { if (historySize > kMaxValForNormalize - 256) { return false; } _cutValue = 16 + (matchMaxLen >> 1); final int windowReservSize = (histor...
48b9d516-aaae-4905-9e16-c9507eec5a18
9
public static void updateEditorSelector() { instance.allloops = LoopManager.getRicsLongCoded(); String[] tmp = instance.allloops.toArray(new String[instance.allloops .size()]); if (instance.LoopSelector != null) { instance.LoopSelector.setEnabled(false); DefaultListModel model = (DefaultListModel) in...
aaaaa575-4057-4f7f-9478-5d454666655d
3
public JSONWriter array() throws JSONException { if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') { this.push(null); this.append("["); this.comma = false; return this; } throw new JSONException("Misplaced array."); }
91250ba6-d747-4446-bec8-09c7a79a4886
1
public void loadItems() { for (int i = maxItems; i >= 0; i--) { Time value = TimerPreferences.getInstance().getTime("item" + i); this.addItem(value); } }
e44f8571-9629-406a-98ee-56fe22d4c740
2
public boolean isBlockBettedOn(Block block) { Set<Player> betsKeys = bets.keySet(); for(Player key : betsKeys) { if(bets.get(key).contains(block)) return true; } return false; }
617f9cb0-a082-4bf2-a1bc-fe6c1b2c4f1a
9
public String getAutoAffects(MOB viewerMOB, Physical P) { final StringBuffer msg=new StringBuffer(""); final int NUM_COLS=2; final int COL_LEN=CMLib.lister().fixColWidth(25.0,viewerMOB); int colnum=NUM_COLS; for(final Enumeration<Ability> a=P.effects();a.hasMoreElements();) { final Ability A=a.nextEleme...
c83845df-47c4-48d6-9764-4634de57afa3
9
public void move(char direction, Map PlayerMap) { int x = CurrentPosition.getX(); int y = CurrentPosition.getY(); try { switch (direction) { case 'U': case 'u': setPosition(new Position(x, y - 1, PlayerMap.getTile(y - 1, x))); break; case 'D': case 'd': setPosition(new Position(x, y +...
5381f86d-a942-4490-8fb7-d06caf8b3f8c
5
protected void printTopKChild4StnWithHybridPro(String filePrefix, int topK) { String topKChild4StnFile = filePrefix + "topChild4Stn_hybridPro.txt"; try { PrintWriter pw = new PrintWriter(new File(topKChild4StnFile)); m_LM.generateReferenceModel(); for (_Doc d : m_trainSet) { if (d instanceof _ParentD...
46c3efaa-0b34-40a1-a543-b269dcf2bbc3
6
@Override public void caseAClassdecl(AClassdecl node) { inAClassdecl(node); if(node.getRM() != null) { node.getRM().apply(this); } { List<PMethoddecl> copy = new ArrayList<PMethoddecl>(node.getMethoddecl()); Collections.reverse(copy); ...
130cd656-d522-4c8e-98cb-da730e3adf38
3
public void load() { if (!this.configFile.exists()) { try { System.out.println("[BurningCS] Could not find the config file! Making a new one."); new File(this.dir).mkdir(); this.configFile.createNewFile(); setDefaults(); ...
6536c8e7-13dc-45df-82a6-cfbb79b68a84
7
public ArrayList<ArrayList<Cell>> nakedOverlap(Cell[] toc){ ArrayList<Cell> toCompare = new ArrayList<Cell>(); ArrayList<ArrayList<Cell>> ret = new ArrayList<ArrayList<Cell>>(); toCompare.addAll(Arrays.asList(toc)); //remove unneccessary comparisons; Iterator<Cell> q = t...
a5ed1974-892c-411e-ade4-058d0f8d5add
4
public Input getCommand() { String input_line = ""; String word1; String word2; System.out.print(">"); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); try { input_line = reader.readLine(); } catch (java.io.IOException exc) { System.out.println("There was an error ...
05e2b101-6458-4e0a-9ab2-f4849a32782c
9
public static void main(String[] args) { // TODO Auto-generated method stub ChessFrame theFrame=new ChessFrame("Chess- Dan Anderson"); Game theGame =theFrame.getGame(); int lastTurnUpdated = theGame.getTurnNumber(); while(!theGame.isGameOver()) { if(theGame.getTurnNumber()!=lastTurnUpdated)//a turn has ...
2d83118c-41c9-4014-a659-a7ddcecfd958
1
public static void warn(String string){ if(developerMode){ System.out.println("WARNING: " + getClassName() + ":" + getMethodName() + "():" + getLineNumber() + ": " + string); } else { System.out.println("WARNING: " + string); } }
f4d79d40-1e92-4026-b7f9-d67550c59f2d
9
@Override public void handle(Player player, Packet packet) { final int id = packet.getShort() & 0xFFFF; final int slot = packet.getShortA() & 0xFFFF; final int interfaceId = packet.getShortA() & 0xFFFF; switch (interfaceId) { case Inventory.INTERFACE: if (slot >= 0 && slot < Inventory.SIZE) { final I...
b131435c-1396-4839-91c3-b854df31fcd0
1
public synchronized void complete() throws IOException { this.channel.force(true); // Nothing more to do if we're already on the target file. if (this.current.equals(this.target)) { return; } FileUtils.deleteQuietly(this.target); FileUtils.copyFile(this.current, this.target); logger.debug("Re-openin...
933e1e8f-35ff-4912-b735-9963b4a409a9
9
public boolean hasEqualMapping(Transaction valueObject) { if (valueObject.getTransaction_id() != this.transaction_id) { return (false); } if (valueObject.getCustomer_id_by() != this.customer_id_by) { return (false); } if (valueObject.getAccount_id() != this.account_id) { return (false); } if (va...
6bf32fd0-c45f-47ca-a4e7-467700e6c3df
4
@Override public String toString() { StringBuffer s = new StringBuffer(); s.append("{"); boolean first = true; for (TreeNode l : ingroup) { if (first) { first = false; } else { s.append(", "); } s.append(l.getLabel()); } s.append("} | {"); first = true; for (TreeNode l : outgroup) {...
1ec5c0e9-7a7e-4681-aa05-613900e675f7
7
private void paintPiston(Graphics2D g) { double place1 = x + width; double place2 = place1 + 8.0; double place3 = y + height; double place4 = place3 + 8.0; int nx = (int) (width / delta); int ny = (int) (height / delta); int i; g.setColor(Color.black); if (tempLine == null) tempLine = new Line2D....
342fa7ff-5a86-441c-8615-9d872fc018bc
1
public void testMultipleLine() throws Exception { final DelimiterWriterFactory factory = new DelimiterWriterFactory(mapping, ',', '"'); final StringWriter strWriter = new StringWriter(); final Writer flatMapWriter = factory.createWriter(strWriter, new WriterOptions().autoPrintHeader(false)); ...
d1a91509-c870-44e8-a8c0-3dbcc5141a38
8
@EventHandler public void onBowUse(EntityShootBowEvent event) { // Entity is not a player if (!(event.getEntity() instanceof Player)) return; Player player = (Player) event.getEntity(); String worldName = player.getLocation().getWorld().getName(); // We do not have to check on this world. if (plugi...
708de254-7e77-468e-b642-11bdd6300103
0
public void setId(Long id) { this.id = id; }
c485a3a6-ce73-4750-b9c9-43e4a0ab2827
5
public static void main(String[] args) { try { // файл с одной строкой Map<String, String> strDNAs = FileUtils.readFileFASTA("d:/temp/rosalind_revp.txt"); String source = StringsUtils.getMinString(strDNAs); //System.out.println(source.length()); //source = "TCAATGCATGCGGGTCTATATGCAT"; // palindr...
6565a0b1-e7ec-463f-8f13-d8b4045d74f7
7
public static void initialize(Graph g) { Random r = new Random(); int vertices = g.getVertices().getSize(); int verticesPerRow = (int) Math.sqrt(vertices) + 1; BinaryHeap<Vertex> verticesInOrder = new BinaryHeap(); BinaryHeap<DoublyLinkedList<Vertex>> neighbours = new BinaryHeap(...
4ce30426-c019-4388-bdfc-b82c058bbb20
7
public void determineBounds() { double value,min,max; // find maximums minimums over all plots m_minX = ((PlotData2D)m_plots.elementAt(0)).m_minX; m_maxX = ((PlotData2D)m_plots.elementAt(0)).m_maxX; m_minY = ((PlotData2D)m_plots.elementAt(0)).m_minY; m_maxY = ((PlotData2D)m_plots.elementAt(...
33948496-d70e-468f-8446-1226fbe97c85
9
public MinecraftFrame(String title, String imagePath, String animationname) { super(title); this.animationname = animationname; StyleUtil.loadUiStyles(); try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.get...
23c53e6d-e2da-4891-95ce-01392e2da319
8
public Object readPropertyNode(Element node) throws Exception { Object result; Object value; String parentClass; String property; Vector children; Element child; int i; Cla...
fc9de2b1-84b6-477b-b95d-0d37c66eaa85
7
public HashMap<String, Behavior> loadFromDir(File dir) { dir.mkdirs(); if (!dir.exists()) { this.logger.log(Level.WARNING, "Behavior directory not found: '" + dir + "'"); return this.behaviors; } ClassLoader loader; try { loader = new URLClassLoader(new URL[] { dir.toURI().toURL() }, B...
2efde203-46db-4670-a3b7-efbe7276dc1f
3
public void addRow(Component ...components) { Component[] newRow = new Component[columns.length]; for(int i = 0; i < columns.length; i++) { if(i >= components.length) newRow[i] = new EmptySpace(1, 1); else newRow[i] = components[i]; } ...
e51c3158-b0da-49ca-8d74-f210f3ff1184
3
public static Station getStationById(int id_station) { Station station = null; Statement stat; try { stat = ConnexionDB.getConnection().createStatement(); stat.executeUpdate("use nemovelo"); ResultSet res = stat.executeQuery("select * from station where id_st...
ce68de89-419d-43a6-9e67-483a648d774e
2
public void run() { if (url == null) { editor.setCursor(cursor); Container parent = editor.getParent(); parent.repaint(); return; } Document doc = editor.getDocument(); try { editor.s...
b8da373c-9032-4163-a9ab-a0ec9982deb9
4
@SuppressWarnings("unchecked") public void setFont() { GL11.glDisable(GL11.GL_TEXTURE_2D); try { font = Font.createFont(Font.PLAIN, new FileInputStream(System.getProperty("resources") + "/fonts/" + fontName)); if(size == 0f) font = font.deriveFont(defaultSize); else font = font.deriveFont(size); ...
c9950e6b-ff87-4b59-9fe4-c6745a704b9b
2
@Override @SuppressWarnings("RefusedBequest") // see the comment above public void removeBuffer(GameAction action) { getBuffers().remove(action); for (GameAction currentGameAction : getGameActions()) { if (currentGameAction.hasAnAttack()) currentGameAction.getAttackDa...
e8f52e76-25d5-441b-835f-11ea7c21b737
9
static final void method985(int i, Class343 class343, int i_32_) { anInt1132++; if (Class320_Sub27.aBoolean8465) { i = 0; Class320_Sub27.aBoolean8465 = false; } if (Class20_Sub1.aClass343_5509 == null || !Class20_Sub1.aClass343_5509.method3968((byte) 97, class343)) { Class20_Sub1.aClass343_5509 = class...
587adc14-0fbb-4b89-b441-be404d099ca8
8
@RequestMapping(value = "/login.htm", method = RequestMethod.GET) public String login(HttpServletRequest req,HttpServletResponse res) { if(req.getAttribute("user") != null) return "redirect:/main.htm";//already loged go to main //retrieving oath tokens returned from twitter which are used t...
2fd59db2-4163-4a7f-b1c8-0201331ed067
0
public void setExecCommand(String execCommand) { this.execCommand = execCommand; }
3458d903-aa04-44de-9f53-debd7c875c86
4
public void render() { try{ for (Text t : rendertext) { if (t.checkIfVisible()) { graphics.drawString(t.getText(), t.getX(), t.getY()); } else { System.out.println("Time Delete"); rendertext.remove(t); } ...
46958f05-a62e-455c-b193-4d64a291a1f9
2
public static void gameOver() { List<Joueur> joueurs = Partie.getInstance().getJoueurs(); Collections.sort(joueurs, new Comparator<Joueur>() { public int compare(Joueur o1, Joueur o2) { return o2.getArgent() - o1.getArgent(); } }); String res = "Résultats :\n"; for (int i = 0; i < joueurs.s...
d7112ed1-c11a-404f-ab4f-5c4e4ecd9280
4
private void drawEntry(NameSurferEntry entry, Color entryColor){ int scale = bottomLineY-topLineY; double[] pointYArray = new double[NDECADES]; for(int i=0;i<NDECADES;i++){ int decadeRank = entry.getRank(decadeArray[i]); String label = entry.getName() + " " + decadeRank; if(decadeRank == 0){...
13061859-6c4d-4874-bd57-06027b19cd28
1
public void avergeGrade() { int grade; int total; int counter; int average; Scanner s = new Scanner(System.in); total = 0; counter = 1; while (counter <= 10) { System.out.println("\nEnter Grade:"); grade = s.nextInt(); total = grade + total; counter++; } average = total / 10; System.ou...
5494bf4c-5fc9-4fff-83fe-4e411eb4241d
5
@Override public void actionPerformed(ActionEvent e) { try { if (e.getSource() == this.view.getJbValidate()) { if ( !view.getJtName().getText().equals("") && !view.getJtPassword().getText().equals("")) { DBInterface test = new DBInterface(); test.I...
b5152b75-6460-4517-b595-921f793b7312
3
private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed String serverID = "ALL"; if (serverID != null && serverMap.size() > 0 && jComboBox2.getSelectedIndex() > 0) { serverID = ((String[]) serverMap.get((Integer) jComboBox...
4b1791c5-3453-46a3-a30e-36bcb864740e
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...
12bf3744-694e-4c3e-a018-1dfe3cb1e11e
0
public PBMAC1ParameterType createPBMAC1ParameterType() { return new PBMAC1ParameterType(); }
fd816e0c-bf25-405a-b0d6-ae466c31f7d8
7
@EventHandler public void GhastRegeneration(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Ghast.Rege...
c7081171-d688-4c46-8ad8-7e00807f81d9
7
public void createChildren(int triangleLevel) { if(level<triangleLevel){ Node rSiblingrChild = null; BigInteger rSiblingNumber = new BigInteger("0"); if (rSibling!=null){ rSiblingrChild = rSibling.rChild; rSiblingNumber = rSibling.number; } rChild = new Node(number.add(rSiblingNumber), level+1...
3c2968dd-943c-4449-8a31-b99c208e0c36
8
public boolean match( TetravexPiece ideal ) { if (ideal.s[LEFT] != EMPTY && ideal.s[LEFT] != s[LEFT]) { return false; } if (ideal.s[TOP] != EMPTY && ideal.s[TOP] != s[TOP]) { return false; } if (ideal.s[TOP] != EMPTY && ideal.s[TOP] != s[TOP]) { return false; } if (ideal.s[BOTTOM] != EMPTY...
c746f513-8a0b-42d2-8b6b-876db4a92f03
6
public String toString() { if(isEmpty()) return "Empty graph"; else { String nodes="Nodes = {"; String edges="Edges = {"; Iterator<String> itSource=mapNodes.keySet().iterator(); while(itSource.hasNext()) { String idSource=itSource.next(); nodes+=idSource+", "; HashMap<String,Double...
c91791eb-babc-4673-8531-c301c948cab8
8
private boolean r_un_accent() { int v_3; // (, line 215 // atleast, line 216 { int v_1 = 1; // atleast, line 216 replab0: while (true) { lab1: do { if (!(out_grouping_b(g_v, 97, 251))) { break lab1; } v_1--; continue replab0; } while (false); break replab0; } ...
0e0dccfa-bb8e-48bb-bfbc-ac77eb2be84f
2
public double getPricesFromRodsStrategy(ArrayList<Rod> rodList) { ArrayList<Rod> maximumRevenueRods = rodList; double sum = 0; if(maximumRevenueRods == null) { return sum; } for (Rod rod : maximumRevenueRods) { sum += rod.getPrice(); } return sum; }
edcd398a-b023-4ae8-90cd-7cdf0b992d2e
6
public void afficheBoard(){ for (int i=0;i<plateauTab.length; i++ ){ System.out.print("+--------------"); } System.out.println("+"); for (int i=0;i<plateauTab.length; i++ ){ for (int j=0;j<plateauTab.length; j++){ System.out.print("| "+plateauTab[i][j].getValTab()[0]+" ");...
326552fc-8945-442e-9a1e-b1c7df2b829d
5
final public Object literal(boolean requireEOF) throws ParseException, java.io.IOException { Object val = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRING: val = string(false); break; case INTEGER: case FLOAT: val = number(false); break; default: jj_la1[24] =...
637d0472-527c-418e-a974-c4aafb20e78d
6
* @param errorP * @return String */ public static String coerceValueToString(Stella_Object value, boolean errorP) { { Surrogate testValue000 = Stella_Object.safePrimaryType(value); if (Surrogate.subtypeOfStringP(testValue000)) { { StringWrapper value000 = ((StringWrapper)(value)); ...
7496a2bb-0292-417c-bca4-48601e41ee1c
3
private void dropItem(Command command){ if(!command.hasNthWord(2)){ System.out.println("Drop what?"); } else { Item i = bag.removeItem(command.getNthSegment(1)); if(i == null){ System.out.println("You don't have " + Phraser.addDeterminer(command.getNt...
11b77733-28c0-4f53-b668-39e1dfea359a
0
@Override public String getName() { return this.name; }
1ef75c7c-9085-4d94-9b97-bbd0b1e4cd63
5
@Override public void validate() { super.validate(); if (getSubmit() != null && SUBMIT.equals(getSubmit())) { if (StringUtils.isBlank(getUserVO().getUserId())) { addFieldError("userVO.userId", "Enter valid User ID"); } if (StringUtils.isBlank(getUserVO().getPassword())) { addFieldError("userVO.pa...