method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ec2e348c-8d55-4cf2-a936-ae7178e4af6f | 6 | private void normalMode() {
boolean isDropBomb;
int count = 0;
gameMode = "Normal Mode";
System.out.println("----------- NORAML MODE -----------");
System.out.println("Tip: Press \"Q\" for quit Game");
while (true) {
Coordinate dropBomb = this.inputPosition();... |
d9604855-ce7b-4373-a0f5-ecd8dfb1961f | 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.... |
620e0b32-8d91-468d-9d1c-de7a66195b55 | 3 | private void handleLs(String[] cmdLine){
if(0 == workersMap.size())
System.out.println("no worker in system");
else{
for(int i : workersMap.keySet()){
//System.out.println("id "+i+"status "+workerStatusMap.get(i));
if(workerStatusMap.get(i) == -1)
... |
d084248b-6190-4fe3-b7ef-097f0ae0e469 | 1 | @Override
public Object call() throws Exception {
E item = null;
while (!Thread.currentThread().isInterrupted()) {
lock.lock();
// wait while the queue is empty
notEmpty.await();
// new client came to the queue
try {
... |
2a57fc02-96ed-49e0-a4b5-fa5ae7171d89 | 9 | private static int traverseParallel(Node node, CharSequence[] strings,
int pos, int deep, List<Callable<Object>> jobs) {
final int BIND_LIMIT = THRESHOLD / SUBBUCKET_THRESHOLD;
for (char c = 0; c < ALPHABET; c++) {
int count = node.size(c);
if (count < 0) {
... |
e551a6db-ef9e-486f-a092-9cfe4e7a2a6d | 2 | private void jButtonJouerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonJouerActionPerformed
// Recuperation de la taille du tableau choisie
String[] taille = ((String)this.jComboBoxTailleGrilles.getSelectedItem()).split("x");
int x = Integer.parseInt(taille[0]);
... |
fee67557-3f81-4c2f-9836-62d7dd46ebf7 | 4 | private void startMelangeAlphanumerique(){
boolean valeurValide;
while(true){
valeurValide = true;
String chaineACoder = "";
int choixDecalage = 1;
System.out.println("Entrez la phrase à melanger: ");
chaineACoder = sc.nextLine();
System.out.println("Choisissez le decalage:");
try{
choix... |
97bc8a72-03b4-4db3-8efb-f37e7b7e424c | 9 | private void heuristicInreply(List<MM2Message> messages, Connection connection) {
// This is the msg_id ==> in-reply-to
Hashtable<String, String> msg_id_to_message_id = new Hashtable<String, String>();
// This is message-id ==> msg_id
Hashtable<String, String> message_id_to_msg_id = new Hashtable<String, Str... |
c963ff69-c827-47cd-aff2-b627942a05c3 | 0 | public int getTailleY() {
return plateau.getTailleY();
} |
9b06453a-2807-4319-959b-811958380429 | 9 | public int getMinimum(String[] area) {
Map<String, Integer> repeatedNum = new HashMap<String, Integer>();
int average = 0;
int totalDiff = 0;
int max = 0;
for(String str : area) {
for(int i=0; i<str.length(); i++) {
Integer val = repeatedNum.get(new String(""+str.charAt(i)));
if(val == null) {
... |
7e958fb1-6969-48af-9145-58684585fbab | 9 | static String[] matchPrefixedField(String prefix, String rawText, char endChar, boolean trim) {
Vector matches = null;
int i = 0;
int max = rawText.length();
while (i < max) {
i = rawText.indexOf(prefix, i);
if (i < 0) {
break;
}
i += prefix.length(); // Skip past this pr... |
865a39bd-cc19-4a5b-85b2-ba0c80d6c7f9 | 0 | public final void setWrapWidth(double wrapWidth) {
this.wrapWidth.set(wrapWidth);
} |
7e2ec63f-b7bd-4f6d-8365-bfe3049a411e | 1 | private void createContent(){
if(contentPanelContent == null){
contentPanelContent = new JPanel();
}
// TODO Create Method
contentPanelContent.add(new JLabel("Dummy"));
} |
220c2870-f80c-423d-bfd9-21e95ae5960a | 2 | boolean hasAnnotations(ChangeEffect changeEffect) {
return changeEffect.getMarker() != null // Do we have a marker?
&& (changeEffect.getMarker() instanceof Custom) // Is it 'custom'?
&& ((Custom) changeEffect.getMarker()).hasAnnotations() // Does it have additional annotations?
;
} |
7b8ae978-fa74-479a-8168-c318dbf05101 | 1 | public void listarProjetos() {
ProjetoBO projet = new ProjetoBO();
try {
tbProjetos.setModel(DbUtils.resultSetToTableModel(projet.preencheTabela(usuarioLogado.getDepartamento().getCodigo())));
} catch (SQLException ex) {
}
} |
3e082e9d-b8c5-456a-adba-54cb8708e050 | 3 | public ClosedLoop copy(){
if(this==null){
return null;
}
else{
ClosedLoop bb = new ClosedLoop();
this.copyBBvariables(bb);
bb.nFeedbackBoxes = this.nFeedbackBoxes;
bb.checkNoMix = this.checkNoMix;
bb.checkConsolidate = this... |
dcb1b9d7-8aff-4663-be09-f5295dd9c808 | 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... |
0cf672de-2bc3-4e91-a200-3f60d5c00132 | 7 | public static OOXMLElement parseOOXML( XmlPullParser xpp )
{
HashMap<String, String> attrs = new HashMap<>();
try
{
int eventType = xpp.getEventType();
while( eventType != XmlPullParser.END_DOCUMENT )
{
if( eventType == XmlPullParser.START_TAG )
{
String tnm = xpp.getName();
if( tnm.eq... |
c5c1f7c5-2589-4659-a4fc-1b72ed9648bc | 5 | public void stopPlugins() {
final Thread curThread = Thread.currentThread();
for (int i = 0; i < pluginsToRun.size(); i++) {
final IRCPlugin plugin = pluginsToRun.get(i);
if (plugin != null && plugin.isActive()) {
if (pluginThreads.get(i) == curThread) {
... |
5c20f78e-665d-407d-977b-5619f735858e | 8 | public static ArrayList<Integer> getMinCoins2(int[] denoms, int sum)
{
ArrayList<Integer> vals = new ArrayList();
if (sum == 0)
{
return vals;
}
if (sum <= -1)
{
return null;
}
ArrayList<ArrayList<Inte... |
f29d2f51-53f5-45db-b00d-04ddc3f50558 | 8 | private void encrypt(){
System.out.println("going to encrypt: " + historyFile + " end of file.");
BigInteger keyString = init.getHpwd();
// setup AES cipher in CBC mode with PKCS #5 padding
Cipher cipher = null;
try {
cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
} catch (NoSuchAlgorithmException... |
024dc436-551c-4fba-9b01-57c01a9ad899 | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE) ... |
addbe2b5-4798-4b10-848b-56caa3e33b28 | 4 | @GET
@Path("/{username}")
@Produces(MediaType.LIBROS_API_USER)
public User getUser(@PathParam("username") String username) {
User user = new User();
Connection conn = null;
Statement stmt = null;
String sql;
try {
conn = ds.getConnection();
} catch (SQLException e) {
throw new ServiceUnavailableEx... |
fb7ebba8-4a32-4610-9812-be6faf3a910d | 6 | public void run() throws IOException {
this.welcomingSocket = new ServerSocket(port);
this.welcomingSocket.setSoTimeout(100000);
try {
System.out.println("Waiting for client on port "
+ welcomingSocket.getLocalPort() + "...");
Socket server = welcomingSocket.accept();
System.out.println("Local s... |
7a3b0a13-c5cc-4516-96e4-dbe8dc82b80a | 8 | private ArrayList<String> getRelevantOperands(String format) {
ArrayList<String> relevantOps = new ArrayList<String>();
String[] mnemFormatSplit = format.split("\\s+");
ArrayList<String> mnemFormatTokens = new ArrayList<String>();
for (String formatTerm : mnemFormatSplit) {
formatTerm = formatTerm.repla... |
d22a274b-f807-4e20-b4ed-80adc5f2e125 | 0 | private void removeUpgrade(Upgrade upgrade, BodyPart bodyPart){
bodyPart.removeUpgrade(upgrade);
upgrade.setUsed(false);
} |
f485c986-8a98-4cf1-b59f-b4e1a48a36e3 | 6 | public static double regularisedGammaFunction(double a, double x) {
if (a < 0.0D || x < 0.0D) throw new IllegalArgumentException("\nFunction defined only for a >= 0 and x>=0");
boolean oldIgSupress = Stat.igSupress;
Stat.igSupress = true;
double igf = 0.0D;
if (x != 0) {
if (x < a + 1.0D) {
// Series... |
63876957-a7cf-4ef0-8fda-e0affc93f3c5 | 9 | public boolean doDownload() throws IOException{
URL fullURL = new URL(srcUrl.toString() + srcFileName);
Logger.log("Start downloading file: " + fullURL.toString());
URLConnection uc = fullURL.openConnection();
uc.setReadTimeout(0);
String contentType = uc.getContentType();
int contentLength = ... |
15ab565a-9ca6-4f36-b9a8-da98777d22fe | 3 | public MobHandler() {
for(int i = 0; i < 10; i++)
mobs.add(new Mob_GreenGoo());
for(int i = 0; i < 10; i++)
mobs.add(new Mob_RedGoo());
for (int i = 0; i < 200; i++) {
mobs.add(new Mob_Mouse());
}
Console.log("Initialized GreenGoo");
} |
993d11fd-5207-448d-a357-cdf4ce5cf2c2 | 5 | public boolean canRatGoForward(MazeRat rat) {
int offX = 0, offY = 0;
switch (rat.dir) {
case EAST:
offX = 1;
break;
case NORTH:
offY = -1;
break;
case SOUTH:
offY = 1;
break;
case WEST:
offX = -1;
break;
default:
return false;
}
try {
return (maze[rat.position.y + offY]... |
5f4e9124-224f-4d62-96cf-e8162fb16f04 | 2 | public void ensureCapacity(int capacity) {
if(data == null) {
data = new byte[capacity];
}
else if (data.length < capacity) {
byte[] nb = new byte[capacity];
System.arraycopy(data, 0, nb, 0, data.length);
data = nb;
}
} |
626a6c4b-ee04-45f2-b7bc-14a3be418bae | 9 | public void drawLines(GC gc) {
ArrayList<Wall> wallsList;
if (intersectionPoints.size() != 0) {
Drawer.drawLine(gc, new Point2D(0, y), intersectionPoints.get(0), Main.backgroundColor);
Drawer.drawLine(gc, intersectionPoints.get(intersectionPoints.size() - 1), new Point2D(Constant... |
c35e0435-68c4-4877-bed4-dfeed88e2f5a | 9 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + dimensionCount;
result = prime * result + dimensionNumBytes;
result = prime * result + ((docValuesType == null) ? 0 : docValuesType.hashCode());
result = prime * result + indexOptions.hashCode();
... |
1b20287a-f60c-44c2-8e10-60e6be14b505 | 0 | public TravelTrip findById(int id){
return em.find(TravelTrip.class, id);
} |
6778a7e8-ad86-4e57-b412-dcf7541c3d56 | 6 | */
public void display(Graphics2D g) {
if ((freeColClient.getGame() != null)
&& (freeColClient.getGame().getMap() != null)
&& (focus != null)
&& freeColClient.isInGame()) {
removeOldMessages();
displayMap(g);
} else {
... |
ce05c614-299c-4443-824a-985d9a958705 | 3 | public int multiply(int n1, int n2) {
if (n1 == 0 || n2 == 0) { // edge case
return 0;
}
else if ( n2 < 0 ) {
return - n1 + multiply(n1, n2 + 1);
}
else {
return n1 + multiply(n1, n2 - 1);
}
} |
de68d0cf-2070-4d32-8211-db66963702f3 | 5 | public void chcur(Gob cur) {
this.cur = cur;
GobHealth hlt = cur.getattr(GobHealth.class);
fx = null;
if (hlt != null)
fx = hlt.getfx();
if (cur.highlight != null) {
long t = System.currentTimeMillis(... |
3b3e339a-6a67-49cf-bae4-15487f366e62 | 9 | private static List<Operation> getOperations(char[] source, char[] target, int[][] positionMinimum) {
List<Operation> operations = new ArrayList<>();
boolean stop = false;
int i = source.length;
int j = target.length;
Character operandeG;
Character operandeD;
wh... |
e6f85fc4-e112-4e95-af9f-eaf56dc4afd3 | 0 | @Test
public void equalsShouldWorkAccordingToContract() {
Chance coinToss = new Chance(0.5);
assertFalse(coinToss.equals(null));
} |
2e050888-93f0-42b6-848f-acd2404f0d1a | 2 | private static Integer getInt() {
Boolean flag;
int numInt = 0;
do {
Scanner scanner = new Scanner(System.in);
try {
numInt = scanner.nextInt();
flag = true;
} catch (Exception e) {
flag = false;
System.out.println("Input type mismatch!");
System.out.print("Please input in Integer: ")... |
e1fe7b87-cfe7-427d-898d-d316890f011c | 3 | @Test
public void setTiles(){
Tile[][] tiles = new Tile[10][10];
for (int x = 0; x < tiles.length; x++){
for(int y = 0; y < tiles[0].length; y++){
tiles[x][y] = new Tile(new Position(x, y), 0);
}
}
World w = new World(null);
w.setTiles(tiles);
assertTrue(w.getTiles().length == 10 && w.ge... |
811b9276-991c-42dc-b392-0f0690474d3b | 7 | @Override
public void actionPerformed(ActionEvent ae) {
// TODO Auto-generated method stub
if(ae.getSource()==comboBox1 ){
//System.out.println(comboBoxRoom);
RoomDataSource roomDS = new RoomDataSource();
List<edu.cgu.ist303.db.Room> roomSingle = new ArrayList<edu.cgu.ist303.db.Room>();
roomSing... |
aeb977e6-1adb-449b-9f43-08ccce8ce936 | 0 | @Override
public boolean supportsDocumentAttributes() {return true;} |
3d22548c-5941-44be-9837-3be6ca120969 | 8 | public WareHouseKeeper(Player player, Day current, BackToSchool frame){
backgroundSong = new Sound("sounds/Background/POL-misty-cave-short.wav");
backgroundSong.playSound();
student = player;
day = current;
this.frame = frame;
earnedPercentage=0;
int delay = 1000; //milliseconds... |
8f55252c-df7e-4e32-a361-f20e13d35b19 | 4 | @Override public void run()
{
while(true)
{
if(kayttajanKomento != Komento.EI_KOMENTOA)
kasitteleKayttajanKomento();
if(!peliOnKaynnissa())
this.pelitilanteenPiirtaja.paivitaTilanne();
else
{
... |
bac55cae-1926-401d-9446-3870beaf94fe | 0 | public Ikkuna(Pelaaja pelaaja, Kamera kamera) {
super();
this.pelaaja = pelaaja;
this.kamera = kamera;
} |
a4dc7f5e-8614-4824-95b6-4fd974d762a1 | 6 | public void getNextPosition() {
if (left) {
dx -= moveSpeed;
if (dx < -maxSpeed)
dx = -maxSpeed;
} else if (right) {
dx += moveSpeed;
if (dx > maxSpeed)
dx = maxSpeed;
}
if (falling && !ignoreGravity)
dy += fallSpeed;
} |
6392c803-2dec-4448-86d5-819734ca4356 | 1 | @Override
/**Observer Interface method. It executes when a message is received.*/
public void update(Observable obs, Object obj) {
NetworkMessage message = (NetworkMessage)obj;
//If we are greeted, we say hi back.
if(message.getType() == NetworkMessage.TYPE_HELLO){
sender.sen... |
044ec4f3-d947-4665-b337-fa6d9873fac3 | 9 | public String guessName() {
if (shadow != null) {
while (shadow.shadow != null) {
shadow = shadow.shadow;
}
return shadow.guessName();
}
if (name == null) {
Enumeration enum_ = hints.elements();
while (enum_.hasMoreElements()) {
Hint hint = (Hint) enum_.nextElement();
if (type.isOfType(... |
4b6d2d63-1046-49ef-936c-12fb52b12ab2 | 0 | public int getRowsCount() {
return m_rowsCount;
} |
d28deee9-84cf-4926-a3d2-d59433605124 | 9 | private List<ProductIon> addProductIonListByCharge(PrecursorIon precursorIon, int charge) {
List<ProductIon> ionList = new ArrayList<ProductIon>();
switch (ionPair) {
case B_Y:
ionList.addAll(ProductIonFactory.createDefaultProductIons(precursorIon, ProductIonType.B, charge))... |
94e70f63-aafe-40f4-8d45-9983955a4c96 | 3 | boolean isSubset( BitSet bs1, BitSet bs2 )
{
for ( int i = bs1.nextSetBit(0);i>=0;i=bs1.nextSetBit(i+1) )
if ( bs2.nextSetBit(i)!=i )
return false;
return true && bs2.cardinality()>bs1.cardinality();
} |
6d9247d4-be51-4789-95ad-0c0e55f21b0a | 0 | @Override
public void setMyProcess(Process p) {
// Nothing here
} |
13f99baa-a82e-4d8d-bd91-276ab2283866 | 7 | public static void main(String[] args) {
String result = "aAddress, Address Select EmployeeCode,EmployeeName,Address1,Address2,Address3,Addressaa";
String keyWord = "Address";
int position = 0;
while(true) {
if (position >= result.length()) break;
int index = result.indexOf(keyWord, position);
i... |
397249dd-6d86-49c9-9d97-b22364b91254 | 5 | public static boolean validateHash(byte[] hash1, byte[] hash2) {
if (hash1 != null && hash2 != null && hash1.length == hash2.length) {
for (int i = 0; i < hash1.length; i++) {
if (hash1[i] != hash2[i]) {
return false;
}
}
re... |
cf435b18-9c43-44fa-ae68-9069414f8c94 | 5 | @Override
//Metodo que permite la modificacion de un producto existente en la BBDD
public boolean modificarProducto(TProducto producto)
{
boolean correcto=false;
TransactionManager.obtenerInstanacia().nuevaTransaccion();
try
{
//Iniciamos la transsacion y bloquea... |
5319fcf0-0aa7-4d30-9c52-639270f74405 | 0 | public ListRender() {
setOpaque(true);
} |
1c727452-fd87-478f-8036-280902a85863 | 8 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Contact other = (Contact) obj;
if (!Objects.equals(this.firstName, other.firstName)) {
return... |
eac7de36-5dcc-439b-98e0-cbb6b0ee6d52 | 6 | public static HashMap<Float, Integer> mapHitsToScore(File inputFile) throws Exception
{
System.out.println("PARSING: " + inputFile.getAbsolutePath());
BufferedReader reader =
inputFile.getName().toUpperCase().endsWith("GZ") ?
new BufferedReader(new InputStreamReader(
new GZIPInputStream( new FileInp... |
8598b183-865f-4c16-8c1c-f482b9376c7a | 0 | public IInfoflowConfig getSootConfig() {
return this.sootConfig;
} |
26b377a4-f3d5-4321-9317-e7fb410c2064 | 2 | private int getNextRosterID() {
int m = 0;
for (Roster r: rosters) {
if (r.getRosterID() > m) {
m = r.getRosterID();
}
}
return m+1;
} |
ab62dcf3-3442-40a4-bcd0-0ccd12bf78ef | 3 | public static int [][] getVectors(String fileLocation) throws FileNotFoundException{
File file = new File(fileLocation);
Scanner scan = new Scanner(file);
//instantiate ArrayList to store inputs
ArrayList<String> input = new ArrayList<String>();
while(scan.hasNextLine())
input.add(scan.nextLine()); //add ... |
1745ef1e-29c5-4431-9682-8b1a3e73407a | 8 | public void addToPlace(String value, int number) {
ListElement index = head;
if (number == 1 || index == null) {
addToBegin(value);
}
if ((number > 1) && (number <= numberOfElements())) {
while (index.next != null) {
for (int i = 1; i < number - 1;... |
4037b453-68dc-44ce-942a-1cbcf05a5360 | 5 | private void initialiseComponents() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
} catch (InstantiationExc... |
7548f7da-9212-40b4-89f3-3b12eb2eeb57 | 4 | public Game createNewGame(Game game) {
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
String url = "jdbc:derby:" + DBName;
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
PreparedStatement pstmt = connection.prepareStatemen... |
b13409ad-1ca1-4391-943a-b41970e5c4e4 | 4 | public boolean deleteBooking(int id){
Booking booking = null;
try {
booking = getBookingDao().queryForId(id);
if(booking!=null){
for(Room room : getRoom(booking)){
removeRoomTo(booking, room);
}
for(Equipment equipment : getEquipment(booking)){
removeEquipmentTo(booking, equi... |
f28e974a-6834-4f32-a2f6-64306cfe5f5e | 8 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
if (cariText.getText().equalsIgnoreCase("") || cariText.getText() == null... |
0900b7e7-8d4b-4cbd-ac4d-70123442c7b4 | 6 | @EventHandler
public void MagmaCubeInvisibility(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.getMagmaCubeConfig().getDouble("Mag... |
128c6496-d174-4b98-90b8-7b4337b86e1c | 9 | public static Location parseString( String fromString ) {
if ((null==fromString) || (fromString.length() < 1 ))
throw new IllegalArgumentException( "Bad input string=" + fromString );
String [] values = fromString.split( "[\\s" + DELIM + "\"]" ); // Can return "" when these match
// System.out.println( "Loc... |
fc939281-97bc-4f1a-af43-6e29a0a2842e | 9 | public static void listingTeamAllSitesIncludingIndividualMembers(
JSONObject json) {
String teamNames[];
String teamId[];
String multiplePlayer[];
String players, playersId, playerInformation;
String multiplePlayerId[];
int i = 0;
int numberTeams = 0;
try {
teamNames = json.toString().split("\"di... |
fa9e919f-7823-432d-9305-16f8a785d4ab | 9 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Person other = (Person) obj;
if (this... |
b5ba6c49-1ea7-4298-806f-4dfe90d681f6 | 1 | private void readHeader(final DataInputStream in) throws IOException {
final int magic = in.readInt();
if (magic != 0xCAFEBABE) {
throw new ClassFormatError("Bad magic number.");
}
in.readUnsignedShort(); // major
in.readUnsignedShort(); // minor
} |
7a57126d-22d3-48d8-8f6a-4669dd92714d | 5 | public static void main(String[] args) {
final int N = 3;
ExecutorService service = Executors.newCachedThreadPool();
final CyclicBarrier cb = new CyclicBarrier(N);
for(int i=0;i<N;i++){
Runnable runnable = new Runnable(){
@Override
public void run(){
try {
Thread.sleep((long)(Math.rando... |
997f5754-cded-4650-a9eb-836129a47dd4 | 9 | public static Coordinate2D[] partition(Coordinate2D c1, Coordinate2D c2, int numPartitions,
int partitionIndex) throws Exception
{
if (numPartitions < 1)
throw new IllegalArgumentException (
"Number of partitions is less than 1. numPartitions: " + numPartitions);
else if (partitionIndex < 0)
throw ne... |
f783f445-69f5-4c2f-b8ea-f6ab405d1863 | 0 | public String getVille() {
return ville;
} |
0919a736-c16f-44f0-bdad-3ea12a32f956 | 6 | private boolean invariant() {
//TODO: InvalidModulException konform gestalten
if (this.bezeichnung != null)
if (!this.bezeichnung.isEmpty())
if (this.studiengang != null)
if (!this.studiengang.isEmpty())
if (this.schule != null)
if (!this.schule.isEmpty())
return true;
return false;
} |
d364c004-12a3-40dd-bc10-b6f1e677a097 | 3 | public static String getURL(String entityName,String methodName,String paramers,String url){
StringBuilder sb = new StringBuilder();
if(!isBlank(entityName)){
sb.append(entityName).append("!").append(methodName);
}else if(!isBlank(url)){
sb.append(url);
}
if(!isBlank(paramers)){
sb.append("?").app... |
de5cb857-018f-483d-9978-182281a9943b | 8 | final public void Type_name() throws ParseException {
/*@bgen(jjtree) Type_name */
SimpleNode jjtn000 = new SimpleNode(JJTTYPE_NAME);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Identifier();
} catch (Throwable jjte000) {
... |
2d42fbfb-e83a-4041-98e3-19c21a00f4dd | 6 | public static void main(String[] args) throws IOException {
int testMark = 0;
char gradeLetter = 0;
String s = "";
System.out.println("Enter your test mark: ");
while ((testMark = System.in.read()) != -1) {
s += (char) testMark;
System.out.println("s " + s);
if (testMark == (int) '\u0013')
br... |
deb9bb01-acf1-446e-957d-b7a8c944e8fd | 9 | public Unit getBetterExpert(Unit expert) {
GoodsType production = expert.getWorkType();
GoodsType expertise = expert.getType().getExpertProduction();
Unit bestExpert = null;
int bestImprovement = 0;
if (production == null || expertise == null
|| production == experti... |
7671bc44-082a-4e89-94e9-32c0417348ba | 7 | public void realizarOP(String texto) {
OrdenCliente orden;
String serv="10.8.7.3";
int puertoServ=5000, puertoCli=4999;
Escuchar h;
switch (texto) {
case "upload":
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChoos... |
def61d88-c815-4d33-b3c2-7d43a353709a | 6 | public ArrayList<Integer> quickSort(ArrayList<Integer> a)
{
//Algorithim is given a list, base case, pick a random pivot, create subarrays
//place elements into subarrays based on comparison with pivot, recursivley call
//on subarrays while pivot is at its final point. concatenate the recursive
//calls with ... |
d50c4281-bfc4-40b9-aceb-f65a35916142 | 1 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/mensaje.jsp");
AlumnoBean oAlumnoBean = new AlumnoBean();
AlumnoParam oAlumnoPara... |
134730d7-fb46-43ea-a23a-0367ef62fbfb | 9 | public final void initUI() {
setTitle("Sigma Function Solver");
setSize(320, 330);
setLocationRelativeTo(null);
setResizable(false);
setDefaultCloseOperation(2);
JPanel panel = new JPanel();
getContentPane().add(panel);
panel.setLayout(null);
fi... |
382756ee-d63c-45bb-a6fa-babeac083f7d | 2 | public void setShutdownFontcolor(int[] fontcolor) {
if ((fontcolor == null) || (fontcolor.length != 4)) {
this.shutdownFontColor = UIFontInits.SHDBTN.getColor();
} else {
this.shutdownFontColor = fontcolor;
}
somethingChanged();
} |
de2d4440-70db-472c-becc-353a23228bbc | 8 | protected static ArrayList<String> getOffspringStrings(int startIndex, String treeStr) {
ArrayList<String> children = new ArrayList<String>();
treeStr = treeStr.trim();
int lastParen = matchingParenIndex(startIndex, treeStr);
//Scan along subtree string, create new strings separated by commas *at 'highest le... |
4546157b-87a7-4492-b6d8-be01041ca4c6 | 7 | @Override
public Dimension minimumLayoutSize(Container parent) {
int height = 0;
int width = (mColumns - 1) * mHGap;
synchronized (parent.getTreeLock()) {
Insets insets = parent.getInsets();
int compCount = parent.getComponentCount();
int[] widths = new int[mColumns];
int rows = 1 + (compCount - 1) ... |
3b07fe0d-9d35-41a6-b444-56341fbf88e0 | 7 | public Boolean infoAction()
{
try
{
HashMap<String, String> apiCall = new HashMap<String, String>();
apiCall.put("action", "info");
JSONObject apiResponse = call(apiCall);
if(apiResponse != null)
{
if(apiResponse.getInt("code") == 0)
{
JSONObject payload = apiResponse.get... |
3cee5278-f99a-45e9-9e50-a8aadba2a5f6 | 9 | public MoveResult endOfMoveChecker(MoveResult battleResult)
{
MoveResult result = battleResult;
boolean redCanMove = false;
boolean blueCanMove = false;
if (result.getStatus() == OK) //If someone has not already won
{
for (PieceLocationDescriptor piece: pieceHandler.getRedPieces())
{
if (canMov... |
de7df018-914b-40a3-9651-8f2394750c83 | 1 | public Job newJob( TriggerFiredBundle bundle, Scheduler scheduler )
throws SchedulerException
{
Class<? extends Job> jobClass = bundle.getJobDetail().getJobClass();
return this.injector.getInstance( jobClass );
} |
1d30332f-2d88-4eab-86ef-4a3deb4ad702 | 7 | public static void main(String[] args) {
final int daysInWeek = 7;
final int months = 12;
final String[] weekDays = new String[]{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
final String[] monthNames = new String[]{"January", "February", "March", "April... |
efccbc0e-ee93-4e8d-87a7-523b80cfb8e3 | 3 | public void render(Graphics g) {
if (!transmitting) {
Resource resource = null;
try {
for (String key : resources.keySet()) {
resource = (Resource) resources.get(key);
resource.render(g);
}
} catch (Conc... |
25094d11-a3e9-4b35-91c8-8bbc58e63cc6 | 8 | @Override
public Message createMessage(byte code, DataInputStream in) throws IOException
{
switch (code)
{
case AcknowledgeMessage.CODE:
return new AcknowledgeMessage(in);
case ConnectMessage.CODE:
return new ConnectMessage(in);
... |
65ed4669-1713-4d64-a7e2-77d1e5abcd3f | 5 | public void update() {
this.oneDayPass();
int sellIn = this.getContentSellIn();
int quality = this.getContentQuality();
if (sellIn >= midSellIn) {
quality += qualityNormalUp;
}
else if (sellIn < midSellIn && sellIn >= lowSellIn) {
quality += qualityDoubleUp;
}
else if (sellIn < lowSellIn ... |
7984b8eb-ee21-4c84-a205-85ad669467d5 | 3 | public String seeOthersInfo() throws Exception {
Connection conn = null;
ResultSet rs = null;
Statement stmt = null;
try{
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url, user, psw);
if (!conn.isClosed())
System.out.println("Success connecting to the Database!");
e... |
df25e6f8-af5a-4f3c-8c23-608e601d68bf | 6 | public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception
{
HashMap<String, HashMap<String, Integer>> map =
new HashMap<String, HashMap<String,Integer>>();
BufferedReader reader = filePath.toLowerCase().endsWith("gz") ?
new BufferedReader(new InputStreamReader(
... |
01218e22-ddce-4202-b4d6-3542b13cce02 | 7 | public void compact() throws Exception
{
ArrayList<Row> delenda = new ArrayList<Row>();
for ( int i=0;i<rows.size();i++ )
{
for ( int j=0;j<rows.size();j++ )
{
if ( i != j )
{
Row r = rows.get( i );
... |
22e87626-b06c-430e-9f5a-3a51df077928 | 7 | public boolean equals(Object loc) {
if (!(loc instanceof SerializableLocation))
return false;
SerializableLocation compare = (SerializableLocation) loc;
if (x == compare.x && y == compare.y && z == compare.z && yaw == compare.yaw && pitch == compare.pitch &&
worldName... |
03119215-090b-444c-8c4b-01a83c77309e | 5 | public static String describeId3v2Support(Property p) {
String supp="";
for(Id3v2FrameConfig cfg : id3v2Fields) {
if(cfg.frameProperty == p) {
if(supp.length()>0)
supp += ", ";
supp += cfg.frameID + (cfg.versionMatch.equals("*")?"":" (" + c... |
43f7fd06-af38-4b96-92f3-b7d222c49edc | 1 | public static void print(){
for (int i = 0; i < 500; i++) {
System.out.println(i);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.