method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4c937485-0822-4920-8c1d-c3bb6c7f83a6
5
private void parseFont(String baseFont) throws IOException { // load the base fonts properties files, if it isn't already loaded if (props == null) { props = new Properties(); props.load(BuiltinFont.class.getResourceAsStream("res/BaseFonts.properties")); } // mak...
6844d4eb-fb8a-4711-aea1-af507ef20ac0
4
private boolean readHeader(SeekableStream fis, long fileOffset, boolean isLowToHigh) { LittleEndianInputStream lbdis; DataInputStream bdis; byte[] buffer = new byte[BPTREE_HEADER_SIZE]; int bytesRead; try { // Read B+ tree header into a buffer fis...
dc9d869e-5662-4ea8-9412-1620e3955392
2
private boolean is_secondary(){ try{ ServerInterface remoteObj = (ServerInterface) Naming.lookup("rmi://127.0.0.1:9090/server1"); if(remoteObj.ping()){ secondary=true; } return secondary; }catch(Exception ex){ System.out.println("No Server found, assume to be primary Server"); return secondary...
96cb2f11-ef4d-4ed3-8610-f8466493998d
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainMenu frame2 = new MainMenu(); frame2.start(); new Thread(play).start(); } catch (Exception e) ...
89efe068-e90e-4965-936f-ac72fb8d9422
6
private String myInitSubString(String name) { String strTmp = null; int j = 0; for(int i = name.length() - 1; i != 0; i--) { if(name.charAt(i) == '_' && j == 0) { j = i; continue; } if(name.charAt(i) == '_' && j != 0) { strTmp = name.substring(i + 1, j); break; } } if(str...
d1468283-b923-41b8-b1bf-87dd59447921
9
@Override public int classDurationModifier(MOB myChar, Ability skill, int duration) { if(myChar==null) return duration; if((((skill.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_CRAFTINGSKILL) ||((skill.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_BUILDINGSKILL))...
0d2b2db7-d84e-4489-ae6b-b8dcd44adff1
3
public boolean horsPlateau(int a, int b){ return !(a>=0 && a<taille && b>=0 && b<taille); }
032b4195-dd47-494b-baaa-0c3beab1b42a
0
public final void sendMessage(String target, String message) { _outQueue.add("PRIVMSG " + target + " :" + message); }
d4259a65-c93d-4905-bd19-3e0a519d25b8
5
private static int readAnswer(BufferedReader reader, int choice_length){ try{ String line; int result = 0; while((line = reader.readLine()) != null){ String choice = line.toLowerCase().trim(); if(choice.length() != 1){ System.out.println("Please enter a letter."); continue; } char ...
fcc901fe-ee48-45c1-9d91-2209b8398b89
5
public static String sha1sum(File file){ String localSha1Sum = null; if (file.exists() && file.isFile() && file.canRead()){ try { MessageDigest md = MessageDigest.getInstance("SHA-1"); DigestInputStream dis = new DigestInputStream(new FileInputStream(file), md); dis.on(tru...
87a70da7-8e20-4598-bdc2-29eb3f2cd6ea
1
private void sendHttpResponse(ChannelHandlerContext ctx, FullHttpRequest req, FullHttpResponse resp) { if (!isKeepAlive(req)) { ctx.write(resp).addListener(ChannelFutureListener.CLOSE); } else { resp.headers().set(CONNECTION, HttpHeaders.Values.KEEP_ALIVE); ctx.write(...
3bcf47e6-cb8e-4af0-800d-341726b85b65
2
boolean hasVowelInMid(String str) { for (int i = 0; i < str.length(); i++) { if (str.charAt(str.length()/2)=='i') { return true; } } return false; }
ae3cf082-9f10-456d-ba1c-e098190c350c
3
private static String addParameters(DTRequest domainToolsRequest, String stringUrl){ //String parameters if(!domainToolsRequest.getParameters().isEmpty()) stringUrl = stringUrl.concat("&"+domainToolsRequest.getParameters()); //Map parameters if(domainToolsRequest.getParametersMap().size() > 0){ //If param...
a5e2f62d-16da-4d03-a342-e7932a42ae8a
6
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ElisaUser other = (ElisaUser) obj; if (!Objects.equals(this.username, other.username)) { retu...
0050893c-c08c-450b-8ec4-513552481b62
0
public void setEmail(String email) { this.email = email; }
36ba333f-a99b-4746-a089-970139c643a7
7
@Override public void paintComponents(Graphics g) { Graphics g2 = g.create(); int x, y; int w, h; Rectangle bounds = this.parent.getBounds(); if (this.skin.isChanged() || (this.btn == null) || (this.menu == null) || (this.btnSym == null) || (this.menuSym == null)) { ...
84ffa57f-509b-432f-9461-e851dc01c258
4
public Interaktionsbrett() { brett.setLayout(new BorderLayout()); brett.setDoubleBuffered(true); javax.swing.SwingUtilities.invokeLater(new Runnable() { // @Override public void run() { rahmen = new JFrame("Interaktionsbrett"); rahmen.add(brett); rahmen.setBackground(Co...
862fe6cf-4bc3-45ec-b1a3-ea7892577002
8
public String plantsHere(MOB mob, Room R) { final StringBuffer msg=new StringBuffer(""); if(R==null) return msg.toString(); final Room room=R; if((room.domainType()==Room.DOMAIN_OUTDOORS_WOODS) ||(room.domainType()==Room.DOMAIN_OUTDOORS_PLAINS) ||(room.domainType()==Room.DOMAIN_OUTDOORS_HILLS) ||((roo...
a92516d0-d421-4776-b5d5-a9f5946e6f83
5
* the number of entries to print */ private void printListTemplate(int indicator, int n) { DecimalFormat df = new DecimalFormat("#########0.00"); Node<AnyType> current = beginMarker.next; int i = 1; if (indicator == 1) { while (current != endMarker) { if (i > n) break; System.out.p...
8a75745c-9685-4b58-b1e3-bb4f39d7cf8b
4
protected boolean subrend(GOut g) { if(Config.nightvision){ return false; } GL gl = g.gl; gl.glClearColor(255, 255, 255, 255); gl.glClear(GL.GL_COLOR_BUFFER_BIT); synchronized(oc) { for(Gob gob : oc) { if(gob.sc == null) { /* Might not have been set up by the MapView yet */ continue; } ...
03462321-fbfc-4172-9492-860f3054dd0e
6
public boolean pointInPolygon(PointF point) { int j = _vertices.length - 1; boolean oddNodes = false; for (int i = 0; i < _vertices.length; i++) { if (_vertices[i].y < point.y && _vertices[j].y >= point.y || _vertices[j].y < point.y && _vertices[i].y >= point.y) ...
d7bed99d-c47d-4578-b3c6-26a678d1e1c1
2
private static void inventoryAdder(Items item){ //push to array //Items newItem = item; inventoryHasAtLeastOne = true; for (int i=0;i<inventory.length;i++){ if (inventory[i] == null){ inventory[i] = item; item.setObtained(true); ret...
a642d4bb-50b3-4642-948e-d73e503b31d7
5
final RasterToolkit method374(boolean bool, AbstractToolkit var_ha, byte i) { anInt579++; int i_3_ = bool ? ((Class42) this).anInt605 : ((Class42) this).anInt578; if (i != 127) return null; int i_4_ = i_3_ | ((AbstractToolkit) var_ha).id << -1894827875; RasterToolkit class105 = (RasterToolkit) ((Cla...
b68c0012-e064-4a14-9525-0837c45e0078
7
@Override protected GPCreature getReplacement(GPCreature current) { /**First see if crossover occurs for this creature*/ double randDouble = RANDGEN.nextDouble(); if (randDouble >= GPConfig.getProbCrossover()) return current; //do nothing in this case /**Randomly select TOURNY_SIZE-1 opponents*/ List<GP...
785d4ab6-7cb2-4a07-a3f6-3eee7c0cac8a
5
@Override public void selectGetOption(ResourceType selectedResource, int amount) { getAmount.setText(Integer.toString(amount)); getAmount.setVisible(true); //Hide them all getwood.setVisible(false); getbrick.setVisible(false); getsheep.setVisible(false); getwheat.setVisible(false); getore.setVisible...
d9e4fa5b-f401-4bea-aebb-e6bb0cc54493
9
public void get(int key) { HashPrinter.tryGet(key); /** Run along the array */ int runner = 0; int hash = (key % TABLE_INITIAL_SIZE); int secondValue = TABLE_INITIAL_SIZE; while (table[hash] == null || (table[hash] != null && (table[hash].getKey() != key)) && runner < TABLE_INITIAL_SIZE) { runner++;...
9d1c10e0-f103-4714-8f90-546dbd4fedaf
0
public void setApellido2(String apellido2) { this.apellido2 = apellido2; }
0e0e0a80-194a-4959-a7e8-7d9e06b7b61b
4
public void run() { char[] data = arc.getData(); while ( first < data.length && st.advance(pos,data[first]) ) { first++; pathLen++; } if ( first < data.length ) { // If we report a mismatch in the first byte then // multiple recursions at the end of a fully matched arc // might fail a...
9f172a1e-b8c3-41a8-9a03-b1425100fc90
3
public void readLineByLine(){ Properties prop = new Properties(); InputStream inStream = getClass().getClassLoader().getResourceAsStream("com/file/resources/file.properties"); BufferedReader bf = null; String line = null; StringBuffer stringBuffer = null; try { prop.load(inStream); String pathLocat...
143d3669-654e-49f5-8126-70b2a4d7dc2f
9
@Override public Result create(String[] conditions, String[] arguments) { //Check for parameter errors if(arguments.length>1){ return new Result(102); }else if(conditions.length!=arguments.length){ return new Result(103); }else { int product_id = -...
9e04e463-35ab-4a19-ab8e-31f66cf9910e
6
@EventHandler public void SnowmanInvisibility(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.getsnowgolemConfig().getDouble("Snowm...
451f87b7-ea11-48c1-bb09-21bb75c3c69d
1
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); oContexto.setVista("jsp/entrada/form.jsp"); EntradaBean oEntradaBean; EntradaDao oEntradaDao; oEntrad...
4f4131c7-0ea5-4d4e-99bd-b36d3cac53f0
9
private void loadServiceData(boolean generationMode) { // Write service classes headers. jTableServiceClasses.setModel(new BasicTableModel( serviceClassesList.size(), 2, false)); jTableServiceClasses.setColumnWidthRelative( new double[] {0.3, 0.7}); TableColumnModel serviceClassesColumnModel = jTable...
6b623bf8-46ea-4ef2-aa0e-7b8a6df8d150
4
public JSONObject toJSONObject(JSONArray names) throws JSONException { if (names == null || names.length() == 0 || this.length() == 0) { return null; } JSONObject jo = new JSONObject(); for (int i = 0; i < names.length(); i += 1) { jo.put(names.getString(i), this....
014200b5-a4a7-419d-8217-e57135f61507
0
@Override public String getTmp() {return tmp.toString();}
f03048ac-0163-40d5-b900-5f3810cb0968
9
public ChunkPosition getNearestInstance(World par1World, int par2, int par3, int par4) { worldObj = par1World; rand.setSeed(par1World.getSeed()); long l = rand.nextLong(); long l1 = rand.nextLong(); long l2 = (long)(par2 >> 4) * l; long l3 = (long)(par4 >> 4) * l1; ...
040cb3d6-03ef-45d4-bfba-302c56d84ad5
7
public int chkRank(List<Card> tblcrds,Player plr){ crds=new ArrayList<Card>(); for (Card card : tblcrds) { crds.add(card); } crds.add(plr.getCrd1()); crds.add(plr.getCrd2()); sort(crds); sort(crds); prnt(crds); if(isRoyalFlush()){ crds.clear(); return 100; }else if (isFourOfKnd()) { ...
afde828a-b377-4d6d-950d-d01691d56bfc
7
public ArrayList<Document> getDocs(String username, String password) throws HttpStatusException { Response res = null; ArrayList<Document> docs = new ArrayList<Document>(); /* * 1st Request ...
8c0bb625-bfac-4921-8b96-e7e5d0201bc6
5
public LogoPanel(Component parent) { initComponents(); this.setLayout(null); this.setBackground(new Color(0f,0f,0f)); this.setSize(parent.getSize()); this.setPreferredSize(parent.getPreferredSize()); try { File imgDir = new F...
166946eb-e6c2-40ca-b45b-ac069c978e9a
9
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.isElement(__in, Campaign__typeInfo)) { ...
c79c77ae-f500-4a93-a229-50d5f989a73e
4
public synchronized ArrayList<SpaceCraft> collisionCheck( SpaceCraft mover ) { // List of ships in collision ArrayList<SpaceCraft> destroyedShips = null; // Go through all the ships in the sector and compare // each against mover for( SpaceCraft target: inSector ) { // Have mover and the target shi...
30121a7b-061a-4b98-abae-af21ee3ea94f
9
public static char determineDirection(int x1, int y1, int x2, int y2){ //figure out which direction something at x1, y1 is from something at x2, y2 if(y1==y2){ //4 or 6 if(x1>x2) return '4'; //left if(x1<x2) return '6'; //right } else if(x1==x2){//8 or 2 if(y1>y2) return '8'; //up el...
06b3797e-77a9-4e03-83c3-72c35b55dc40
3
public Vector<String> lookup(String namespace) { Enumeration<?> enumeration = properties.propertyNames(); Vector<String> output = new Vector<String>(); while (enumeration.hasMoreElements()) { String possibleKey = (String) enumeration.nextElement(); if(possibleKey.starts...
fcb7ddcc-49f6-4d1b-a5be-ff515d73899d
0
public int getRowCount() { return entries.length; }
635ac6ca-fe01-4416-84df-8bc50e0d801b
1
public boolean matches(Operator loadop) { return loadop instanceof LocalLoadOperator && ((LocalLoadOperator) loadop).getLocalInfo().getSlot() == local .getSlot(); }
63e1a1e3-bfc5-4f23-a355-962233109332
3
public List<User> getFollowing(String email) { Connection connection = null; List<User> followingList = new ArrayList<User>(); String query = null; PreparedStatement statement = null; try { connection = dataSource.getConnection(); query = "SELECT users.email, users.username FROM follows ...
9a96532f-0d6a-4b61-b31f-8ed8f4988fdc
0
public String getEmail1() { return email1; }
10b426e8-2a2c-418d-9ba8-edff7e55dfc1
5
public static Class<?> loadClass(String pathToJar, String targetClassName) throws Exception { JarFile jarFile = new JarFile(pathToJar); Enumeration e = jarFile.entries(); URL[] urls = { new URL("jar:file:" + pathToJar+"!/") }; ClassLoader cl = URLClassLoader.newInstance(urls); ...
cedbda3e-9826-4c82-aa76-cdbd6c4e97f3
2
public static void copy(InputStream in, File file) { try { OutputStream out = new FileOutputStream(file); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.close(); in.close(); } catch (Exception e) { e.printStackTrace(); } }
935bbd61-9a3c-4025-ba30-a7abb8f30a15
8
public void updateNotifyFlag(PriceNotifProdDetDTO usrDTO) throws IOException { Gson gson = new Gson(); BufferedReader buffRead = null; PrintWriter out = null; PrintWriter pw = null; PriceNotifProdDetDTO getDTO; try { buffRead = new BufferedReader(new FileReader("Add_Favorites.json")); Gson gsonUpda...
aa4c62df-fa02-4b91-82bc-fb926ed25131
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Measure measure = (Measure) o; if (!m_id.equals(measure.m_id)) return false; if (!m_maxDeviation.equals(measure.m_maxDeviation)) return false; ...
c2b631c3-01b6-4494-8b47-13b11fe7be1a
6
public int minDepth(TreeNode root) { int minDepth = 0; if (root == null) { return 0; } ArrayList<TreeNode> current = new ArrayList<TreeNode>(); ArrayList<TreeNode> next = new ArrayList<TreeNode>(); current.add(root); while (!current.isEmpty()) { ...
100c4189-3d14-414d-af06-207b1bcdee61
7
public static void showRanks(Player player) { for (int i = 0; i < 316; i++) player.getPackets().sendIComponentText(275, i, ""); for (int i = 0; i < ranks.length; i++) { if (ranks[i] == null) break; String text; if (i >= 0 && i <= 2) text = "<img=1><col=ff9900>"; else if (i <= 9) text = "<...
ceeff9a7-422b-4ec8-9e72-a6b46f49710d
7
public String getContentOfSelectionAsBlock(int x, int y, int height, int width) throws DoenstFitException { //Outside of image if (x > img.getWidth() || y > img.getHeight()) return null; if (height + y > img.getHeight()) height = img.getHeight() - y; if (width +...
acc460e2-2b5f-43e0-8cde-39c1dd252f4f
1
private void resetGraph() { valid = true; for( Regraphable regraphable : regraphables ) { regraphable.regraphed(); } repaint(); }
63ec1f35-6ece-4059-87a6-dde88ae7a722
6
private static List<Holder> getHolders( OtuWrapper wrapper ) throws Exception { List<Holder> list = new ArrayList<Holder>(); for( int x=0; x < wrapper.getOtuNames().size(); x++) { Holder h= new Holder(); h.taxaName = wrapper.getOtuNames().get(x); list.add(h); for( int y=0; y < wrapper.getSam...
ee616199-88c5-4192-8aac-ddde17d405ab
0
public void setName(String name) { this.name = name; }
6883790b-290c-49c3-92ae-4328ab508a30
8
List<CourseListing> getByCategory(String selectedCategory) { List<CourseListing> courseListing = new ArrayList<CourseListing>(); try { //Connect to database conn = DriverManager.getConnection(url, userName, password); stmt = conn.createStatement(); Res...
98ed06b2-b089-4eef-9b12-793a19753719
5
@Override public boolean dispatchKeyEvent(KeyEvent arg0) { //this method is called twice: once for key pressed and again for released, ignore release //otherwise it will try to execute the command twice if(arg0.getID() != KeyEvent.KEY_PRESSED) return false; int keyPressed = arg0.getKeyCode(); if (keyPr...
f6270c73-5a7f-4153-b84d-dda14791fc51
9
public void run() { while(!player.getSocket().isClosed()){ try { String response = reader.readLine(); if(response.startsWith("MY BET")){ System.out.println("EMPEZANDO APUESTAS!!!"); String rx_numbers = response.substring("MY BET ".length(), response.length()); String rx_bet[] = rx_num...
b7ecf428-b0f9-4911-b8df-4a2cebb32f68
2
public Core createRootObject(GedcomRecord record) { String xref = record.getXref(); if (xref == null) { return new Note(record.getContent()); } else { Note note = (Note) getObjectByXref(xref); if (note == null) { note = new Note(record.getContent()); putObjectByXref(xref, note); } return...
d755b629-4c58-43c1-95db-a2ee7883e36b
4
void computeTextWidths (GC gc) { if ((parent.getStyle () & SWT.VIRTUAL) != 0 && !cached) return; /* nothing to do */ int validColumnCount = Math.max (1, parent.columns.length); textWidths = new int [validColumnCount]; for (int i = 0; i < textWidths.length; i++) { String value = getDisplayText (i); if (value !=...
15545ecf-c4f5-430b-b756-c763f6388f7c
5
public void dividir(Integer num) { int cont = 0; Nodo<T> q = p; while (q != null) { q = q.getLiga(); cont++; } q = p; int primeraParte = cont - cont / 2; cont = 0; if (num == 1) { while (cont != primeraParte) { ...
5e272694-4202-4f21-845a-faf4d6d35c16
5
public static String[] parseString(String str) throws IllegalArgumentException { // Tokens are split using quotation marks StringTokenizer strTok = new StringTokenizer(str, "\""); // An arraylist is used to store the tokens ArrayList<String> tokens = new ArrayList<String>(); // 2 or 4 tokens required for leg...
30899d61-6d4f-4609-a5c2-28121023e1c0
3
public void catchPowerUp(int type) { switch (type) { case 0: teleports += 1; tCount++; break; case 1: plusCount++; break; case 2: minusCount++; break; } ...
80da3f64-00f3-4f96-a691-8694a6daa0aa
0
public void keyReleased(KeyEvent e) { }
6c33d19d-676c-4403-bee3-2521e53ebb83
2
public static void puntos() { file = new File("."); ruta = file.getAbsolutePath(); Thread hilo = new Thread() { @Override public void run() { try { Thread.sleep(1); FileInputStream fis; Player pla...
932427be-0f7d-4ad5-8d80-62158c2c76de
2
public static int validateDirection(int dir) { for (int i = 0; i < directions.length; i++) if (dir == directions[i]) return dir; return ((dir % 4) + 4) % 4; //This is in case it's negative }
2761923d-36d8-4bab-9331-f00826b919ce
4
public IrcUser getUser(String nick) { for(IrcUser u: Users) { if(u == null) continue; if(u.getNick() == null) continue; if(u.getNick().equals(nick)) return u; } return null; }
1688dd7b-9df7-42cc-929c-4ca1ca3f0307
9
public static CookieParams verifyCookie(String cookie, ITranslator translator) throws InvalidCookieException { System.out.println("verifying login cookie: " + cookie); int userCookieIndex = cookie.indexOf("catan.user="); CookieParams result; if (userCookieIndex != -1) { cookie = cookie.replaceFirst(...
0b366cb8-8fd2-4d60-8f6e-674cb05c8da2
9
public static Integer intArith( Vector< Var > vars, String e ){ char o = operand( e ); if( o == ' ' ){ return intFilter( vars, e ); } String pair[] = oSplit( o, e ); pair[0] = pair[0].trim(); pair[1] = pair[1].trim(); if( pair.length != 2 ) { System.out.println("ERRO: So e permiti...
001f9711-317e-4947-963d-badd16f01cff
7
@Override public HandshakeState acceptHandshakeAsClient( ClientHandshake request, ServerHandshake response ) { if( failed ) { return HandshakeState.NOT_MATCHED; } try { if( !response.getFieldValue( "Sec-WebSocket-Origin" ).equals( request.getFieldValue( "Origin" ) ) || !basicAccept( response ) ) { ret...
4d882274-6ec7-40c9-9f0f-005672915f8d
5
public void visitLookupSwitchInsn( final Label dflt, final int[] keys, final Label[] labels) { buf.setLength(0); for (int i = 0; i < labels.length; ++i) { declareLabel(labels[i]); } declareLabel(dflt); buf.append("mv.visitLookupSwitchInsn(...
76b5a75f-d88c-49af-87bd-aae1d602e7d4
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; CommodityPO other = (CommodityPO)obj; if (this.name == null) { if (other.name != null) return false; } else if (!this.name.equals...
0770f50f-2b5e-4c6d-96d5-8ecdfe4cf31e
6
public synchronized void playSound(final String soundName) { if (soundName == null || soundName.isEmpty()) { return; } new Thread(new Runnable() { @Override public void run() { try { playClip(soundName); } catch (IOException e) { System.out.println(e.getLocalizedMe...
399afa1c-4406-49dd-a576-bfedb125f2c2
4
public void createBackup() throws AlreadyModdedException { logger.debug("Attempt to backup all Files from " + pack.getName()); if (!hasBackup()) { try { for (File file : files) { File bakFile = new File(file.getAbsolutePath() + "_bak"); if (!bakFile.exists()) { logger.debug("Creating Backup: ...
e7d21361-8d46-42cd-8a15-535110d69219
2
public String lowMonth(){ double least = profit[0]; String leastMonth = month[0]; for(int i = 1; i < 12; i++){ if(least > profit[i]){ least = profit[i]; leastMonth = month[i]; } } return leastMonth; }
1033813c-66bb-438c-b125-158c349322f7
1
@Override protected Map<AbstractPage, List<ProgressReportStruct>> doInBackground() throws Exception { workerThread = Thread.currentThread(); if (jm != null) jm.goGoGo(); // -> several calls to PageJob.report() -> jm.report() -> SwingWorker.publish() -> this.process() -> gui.updateTree() return bulkResults; //...
d7626f4c-a763-4d5c-ad11-7be2b76be37e
7
public void compFinalResult() { do { iStage++; compAllocation(); if (compDistribution()) { /* deadline can not be satisfied */ if (!bDeadline) { System.out.println("THE DEADLINE CAN NOT BE SATISFIED!"); return; } else { System.out.println("\nNEW ROUND WITHOUT CHECKING:"); dEv...
12d6d7bd-1e3b-4209-b348-3c694d3b4019
3
public ResizingByteBuffer setRange(int destination, byte[] newData) { if(newData == null) return this; ensureSpaceFor(destination + newData.length); for(int i=0;i<newData.length;i++) { buf[destination+i]=newData[i]; } if(destination + newData.length > this.index) { // if buffer grew, move index ba...
6f8df400-ffa0-477d-b475-db09a8f5bcf4
2
public boolean equals(Object obj) { if (obj == null) { return false; } if (obj instanceof Scores) { Scores sobj = (Scores) obj; return highScore() == sobj.highScore(); } else { return false; } }
2afdf50d-cec9-469c-a0bc-db68d3577cc6
6
private void logonButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logonButtonActionPerformed userName = ""; password = null; // getting data from textfield and password field and storing in variable userName = usernameTF.getText(); password = password...
89ba080c-1fa5-4e96-ad63-990ce9ffb5fe
4
private static DirKey decodeDir(String dirS){ if(dirS.trim().equals("up")){ return DirKey.Up; } else if(dirS.trim().equals("down")){ return DirKey.Down; } else if(dirS.trim().equals("left")){ return DirKey.Left; } else if(dirS.trim().equals("right")){ return DirKey.Right; } else{ return...
1feba5a9-f6c0-44b1-8089-f69b0de59d23
8
public int[] generate(int nplayers, int bowlsize) { int nfruits = nplayers * bowlsize; // first randomly select one fruit to be guaranteed absent int r1 = (int) (Math.random() * 12); // fill distribution with random number from 1 to nfruits // disregarding the fruit we ...
66edcbc4-df6f-4ea5-8f12-e7db760666bf
6
public VertexSet getNeighbourhood(City city){ if (cityList.containsID(city.getID())) { VertexSet result = new VertexSet(); City cityOne; City cityTwo; for (Path p : pathList) { cityOne = p.getFirstCity(); cityTwo =...
0caeec62-c4c1-4a8c-a29e-35c612ed48e2
0
public List<String> getSearchedSites() { List<String> searchedSites = new ArrayList<String>(); // TODO return searchedSites; }
560020f4-fdde-4601-8d96-f4af0172d504
5
@Override public void stepFoward(){ if(isSliding() || isFull){ super.stepFoward(); return; } turn(isRightRight()? -.004 : .004); counter ++; if(counter > 1){ if(getSpeed() < 4) addForwardSpeed(.02); else addForwardSpeed...
4d73e1f1-66ca-44df-977f-2774bbbf376f
9
private int searchForItem(String s, int startIndex, boolean wrap) { int size = getSize(); int lastIndex = size - 1; if (startIndex > lastIndex) { if (wrap) { startIndex = 0; } else { startIndex = lastIndex; } ...
2c917ce1-70ce-43c4-8257-2a143e9d02a2
5
private boolean nameInUse() { if (tfFirstName.getText().isEmpty() || tfFamilyName.getText().isEmpty()) { lblNameInUse.setVisible(false); return true; } else { String firstName = tfFirstName.getText(); String familyName = tfFamilyName.getText(); ...
93c2a0bd-2c3c-4b3d-b363-f7201b8dcc93
1
public String getPath(int index) { if (index > mainCon.size()-1) return ""; return mainCon.get(index).getPath(); }
f20190fd-121f-4e1e-a9f8-4902952b6a47
3
private void buildList(File[] files, ArrayList<File> mp3s) { for (File file : files) { if (file.isDirectory()) { buildList(file.listFiles(), mp3s); // Calls same method again. } else { if(file.getName().endsWith(".mp3") == true){ mp3s.add(file); ...
d013f9d4-632f-4552-85b6-e6406d53b557
4
public byte[] sign(Serializable obj) throws SignatureException { try { //Signature algorithm initialization RSAsign.initSign(keyPair.getPrivate()); //Transform the object to be signed to a byte[] byte[] bytes = toBytes(obj); //Signature ByteArrayInputStream bufin = new ByteArrayInputStream(b...
7bcde86c-0ce4-4842-af4a-457098d1c532
6
private void remedyDoubleBlack(Position<Entry<K,V>> p) { Position<Entry<K,V>> z = parent(p); Position<Entry<K,V>> y = sibling(p); if (isBlack(y)) { if (isRed(left(y)) || isRed(right(y))) { // Case 1: trinode restructuring Position<Entry<K,V>> x = (isRed(left(y)) ? left(y) : right(y)); ...
0f899a56-f883-4ab6-ad18-181c5f5ab572
5
public static boolean isPrime(int x) { if (x == 2) { return true; } if (x % 2 == 0 || x == 1) { return false; } for (int i = 3; i * i <= Math.abs(x); i += 2) { if (x % i == 0) { return false; } } return true; }
358c2153-d761-4481-bcb7-3f40898535bf
4
public void librarian_menu() throws Exception{ int lib_menu; System.out.println("------------------------------"); System.out.println("1. "); System.out.println("2. Ʈ"); System.out.println("3. "); System.out.println("4. α׾ƿ"); System.out.println("------------------------------"); System.out.print("...
56c6e3b5-0d34-4ceb-998b-32e68175e9b8
1
public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub Grammar g = environment.getGrammar(UnrestrictedGrammar.class); Production[] p=g.getProductions(); Grammar g_trimmed=trim(p); // FrameFactory.createFrame(g_trimed); if (g == null) return; TMBruteParsePane bpp = new TMBrut...
7001e793-1cfd-4a0e-ae93-3c36f4fc5918
9
public Operation opperation() { Scanner scanner = new Scanner(System.in); out.println("Bitte wählen Sie Ihre Rechenoperation aus: "); out.println(" 0 = Hauptmenü "); out.println(" 1 = Addition "); out.println(" 2 = Subtraktion "); out.println(" 3 = Multiplikation "); ...
88cb9347-b005-45d1-ac95-102ee390a3df
4
public double value(StateObservationMulti a_gameState) { boolean gameOver = a_gameState.isGameOver(); Types.WINNER win = a_gameState.getMultiGameWinner()[id]; double rawScore = a_gameState.getGameScore(id); if(gameOver && win == Types.WINNER.PLAYER_LOSES) rawScore += HUGE...
8cb35b5b-ac24-4deb-90a1-efbae84329dd
5
public static <V> List<V> sort(List<V> list, Comparator<? super V> sortRule) { if (list.size() < 2) return list; List<V> sorted = new ArrayList<>(list.size()); // We need initial compare values. sorted.add(list.get(0)); sorted.add(list.get(1)); int i = 0, j...
9c3dc529-fa1b-4520-afaf-117968f0739f
2
public Matrix(int x, int y){ this.x = x; this.y = y; mat = new int[x][y]; for(int i = 0; i < x; i++){ for(int j = 0; j < y; j++){ mat[i][j] = 1; } } }