method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
12005bb6-5a64-4d17-a887-085267ee6ff8 | 1 | public void run() {
try {
take = player.pass(bowl,bowlid,round,canPick,mustTake);
} catch (Exception e) {
e.printStackTrace();
exception = e;
}
} |
567dc24f-63d7-4a81-b3df-fd488ebe6298 | 5 | public void cargar()
{
try
{
String workingDir = System.getProperty("user.dir");
File dex = new File(workingDir+"/pokeDexNac.txt");
BufferedReader pokeDex = new BufferedReader(new FileReader(dex));
File stats = new File(workingDir+"/pokeSt... |
95f47e99-7729-45cb-88f3-629154795d3f | 9 | public Object getValueAt(int row, int column) {
if (row >= listData.size())
throw new IndexOutOfBoundsException("Table row "+row+" is not valid");
AccountTransaction r = listData.get(row);
Object value;
double amount;
switch (column) {
... |
8cc389de-f0fe-4aa5-a1ac-66c1d9256684 | 1 | private void handleUpdate() {
if (pref instanceof PreferenceBoolean) {
PreferenceBoolean prefBoolean = (PreferenceBoolean) pref;
prefBoolean.setTmp(checkbox.isSelected());
checkbox.setSelected(prefBoolean.tmp);
}
} |
f6eb3722-95db-4744-9bb6-e4523b833096 | 0 | public boolean isInitialized() {
return this.initialized;
} |
936f6dbf-42f8-482c-ad37-55cd4e1bf8d8 | 9 | void run(){
Scanner sc = new Scanner(System.in);
int[] d = {0, 20, 19, 20, 19, 20, 19, 20, 19, 20, 19};
int T = sc.nextInt();
while(T--!=0){
int Y = sc.nextInt(), M = sc.nextInt(), D = sc.nextInt();
int res = 0;
while(!(Y==1000&&M==1&&D==1)){
if(Y%3==0&&D==20 || Y%3!=0&&D==d[M]){
M++; D=1;
... |
5d75f7b1-41f4-465a-83b8-cfdeb5726cdf | 1 | private BufferedReader createCatReader(File archivoCat) throws IOException {
InputStream inputStream = new FileInputStream(archivoCat);
if (archivoCat.getName().toLowerCase().endsWith(".gz")){
inputStream = new GZIPInputStream(inputStream);
}
return new BufferedReader(new InputStreamReader(inputStream, "ISO-... |
983c5eb3-4567-4e80-a5bc-c56175b00840 | 2 | private void processMoveResult(String result, CardMove move) {
if (result.isEmpty()) {
game.getHistory().push(move);
} else if (!result.equals("ONTO_SELF")) {
storeMessage(new RenderMessage(result, true));
}
} |
68b313b9-aaf9-4a8c-bfb6-d63ea0b9a97d | 6 | Info(BEDictionary dict) throws MetaInfoException, InvalidBEncodingException, UnsupportedEncodingException, NullHashException {
mDictionary = dict;
// ----- Required Keys -----------------------------------------------
if (mDictionary.contains(KEY_PIECE_LENGTH))
mPieceLength = mDictionary.getInt(KEY_PIECE_LENG... |
21388b6d-9217-422d-9531-ef93f32dfb31 | 7 | public boolean isUnderstood(Event event)
{
int commandType = event.getCommandType();
int minExpectedArgCount = minExpectedArgByteCount(commandType);
int maxExpectedArgCount = maxExpectedArgByteCount(commandType);
if (minExpectedArgCount == maxExpectedArgCount)
{
... |
506f8fb3-42ba-4bac-a957-baef6504ed90 | 6 | public byte getCloneLimit() {
if (isHokage() && clonelimit < 69) {
this.clonelimit = (byte) 69;
} else if (isJounin() && clonelimit < 25) {
this.clonelimit = (byte) 25;
} else if (isGenin() && clonelimit < 15) {
this.clonelimit = (byte) 15;
}
r... |
e98745ea-4683-4207-ab71-ad936bcf41b6 | 3 | private void handleSetupDevice(SetupDeviceMessage originalMessage,
AcknowledgmentMessage message) {
switch (originalMessage.getSetupDeviceMessageType()) {
case CONNECT_DEVICE:
handleConnectDevice(originalMessage, message);
break;
case SET_IMAGE_QUALITY:
case SET_POLLING_RATE:
// do nothing?
break... |
da0ca258-ecf2-41c4-8a87-ecf94d263ee0 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return super.okMessage(myHost,msg);
final MOB mob=(MOB)affected;
if((msg.amITarget(mob))
&&(CMath.bset(msg.targetMajor(),CMMsg.MASK_MALICIOUS))
&&(msg.targetMinor()==CMMsg.TYP_CAST_SPELL)
&... |
a4bf6253-d98b-4601-9b34-d5fb36414eb1 | 2 | private void netTest() throws InterruptedException{
URL netTest = null;
try{
netTest = new URL("http://themoneyconverter.com");
} catch(MalformedURLException e){
System.out.println(e+"test");}
try {
InputStream xml = netTest.openStream();
} ... |
f8e1a7a6-ec11-49ca-b295-d4c821d4eda3 | 5 | protected int deltaDBtoDeltaInfIndex(int curDB, int dDB) {
int dII;
if (curDB <= 0) {
if (dDB <= 0) {
// NEG NEG
// no penalty
dII = 0;
}
else {
// NEG POS
// penalty if dDB is big enough
... |
631fc443-5ed3-4aaa-a2a3-68b0480ddb1d | 9 | private void parseArgs(ParseToken token, String[] args)
throws CouldNotParseException {
if (args.length > 2) {
throw new CouldNotParseException();
} else if (args.length == 1) {
String arg = args[0].trim();
if (Character.isLowerCase(arg.charAt(0))
... |
470adacb-07a4-45c7-b93d-91fb39b735fc | 6 | public FixtureDef[] build() {
FixtureDef[] fixtures = new FixtureDef[shapes.size()];
Vector c1 = new Vector(allVertices.get(0));
Vector c2 = new Vector(c1);
for (Vector v : allVertices) {
c1.x = Math.min(v.x, c1.x);
c1.y = Math.min(v.y, c1.y);
c2.x = Math.max(v.x, c2.x);
c2.y = Math.max(v.y, c... |
fb672a49-4ca3-4b13-b2d9-150d26d9000d | 2 | public long getLong(String key) throws JSONException {
Object object = this.get(key);
try {
return object instanceof Number ? ((Number) object).longValue()
: Long.parseLong((String) object);
} catch (Exception e) {
throw new JSONException("JSONObject["... |
c199a54d-a37a-4eca-8083-0050954d5b4b | 7 | public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
super.paintComponent(g2d);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
ListIterator<Forme> it = model.getAllFormes().listIterator();
// Parcours de la liste pour redessiner toutes les form... |
d2626cc2-d95d-46ef-a9fc-13403aa2e93e | 5 | @Override
public void perform(CommandSender sender, String[] args) {
List<String> GymTypes = instance.getConfig().getStringList("GymTypes");
ChatColor statusColour;
if (args.length == 1)
{
for (String i : GymTypes)
{
if (args[0].equalsIgnoreCase(i))
{
boolean gymStatus = instance.getConfig(... |
f51baa33-b45d-47be-baf0-b8954873547a | 6 | @Override
public int move() {
int rockMoves = 0,rockWins = 0;
int paperMoves = 0, paperWins = 0;
int scissorMoves = 0, scissorWins = 0;
for(int i = 0;i<moves.size();i++){
if(moves.get(i)==RPSPlayer.ROCK){
rockMoves++;
if(results.get(i)){
... |
d8ba40e0-46a9-4d43-80d3-a32f26bc34e6 | 6 | private static List<AttackTransferMove> getNecessarySupportMoves(BotState state, Region neededHelpRegion,
int missingArmies, int minimumUsefulArmies) {
List<AttackTransferMove> out = new ArrayList<>();
List<Region> ownedNeighbors = new ArrayList<>();
ownedNeighbors.addAll(neededHelpRegion.getOwnedNeighbors(sta... |
d05dc291-98d1-4f74-b77e-e63f190caec3 | 3 | private void removeMarkedAlignements(boolean[][] marked) {
for (int i = 0; i < marked.length; i++) {
for (int j = 0; j < marked[i].length; j++) {
if (marked[i][j]) {
game.flush(i, j);
marked[i][j] = false;
}
}
}
} |
7bc56ed3-270c-403a-b664-ed4574b918c6 | 5 | private boolean setIsOK(byte[] set)
{
// byte starting[] = new byte[row.length];
// System.out.println("Looking at set " + java.util.Arrays.toString(set));
for (int i=0; i < set.length - 1; i++)
{
for (int j=i + 1; j < set.length; j++)
{
// System.out.println("Comparing set[" + i + "]... |
973a3b09-5fbb-4b6d-a963-d19a39faa7cc | 1 | public static void main(String[] args) {
/*
* Enter your code here. Read input from STDIN. Print output to STDOUT.
* Your class should be named Solution.
*/
Scanner in = new Scanner(System.in);
int res;
String n = in.nextLine();
String[] n_split = n.split(" ");
int _a_siz... |
50f9d5ad-9797-4ffc-bcae-e735698a3fc8 | 2 | public static void main(String[] args) {
setLookAndFeel();
boolean firstLaunch = ConfigManager.getInstance().getProperties().getProperty("virgin").equals("true");
boolean isLauncherUpdateRequired = launcherUpdateRequired();
System.out.println("First launch: " + firstLaunch + " ... |
884514d3-fc5e-4e92-991e-8dac4346c384 | 8 | public boolean execute()
{
updateGraph();
if (!trace)
rp.reset(g.size());
else
nextnode = 0;
final int nn = (n < 0 ? Network.size() : n);
if (method.equals("stats")) {
IncrementalStats stats = new IncrementalStats();
for (int i = 0; i < nn; ++i)
stats.add(nextDegree());
System.out.println(name + ": " ... |
109d10c7-81b3-48b9-ba6a-50eac323f5a2 | 5 | public static void display(tile[][] input) {
System.out.println(" 1 2 3 4 5 6 7 8 9 10");
for (int y = 0; y < 10; y++) {
System.out.print(y + 1 + " " + ((y != 9) ? " " : ""));
for (int x = 0; x < 10; x++) {
if (board[x][y].getFlag()) {
System.out.print("F ");
} else if (board[x][y].getCovered()... |
93975f44-75f0-4e90-9b90-cd288df0bb6c | 5 | @Override
protected void onPart(String channel, String sender, String login, String hostname)
{
super.onPart(channel, sender, login, hostname);
int targettab = 0;
int i = 0;
while(true)
{
try
{
if(Main.gui.tabs.get(i).title.equalsIgnoreCase(channel) || Main.gui.tabs.get(i).title.substring(1).equal... |
945739da-7a9d-439d-8267-0747f19fa84f | 3 | public void vote(Client client, String answer) {
synchronized (votes) {
if (!votes.containsKey(client.getName())
&& answers.contains(answer)) {
if (closed) {
String popup = Popup
.create("Umfrage",
String.format("Umfrage #%s - Problem", id),
"Du hast dir f�r die Beantwortung ... |
b75d4146-2c0d-462e-8224-4fcf9241a3c0 | 7 | @Override
public String toScript() {
if (script != null) return script;
StringBuilder sb = new StringBuilder(1000);
// Build all hyperplanes x*(p-q) >= 0
sb.append("my $hyper = new Matrix<Rational>([");
boolean first = true;
for (Point point : this.points) {
// Corrects some problems ... |
1a8aad86-13d6-4292-baa2-f986ba16cc02 | 3 | private void check(Object probe, Object current) {
List<Object> nl = graph.get(current);
if (nl == null) {
return;
}
for (Object o : nl) {
if (o == probe) {
throw new ComponentException("Circular reference to: "
+ probe);
} else {
check(probe, o);
}
}
} |
412e940c-ab2b-4183-b349-d6e08a760486 | 8 | private void button_clean_red_listMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button_clean_red_listMousePressed
if(frame_index_selected!=-1)
{
if(current_frame==null)
{
Element new_frame = hitboxes_doc.createElement("Frame");
new_frame.setAttribute("num... |
850cb58b-db62-4601-9615-2b8a71ee44f0 | 5 | public void update(){
if(core.SubTerra.getLevel()==null) return;
l = core.SubTerra.getLevel();
setReletiveTo(l.p);
for(Entity e: l.ents){
e.update();
}
for(int xx=0;xx<Level.SIZE;xx++){
for(int yy=0;yy<Level.SIZE;yy++){
if(l.worldDa... |
a091248d-96b3-4306-9fbd-ae5c2f7cea29 | 3 | @Test
public void preAuthCompletionGreaterAmount() throws BeanstreamApiException {
CardPaymentRequest paymentRequest = getCreditCardPaymentRequest(
getRandomOrderId("GAS"), "120.00");
PaymentResponse response = beanstream.payments()
.preAuth(paymentRequest);
try {
if (response.isApproved()) {
Paym... |
411a41df-cf7e-4d95-9b1d-859951fcb259 | 7 | @Override
public void endElement(String s, String s1, String element) throws SAXException {
// if end of book element add to list
if (element.equals("book")) {
bookL.add(bookTmp);
}
if (element.equalsIgnoreCase("isbn")) {
bookTmp.setIsbn(tmpValue);
}
... |
9e0c8cc4-9a9f-4a6f-9b0b-2612bb0aa475 | 3 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String urlPath = request.getParameter("action");
String reqHelperClassName = (String) props.get(urlPath);
if (reqHelperClassName != null) {
try {... |
c62acb1b-582c-4801-a9b2-fd7ffa1d278b | 8 | protected synchronized int getRarestPiece(Peer peer)
{
int[] availability = new int[this.client_info.getNumber_of_pieces()];
//compute availability
for (Peer aPeer:connectedPeers)
{
availability = RUBTToolKit.recomputeAvailability(availability, aPeer.getBitfield());
}
ArrayList<Integer> rarestPieces = n... |
553b163b-5d47-4683-abaf-0b3690621fcd | 2 | private classifiedData classify(String imageFilePath){
classifiedData DataIn = new classifiedData();
try {
// System.out.println("the file output: " + imageFilePath);
//load the image as a buffered image (works multiple features from a single image)
BufferedImage img = ImageIO.read(new ... |
55aa289c-84ff-4fa2-996d-825639b5a635 | 9 | public void run() {
Selector selector = DatagramAcceptorDelegate.this.selector;
for (;;) {
try {
int nKeys = selector.select();
registerNew();
if (nKeys > 0) {
processReadySessions(selector.sele... |
444aa15a-50e1-4376-b48a-7eb24784702d | 5 | private void ajouterSeance() {
System.out.println("Liste de vos modules :");
Professeur professeur = (Professeur) this.modeleApplication.getCurrent();
ArrayList<Module> modules = this.universite.getModulesParProfesseur(professeur);
if (modules.isEmpty()) {
System.out... |
094e847b-88db-46a2-8b94-60f23624ac94 | 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(
... |
3926402b-c426-46ec-9ebf-55f2f6e05196 | 2 | public SyncDownloadView(final JPanel panel) {
// Build the left side table
final SyncDownloadTableModel model = new SyncDownloadTableModel();
final JTable table = new JTable(model);
final JScrollPane left = new JScrollPane(table);
// Build the right side info
final JPanel right = new JPanel();
right.setB... |
7d41adba-9c1e-42d8-bb2d-17758772bd83 | 5 | public static void main(String[] args) {
//Creates the return value for the highest domino in the series.
String highestDomino = null;
//Creates the placeholder for the weight of the highest domino.
int highestValue = 0;
//Creates the return value for the lowest domino in the series.
String lowestD... |
e5907e1d-b186-48b9-b4f5-04ed29a7f8ce | 5 | public boolean isBlack(BufferedImage image, int posX, int posY) {
if(erase) {
if(flat) {
if(image.getRGB(posX, posY) == Color.RED.getRGB())
return true;
} else {
if(image.getRGB(posX, posY) == Color.WHITE.getRGB())
return true;
}
} else {
if(image.getRGB(posX, posY) == Color.BLACK.getR... |
411a8415-d6e4-4967-98e5-ea6e50fc2f0e | 5 | public static InputStream inputStreamFrom(final Object object) throws IOException {
if (object instanceof InputStream) return (InputStream)object;
if (object instanceof File) return IO._inputStreamFrom_((File)object);
if (object instanceof ByteArraySection) return IO._inputStreamFrom_((ByteArraySection)object);
... |
2d91f706-2684-47e6-8c0b-d94eac298fa3 | 3 | private String scanYamlDirectiveValue () {
while (peek() == ' ')
forward();
String major = scanYamlDirectiveNumber();
if (peek() != '.')
throw new TokenizerException("While scanning for a directive value, expected a digit or '.' but found: " + ch(peek()));
forward();
String minor = scanYamlDirectiveNumb... |
3fc68529-9a1a-4850-95f3-c5c07ccedc9c | 5 | public static Database getAccessionType(String accession){
if(accession.contains("UNIMOD")){
return Database.UNIMOD;
} else if(!accession.contains("UNIMOD") && accession.contains("MOD")){
return Database.PSIMOD;
} else if(!accession.contains("MOD") && NumberUtils.isNumber... |
248fea49-00c7-497b-aa87-e972059d73b7 | 4 | @Override
public void start(Stage primaryStage) throws MalformedURLException {
File f = new File("img/1.png");
System.out.println(f.getAbsolutePath());
Image image = new Image(f.toURI().toURL().toString());
// // simple displays ImageView the image as is
BackgroundRemoval br = new BackgroundRemovalImpl(... |
03ac05e9-9318-4426-9438-552eca9ea702 | 8 | public static DPCSchema loadSchemaResource(String aResourcePath) throws IOException {
ArrayList<DPCColumnSchema> tResultColumnSchemaList = new ArrayList<DPCColumnSchema>();
InputStream tResourceInputStream = null;
BufferedReader tResourceBufferedReader = null;
tResourceInputStream = mInstance.getClass().getClas... |
1524720d-f5e2-4ca8-ac2f-2b37c7831099 | 2 | public String setName(final String name) {
if (name == null)
throw new IllegalArgumentException("name must not be null");
if (name.length() == 0)
throw new IllegalArgumentException("name must not be an empty string");
this.name = name;
return name;
} |
4587a201-4680-468e-b73d-5cc55b6089b6 | 2 | public String loadMedico() {
Map parametros = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
String idMed = parametros.get("idMedico").toString();
Integer id = Integer.parseInt(idMed);
int i;
for (i = 0; i < medicosBean.size(); i++) {
... |
4194e1a0-4f0e-4589-bf9a-6e9926c4d5fe | 1 | public void visit_fcmpl(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
6f8d62c0-514b-4a05-a624-5e640544177a | 7 | boolean ifBlockCombination(ArrayList<String> blockSet){
boolean ifNoCombine = false;
//這邊檢查同block name的結合
String name = new String(blockSet.get(0));
for(String a : blockSet){
if(name.equals(a) == false){
ifNoCombine = true;
break;
}
}
if(ifNoCombine == false)
return true;
//這邊檢查不同block... |
0050d2d8-4e68-472a-9d63-62c814506b34 | 0 | public void setCtrMoaTipo(String ctrMoaTipo) {
this.ctrMoaTipo = ctrMoaTipo;
} |
1d9e40e1-8597-479f-a843-e4607b0a6fd0 | 4 | public static String toString(JSONObject o) throws JSONException {
StringBuffer sb = new StringBuffer();
sb.append(escape(o.getString("name")));
sb.append("=");
sb.append(escape(o.getString("value")));
if (o.has("expires")) {
sb.append(";expires=");
sb.ap... |
51905ba4-d5f5-4b1d-b5e5-aa722fbe39c2 | 6 | private Message decideErr(Message oMsg){
Message sMsg = new Message();
sMsg.setRecipient(oMsg.getSender());
sMsg.setSender(oMsg.getSender());
for(int i = 0; i < oMsg.getHeader().size(); i++)
sMsg.addHeader(oMsg.getHeader().get(i));
if (error == null) {
} else switch (error) {
case "syntax":
... |
0e30c255-7c50-4730-8d9d-ba0d7fe548c3 | 6 | public void run() {
if (arena.isClosed()) {
sender.sendMessage(OITG.prefix + ChatColor.RED + "That arena is closed.");
return;
}
if (arena.isIngame()) {
sender.sendMessage(OITG.prefix + ChatColor.RED + "A round is already in progress in that arena.");
... |
eafde32e-5c02-4623-8e35-9e6ed322821d | 0 | public void setFind(int i, String s) {
this.finds.set(i, s);
} |
3767c84b-77a7-4e9f-badd-c759ff3b9f45 | 3 | private void threadRunner()
{
try
{
while(true)
{
Runnable runnable = _queue.take();
//System.err.println(Thread.currentThread().getName()
//+ ": Executing event.");
try
{
runnable.run();
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
}
ca... |
3fd2f922-65e9-42d6-9865-69dd6d9c426b | 0 | @Test
public void testConnected() {
// initial : 0 1 2 3 4
// union(0, 1) : 1 1 2 3 4
// union(2, 3) : 1 1 3 3 4
// union(3, 1) : 1 1 3 1 4
// 1 4
// 0 3
// 2
QuickUnion spy = Mockito.spy(new QuickUnion(5));
when(spy.getRoot(1)).thenReturn(1);
when(spy.getRoot(0)).thenReturn(1);... |
ee6b299a-8675-4fc2-9dac-a59afe35ada1 | 2 | private RoomState readRoom( InputStream in, int squaresH, int squaresV ) throws IOException {
RoomState room = new RoomState();
room.setOxygen( readInt(in) );
for (int h=0; h < squaresH; h++) {
for (int v=0; v < squaresV; v++) {
// Dunno what the third int is. The others are for fire.
// Values in the... |
1893d82c-21cc-4c85-8be0-4c76951cdba9 | 1 | Stats(Collection<VoieEnum> voies) {
voituresEnAttentes = new HashMap<VoieEnum, AtomicInteger>();
attenteParVoie = new HashMap<VoieEnum, AtomicLong>();
voituresEngageesParVoies = new HashMap<VoieEnum, AtomicInteger>();
voituresEntrees = new HashMap<VoieEnum, AtomicInteger>();
voituresSorties = new HashMap<Voie... |
d93726a7-966b-417a-855b-5a1fe63b27c3 | 7 | @Override
public void unInvoke()
{
Item I=null;
if(affected instanceof Item)
I=(Item)affected;
super.unInvoke();
if((canBeUninvoked())&&(I!=null)&&(I.owner() instanceof MOB)
&&(!I.amWearingAt(Wearable.IN_INVENTORY)))
{
final MOB mob=(MOB)I.owner();
if((!mob.amDead())
&&(CMLib.flags().isInTheGa... |
ad0913a2-29e9-4d5d-8c97-fa87a7e53d44 | 2 | public DefaultLinkFinder(final String content) {
if (content == null || "".equals(content.trim())) {
throw new IllegalArgumentException("content cannot be null");
}
this.content = content;
} |
3caa2f84-0bd7-49b5-9687-8ad67ee5ebe2 | 1 | private void firePeerDisconnected() {
for (PeerActivityListener listener : this.listeners) {
listener.handlePeerDisconnected(this);
}
} |
52d40734-f276-416f-ae8c-81fa4c5cf082 | 3 | @After
public void teardown()
{
try{
if(connection!=null && !connection.isClosed())
{
drop.executeUpdate("Drop table Client");
connection.close();
connection = null;
}}
catch(Exception ex)
{
ex.printStackTrace();
}
} |
8085660c-2e08-4db6-8b32-033c049f7eba | 7 | public RichGameMap(){
startPoint=new StartPoint();
landList.add(startPoint);
bareLands=new BareLand[58];
mines=new Mine[6];
int k=0;
for(int i=1;i<64;i++) {
if(i==14) {
hospital=new Hospital(i);
landList.add(hospital);
... |
ae666c29-ee57-4969-b647-179312271dd6 | 7 | public void printMarket(){
if (deck == null){
return;
}
if (deck.getAskDeck() != null){
System.out.println("ASK:");
for(int i = 0; i < deck.getAskDeck().size(); i++){
System.out.print(deck.getAskDeck().get(i).getPrice());
System.out.print(deck.getAskDeck().get(i).isBid());
System.out.p... |
1b843e39-86eb-4185-a780-759244a0e7c9 | 4 | public static void main(String[] args) throws ParseException {
// Parse available options
Options opts = createOptions();
CommandLineParser parser = new PosixParser();
CommandLine cmd = parser.parse(opts, args);
// if help needed
if (cmd.hasOption("h") || args.length==0) {
HelpFormatter help = new HelpFo... |
996b0723-855e-4ee6-baf3-874e5032e9f8 | 9 | public static void main(String[] args) throws Throwable{
Escaner sc = new Escaner();
StringBuilder sb = new StringBuilder();
for (int c = 0, C = sc.nextInt(); c < C; c++) {
int D = sc.nextInt();
int[][] shuffle = new int[D][52];
for (int i = 0; i < shuffle.length; i++)
for (int j = 0; j < shuffle[i]... |
30f49928-ec68-4c77-8d51-41ecc7227ef5 | 1 | @Override
public void updatePlayers(List<Player> players) {
allPlayers.removeAllElements();
for (Player player : players) {
allPlayers.addElement(player.getName());
}
checkMinimumPlayers();
} |
f0299008-ab8e-46c1-bbcd-0b49c72b0f3d | 6 | @Override
public void paint(Graphics2D g, JXMapViewer map, int w, int h) {
g = (Graphics2D) g.create();
// convert from viewport to world bitmap
Rectangle rect = map.getViewportBounds();
g.translate(-rect.x, -rect.y);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON... |
5e199dd7-08b8-4d29-97cc-0e07f8e0d8dd | 7 | @Override
public double timeToReach(Node startNode, Node endNode, Message msg) {
// TODO Auto-generated method stub
double dist = startNode.getPosition().distanceTo(endNode.getPosition());
/* Link rate | time arrive mSec | dist
* ----------------------------------------------------
* 11 | 2542 | 399
... |
4a6c30c4-e540-4d61-ad0e-c36d859dcf9a | 8 | private static List<String> getEtapeIntermediare(char[] source, char[] target, int[][] positionMinimum) {
List<Operation> operations = getOperations(source, target, positionMinimum);
List<String> etapes = new ArrayList<>();
char[] temp = new char[Math.max(source.length, target.length)];
... |
69abe412-5b7a-4ad7-9ae8-120189b6c06a | 6 | @EventHandler
public void IronGolemWaterBreathing(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.getIronGolemConfig().getDouble("I... |
9e91178c-e9a5-4128-8f2c-9057b56ae687 | 9 | public PhylogenyData copy() {
final NodeData new_pnd = new NodeData();
if ( isHasSequence() ) {
new_pnd.setSequence( ( Sequence ) getSequence().copy() );
}
if ( isHasEvent() ) {
new_pnd.setEvent( ( Event ) getEvent().copy() );
}
if ( isHasNodeIdent... |
3ea3167d-9ee0-4ccb-af54-af64644ecb9b | 9 | private static String getCause(int statusCode){
String cause = null;
switch(statusCode){
case NOT_MODIFIED:
break;
case BAD_REQUEST:
cause = "The request was invalid. An accompanying error message will explain why. This is the status code will be ... |
ec10d3da-1a34-4d6b-ba80-fbd8a479bcdc | 9 | public static Result preemptiveHighestPriorityFirst(FutureStack future, int duration)
{
//Implemented with RR
String result = "";
int time;
ArrayList<Process> active;
ArrayList<Process> completed = new ArrayList<Process>();
//Set up priority queues
ArrayList<ArrayList<Process>> priorityQueues = new... |
e6047c19-a4cc-4b88-840d-e010585f043e | 1 | void imeOn() {
try {
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_HIRAGANA);
robot.keyPress(KeyEvent.VK_HIRAGANA);
} catch (AWTException e) {
/* ignore exception */
}
} |
a847baaf-afb9-45a9-97f0-4b1af93aac7c | 1 | protected void listAllVoices() {
System.out.println("--------------------------------------------------");
System.out.println("All voices available:");
VoiceManager voiceManager = VoiceManager.getInstance();
Voice[] voices = voiceManager.getVoices();
for (Voice voice : voices) {... |
e17c3b62-e013-46df-a918-2da1ce965395 | 3 | public void saveProgram() {
LogoDocument program = getProgram();
File file = program.getFile();
if (file == null){
file = askForFileName();
program.setFile(file);
}
if (file != null){
try {
program.save();
} catch (IOException e) {
e.printStackTrace();
}
}
} |
10884585-0034-4b41-85b5-5442ef0bc2ea | 1 | @Test ( timeout = 2000 )
public void serverWriteToSocketClosedByClient () throws Exception {
Socket[] sockets = connectToServer();
try ( Socket serverSocket = sockets[ 0 ];
Socket clientSocket = sockets[ 1 ] ) {
clientSocket.close();
// wait for close to propag... |
f0f8293b-ffb9-48c8-b90b-cd53deaad248 | 4 | private int readFully(byte[] b, int offs, int len)
throws BitstreamException
{
int nRead = 0;
try
{
while (len > 0)
{
int bytesread = source.read(b, offs, len);
if (bytesread == -1)
{
while (len-->0)
{
b[offs++] = 0;
}
break;
//throw newBitstreamException(UNEX... |
06f85d33-8fec-47db-902c-5e0d9f59ae1c | 9 | private void gerarTabela(List<Profile> lista, String tituloTabela, int linhaInicial) throws IOException, WriteException {
WritableFont wf = new WritableFont(WritableFont.ARIAL, 10,
WritableFont.BOLD);
WritableCellFormat cf = new WritableCellFormat(wf);
NumberFormat dp3 = new NumberFormat("####.###");
Writa... |
0f96329b-d6d6-49d3-9b30-54975d34c3b7 | 2 | public void exit() {
_scanner.close();
try {
UnicastRemoteObject.unexportObject(_instance, true);
_remoteObj.logout(_username, ServerInterface.CLIENT);
} catch(Exception ex) {
if(connect()) {
exit();
return;
}
System.out.println("Error on exit");
System.out.println(ex.getMessage());
}
... |
552f1fd8-8004-4583-9db6-23e7c00d6fda | 7 | @Override
public boolean nextKeyValue() throws IOException, InterruptedException {
if (key == null) {
key = new LongWritable();
}
key.set(pos);
if (value == null) {
value = new Text();
}
value.clear();
final Text endline = new Text("\n"... |
ea7bbb52-9d62-4dab-91a7-a59287b24790 | 1 | public boolean flowMayBeChanged() {
return jump != null || jumpMayBeChanged();
} |
48b69c1c-02a4-4a3d-be38-c4a0498d08d7 | 9 | public String generatePath() {
// Our input for solving
StartFinish startFinish = new StartFinish();
KeyTable<Vertex, String> table = new KeyTable<Vertex, String>();
prepareForSolving(table, startFinish);
Vertex start = startFinish.getStart();
Vertex finish = startFinis... |
e522ac97-47c7-4198-a261-0c5493567982 | 0 | public Ellipse2D getShape()
{
return new Ellipse2D.Double(x, y, XSIZE, YSIZE);
} |
13432346-de1a-4165-865c-edd794838a0f | 2 | public int w() {
return _map == null || _map.length < 1?0:_map[0].length;
} |
710c066f-00e3-4f43-a3b6-adb9a8ced6fe | 1 | public void log(Object message, int level) {
Date date = new Date();
if (level <= this.level) {
System.out.println(ConfigurationManager.portlet + ", " + date.toString() + " MSG: " + message);
}
} |
cb4d4b38-cab4-4b1c-b2d9-dbdf6633d246 | 1 | public String getName() {
return this.name == null ? "" : this.name;
} |
641910b9-03a0-4871-aed9-af59af73e91c | 0 | @Override
public DataStructures getStructure() {
return data;
} |
28a1b585-d076-4baa-952a-dacb72d8f853 | 5 | public static String rowToString(JSONArray ja) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < ja.length(); i += 1) {
if (i > 0) {
sb.append(',');
}
Object o = ja.opt(i);
if (o != null) {
String s = o.toString();... |
ee3ec3db-d1c7-44d2-976d-a00b83a40627 | 6 | public void AlteracaoDadosPessoais(Usuario user) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL_ALTERACAO_DADOS_PESSOAIS);
comando.setS... |
fdd31cb8-a625-49ac-aeb0-a57d2b2133e0 | 3 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner cin = new Scanner(System.in);
String input = cin.nextLine();
String[] al = input.split(" ");
int i = 0;
for(i = 0; i < al.length-1; i++,i++){
int first = Integer.parseInt(al[i]);
int last = Integer.p... |
2dfd160c-8909-490c-a82c-c8949f8d4450 | 7 | public void initialize() throws Exception {
if (m_baseExperiment == null) {
throw new Exception("No base experiment specified!");
}
m_experimentAborted = false;
m_finishedCount = 0;
m_failedCount = 0;
m_RunNumber = getRunLower();
m_DatasetNumber = 0;
m_PropertyNumber = 0;
m_Cu... |
b748d0bc-e107-4811-bc5f-1d3975a44fa6 | 7 | public void cargarXml(){
//Se crea un SAXBuilder para poder parsear el archivo
SAXBuilder builder = new SAXBuilder();
File xmlFile = new File( "config.xml" );
try
{
Document document = (Document)builder.build( xmlFile );
Element rootNode = document.getRoo... |
cbfcedb7-aee6-4173-9bb3-81630c3c50bd | 1 | private int calculateInternalHashCode(Cell[] currentBoard){
int maxLength = (currentBoard.length <= CELL_NUMBER_TO_CALCULATE_HASHCODE)
? currentBoard.length
: CELL_NUMBER_TO_CALCULATE_HASHCODE;
Cell[] limitedCurrentBoard = Arrays.copyOfRan... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.