method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
14051e03-dc06-495d-95f9-eef3178fb3d3 | 3 | public ArrayList<String> getItemTypeList(String category, String types) {
ArrayList<String> matchingItems = new ArrayList<String>();
ItemType itemType = null;
for (int i = 0; i < itemTypesList.size(); i++) {
itemType = itemTypesList.get(i);
if(itemType.getCatego... |
35a72dd9-3078-4b41-aef2-016236bac715 | 6 | private static void setLookAndFeel(String lookAndFeel) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if (lookAndFeel.equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
8afab710-68c2-4937-a8cf-caf3dbcb1ebd | 5 | public void tick(Input input)
{
player1.tick(input);
//player2.tick();
//player3.tick();
//player4.tick();
for(Particle p : particles)
{
p.tick();
if(p.remove)
{
particles.remove(p);
}
}
... |
d4f6da9c-2403-4e54-b4ce-0c2b40844ef3 | 2 | private void releaseKey(int code) {
keyDown[code] = false;
if (code < maxKeyCount) {
String keyName = keyNames[code];
if (keyName != null) {
lastKey = keyName;
}
}
} |
9ede2c0d-84c2-4040-9d81-d4f1216ce7d0 | 2 | public void close() {
if (sequencer != null && sequencer.isOpen()) {
sequencer.close();
}
} |
2b40396c-32ed-445d-8382-e94849c32d39 | 1 | public void makeMove(Location loc) {
if (loc == null)
removeSelfFromGrid();
else
moveTo(loc);
} |
de0edaa4-bb51-42de-85f0-e76e641976c3 | 3 | public static ArrayList<Station> getAllStation() {
Statement stat;
ArrayList<Station> stations = new ArrayList<>();
try {
stat = ConnexionDB.getConnection().createStatement();
stat.executeUpdate("use nemovelo");
ResultSet res = stat.executeQuery("select * fro... |
747ba2cd-bbbb-40cf-ac60-e0687b621844 | 5 | @Override
public Future<WebServer> stop() {
FutureTask<WebServer> future = new FutureTask<WebServer>(new Callable<WebServer>() {
@Override
public WebServer call() throws Exception {
if (channel != null) {
channel.close();
}
... |
35a6b712-ddea-4c9f-8749-d4eafec5e0f5 | 4 | public static void UperFirstName(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement st... |
0f80087f-0eb9-45ea-93b4-aee4cfee36a5 | 1 | private void init() {
setLayout(new BorderLayout(0, 5));
setBorder(makeBorder());
Box box = Box.createVerticalBox();
box.add(getTopPanel(), BorderLayout.NORTH);
box.add(testPanel.getMainPanel(), BorderLayout.NORTH);
add(box, BorderLayout.NORTH);
new Thread(new Ru... |
395fce66-8256-414a-b4cb-14603b005941 | 0 | public void setFromDate(String fromDate) {
this.fromDate = fromDate;
} |
d515f49f-1e57-49e5-a6c2-4c6afd92d01f | 6 | private static void trainTransitionParameters(double[] emissions, GaussianMarkovModel mm,
GaussianForwardAlgorithm fa, GaussianBackwardsAlgorithm ba) throws Exception
{
int numStates = mm.getMarkovStates().length;
double[][] A = new double[numStates][numStates] ;
double logPx = fa.getLogFinalPValue();
... |
4ab0059a-6f73-48cc-9bc9-46f29fc1bc34 | 0 | public TreePanel initTreePane() {
final TreePanel tpane = new TreePanel(treeDrawer);
gui.SuperMouseAdapter a = new gui.SuperMouseAdapter() {
public void mouseClicked(MouseEvent event) {
TreeNode n = tpane.nodeAtPoint(event.getPoint());
controller.nodeClicked((MinimizeTreeNode) n, event);
}
public ... |
6f4e3330-39fb-46a3-a14c-d0ee6368b15d | 5 | private static void createContext
( String subscriptionClassName, String[] parameterValues, String connectionURL )
throws Exception
{
Class<?> subscriptionClass = Class.forName( subscriptionClassName );
SubscriptionSignature subscriptionSignature = (Sub... |
70454083-2126-48f3-90d7-6f814a7f12e7 | 5 | public void processEpsilonValue() {
try {
DataWriters = new ArrayList<DataWriter>();
DataWriters.add(new OpinionDensityDataWriter(Constants.files.get(OpinionDensityDataWriter.id)));
DataWriters.add(new OpinionClusterDataWriter(Constants.files.get(OpinionClusterDataWriter.id)));
DataWriters.add(new Realiza... |
035653b0-cfe9-4e94-adc6-04fc588c61f3 | 0 | public String getMessage() { return Message; } |
d41d5ce6-f55d-48fb-9b1e-4697800692cc | 1 | private void doBeforeProcessing(ServletRequest request, ServletResponse response)
throws IOException, ServletException {
if (debug) {
log("FiltradoSesion:DoBeforeProcessing");
}
// Write code here to process the request and/or response before
// the rest of the f... |
d4aedc72-d6ac-4b8d-9709-d0ff2e33aa50 | 1 | private String getIntegerValue(final Field field, final Object object) {
Object result = getRawValue(field, object);
if (result == null) {
result = "";
}
return result.toString();
} |
036ef972-b6e6-4f0e-ba21-330dc126c760 | 3 | public ZFrame unwrap() {
if (size() == 0)
return null;
ZFrame f = pop();
ZFrame empty = getFirst();
if (empty.hasData() && empty.size() == 0) {
empty = pop();
empty.destroy();
}
return f;
} |
a2bc1531-109a-4d6b-8673-3685beb43ff1 | 8 | public List<Movimentacao> buscaPorContaETipo_Concatenando_LevementeRefatorado(Conta conta, TipoMovimentacao tipo) {
StringBuilder jpql = new StringBuilder(" select m from Movimentacao m ");
List<String> criteria = new ArrayList<String>();
if (conta != null) {
criteria.add("m.conta = :conta");
}
if (tipo... |
6e88f7e6-8a8d-4637-9494-f5cfcb681985 | 5 | public static FileDescriptor forTuple(Tuple tup) {
if (!tup.isOfTypes(byte[].class, Integer.class, Long.class))
throw new IllegalArgumentException(
"Invalid Tuple passed to FileDescriptor.forTuple()!");
String id = new String((byte[]) tup.getItem(0));
int owner = (int) tup.getItem(1);
long size = -1L... |
b222fd1a-0a1e-4206-a371-c7923c47abc9 | 6 | private void broadcastFinalScores(){
String stringScores;
int finalScore[];
System.out.println();
printStatus("[ GAME OVER ] " + GameInfo.indexToPlayerName(turn) + " wins");
stringScores = "";
finalScore = new int[hands.length]; // all elements are set to 0 by default in Java
//... |
866648ab-610d-42fd-acc3-ff813bfa6f0c | 5 | private static boolean meetsFilter(String ticker) {
boolean fits = true;
for (FilterPanel fp : EarningsTest.singleton.filters) {
if (!fp.include.isSelected())
continue;
int id = fp.getId();
boolean checkDividendHistory = DBLabels.labels[id]
.equals("Dividends");
float low = fp.getLow();
flo... |
5b395204-bdb8-4f63-bd31-7750a19ecc8b | 3 | protected void processKeyEvent(KeyEvent ke) {
int kc = ke.getKeyCode();
if (ke.isShiftDown()) {
speed = HYPER;
rotAmount = Math.PI / 60.0;
} else {
speed = NORMAL;
rotAmount = Math.PI / 120.0;
}
if (ke.isAltDown()) {
altTransform(kc);
} else {
if (ke.isControlDown()) {
controlTransform... |
367e98bc-9b01-43f8-922a-2f6977887418 | 5 | private static Region getBestNeighborRegion(Region missingRegion, ExpansionDecisions madeExpansionDecisions,
BotState state, SuperRegion superRegion) {
List<Region> ownedNeighbors = missingRegion.getOwnedNeighbors(state);
int maximumIdleArmies = 0;
// First calculate the maximum amount of armies of an owned ne... |
1685b866-3b42-4853-8d0a-74c4693e78aa | 5 | private void defineRoomSums()
{//Fills in table
roomSumsFrame = new JFrame();
roomSumsTable = new JTable();
roomSumsTable_header = new String[DataBase.schoolPeriodCount*2+1];
roomSumsTable_data = new String[DataBase.rooms.length][DataBase.schoolPeriodCount*2+1];
roomSumsTable_header[0] = "Room";//First... |
6db92c77-711e-47ae-bb19-58fcdb4567ae | 7 | public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
if (image != null) {
AlphaComposite alpha = AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, 1);
g2d.setComposite(alpha);
g2d.... |
3e230c90-a17d-4315-b228-e5a1a135deed | 7 | @Override
public void run() {
while (!stop) {
try {
opcion = canalEntrada.readInt();
} catch (IOException e) {
System.out.println("Error al recibir comando" + e.getMessage());
}
switch (opcion) {
case 1:
break;
case 2:
System.out.println(recibirMensaje());
break;
}
... |
9f9acb85-6ca2-4ff2-a892-40dadfaa460d | 8 | @Override
public boolean equals(Object object) {
if (!(object instanceof KeyedId)) {
return false;
}
KeyedId other = (KeyedId) object;
return !((this.name == null && other.name != null)
|| (this.name != null && !this.name.equals(other.name))
... |
798bdaf2-4dd4-49f1-b7f5-7db290cfcecf | 2 | public void recruited()
{
for (int i=0; i<recruits.length; ++i) {
recruits[i].updateRange();
}
for (int i=0; i<buys.length; ++i) {
buys[i].checkActive();
}
units.updateUnits();
updateResources();
} |
a2b3fc46-510b-4611-8d46-6e25cf4a9842 | 2 | public void paint(Graphics g){
super.paint(g);
if(gameover){
gameover(g);
}
else{
Graphics2D g2d = (Graphics2D)g;
g2d.setColor(Color.YELLOW);
g2d.fillRect(apple.getX(), apple.getY(), a_width, a_width);
g2d.setColor(Color.GREEN);
g2d.fillRect(player.getX(), player.getY(), p_width, p_width);... |
3445fd0e-b81c-46c4-b817-3b8c73e166e5 | 6 | private final int jjMoveStringLiteralDfa17_0(long old1, long active1, long old2, long active2)
{
if (((active1 &= old1) | (active2 &= old2)) == 0L)
return jjStartNfa_0(15, 0L, old1, old2);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(16, 0L, ac... |
d9a7550a-3c9c-4d98-bb72-0a460663053e | 6 | @EventHandler
public void SpiderNightVision(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.getSpiderConfig().getDouble("Spider.Nig... |
d42f861a-8b09-4214-bfd4-24c30f8fab05 | 9 | public void connect() {
int iPort = 6667;
if (wikimediaBot == null || !wikimediaBot.isConnected()) {
try {
iPort = Integer.parseInt(port);
} catch (Exception e) {
System.out.println("IRC.java, problem parsing integer: "
+ e.getMessage());
}
String[] channels ... |
77d9123b-4da3-4448-8f3e-8e8c80d48c73 | 1 | public static void filewrt() throws FileNotFoundException, UnsupportedEncodingException{
PrintWriter wfile = new PrintWriter(fnames, "UTF-8");
for (int i=0;i<names.size();i++){
wfile.println(names.get(i));
}
wfile.close();
} |
e42d68d2-1d12-4a53-afc0-51347f34de4a | 1 | public Set equivalent(final Node node) {
Set s = (Set) equiv.get(node);
if (s == null) {
s = new HashSet(1);
s.add(node); // A node is equivalent to itself
equiv.put(node, s);
}
return s;
} |
27ec1679-7f08-4aef-974d-5236fa6ce257 | 3 | public void visitLocalVariable(String name, int index) {
if (index >= ignoreCount && index < ignoreCount + paramCount) {
if (!name.equals("arg" + currentParameter))
debugInfoPresent = true;
result.append(',');
result.append(name);
... |
4778df3a-d392-455c-be98-21b8d2c188c6 | 2 | void compareHypergeometric(int k, int N, int D, int n, double result) {
double p = Hypergeometric.get().hypergeometric(k, N, D, n);
double abs = Math.abs(p - result);
double diff = abs / Math.min(p, result);
if ((abs > 1E-300) && (diff > 0.00001)) throw new RuntimeException("Difference:" + diff + "\t\t" + p + ... |
e2d76c81-bab7-41a1-8ad1-5fa7b2d08400 | 9 | public static String readline(InputStreamReader in) {
int ch;
StringBuffer line=null;
try {
while (true) {
ch = in.read();
if (ch==-1) {
if (line==null) return null;
return line.toString();
}
if (ch==10 || ch==13) {
// eol if we read other characters, ignore if not
if (line!... |
a72ef927-e75c-4447-b8f6-cf68627594a8 | 9 | public int deleteFile(final String directory, final String name) {
final String path = directory + "/" + name;
int error = 0;
final Integer fileNode = fileTable.containsKey(path) ? fileTable.get(path) : -1;
if( fileNode != null && fileNode != -1 && Utils.range(fileNode, 0, MAX_FILES) ) {
final File f... |
1d212a51-e307-4f5d-af3c-052f16e54a4e | 1 | public static synchronized TaskQueue getInstance() {
if (instance == null) {
instance = new TaskQueue();
}
return instance;
} |
925a6350-7716-46ba-9151-cc34ce570063 | 9 | public void fixJumping() {
if(!isRightHeld && !isLeftHeld) {
if(currentAnimation() == jumpLeft) {
setAnimation(stillLeft);
this.direction = "left";
}
if(currentAnimation() == jumpRight) {
setAnimation(stillRight);
this.direction = "right";
}
} else {
if(!this.frictionLock) {
if(is... |
211585b8-d55d-4985-9378-94f17a943a33 | 1 | @Override
public void run() {
arr_data = Product.showAll();
data = new Object[arr_data.size()][];
for (int i = 0; i < arr_data.size(); i++) {
data[i] = arr_data.get(i).Array();
}
this.fireTableDataChanged();
} |
d2006da9-1a18-48ec-ad0f-0cf0d4908925 | 9 | @Override
public String toString() {
final StringBuffer a = new StringBuffer();
final StringBuffer b = new StringBuffer();
Element temp = pattern;
while(temp != null) {
if (temp.isSpecial) {
switch(temp.item) {
case '.':
a.append("[:ANY:]");
break;
case 'd':
a.append("[:dig... |
70196e05-f128-4edb-8b27-3effef40694b | 1 | @Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + averageStartsCount;
return result;
} |
73575b51-2bc7-4111-978f-6bb7cf04f01a | 0 | public int getEventId() {
return eventId;
} |
5f1282ce-b9b5-4c98-8928-d9be1145b862 | 1 | public synchronized void stageOne() {
try {
//do your work here
Thread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
list1.add(random.nextInt(100));
} |
1f5cc96f-2f37-4c24-8b5c-ea7410eda400 | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
704acbc2-4a4a-4da5-82c3-55957a78e67d | 8 | @Override
public int compare(Patient o1, Patient o2) {
//throw new UnsupportedOperationException("Not supported yet.");
if(o1.isPrivatpatient() == true && o2.isPrivatpatient() == false){
return -1;
}
if(o1.isPrivatpatient() == false && o2.isPrivatpatient() == true){
... |
dcd6e1c4-8e31-4c55-b232-c777d099fb10 | 9 | public String[][] getRows(String name, String[] columnNames, SortFilterState sortFilter, int start, int pageSize) {
List<String[]> result = new LinkedList<String[]>();
StringBuilder sb = new StringBuilder();
sb.append("SELECT ");
for (int i = 0; i < columnNames.length; ++i) {
sb.append(columnNames[i]);
... |
022d6a65-9a02-408f-bbdd-3b577f0eaf8c | 4 | public void writeKnownAttributes(GrowableConstantPool gcp,
DataOutputStream output) throws IOException {
if (lvt != null) {
output.writeShort(gcp.putUTF8("LocalVariableTable"));
int count = lvt.length;
int length = 2 + 10 * count;
output.writeInt(length);
output.writeShort(count);
for (int i = 0;... |
e7dc61d9-de45-461f-a54d-0506b79bccc0 | 7 | private static boolean getIsCreateFromConsole() throws CancelOperationException {
String[] options = { "Create a new queue in the system.", "Delete an existing queue from the system."};
final StringBuilder builder = new StringBuilder("Please enter the number of the option to continue:\n");
// Prints each line ... |
469d927c-2a39-40d2-90b1-fa73fc093ea5 | 2 | private void trackListGenerator(Object[] inpista) {
//Recibe un arreglo y crea una lista de pistas vacias y su archivo .gdb
tracksList.clear();
String location = ruta + "\\GameData\\Locations";
for (Object pista : inpista) {
String fileMask = pista.toString();
Str... |
57ae49ee-d604-4814-86c8-bc6e09645dcc | 6 | public void paint(Graphics g2) {
Controls.setTile(getTile());
Graphics2D g = (Graphics2D) g2;
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (map != null) {
g.scale(scale, scale);
g.drawImage(map, mapLoc.x, mapLoc.y, nul... |
f1f4891b-fa2b-4d85-8223-ed29e7199f15 | 2 | public void copyRegionHFlip(CPRect r, CPLayer source) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(r);
for (int j = rect.top; j < rect.bottom; j++) {
for (int i = rect.left, s = rect.right - 1; i < rect.right; i++, s--) {
data[i + j * width] = source.data[s + j * width];
}
}
} |
4852b8c6-1c7a-461c-8bde-957d75e53317 | 4 | /*Update Username*/public boolean changeUsername(String username, String newUsername){
try{
if(newUsername.length() > 40)return false;
if(username.length() > 40) return false;
select1.setString(1, newUsername);
ResultSet rs = select1.executeQuery();
if(rs.next())return false;
updateUsername.s... |
1ac6f628-b90b-4dd6-8ca6-5f85cd75a680 | 4 | @Override
public void run() {
System.out.println("UserHandler thread started");
String hours = new SimpleDateFormat("HH").format(Calendar.getInstance().getTime());
String minutes = new SimpleDateFormat("mm").format(Calendar.getInstance().getTime());
String seconds = new SimpleDateFo... |
390a188c-c05e-4fb0-8178-cfbd454ba160 | 0 | public String getComponentTitle() {
return "Multiple Runs";
} |
cccede0f-120e-43dd-a6db-d66c25b089f2 | 6 | private static String stringify(final InputStream inputStream) {
if (inputStream == null) {
return "";
}
try {
int ichar;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (;;) {
ichar = inputStream.read();
if (ichar < 0) {
break;
}
baos.write(ichar);
}
return ba... |
442f2185-c8c4-4508-9a8a-e8eccfe07ad5 | 5 | public static LocaleCode getByLocale(Locale locale)
{
if (locale == null)
{
return null;
}
// Locale.getLanguage() returns either an empty string or
// a lower-case ISO 639 code.
String language = locale.getLanguage();
// Locale.getCountry() retu... |
fb3814bf-cae2-443f-90b2-e2119aa4417b | 1 | public List<double[]> run(File image) {
if (!image.exists())
return new LinkedList<double[]>();
descriptor.run(ImageProcessorFactory.newProcessor(image));
return descriptor.getFeatures();
} |
baf9a62e-5717-4e7e-b77b-c0bdda9b7de8 | 6 | public final void spawnBlockParticles(Level level, int x, int y, int z, int side,
ParticleManager particleManager) {
float offset = 0.1F;
float var8 = x + random.nextFloat() * (minX - maxX - offset * 2F) + offset + maxX;
float var9 = y + random.nextFloat... |
1757a1e8-f0ee-4f14-972d-a837cb1b10ae | 9 | @Override
public Subtitles parse(InputStream inputStream, String charset, double fps)
throws UnsupportedSubtitlesFormatException {
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(inputStream,
charset));
Subtitles subtitles = new Subtitles(fps);
String line;
... |
67f416ba-d361-40d7-91c5-fda649e92e6c | 5 | private void postPlugin(boolean isPing) throws IOException {
// Server software specific section
PluginDescriptionFile description = plugin.getDescription();
String pluginName = description.getName();
boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enab... |
394a6b3c-54b0-4494-aec6-580d1298e7d8 | 3 | private void validateFileName(String fileName) throws InvalidFileException {
Pattern pattern = Pattern.compile(FILE_NAME_REGEXP);
Matcher matcher = pattern.matcher(fileName);
if (matcher.matches()) {
File file = new File(fileName);
if (!file.exists() || file.isDirectory())
throw new InvalidFileException... |
9b810516-49e5-4a03-9c41-034fce1b0074 | 7 | @EventHandler
public void onPlayerChat(final AsyncPlayerChatEvent e) {
String msg = e.getMessage();
msg = ChatColor.translateAlternateColorCodes('&', msg);
String newMsg = msg;
if (plugin.getConfig().getBoolean("Tagging")) {
if (inCooldown.contains(e.getPlayer())) {
e.getPlayer()
.sendMessage(
... |
564ce12d-2436-46c1-acec-d7221b510982 | 1 | public NetworkUtils(String address, int port, String message){
try {
this.ipaddress = InetAddress.getByName(address);
this.port = port;
this.message = message;
} catch (UnknownHostException e) {
Bukkit.getLogger().severe("Can not connect to host, did you use the correct address?");
}
} |
3fc5fab8-d4f2-4971-8b02-c11cb6939986 | 5 | private double[][] createEmptyValueGrid(GeoParams geoParams, Operator operator) {
double delta_y = Math.abs(geoParams.geoBoundNW.latitude - geoParams.geoBoundSE.latitude);
double delta_x;
if (geoParams.geoBoundNW.longitude > geoParams.geoBoundSE.longitude) {
//We've wrapped around from 180 to -180,
delta_x ... |
c7dc80e6-5558-4f5d-ba3c-8771950599c3 | 8 | public static SortedDocValues wrap(SortedSetDocValues sortedSet, Type selector) {
if (sortedSet.getValueCount() >= Integer.MAX_VALUE) {
throw new UnsupportedOperationException("fields containing more than " + (Integer.MAX_VALUE-1) + " unique terms are unsupported");
}
SortedDocValues singleton = ... |
f0d80d2c-8422-4fe9-84b8-85745ace3eb9 | 1 | public void addUniform(String uniform){
int uniformLocation = glGetUniformLocation(program,uniform);
if (uniformLocation == 0xFFFFFFFF){
System.err.println("Could not find uniform: " + uniform);
new Exception().printStackTrace();
System.exit(1);
}
un... |
a7bae526-7140-4218-a66b-ffe0220b0557 | 3 | @Override
public void deserialize(Buffer buf) {
cellId = buf.readShort();
if (cellId < 0 || cellId > 559)
throw new RuntimeException("Forbidden value on cellId = " + cellId + ", it doesn't respect the following condition : cellId < 0 || cellId > 559");
objectGID = buf.readShort()... |
2d8ab1aa-a8e8-467f-8c0c-45292dddcd46 | 2 | public static void main(String[] args) throws Exception {
System.out.println("==== Menu =====");
System.out.println("1. Serveur");
System.out.println("2. Client");
String str = sc.nextLine();
int value = Integer.parseInt(str);
switch (value) {
case 1:
new Serveur().createServeur();
break;
c... |
186cb73e-f04e-4bf5-bcc9-8e923ae2660d | 6 | @Override
public boolean eval(Critter c) {
// TODO implement me!
// returns the boolean value of this condition for Critter c
if (op.toString().equals("<"))
return left.eval(c) < right.eval(c);
else if (op.toString().equals("<="))
return left.eval(c) <= right.eval(c);
else if (op.toStrin... |
996158d3-1e65-47bc-a0ab-f4ab059879f8 | 8 | @EventHandler
public void receivePluginMessage( PluginMessageEvent event ) throws IOException, SQLException {
if ( event.isCancelled() ) {
return;
}
if ( !( event.getSender() instanceof Server ) )
return;
if ( !event.getTag().equalsIgnoreCase( "BSHomes" ) ) {
... |
ee058dbc-5151-4cc5-b58e-c731853c41d4 | 5 | private boolean isStatement() {
return peekTypeMatches("RETURN") || peekTypeMatches("ID")
|| peekTypeMatches("IF") || peekTypeMatches("WHILE")
|| peekTypeMatches("FOR") || peekTypeMatches("BREAK");
} |
5c71db2b-8832-4315-92fc-2d1fcd9070e3 | 9 | private static boolean isPrimitiveEquivalent(Class<?> primitive, Class<? extends Object> aClass) {
if (primitive == int.class
|| primitive == long.class
|| primitive == float.class
|| primitive == double.class) {
return (aClass == Integer.class
... |
b55d5c5a-dd54-4c25-8d39-1c2212e1d06d | 0 | @Override
public void rotate(int angle)
{
super.rotate(angle,center);
setColoredExes();
} |
2ed83a5a-b624-4d0e-b431-94d4e7ee4179 | 2 | public static boolean isQualified(){
//if (shopList = 0) return false; //@todo should check the size of shopList
if (isSorted) return true;
if (shopListArr.length <= maxShopListSize) return true;
return false;
} |
cd01069c-ce53-4cad-afbd-32e2c9ed0c1a | 1 | public void setForegroundColor( Color foregroundColor ) {
if( foregroundColor == null ) {
throw new IllegalArgumentException( "foregroundColor must not be null" );
}
this.foregroundColor = foregroundColor;
regraph();
} |
5375c82a-6db7-4a94-a64e-2f3c9b42e13d | 4 | public void count() {
genome = snpEffectPredictor.getGenome();
readLengthSum = 0;
readLengthCount = 0;
// Iterate over all BAM/SAM files
try {
if (verbose) Timer.showStdErr("Reading file '" + fileName + "'");
countReads = new CountByKey<Marker>();
countBases = new CountByKey<Marker>();
countType... |
e15c7399-0c24-4a9e-a7bf-72850fc8d4d3 | 1 | protected int findColumnStrict(CycVariable col) throws IllegalArgumentException {
if (col == null) {
throw new IllegalArgumentException("Got null column name.");
}
return findColumnStrict(col.toString());
} |
7ff245f9-81e1-435b-aa6e-fed0f3e7546a | 3 | public static List<String> topDown (List<Character> s) {
// trivial case
if ( s.size() == 2 ) {
String s1 = new String(new char[]{s.get(0), s.get(1)});
String s2 = new String(new char[]{s.get(1), s.get(0)});
ArrayList<String> al = new ArrayList<>();
al.add(s1);
al.add(s2);
return al;
}... |
72ad8e66-cdc3-48fc-8df3-2dfb440adf2a | 0 | public File getFile() {
return _file;
} |
2d54a3ae-69b0-470a-b612-2bd1ac764fe4 | 4 | public Othello() {
super(GAME_WIDTH, GAME_HEIGHT);
boolean test = false;
if (test || m_test) {
System.out.println("Othello :: Othello() BEGIN");
}
if (test || m_test) {
System.out.println("Othello :: Othello() END");
}
} |
93ca1fcf-c614-42a2-8b8d-cd50f8dbc36a | 6 | public void quickS(int low, int high) {
int mid = (low + high) / 2;
int left = low;
int right = high;
int pivot = arrA[mid]; // select middle element as pivot
while (left <= right) {
while (arrA[left] < pivot)
left++;// find element which is greater than pivot
while (arrA[right] > pivot)
right--... |
a8dc771c-ff7d-4152-85af-8f98df03e3f0 | 3 | public void updateObjects(int deltaTime) {
// Draws settings Menu if necessary
if (getIsDrawingSettingsMenu()) {
drawSettingsMenu();
}
// Update ImageButtons
for (ImageButton obj : screenObjects) {
obj.update(deltaTime);
}
// Update LoopMenu if necessary
if (loopMenu != null) {
loopMenu.updat... |
f894c56a-f607-45a4-ba7c-c7c146b10eba | 7 | public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( (other == null ) ) return false;
if ( !(other instanceof BiCopiesarticlesId) ) return false;
BiCopiesarticlesId castOther = ( BiCopiesarticlesId ) other;
return (this.getNoArticle()==castOther.getNoArticle())... |
545e783a-0c86-4ff4-90b4-78cff6020cf0 | 1 | public String bitrate_string()
{
if (h_vbr == true)
{
return Integer.toString(bitrate()/1000)+" kb/s";
}
else return bitrate_str[h_version][h_layer - 1][h_bitrate_index];
} |
a2a0dab7-4554-447e-99bf-8b582c7987e8 | 5 | public StorageDatabase() {
try {
Class.forName("org.h2.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
File root = Constants.getRoot();
File databaseLocation = new File(root,"storageDatabase");
String path = null;
try {
... |
a3ffcdc8-1636-41b7-a70a-a035bb3b969b | 8 | public static void main(String[] args) throws Exception {
if (args.length != 9) {
System.err
.print("Syntax error. Correct syntax:\n"
+ " <trainfile_supervised> <trainfile_semisupervised> "
+ " <testset>"
+ "<supervised_weight> <observation_feature> <state_feature> "
+ "<modelfile... |
def91104-21b6-47c5-a6dd-2277bd428210 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
IpEntity ipEntity = (IpEntity) o;
if (ip != null ? !ip.equals(ipEntity.ip) : ipEntity.ip != null) return false;
if (urlMap != null ? !urlMap.eq... |
89dce42d-4802-4734-96d9-78e4c1cc12dc | 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 Link)) {
return false;
}
Link other = (Link) object;
if ((this.codlink == null && other.codlink != null) || (th... |
ef0ef25c-67e3-4fc8-85cf-19517aee6a4d | 1 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource()==questionDeleteButton) {
this.setVisible(false);
this.getParent().remove(this);
this.invalidate();
}
} |
0db2c38a-c06d-41e5-870c-1ee8eed21722 | 5 | private void unfilter(byte[] curLine, byte[] prevLine) throws IOException {
switch (curLine[0]) {
case 0: // none
break;
case 1:
unfilterSub(curLine);
break;
case 2:
unfilterUp(curLine, prevLine);
... |
99ca8e55-0846-467b-a857-25b9143c25df | 7 | public ArrayList<Boolean> CreateAgendaSlotStatus(){
ArrayList<Boolean> result = new ArrayList<Boolean>();
int hour1,hour2,duration;
boolean overlapTasksExist = false;
for (int i = 0; i < 25; i++) {
result.add(true);
}
for (int i=0; i<currDateTask.size(); i++){
if(Character.isDigit(currDateTask.get(i).... |
d400c630-1f00-47d5-bc8e-d535a5d1d7a0 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
GraphGenericNode<?> other = (GraphGenericNode<?>) obj;
if (Data == null) {
if (other.Data != null)
return false;
} else if (!Data.equals... |
f7b1d377-a457-48ff-9dbc-650f5ce11d87 | 4 | public synchronized T checkOut() {
long now = System.currentTimeMillis();
T t;
if (unlocked.size() > 0) {
Enumeration<T> e = unlocked.keys();
while (e.hasMoreElements()) {
t = e.nextElement();
if ((now - unlocked.get(t)) > expirationTime) {... |
96eecbb2-6673-438b-93e0-9d86b0d9d342 | 1 | public void send(Message msg) {
System.out.println("Sneding message: \"" + msg.encode() + "\"");
try {
conn.send(msg.encode());
} catch (CouldNotSendPacketException e) {
System.out.println("Could not send message: " + e.getMessage());
}
} |
0e80487f-678d-40cb-b594-0f406adc2758 | 1 | private int score(int[] bowl){
int sum=0;
for(int i=0;i<12;i++){
sum+=pref[i]*bowl[i];
}
return sum;
} |
7fc21a31-a5a1-4b2a-b203-cd8de0477081 | 3 | public static String getExtension(String filename)
{
int i = filename.lastIndexOf('.');
int j = filename.lastIndexOf(File.separatorChar);
return (i > 0 && i > j && i < filename.length() - 1) ? filename
.substring(i + 1).toLowerCase() : "";
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.