method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0bce3826-4627-4a8f-a784-07da8c82eec1
7
public void onEnable() { registeredCommands = 0; registeredListeners = 0; instance = this; mainLogger = new MainLogger(this); mainConfig = new MainConfig(this); mainLogger.setConfig(mainConfig); mainConfig.setupConfig(this); serverListenerTMP = new ServerListenerTMP(this); playerChatListener = new Pl...
dc0c350b-dead-4954-a4ad-21670aab7772
1
private boolean jj_2_22(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_22(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(21, xla); } }
fd8f8e6e-f360-49e0-a09b-69d0b65d6c9f
0
public synchronized void addListener(DecadeListener l) { listeners.add(l); }
b501418f-2017-4bd6-b732-2991ee72d812
2
public void close() { try { if (bitStream != null) bitStream.close(); } catch (IOException e) { } }
a8ff7306-fe44-4aa3-afd3-670792f3663a
5
public void printInfo(Graphics g, Vector2 playerPos, double visibility) { g.setColor(Color.yellow); String[] m = new String[] { "Floor", "Wall", "Light", "AI", "Door" }; g.drawString("Mode : " + m[mode], rect.x + 10, rect.y + 45); g.drawString("(Id: " + currentId + ")", rect.x + 125, rect.y + 45); if (mode =...
aa37c9a0-24e1-402d-a36d-652806ba624d
8
@Test public void test() { Imagem img; ImagemIterator iterator = new InferiorDiagonalIterator(); // Teste com largura maior i = 0; img = new Imagem(4, 3); iterator.iterate(img, new ImageIteratorCallback() { @Override public void callback(int x,...
308c381a-8b01-4f31-acfa-b4d6ee04d290
2
public static void addEffect(GameObject effect, int layer){ if(layer >= 0 && layer <= 3) effects.get(layer).add(effect); }
037a89be-fb68-4378-83e1-7bdc7d5c5d84
7
public static void setEnumDocumentation(Configuration configuration, ClassDoc classDoc) { MethodDoc[] methods = classDoc.methods(); for (int j = 0; j < methods.length; j++) { MethodDoc currentMethod = methods[j]; if (currentMethod.name().equals("values") && ...
c4f8db02-042b-42d9-8ff7-606c0e4998ae
1
@SuppressWarnings ( { "unused", "resource" } ) @Test public void testDgramSocket () throws Exception { ServerThread serverThread = new ServerThread() { @Override protected void handleConnection ( final AFUNIXSocket sock ) throws IOException { System....
4db9f971-1247-4e20-bb48-b9602291404e
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Situacao)) { return false; } Situacao other = (Situacao) object; if ((this.idSituacao == null && other.idSituac...
64d2da70-cace-4b26-ae92-59cd8753e5dd
2
private PrintStream getPrintStream(Socket clientSocket) { PrintStream printStream = null; try { printStream = new PrintStream(clientSocket.getOutputStream()); this.log.fine("Create new printStream: " + printStream.toString()); } catch (IOException e) { e.printStackTrace(); try { clientSocket.close...
dcea9e4a-6ee9-416f-8770-b92ba4420e40
0
public ChaoticFilter(final ConnectionProcessor proc, final Properties props) { super(proc, props); }
0986a94a-811c-48db-8ea5-bbd89422e49f
0
public static boolean detectBlur(ImageProcessor image, double threshold){ // method taken from http://stackoverflow.com/questions/7765810/is-there-a-way-to-detect-if-an-image-is-blurry ImageProcessor dummy = image.convertToFloatProcessor(); dummy.resetMinAndMax(); dummy.multiply(1.0 / dummy.getMax()); //normali...
9491c57a-fb9c-4ba1-975b-b447043aace8
6
public static void main(String args[]) { if (args.length!=1){ System.out.println("Not the proper usage dude, try: java Lexer <filename>"); System.exit(-1); } String fileName = args[0]; Token tok; try { Lexer lex = new Lexer...
ef060c47-13e6-4f8c-a7ec-8970af4c4035
7
private void appendAllowed(StringBuilder prepend, String ID) { final Iterator<String> i=CMLib.expertises().filterUniqueExpertiseIDList(CMLib.ableMapper().getAbilityAllowsList(ID)); int lastLine=11; if(i.hasNext()) { prepend.append(L("\n\rAllows : ")); while(i.hasNext()) { final String allowStr=i...
10d1a483-f04b-49ec-842a-dc009dcb1755
4
public Data serverdbMsg() throws Exception { Object obj = null; try { try { if (server.getinput() != null) { obj = server.getinput().readObject(); } else { output.writeObject(new Data(new Item("@@@notserverdb@@@"))); ...
810243dd-a2bb-4b91-b017-43b17829e576
3
@Override public void run() { seedsList.clear(); File file = new File(seedDestination); BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); String seed; while((seed=br.readLine())!=null){ seedsList.add(s...
fcf21eb3-9746-4bc5-ae10-63813afdbd4e
9
private void drawShape(Shape shape, BasicGraphicalElement element, Color backupColor) { GraphicAttributes attributes = element.getGraphicAttributes(); Color fillColor = null; if (element.isClosed() && attributes instanceof FillAttributes) { fillColor = ((FillAttributes) attributes).getFillColor(); } if (fi...
ba326b01-20b0-4bc9-b212-ff8f2a731c4d
6
public static void main(String[] args) throws IOException { BufferedReader buff = new BufferedReader(new FileReader(new File("./resources/kargerMinCut.txt"))); List<Vertex> vertexes = new ArrayList<Vertex>(); for(int i = 0; i < 200; i++) vertexes.add(new Vertex()); String ...
798973c8-fa6d-485c-84ec-e8f1411dab90
2
protected static void initializeLogger() { try { FileHandler fh = new FileHandler(server.Main.class.getName()+".log"); fh.setFormatter(new SimpleFormatter()); log.addHandler(fh); } catch (SecurityException e1) { // TODO Auto-generated catch block e1.printStackTrace(); System.exit(-1); } catch (I...
3989848d-08ee-4ddf-8427-8c5fa9cdafc5
6
public boolean eliminateWithCluster(int clusterSize){ boolean eliminated = false; //Search the statistic for count of clusterSize. ArrayList<String> matchCountValues = new ArrayList<String>(); HashMap<String, Integer> possibleValueCounters = this.getStatistic(); String[] values...
e413dfe6-cf03-47a1-9d76-944f0910de85
4
public void clearToolItem(Player playerSender){ if(playerSender!=null){ if(playerSender.getInventory().contains(tool)){ playerSender.getInventory().remove(tool); } }else{ for(Player p : Bukkit.getOnlinePlayers()){ if(p.getInventory().contains(tool)){ p.getInventory().remove(tool); } ...
92712458-f2bb-4571-8d04-f6ba7a1b22af
4
public void run() { sockets.add(socket); onConnect(socket); try { BufferedReader in = new BufferedReader(new InputStreamReader( socket.getInputStream())); String line; while ((line = in.readLine()) != null) { if (!listening) return; onMessage(socket, line); } } catch (E...
551feda9-b329-4171-bda5-c59c77e065cc
5
protected void printTopKChild4Stn(String filePrefix, int topK) { String topKChild4StnFile = filePrefix + "topChild4Stn.txt"; try { PrintWriter pw = new PrintWriter(new File(topKChild4StnFile)); // m_LM.generateReferenceModel(); for (_Doc d : m_trainSet) { if (d instanceof _ParentDoc) { _ParentDo...
8c4dfa33-5d9a-4ec7-aab4-8098d4e554d1
8
public static String eventuallyRemoveStartingAndEndingDoubleQuote(String s) { if (s.startsWith("\"") && s.endsWith("\"")) { return s.substring(1, s.length() - 1); } if (s.startsWith("(") && s.endsWith(")")) { return s.substring(1, s.length() - 1); } if (s.startsWith("[") && s.endsWith("]")) { return ...
b60fabeb-c6ea-424b-8439-348cfe35a6f5
9
private void hideOrShowComponentsBasedOnRole() { //components for the roles Component[] adminComps = {lblEditPassword, lblPassword, tfPassword, lblAdminUsername}; Component[] plComps = {lblLeadProjects, lblEditLead, leadHolderScroll, leadHolder}; Component[] spComps = {anstalldShowHolder...
78608137-0a84-41b7-b106-b6641cbfaf07
0
private CharacterFactory(){}
888aafd4-2b38-4e69-9f43-d590ab91d646
9
private void checkHarmonics(Note n, LinkedHashMap<Note, Boolean> checkNotesList, ArrayList<Complex> freq, HashSet<Note> curNotes) { if (!checkNotesList.get(n)) { checkNotesList.put(n, true); if (checkForThresholdUp(n, freq, noiseThreshold)) { curNo...
62a1a93a-0552-4253-b62c-b31b4871d4a8
3
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String ryhmaIdStr = request.getParameter("ryhma"); String pizzanNimi = request.getParameter("nimi"); String hintaStr = request.getParameter("hinta"); Strin...
67785957-781b-4a20-a445-f7716e982a5f
3
private void permuteHelper(int[] num, int left){ if(left == num.length -1){ ArrayList<Integer> list = new ArrayList<Integer>(); for(int i=0; i<num.length; i++){ list.add(num[i]); } result.add(list); return; } fo...
508b8476-2b39-4800-8eb3-3f066f1fc472
9
public boolean isValidSolution() { for (Lecture lecture : environment.getLectureList()) { int numAssigns = 0; for (Assign assign : assignmentMap.values()) { if (assign.getLecture().equals(lecture)) numAssigns++; } // Ensure that every lecture is assigned exactly once if (numAssigns > 1) { ...
33f7d67b-7e13-4229-a896-06ff225107c5
1
@Override @Execute public void execute() throws ComponentException { check(); while (!cond.alive) { internalExec(); } }
66885123-f09a-4aa7-bd40-502d18d0adf3
5
public void send(DataOutputStream outputStream)throws Exception{ //send tanks Tank s; outputStream.writeUTF("$tank$"); outputStream.writeInt(tanks.size()); for(Map.Entry<Integer, Tank> entry : tanks.entrySet()){ s = entry.getValue(); outputStream.writeInt...
ccec899f-33b4-477e-9b4b-eb01be001794
8
private boolean readArray() throws IOException, JSONSyntaxException { // Mind the case of an empty array: [] /*if( this.currentChar == ']' ) { this.fireArrayEnd(); return true; }*/ // while( this.readJSON(false,true) && this.currentChar != ']' ) { boolean stop = false; do { boo...
032c9c6d-2015-41b2-b9af-1c13b8c1c3f1
6
private List<String> parseOutput(String stemOutput) { List<String> words = new ArrayList<>(); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < stemOutput.length(); ++i) { char symbol = stemOutput.charAt(i); if (symbol == '?') { buffer.delete(...
5f16b2f9-6b36-43f2-a940-2e8820ed34e9
2
public DiceRoll(int rollValue) { if(rollValue > 1 && rollValue < 13) { this.rollValue = rollValue; } else { //throw exception } }
63f0c1d9-edf0-4449-8cd2-dce92556e03a
3
public String toString() { String s = "<" + name; for(int i = 0; i < attrs.getLength(); i++) s += " " + attrs.getLocalName(i) + "=\"" + attrs.getValue(i) + "\""; if(subObjects.size() == 0) return s + " />"; else s += ">"; for(Object o : subObjects) s += o.toString(); return s + "</"...
f4edd8e2-8c21-47d7-9ba9-0bfd1665c415
4
public <T> T get(CacheKey cacheKey, Class<T> type) { if (cacheKey == null) { throw new IllegalArgumentException("Parameter 'cacheKey' must be not null"); } if (type == null) { throw new IllegalArgumentException("Parameter 'type' must be not null"); } Obje...
a425c278-64f9-447d-8d73-77e8ba9ca367
7
private void writerToFile(String str, int line, int state, int type_token, int index) { String nameOfTable; switch (type_token) { case 0: // id nameOfTable = "id"; break; case 2: // int nameOfTable = "int"; break; ...
938e701e-ab2e-4f94-b3c3-37b1cfb09f21
6
Class367_Sub11(NativeOpenGlToolkit class377, IndexLoader class45) { super(class377); try { if (class45 != null && ((NativeOpenGlToolkit) class377).aBoolean9923) { aClass193_7395 = za_Sub2.method3442(34336, class45.getChildArchive("gl", "uw_ground_unlit"), class377, 4); aClass193_7...
73e30825-0f34-467c-8d3e-0684266f4d20
3
public int read(byte[] buffer, int offset, int length) { if (closed) { return -1; } int totalBytesRead = 0; while (totalBytesRead < length) { int numBytesRead = super.read(buffer, offset + totalBytesRead, length - totalBytesRead); ...
059e4b80-a550-4e5a-9040-eada1f1bf3ef
4
public double getSplashDamageRate(PointI p, int mobSize){ double sd = 0d, nd = 0d; for(int x=p.x; x<p.x+mobSize; x++){ for(int y=p.y; y<p.y+mobSize; y++){ sd += splashKillCounts[y][x]; nd += normalKillCounts[y][x]; } } if(sd == 0d) return 1d; if(nd == 0d) return 0d; return sd / (sd + nd); }
8b3775d0-58c0-452d-bf98-349f4c22ba06
5
public void updateRuleLabelMapping(Map<String, List<Rule>> ruleLabelMapping) { if (null == ruleLabelMapping || ruleLabelMapping.size() == 0) return; if (this.ruleLabelMapping == null) this.ruleLabelMapping = new TreeMap<String, Set<String>>(); for (Entry<String, List<Rule>> entry : ruleLabelMapping.entrySet()) { ...
689c7b59-5a65-4620-8a27-19fc21b6ba11
5
public static void spielstand() throws IOException{ Properties spielstand = loadProperties("spielstand.txt"); JOptionPane.showMessageDialog(null, "Ein Zwischengespeichertes Spiel wird wiederhergestellt!", "Weiterspielen", JOptionPane.INFORMATION_MESSAGE); String spielername1 = spielstand.getProperty("spi...
5872ddf7-0731-4d48-afef-6cbd7baf6954
2
@Override public void Parse(Session Session, EventRequest Request) { Map<Integer, Room> UserRooms = new HashMap<Integer, Room>();//Grizzly.GrabHabboHotel().GrabRoomHandler().GrabUsersRooms(Session.GrabHabbo().ID); if (UserRooms.size() == 0) { UserRooms = Grizzly.GrabHabboHotel().GrabRoomHandler().GrabUser...
5cc5db2e-6e7e-43e8-92ec-448f13dad4f6
2
private void loadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadButtonActionPerformed this.setVisible(false); TreePath path = this.studiesList.getSelectionPath(); if(path == null || path.getLastPathComponent().equals("Root")) return; // No study...
09411772-493a-4279-82e6-08dd915cbca2
8
@Test public void testPertenece2() { boolean expected = false; boolean actual = arbolito.pertenece(8) && arbolito.pertenece(3) && arbolito.pertenece(6) && arbolito.pertenece(1) && arbolito.pertenece(16) && arbolito.pertenece(4) && arbolito.pertenece(7) && arbolito.pertenece(14) && arbolito.pertenec...
5e2d42c9-ed9e-4ade-b271-9a574c9acc8f
0
@Override public String getMessageText() { String msg = name + " " + settings.getLanguage().getLabel("text_newparticipant"); return msg; }
d770f4fa-49ac-444f-8f5c-4dd0d0b651dd
6
private void findInput(LinkedList input) { String current; //current sentence String currentinput; //current user input Collections.shuffle(databaseText); //iteration through the list to find all sentences with a relation to the user input while (!input.isEmpty()) { ...
3b152b15-e7c3-4b79-aabf-7ba6783abc07
6
final Class318_Sub4 method2386(int i, AbstractToolkit var_ha) { anInt10352++; AnimatableToolkit class64 = method2465(var_ha, anInt10355, ((anInt10334 ^ 0xffffffff) == -1 ? 0 : 5) | 0x800, (byte) -82); if (class64 == null) return null; if (anInt10334 != 0) class64.a(anInt10334 * 2048); Class1...
19d246a3-234f-494e-bdb9-9dbdbb00c285
4
String remaining() { if (position >= 0 && position < items.length) { StringBuilder out = new StringBuilder(); for (int i = position; i < items.length; i++) { if (out.length() > 0) { out.append("/"); } out.append(items[i]...
a77360c0-1827-4d3e-83ef-03b1a60fc8ee
6
public BigDecimal[] subtractWeightedMean_as_BigDecimal() { if (!weightsSupplied) { System.out.println("subtractWeightedMean_as_BigDecimal: no weights supplied - unweighted values returned"); return this.subtractMean_as_BigDecimal(); } else { boolean holdW = Stat.weightingOptionS; if (weightingReset) { ...
0d3e459a-d6d6-444a-956d-f3e3cad48b9a
3
private void prioritizeVortexes(int beginning) { this.vortexHeap = new MinimumHeap(); for (VortexSpace vortexSpace : vortexSpaces) { int distance = -1; if (vortexSpace.getId() == beginning) { distance = 0; } else { distance = Integer.MAX_VALUE/3; } Vortex vortex = new Vortex(vortexS...
149ac410-3b18-4e9a-a500-f52099764972
0
@Parameters public static Collection<Object[]> getData() { return Arrays.asList( new Object[]{ URI.create("http://testlink.sourceforge.net/demo/lib/testcases/tcPrint.php?testcase_id=2750"), new TestLinkId.InternalTestLinkId(2750L) }, new Ob...
5a8738b3-a660-4d42-85df-8c1647849194
4
public void EliminaMedio (int Posicion) { if ( VaciaLista()) System.out.println( "Nada"); else { NodosProcesos Aux =null; NodosProcesos Actual = PrimerNodo; int i =1; while (( i != Posicion) & (Actual.siguiente != PrimerNodo)) { i++; Aux =Actua...
5e2a55ef-1090-4146-aed8-a6d1b8187e15
2
private void toggleTimeDiagrams() { final int coordX = getRightUpperCornerPosition().x + UIConstants.SPACE_BETWEEN_WINDOWS; final int coordY = getRightUpperCornerPosition().y; if (timeDiagramsWindow == null) { // singleton instance of TimeDiagram timeDiagramsWindow = new ...
057643c2-bbe7-4585-9f0c-7ea87da806a1
3
public int getBestMove(Board testBoard, ArrayList<Piece> moves) { int bestMove = 0; TreeMap<Double, Integer> ratios = new TreeMap<Double, Integer>(); for(int i = 0; i < moves.size(); i++) { double result = testMove(testBoard, moves.get(i)); if(ratios.get(result) == null) { ratios.pu...
5edd69e9-a023-40f2-8221-82d6bb0d3eac
6
@EventHandler(priority=EventPriority.HIGHEST) public void onBlockRemove(BlockBreakEvent event) { int iloscGildii = Bufor.iloscGildii; if (iloscGildii != 0) { for (int i = 0; i < iloscGildii;i++) { if (!(event.isCancelled())) { String aktualnaGildia = Bufor.listaGildii.get(i); ...
84688d38-33ac-4bca-819e-24d2982430ec
1
public InstrInfo remove() { if (first == LAST) throw new NoSuchElementException(); InstrInfo result = first; first = result.nextTodo; result.nextTodo = null; return result; }
fdc6355e-c580-42bd-ad67-d169760235a3
5
public static void main(String[] args) throws IOException { if(args.length != 2 || args[0].equalsIgnoreCase("help")) { System.out.println("Argument is empty! Please provide the path of the input.txt"); System.out.println("SkipLists Path/to/input.txt Path/to/output.txt"); return; } PrintWriter out =...
4e12f1f8-e230-4258-a9ec-a91c575be4fc
7
private static List<BarNode> listNodes(Filter<BarNode> filter, Comparator<BarNode> sorter) { List<BarNode> nodes = new ArrayList<BarNode>(NUM_SLOTS); for (int i = 0; i < NUM_SLOTS; i++) { BarNode cur = getNode(i); if (cur != null && (filter == null || filter.accept(cur))) nodes.add(cur); } if (nodes.s...
cf2f704b-b1ba-45b7-9667-b21ad00081f5
6
public static String getSpellingWithinThousand( int i ) { String tempString =""; if(i/100 >= 1) { tempString = tempString.concat(getHundredsSpelling(i)) ; } if(i/10 >= 2) { if(tempString.length()!=0 && i %100 !=0) //for hundred AND one two three texts tempString = tempString.concat(" ...
218a6670-58a2-40fa-9e97-037c092ae2d9
2
static String makeDetailsString(InstructionFromSet instructionFromSet, String instructionDescription) { StringBuilder descriptionBuilder = new StringBuilder(); descriptionBuilder .append("<html>\n") .append("<p style=\"width:250px\">").append(instructionDescription).appen...
3b9a3fc8-984e-4304-9deb-1f50308e9b67
6
private boolean hasStrongerMode(Literal literal, Literal conflictLiteral) { Mode m1 = literal.getMode(); Mode m2 = conflictLiteral.getMode(); if (m1.equals(m2)) return false; if (m1.getName().equals(m2.getName()) && m1.isNegation() != m2.isNegation()) return false; if (!strongerModeSet.containsKey(m1.getName(...
930f069a-2d0d-430d-889f-711d68ac2912
9
public void exploreSolution(){ if (isAnExit(current_cell)){ Solution sol = new Solution(); for(Cell c : this.current_solution){ sol.add(c); } this.solutions_list.add(sol); }else{ for (int i = 0 ; i < 4 ; i ++){ int newx = this.current_cell.getX() + this.directions[i].getX(); int newy =...
af1cca2f-621d-4b33-8ffd-7f53ae6a2c7a
9
public void userDetected() { Platform.runLater(new Runnable() { @Override public void run() { switch (state) { case SUPER_FREE: state = States.FREE; goToFree(); startUser(); ...
bbb2bb14-eca1-4a70-b267-e1c7505224dc
4
static boolean containsAll(int[] result, int[] a, int[] b) { for (int i = 0; i < a.length; i++) if (!contains(result, a[i])) return false; for (int i = 0; i < b.length; i++) if (!contains(result, b[i])) return false; return true; }
ed4a554d-72f7-4e77-ac16-95c1783abe81
2
public void paint(Graphics g) { Dimension d = getSize(); g.setColor(Color.white); g.fillRect(0, 0, d.width, d.height); g.setColor(Color.black); if (centerMode) { if (value >= valueRange /2) { g.fillRect(d.width / 2, 0, (value - valueRange/2) * d.width / valueRange, d.height); } else { g.fillRe...
a2a47251-73c2-4e75-9dcc-95ce0430f8ad
6
public float getOptionFloatValue(EnumOptions enumoptions) { return enumoptions == EnumOptions.MUSIC ? this.musicVolume : (enumoptions == EnumOptions.SOUND ? this.soundVolume : (enumoptions == EnumOptions.SENSITIVITY ? this.mouseSensitivity : (enumoptions == EnumOptions.BRIGHTNESS ? this.ofBrightness : (enumopti...
57f67a57-9260-4228-8ba4-9f87308e7948
0
public void setDepartureDate(LocalDate value) { this._departureDate = value; }
e0ab9549-adbc-4084-b68c-97d3485488ec
6
private boolean isLogicOperator(Token token) { if(token.getType() == TokenType.EQ || token.getType() == TokenType.GE || token.getType() == TokenType.GT || token.getType() == TokenType.LE || token.getType() == TokenType.LT || token.getType() == TokenType.NE) { return true; } else { return false; } }
72286702-c750-4ce9-9611-dda92d7bd5ac
9
@Override public void actionPerformed(ActionEvent ae) { virhekasky.setText(""); if (komennot.containsKey(ae.getSource())){ Kortti kortti=komennot.get(ae.getSource()); if (pelaaja.getOhjelma().size()==5) { virhekasky.setText("Et voi lisätä ohjelmaasi useampaa ...
72043d67-ce0e-4361-9b35-4b656bcbcc8f
9
public void target() { GameActor t = getTargetedActor(); if(t != null) { PhysicsComponent tPC = (PhysicsComponent)t.getComponent("PhysicsComponent"); if(tPC != null) { PhysicsComponent ownPC = (PhysicsComponent)getOwningActor().getComponent("PhysicsComponent"); ...
839e29c4-556a-4f20-a791-fde3f4f64628
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Candidate)) return false; Candidate other = (Candidate) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) r...
dbae53af-b5c8-40bc-b4f5-52f0954ee93f
1
private static void writeTrie(Node x) { if (x.isLeaf()) { BinaryStdOut.write(true); // leaf BinaryStdOut.write(x.ch, 8); // print char return; } // pre-order traversal BinaryStdOut.write(false); // internal node writeTrie(x.left); writeTrie(x.right); }
84240bbd-ac72-456a-ae54-ea00226edacc
3
private void addForeignKeyGenerators(List<Column> columns, String schemaName, String tableName) throws SQLException { // add Generators that can be derived from foreign key constraints. for (Column column : columns) { if (metaDataDao.hasForeignKey(tableName, column.columnName)) { ...
11ec148b-8430-4fb6-8057-b436352d8ac5
1
*/ public boolean hasValidLease() { return (cycLeaseManager == null) ? true : cycLeaseManager.hasValidLease(); }
84a3b169-3f3c-4dff-9931-cbc119a7554f
1
@Override public void run() { executor = Executors.newCachedThreadPool(); try { InetSocketAddress addr = new InetSocketAddress(8080); HttpServer server = HttpServer.create(addr, 0); server.createContext("/", new HandleHttpClientRequest()); ...
a145f6d8-e437-42ae-b8fb-0f8e5a3ecc03
5
public boolean finished() { if (actor == null) return false ; if (this == actor.mind.rootBehaviour()) { if (priorityFor(actor) <= 0) return true ; } if (nextStep() == null) { if (verbose) I.sayAbout(actor, "NO NEXT STEP") ; return true ; } return false ; }
b97f45bc-49a1-4bb8-ae6e-aea2e523c9cf
0
public void setDirs(int north, int south, int east, int west){ this.north = north; this.south = south; this.east = east; this.west = west; }
69746b5d-b35c-4082-9603-0032341ea3a2
3
protected ArrayList<Path> collectRelativeFilesInSrc1NotPresentInSrc2(final Path src1, final Path src2) throws IOException { final ArrayList<Path> src1ToSrc2Files = new ArrayList<Path>(); Files.walkFileTree(src1, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preV...
7a333eb2-131f-4e0e-9ab2-9aca83240466
4
private static String preprocess(String contents) { String[] lines = contents.split("[\n\r]+"); StringBuffer ready = new StringBuffer(); for (int i = 0; i < lines.length; i++) { String l = lines[i]; if (!l.startsWith("#") || l.matches("^\\s*$")) { ready.append(l); if (!l.trim().endsWith("|")) { ...
7ab6cad6-94aa-47d4-8f59-cf54a0fd9a96
0
public byte[] getY() { return y; }
5be97589-4ebb-4d48-879d-9226b3ec4334
0
public static void main(String[] args) { Strategy.process(new Upcase(), s); Strategy.process(new Downcase(), s); Strategy.process(new Splitter(), s); }
7284d989-7604-4253-aa4b-d425119c9e93
9
public static Map<String, String[]> readTestData(String[] dataFields) throws Exception{ int rowCount = 0; int colCount = 0; int i =0; String testDataFile = ConfigReader.getInstance().getTestDataFilesPath()+ConfigReader.getInstance().getTestCaseName()+".xls"; String environment = ConfigReader.getInst...
76620df5-c2a8-463e-9fd0-655cc484ac63
8
@Override public void run() { synchronized(lock) { startTime = java.lang.System.currentTimeMillis() + delay; } // Loops to act like a timer while(true) { if(canceled) { return; } // Saves all values for use synchronized(lock) { ...
a2f05b42-fb18-46e3-bdad-5cfe59083f1c
4
public static void createNewHome( String player, int serverLimit, int globalLimit, String home, Location loc ) throws SQLException { BSPlayer p = PlayerManager.getPlayer( player ); if ( getSimilarHome( p, home ) == null ) { int globalHomeCount = getPlayersGlobalHomeCount( p ); i...
d6bf8884-67d3-4ed6-8633-ea1327a4a641
6
private void initComponents() { setTitle("Database Export"); TableListPanel = new javax.swing.JScrollPane(); TableList = new javax.swing.JList(); ExportSubmitButton = new javax.swing.JButton(); SelectAllCheck = new javax.swing.JCheckBox(); setDefaultCloseOperation(javax....
92b60045-8ade-4f07-884a-ac36cbf19318
6
protected void possiblyUpdateCurrentLineHighlightLocation() { int width = getWidth(); int lineHeight = getLineHeight(); int dot = getCaretPosition(); // If we're wrapping lines we need to check the actual y-coordinate // of the caret, not just the line number, since a single logical // line can span multi...
88caa709-aa9b-4840-a6c3-9cc0f7329c21
5
public int hgetbits(int N) { totbit += N; int val = 0; int pos = buf_byte_idx; if (pos+N < BUFSIZE) { while (N-- > 0) { val <<= 1; val |= ((buf[pos++]!=0) ? 1 : 0); } } else { while (N-- > 0) { val <<= 1; val |= ((buf[pos]!=0) ? 1 : 0); pos = (pos+1) & BU...
fc358cf5-280d-486f-9976-1e78f42d5b0b
0
private BeverageFactory() { }
78e732d5-4f6f-4897-ab58-72838fb10db2
7
public void calculateDuplication() { Map<MonitoredAS, SingleASspikes> allUpdates = updates.getUpdateMap(); // for every monitor for (MonitoredAS monitoredAS : allUpdates.keySet()) { // get all spikes Map<Long, Spike> spikes = allUpdates.get(monitoredAS) .getAllSpikes(); // for every spike for ...
84103d69-35bb-48fd-8fdd-7d8453ab3987
3
public void setReturnAddresses(String returnAddress){ if(statement instanceof ReturnStatement) ((ReturnStatement) statement).setReturnAddress(returnAddress); if(statements instanceof ReturnStatement) ((ReturnStatement) statements).setReturnAddress(returnAddress); if(statements instanceof Statements) ...
0038a5ce-a84f-4127-bbda-7978bc1bb474
1
public void visit_land(final Instruction inst) { stackHeight -= 4; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 2; }
a65bc263-d136-4643-b60e-0a3897e8edb7
7
public static void analyseFriendsRequest(Hashtable<String, String> dataTable){ Friends newFriend = new Friends(dataTable.get("NewFriendName"), dataTable.get("NewFriendHost"), "false"); if(friendList.size() == 0) friendList.add(newFriend); else{ for(int i=0; i < friendList.size(); i++){ if(!friendList....
24354a53-8f66-4ea4-9586-8ec419b15269
3
static void removeDupFU(LinkedListNode n) { LinkedListNode m; while (n != null) { m = n.next; while (m != null) { if(n.getValue() == m.getValue()) { m.pre.next = m.next; } m = m.next; } n ...
905d3051-64f4-428f-833f-9078d8108d12
5
public ControlExample(Composite parent) { initResources(); tabFolder = new TabFolder (parent, SWT.NONE); tabs = createTabs(); for (int i=0; i<tabs.length; i++) { TabItem item = new TabItem (tabFolder, SWT.NONE); item.setText (tabs [i].getTabText ()); item.setControl (tabs [i].createTabFolderPage ...
27119e09-1f6c-4fe8-b45e-8fb97a72638a
5
public static void main(String[] args) { if (args.length < 2) { System.err.println("Usage: JPLEphemerisSpeedTester filename count"); System.exit(1); } String filename = args[0]; int nTests = Integer.parseInt(args[1]); JPLEphemeris ephemeris = null; try { FileInputStream istream = new FileInputSt...
ec0796a5-00c0-493f-a20a-ccb1e2f16731
4
@Override public Component getListCellRendererComponent(JList<? extends Record> list, Record value, int index, boolean isSelected, boolean cellHasFocus) { JPanel recordViewPanel = new JPanel(); recordViewPanel.setLayout(new BorderLayout()); ...
e1779191-cd4b-4197-a89b-2ded1af1fc6d
7
private String compareCodes(String codeToGuess, String codeSubmitted) { //logica principale del gioco: data una stringa, calcola i + e i - String answer = ""; Boolean toGuess[] = {false, false, false, false}; Boolean submitted[] = {false, false, false, false}; for(int i=0; i<4; i++){ if(codeSubmitted.ch...