method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
152e1cd4-a0a5-4b80-9ba1-defa5a5d04de | 3 | public static double getPowerDifference(Laser l, double elapsedTime){
double diff = 0;
double totalPower = 0;
double power = 0;
if(l.parent instanceof Ship){
totalPower = ((Ship)l.parent).getTotalPower();
power = ((Ship)l.parent).getPower();
}else if(l.parent instanceof Turret){
totalPower = ((Ship)(... |
5349ec5c-0c45-467b-b6fb-8ce7878ed512 | 4 | public void selectTab(Event evt) {
Object source = evt.getSource();
if (source == tabPersoon) {
clearTabPersoon();
} else if (source == tabGezin) {
clearTabGezin();
} else if (source == tabPersoonInvoer) {
clearTabPersoonInvoer();
} else if (so... |
8236dfb7-cc2b-4fcd-9c58-7ff86cfec304 | 2 | @Override
public void run() {
while(!Thread.currentThread().isInterrupted()) {
Integer take = queue.take();
System.out.println("Took: " + take);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
a389dc8f-4cdc-4774-ae23-1e94546f9bed | 6 | public AppLauncher(String args[]) {
if(args.length == 3 || args.length == 5) {
} else {
messageErreur("Nombre d'arguments incorrect");
}
String[] nomJoueurs = new String[args.length-1];
for(int i=0;i<(args.length-1);i++) {
nomJoueurs[i] = args[i];
}
// initialisation du modèle
int nomb... |
1fe67307-a205-4f7b-bfc3-a3c550ce1a08 | 3 | private static void method498(char dest[], char src[]) {
for (int chars = 0; chars < dest.length; chars++) {
if (src[chars] != '*' && Censor.isUpperCaseLetter(dest[chars])) {
src[chars] = dest[chars];
}
}
} |
8ca44927-6179-4f24-be69-2c025f60ccaa | 2 | public ConfigGetDb(String fileName)
{
FileInputStream inputFile = null;
try
{
inputFile = new FileInputStream(fileName);
} catch (FileNotFoundException e)
{
System.out.println(fileName + ":" + e);
e.printStackTrace();
}
Properties props = new Properties();
InputStream in = new Buff... |
765d9142-cd24-4e1f-946d-770d4477921f | 3 | private String getDocument(String resourceName, String... images)
{
try
{
InputStream is = GuiUtil.getResource(resourceName);
InputStreamReader isr = new InputStreamReader(is, "UTF-8");
BufferedReader br = new BufferedReader(isr);
StringBu... |
366951b7-2757-4443-8bc0-d51e1c9aa92c | 2 | public boolean mousedown(Coord c, int button) {
if (button == 1) {
if (ui.modctrl) {
ui.grabmouse(this);
dm = true;
doff = c;
} else {
Coord tc = localToReal(c);
mv.map_abs_click(tc.x, tc.y, button, 0);
return false;
}
}
return (true);
} |
28424e0e-aba3-40e7-84ac-67d5e6e3ceaa | 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 Chamado)) {
return false;
}
Chamado other = (Chamado) object;
if ((this.getId() == null && other.getId() != nul... |
e7859ec3-41cf-4a99-93f3-2fe3ebd426d2 | 8 | public void allsended ()
{ if (S.equals("")) return;
if (S.startsWith("Match") && S.indexOf("requested")>0)
{ new MatchDialog(CF,S,Out,this);
S=""; Lines=0; return;
}
if (Global.blocks(S)!=MessageFilter.BLOCK_COMPLETE)
CF.append(S);
if ((Global.blocks(S)==0 && CF.wantsinformation())
|| Global.pos... |
4254dbfc-bee9-4378-834b-53d7fa9124e8 | 0 | public void setId(String value) {
this.id = value;
} |
28be4c6c-4fde-4b9b-a192-9bc4c9eef008 | 8 | public DrBrainInitialMaze(String filename) {
String curLine;
try {
Scanner in = new Scanner(new File(filename));
//first line is just an explanation:
if(in.hasNextLine()) {
curLine = in.nextLine();
//System.out.println(curLine);
}
if(in.hasNextLine()) {
curLine = in.nextLine();... |
a2141200-8608-4670-bfbf-00c747bdd5ae | 3 | public int numberOfAliveCells() {
int aliveCells = 0;
for(int i = 0; i < model.getHeight(); i++) {
for(int j = 0; j < model.getWidth(); j++) {
if(isCellAlive(i,j)) {
aliveCells++;
}
... |
ed3fbd86-bb75-460b-ac6c-550bd0e63650 | 8 | public boolean build(Tile t, String type, Dude dude)
{
if (dude.getTask().getTask().equals("buildTile")) {
if (dude.isAt(t.getX(), t.getY())) {
// finish building tile
if (t.getStructure() != null) {
removeStructure(t.getStructure());
}
t.setImage(dude.getTask().getType());
t.setHeight(t... |
ee5ca3b8-47d9-4aad-b110-8ffdd7ec4ae3 | 5 | @Override
void handleMessage(ACLMessage msg) {
String message = msg.getContent();
System.out.println(this.getLocalName() + " got message " + message + ", answers.");
if(message.equals(DEFECT)){
semaphore = otherPlayerDefected;
otherPlayerDefected = true;
}
else if(message.equals(COOPERAT... |
4e3d9aae-57bc-4086-8e2d-8b4b5973593a | 3 | public void loop() {
final KeyListener This = this;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
view.getFrame().addKeyListener(This);
view.show();
}
});
long target_delta = 1000/options.getFr... |
c1033c2f-17b5-4a65-a360-5ecaad0b9869 | 4 | private void loadFile(String fileName) {
try {
KnowledgeBase newKnowledgeBase = new KnowledgeBase();
Reader content = null;
if (fileName.startsWith("classpath:")) {
// Skip the "classpath:" prefix ..
fileName = fileName.substring("classpath:".... |
550fa0da-f284-4a33-bf3c-7d4807727771 | 9 | private void commandItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_commandItemStateChanged
String c=((ComboText)command.getSelectedItem()).getValue();
editor.removeAll();
if(c.equals("MAKE")){
editor.add(this.create);
}
if(c.equals("drawMap")){
... |
e2b1d4fd-81a5-404a-873f-eae6dbb3f57d | 4 | public static double[] ranks(Comparable[] __array) throws Exception {
int _MAX;
double[] RET;
int rank=1;
int j;
Arrays.sort(__array);
_MAX = __array.length;
RET = new double[_MAX];
for (int i=0; i < _MAX; ) {
for (j=i+1; j < _MAX; j++) {
... |
4c988c89-a81d-48c9-b622-ea58b9e03a9f | 7 | public static boolean isWideLocation(Block b)
{
return isSafeBlock(b.getRelative(BlockFace.NORTH))
&& isSafeBlock(b.getRelative(BlockFace.NORTH_EAST))
&& isSafeBlock(b.getRelative(BlockFace.EAST))
&& isSafeBlock(b.getRelative(BlockFace.SOUTH_EAST))
&& isSafeBlock(b.getRelative(BlockFace.SOUTH))
&... |
ddd88e8a-1871-4b16-bc3d-8ca4ed669556 | 4 | public boolean shouldWeStop() throws IOException {
if(!ponder && ((System.currentTimeMillis() - startTime) > timeForThisMove)) return true;
String line = uci.getCurrentCommand();
if("stop".equals(line)) return true;
if("ponderhit".equals(line)) ponder = false;
return false;
} // END shouldWeStop |
9c622084-7885-48bf-8828-05e62319c1d8 | 9 | public String createValidURL(String parent, String next)
throws Exception
{
if (next.startsWith("http") ||
next.startsWith("ftp")) {
// absolute URL
return next;
} else if (next.length() == 0) {
return parent;
} else if (next.ch... |
9c8fca02-1ab7-482f-b58d-12b2d71b42c9 | 0 | @Test
public void testToString() {
System.out.println("toString");
Cuenta instance = new Cuenta();
String expResult = "";
String result = instance.toString();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
... |
a7c41301-8cb6-4d27-bc98-31dfd38e9cba | 2 | public void replacePhis(final FlowGraph cfg) {
replaceCatchPhis(cfg);
replaceJoinPhis(cfg);
// Remove the phis.
cfg.visit(new TreeVisitor() {
public void visitTree(final Tree tree) {
final Iterator e = tree.stmts().iterator();
while (e.hasNext()) {
final Stmt s = (Stmt) e.next();
if (s i... |
3c2eb185-509b-404e-8f62-688b5117577a | 0 | public JButton getjButtonClose() {
return jButtonClose;
} |
95fda084-9704-4244-b1d5-c682c4d0c8b6 | 4 | @Override
public void execute() {
seq(new EflSelectPcMonOperationSegment(PC_MON_RELEASE));
seqSample(() -> {
int numMons = curGb.readMemory(0xDA80);
for (int i = 0; i < numMons; i++) {
int curMon = curGb.readMemory(0xDA80 + i + 1);
if (curMon == mon) {
monGoalPosition = i... |
5dcd9bc8-f7cb-4fc1-828e-376875d091b2 | 8 | private double findSplitNumericNominal(int index) throws Exception {
double bestVal = Double.MAX_VALUE, currVal, currCutPoint;
int numMissing = 0;
double[] sum = new double[m_Instances.numClasses()];
double[][] bestDist = new double[3][m_Instances.numClasses()];
// Compute counts for all the value... |
483439cd-f56f-4223-acee-b40c892fb14a | 0 | public OutlinerDocument getDocument() {return this.doc;} |
f3c8cdf9-1c6b-44b8-b16d-542856be676f | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Logbook))
return false;
Logbook other = (Logbook) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return fal... |
35933fba-80fa-4c04-83a4-5973c263cf86 | 7 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
String callback = request.getParameter("callback");
if (action == null || callback == null) {
r... |
af7b1a14-6ecd-4276-82c6-5c265273edc0 | 3 | @Override
public void seek(long pFrame) throws MusicPlayerException {
this.mLock.lock();
try {
if ( !this.canSeek() ) {
throw new IllegalStateException( "can't seek" );
}
if ( !this.mStreamPlayerRunnable.isStopped() &&
!this.mStreamPlayerRunnable.isDone() ) {
this.mStreamPlayerRunnable.seek( ... |
134efa85-d326-44b6-88ba-dd96e9d671d7 | 5 | private static double[] getSupportPoints(int lineNumber, double[] lowPrices) {
double[] sPoints = new double[lineNumber];
for(int i =0;i<lineNumber-1;i++){
double price = 999999999;
for(int j=-25;j<=0;j++){
if((i+j>=0) && (i+j<lineNumber-1) && lowPrices[i+j]<pr... |
035835d1-efeb-422e-9e4c-39f01bc0c614 | 4 | public static void main(String[] args) {
String result;
int i;
System.out.println("Let's smoosh arrays!\n");
int[] test1 = {3, 7, 7, 7, 4, 5, 5, 2, 0, 8, 8, 8, 8, 5};
System.out.println("smooshing " + stringInts(test1) + ":");
smoosh(test1);
result = stringInts(test1);
System.out.prin... |
161d3d28-8b46-43cd-a6ba-4113bafe25bd | 6 | private void removeLocksAndUnblock(Transaction transaction,
long timestamp) {
Set<String> variables = lockManager.endTransaction(transaction);
transactionMap.remove(transaction.getName());
for(LinkedHashMap<Transaction, Lock> transactionLockMap
: blockedTransactions.values() ) {
transa... |
e05289db-2de8-4b78-8585-8b8edc520f00 | 5 | public static void main(String[] args)throws IOException
{
double finalAnswer=0;
double finalcurvePoints=0;
double finalPeriod=0;
double finalPercDif=0;
double finalR2=0;
for(int i = 19;i<=30;i++){
for(int j=2;j<=10;j++){
... |
bcc9616d-e335-4d1b-9506-7b1a5ea37a20 | 3 | private void remove() {
try {
Connection connection;
int i;
int option;
UI.printHeader();
System.out.println(connections.size() + " conexiones activas:");
System.out.println("");
for (i = 0; i < connections.size(); i++) {
connection = connections.get(i);
System.out.println((i + 1) + ") ... |
cbc6e964-496c-4ec8-bd88-01f25a6f9937 | 9 | public Value atomize() throws XPathException {
switch (getNodeKind()) {
case Type.COMMENT:
case Type.PROCESSING_INSTRUCTION:
return new StringValue(stringValue);
case Type.TEXT:
case Type.DOCUMENT:
case Type.NAMESPACE:
r... |
020013f8-321e-4856-b9ef-4c8b4644d940 | 5 | public Matrix multiply(Matrix matrix) { // Text if compatible, and if so
// return the matrix product.
if (this.cols == matrix.rows) {
Matrix result = new Matrix(this.rows, matrix.cols);
for (int i = 0; i < result.rows; i++) {
for (int j = 0; j < result.cols; j++) {
float value = 0;
for... |
dc5da5f7-4b27-4a66-9e12-f83db9c8d5ef | 7 | public boolean equals(Object o)
{
if (o == null)
return false;
if (o == this)
return true;
else
{
Polygon temp = (Polygon) o;
if (this.vectorList.size() != temp.getVectorList().size())
return false;
else
{
for(int i = 0; i < this.vectorList.size(); i++)
{
int j = 0;
whil... |
2da4b868-d873-473d-ab51-6624f323e45e | 2 | public Auto zoekAuto(String kt){
Auto antw = null;
for(Auto a: alleAutos){
if(a.getKenteken().equals(kt)){
antw = a;
break;
}
}
return antw;
} |
a4108571-4c41-41a2-8811-a40086e9725e | 4 | protected void calculateCorners(double x, double y) {
int leftTile = (int) (x - width / 2) / tileSize;
int rightTile = (int) (x + width / 2 - 1) / tileSize;
int topTile = (int) (y - height / 2) / tileSize;
int bottomTile = (int) (y + height / 2 - 1) / tileSize;
if (topTile < 0 ||... |
a8b9f155-1ca6-435b-9845-364f90ac8359 | 7 | @Override
public void run()
{
// Note the time we start
long start = System.nanoTime();
LivingEntity entity;
// Iterate through each entity until there are none left or the task has run for 0.5ms
while ((entity = it.next()) != null && (System.nanoTime() - start) < 500000L)
{
// Check if the mob shou... |
7a5f3c02-693f-4b9c-b153-6fbf4b842eb9 | 2 | public void getSingleNews(SPNews spNews) throws FailingHttpStatusCodeException, NullPointerException, IOException {
int id = spNews.getId();
String siteDialogURL = "http://ecampus.ucn.dk/Noticeboard/Lists/NoticeBoard/DispForm.aspx?"
+ "NoticeBoardItem=" + id + "&WebID=87441127-db6f-4499-8c99-3dea925e04a8&IsDlg=... |
61b493d3-178a-4696-b5e4-a6692c55bca4 | 9 | public HashMap<PLIRBasicBlock, PLIRBasicBlock> generateDominatorTree(PLIRBasicBlock r)
{
// step 1
nid = 0;
for (PLIRBasicBlock block : r.treeVertexSet)
{
pred.put(block, new ArrayList<PLIRBasicBlock>());
semi.put(block, 0);
}
visited = new ArrayList<PLIRBasicBlock>();
DomDFS(r);
// Steps 2/3 ... |
c65284b5-12e9-4029-be0d-565cb140c3df | 4 | private void updateMemory(List<Point> possibleMoves, Environment e) {
for (Point p : possibleMoves) {
Item item = e.viewItemAtPosition(SIGHT, p);
if (_worldMemory.get(p) != null) {
Entry<Item, Double> entry = _worldMemory.get(p);
if (entry.getKey() == item ) {
Double oldCert = entry.getValue();
... |
dcb89cde-1883-4f81-a14a-65e54ce77bbb | 4 | public void decode(String useleassPart) throws IkszorConvertException {
this.isDecoded = false;
try {
boolean[] key = IkszorManager.string2BooleanArray(this.symmetricKey);
boolean[] eValue = IkszorManager.string2BooleanArray(IkszorManager.fillValue(this.encodedValue, this.symmetricKey, useleassPart, (byte) 32... |
c76a9ff9-77a0-4aff-9e08-47f45a5bc08e | 5 | public String buscarClientePorApellidoMaterno(String surname2){
//##########################CARGA_BASE DE DATOS#############
tablaDeClientes();
//##########################INGRESO_VACIO###################
if(surname2.equals("")){
surname2 = "No busque nada";... |
6907f194-10f7-44eb-98bd-717bec3ea769 | 6 | public void send(Command cmd) {
try {
//System.out.println("Sending Command -> " + cmd);
if (!cmd.equals(prev)) {
this.oos.writeObject(cmd);
}
if ((reply = this.reader.readLine()) != null) {
System.out.println(reply);
... |
f250e785-e7b5-4c27-8a07-0505cf1b6a8e | 2 | public double computeConfidenceScore( ) {
double confidenceScore = 0;
// Generate an iterator. Start at end of list
ListIterator li = chain.listIterator(chain.size());
// now create a tally system for all the identities in the system
HashSet<WeightedIdentity> IDTally = new HashSet<WeightedIdentity>();... |
77ef0d81-6040-432c-947a-b65ae1a2dc7d | 7 | public String toXMLBIF03() {
if (m_Instances == null) {
return("<!--No model built yet-->");
}
StringBuffer text = new StringBuffer();
text.append(getBIFHeader());
text.append("\n");
text.append("\n");
text.append("<BIF VERSION=\"0.3\">\n");
text.append("<NETWORK>\n");
text.ap... |
f45b3abb-a94e-4251-8420-dc693532c4c7 | 4 | public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("Prefix : ");
sb.append(prefix);
sb.append('\n');
sb.append("Key : ");
sb.append(key);
sb.append('\n');
sb.append("Detail : ");
sb.append(detail);
sb.append('\n');
sb.append("Separa... |
fe9a7ec8-e084-42c0-8d47-dd318cabb43c | 2 | public static void main(String[] args) {
if(args.length < 1) {
usage();
System.exit(1);
}
int num = Integer.parseInt(args[0]);
int delay = 0;
if(args.length > 1)
delay = Integer.parseInt(args[1]);
new MultiClient(num, delay).start();
} |
e1360ede-46ca-41dd-859d-70a6bbdc8715 | 3 | public void stopGame() {
// Setting isRunning to false will
// make the thread stop (see run())
this.isRunning = false;
// Unset the game model...
this.view.setModel(null);
// Stop listening for events
this.view.removeKeyListener(this.keyListener);
// Make sure we wait until the thread has stopped...... |
0397f816-29e5-4232-a3d2-2809096c4590 | 5 | public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
String afile=args[0];//"/home/dharmesh/aditya/mallet-2.0.7/entestingforsvmfemale.out";
String afile2=args[1];//"/home/dharmesh/aditya/mallet-2.0.7/entestingforsvmmale.out";
String bfile=args[2];//"/home/dharmesh/ad... |
00e1e75e-9e0d-462f-8038-0cf89e33cca2 | 4 | public static void main(String[] args)
{
if (args.length > 2)
{
SortingAlgorithm algorithm = getSortingAlgorithm(args[0].toLowerCase());
if (algorithm != null)
{
try
{
int length = Integer.parseInt(args[1]),
n = Integer.parseInt(args[2]);
... |
215c33cb-a502-4110-bc7e-f1e293f3d3be | 6 | public static int loadShaderPair(String vertexShaderLocation, String fragmentShaderLocation) {
int shaderProgram = glCreateProgram();
int vertexShader = glCreateShader(GL_VERTEX_SHADER);
int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
StringBuilder vertexShaderSource = new StringBuilder();
StringBuil... |
a4d41858-8cdd-4f28-b90a-acedf0092765 | 6 | private int compare( idx o, int i ) // this compares keys
{
int r=0;
for(int n=0; r==0 && n<o.searchKey.length; n++ )
{
int a = pgC[i][n], b = o.searchKey[n];
if(a<0) a+=0x100; if(b<0) b+=0x100; // to unsigned
if(a<b) r=-1; else if(a>b) r=1;
}
return r;
} |
167c0c58-a4ba-47f4-b4af-9c64b61b162e | 5 | public void start() throws JSchException{
Session _session=getSession();
try{
sendRequests();
Request request=new RequestShell();
request.request(_session, this);
}
catch(Exception e){
if(e instanceof JSchException) throw (JSchException)e;
if(e instanceof Throwable)
... |
d6f2c5f3-5438-4ab3-94d8-353935273625 | 6 | private boolean RDFTCheck (List<CarrierInfo> carrierList) {
// Check there are 8 carriers
if (carrierList.size()!=8) return false;
int a,leadCarrierNos[]=new int[8];
// Check the difference between the highest carrier bin and the lowest is within an allowable range
int totalDifference=carrierList.get(7).getBi... |
41c0f581-46e2-4e76-afdf-39c9f8942755 | 1 | public static synchronized Name getInstance() {
if (name == null) {
name = new Name();
}
return name;
} |
3f4720e1-7b75-4b94-8c5a-5f45ea9a9b1b | 9 | private void doTotalOrderTest(int numberOfMembers) throws Exception {
final int maxMessages = 1024;
final int totalMessages = maxMessages * numberOfMembers;
for (int i = 0; i < numberOfMembers; ++i) {
TOANode node = createNewChannel("to_test_" + i);
node.start("to_test_cl... |
61ba9fb9-e365-44cd-9f71-6d471093b988 | 4 | private void jTabbedPane2MouseClicked(java.awt.event.MouseEvent evt) {
if (!DarkIRC.channelsList.get(jTabbedPane2.getSelectedIndex()).equals(DarkIRC.currentChan)) {
jTabbedPane2.setForegroundAt(jTabbedPane2.getSelectedIndex(), Color.BLACK);
Logs.makeLog(Da... |
bb4bfd3e-73f4-4672-b167-c6ac858181d7 | 3 | public void actionPerformed(ActionEvent event)
{
if (comboBox.isEditable())
{
String newEntry = entryToUpperCase();
if (!newEntry.equals(Files.REVERT))
{
FileParser.writeFile(newEntry+Files.PRESET_EXTENSION);
if (!exists(newEntry))
comboBox.addItem(newEntry)... |
bffd915e-fcdc-45e5-bcea-acf92c7d4a28 | 2 | public static void makeNextBlackMoves(){
boolean incorrectOption = true;
while(incorrectOption)
{
Move move = UserInteractions.getNextMove(Player.black);
if (CheckValidMoveForBlackHuman(move.initialRow, move.initialCol,
move.finalRow, move.finalCol))
... |
c3e35a37-273a-4e7b-8492-defa3d58cf66 | 4 | public boolean remove(Attribute attribute) {
if (attributes == null)
return false;
UUID uuid = attribute.getUUID();
for (Iterator<Attribute> it = values().iterator(); it.hasNext(); ) {
if (Objects.equal(it.next().getUUID(), uuid)) {
it.remove();
... |
f23d4b11-f4be-4498-83e5-03dc0faeeee4 | 0 | public Level() {
vertices = new ArrayList();
nextLevel = null;
} |
bdf2a3de-e81b-409b-8f09-2f21de6e8f48 | 5 | public void asignarColumnaLetras(String nombreRespuesta, int numeroRespuesta){
switch(numeroRespuesta){
case 0: _jlbl1.setText(nombreRespuesta);
break;
case 1: _jlbl2.setText(nombreRespuesta);
break;
case 2: _jlbl3.setText(nombreRespuesta);
... |
136b9c04-9e03-46f3-9db1-846fb5b53087 | 4 | public void refreshCurve() {
// System.out.println("Curve refreshing");
needsRefresh = false;
double lengthx = end.x - start.x;
double lengthy = end.y - start.y;
double centerx = ((double) (start.x + end.x)) / 2.0;
double centery = ((double) (start.y + end.y)) / 2.0;
d... |
312820ed-6b59-435f-9f85-f516f7c9de16 | 5 | public void changeOwner(EU2Country country) {
int id = go.getInt("id");
String sid = go.getString("id");
boolean b = false;
EU2Country prevOwner = null;
for (int i = 0; i < scenario.numCountries() && !b; i++) {
GenericList provs = scenario.getCountry(i).go.ge... |
85afa46b-69a3-4328-aadd-e8385f8207a3 | 4 | protected final void onButtonClick(Button var1) {
if(var1.id == 0) {
this.minecraft.setCurrentScreen(new OptionsScreen(this, this.minecraft.settings));
}
if(var1.id == 1) {
this.minecraft.setCurrentScreen(new GenerateLevelScreen(this));
}
if(this.minecraft.session != nu... |
6f4bf1fe-bdd9-4991-ae5d-4b8c98bcfbaa | 6 | public ArrayList<String> getUsers() throws Exception
{
// System.out.println(super.mathGame.getCursor());
@SuppressWarnings("unused")
String gameType; //TODO The variable is initialized but never used
if (mathGame != null) {
gameType = mathGame.getTypeManager().getType().toString().toLowerCase();
}
... |
eaf5afff-b060-42a8-a7ad-b9ce4807e45e | 7 | public static int[][] getTriangleData(String filename) {
try {
BufferedReader in = new BufferedReader(new FileReader(filename));
String line;
int lines = 0;
while (in.readLine() != null) {
lines++;
}
in.close();
... |
d7feb19c-baae-4ceb-bc6d-18b90a5ef19d | 0 | public void setFirstName(String firstName) {
_firstName = firstName;
} |
81c97a21-53e6-46b1-9b5b-b0654aa62f3b | 7 | public static BasicCommand makeFromString(String command){
BasicCommand basicCommand;
switch(command){
case "Create Profile":
basicCommand = makeAddProfile();
break;
case "Create Computer":
basicCommand = makeAddCom();
... |
7217e0a2-c2ee-47e9-a23b-20f86e7def3c | 0 | @Test
public void minReturnsNullWhenHeapIsEmpty() {
assertEquals(null, h.min());
} |
c2501f37-1ae5-4272-a2ca-9b3e1e422f0a | 2 | public void popularCbProjeto() {
ArrayList<String> Projetos = new ArrayList<>();
ProjetoBO projetoBO = new ProjetoBO();
try {
Projetos = projetoBO.CMBProjeto(usuarioLogado.getDepartamento().getCodigo());
} catch (SQLException ex) {
JOptionPane.showMessageDialog(n... |
4f027cd5-5be7-47c6-b2dc-2b38edc404e7 | 6 | private static void writeEdges(BufferedWriter writer, HashMap<String, Integer> lookup,
List<NewRDPParserFileLine> list) throws Exception
{
HashSet<String> nodeLines = new LinkedHashSet<String>();
for( NewRDPParserFileLine fileLine : list)
{
for( int x=TAXA_ARRAY.length- 1; x >=1; x--)
{
String level... |
7631ed95-4891-4ae7-b616-38b471c7398c | 5 | public static void configure()
{
/**
* Loads the config file
*/
String line;
try
{
BufferedReader reader = new BufferedReader(new InputStreamReader(STTheme.class.getResourceAsStream(getRootPath()
+ "/config.txt")));
while ((l... |
0e28a94f-a343-45f4-b14e-86aca9c30e16 | 5 | @Override
public void flush()
{
// Only a streaming source can be flushed, because only streaming
// sources have queued buffers:
if( channelType != SoundSystemConfig.TYPE_STREAMING )
return;
// determine how many buffers have been queued:
int queued ... |
715ff73b-6fc0-478d-9a94-4a456cea268f | 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... |
2fbf6adc-8552-4221-8384-01bc795bf370 | 7 | private boolean formatCheck(boolean isAudio) {
if (isAudio == true) {
if (sTimeT.getText().matches("[0-9]+")
&& tTimeT.getText().matches("[0-9]+")
&& outFileT.getText().endsWith(".mp3")) {
return true;
} else {
return false;
}
} else {
if (sTimeT.getText().matches("[0-9]+")
&& tTi... |
7993861c-dfa5-4243-8926-3d2c846b5af0 | 3 | @Override
public void deserialize(Buffer buf) {
pageIndex = buf.readShort();
if (pageIndex < 0)
throw new RuntimeException("Forbidden value on pageIndex = " + pageIndex + ", it doesn't respect the following condition : pageIndex < 0");
totalPage = buf.readShort();
if (tot... |
82375676-080c-4a03-8329-05d52a7e5bbc | 2 | public synchronized void info() {
float dl = 0;
float ul = 0;
int choked = 0;
for (SharingPeer peer : this.connected.values()) {
dl += peer.getDLRate().get();
ul += peer.getULRate().get();
if (peer.isChoked()) {
choked++;
}
}
logger.info("BitTorrent client " + this.getState().name() + ", " ... |
be9933ae-a3a6-434f-b925-fd2762dee3ab | 7 | public void maakOpdracht(String vraag, String antwoord, String meerkeuze, boolean juisteVolgorde, int minAantalTrefWoorden, String hints,
int maxAantalPogingen, Time maxAntwoordTijd, OpdrachtCategorie categorie, Leraar auteur, Datum opmaakDatum, String type)
throws IllegalArgumentException, Exception {
try {
... |
f7a44501-8b73-49b4-a3b3-e153cdbe6c98 | 7 | public static void main(String[] args)
{
Grid<Actor> gr = new BoundedGrid<Actor>(5, 9); //create a 5x9 grid
world = new ActorWorld(gr);
boolean doneSpawning = false;
//go through each cell
for(int r = 0; r < gr.getNumRows(); r++)
{
for(int c = 0; ... |
386de024-dae9-4d7c-a97e-d2d22c966289 | 8 | JMenu createToolBarMenu(final JMenuItem removeToolBarItem) {
String s = getInternationalText("Tools");
JMenu menu = new JMenu(s != null ? s : "Tools");
menu.setMnemonic(KeyEvent.VK_T);
menu.addMenuListener(new MenuListener() {
public void menuSelected(MenuEvent e) {
removeToolBarItem.setEnabled(hasToolb... |
cef041a5-286f-4d6e-bbf1-45155702c05c | 4 | protected Varargs execute(String command) {
int exitValue;
try {
exitValue = new JseProcess(command, null, globals.STDOUT, globals.STDERR).waitFor();
} catch (IOException ioe) {
exitValue = EXEC_IOEXCEPTION;
} catch (InterruptedException e) {
exitValue = EXEC_INTERRUPTED;
} catch (Throwable t) {
e... |
684b457f-241e-46be-977b-ca85ca048ba9 | 9 | protected void walk(String path, CButton buttonsList)
{
File rootFolder = new File(path);
File[] list = rootFolder.listFiles();
if (list == null)
return;
String fileSeparator = "\\";
if (System.getProperty("os.name").equals("Linux"))
fileSeparator = "/";
for (File f : list)
{... |
305b14ea-fb85-4f6b-a090-27776a0b54ea | 8 | public Shape paintLayer(Graphics g, int p0, int p1, Shape viewBounds,
JTextComponent c, View view) {
g.setColor(getColor());
p1++; // Workaround for Java Highlight issues.
// This special case isn't needed for most standard Swing Views (which
// always return a width of 1 for modelToView() calls), but... |
9149ab02-e4d8-471e-94ce-ef33b8f7cd7f | 4 | @Override
public boolean traverse(EnumSet<TraversalOption> options) {
if (!init())
return false;
Entity near = Bank.getNearest();
if (near != null && curBank == null)
return EntityUtil.bringOnScreen(true, near);
else
return init() && curBank.traverse(options);
} |
5e883a23-f77b-4969-8c75-bc37c286af5d | 3 | static boolean esseKuchen(ServerKontext kontext, Spieler spieler,
Item kuchen)
{
int energie = spieler.getLebensEnergie();
if(kuchen.isKuchen())
{
energie += SpielKonstanten.KUCHEN_ENERGIE_GEWINN;
kontext.schreibeAnSpieler(spieler,
TextVerwalter.kuchengegessentext(energie));
}
else if(kuchen.... |
1a7cf93d-592c-4e74-99dc-a8657982ed51 | 5 | public Boardable[] canBoard(Boardable batch[]) {
final int minSize = 1 + inside.size() ;
if (batch == null || batch.length < minSize) {
batch = new Boardable[minSize] ;
}
else for (int i = batch.length ; i-- > 1 ;) batch[i] = null ;
batch[0] = entrance ;
int i = 1 ; for (Mobile m : inside)... |
9abedca5-fcf0-4036-825e-4474f5163b0a | 3 | public static int flp(String s, int[][] map, int i, int j) {
if(i==j) return map[i][j]=1;
if(s.charAt(i)==s.charAt(j)) {
if(map[i+1][j-1]!=0) {
map[i][j] = map[i+1][j-1] +2;
} else {
map[i][j] = flp(s, map, i+1, j-1) +2;
}
} else {
map[i][j] = Math.max(flp(s, map, i, j-1), flp(s, map, i-1,j));... |
5de23712-db1c-4557-85f0-fb0b6eec41fd | 7 | private byte[] encodePapPassword(final byte[] userPass, byte[] sharedSecret) {
// the password must be a multiple of 16 bytes and less than or equal
// to 128 bytes. If it isn't a multiple of 16 bytes fill it out with zeroes
// to make it a multiple of 16 bytes. If it is greater than 128 bytes
// tr... |
b47eeeb9-9639-4774-8237-7d1ea8dd8e0d | 5 | public static Remote440 exportObject(Remote440 remoteObject,int argPort) throws UnknownHostException, RemoteException440 {
if (Naming.isNamed(remoteObject)) {
throw new RemoteException440("Object has already been exported");
}
RemoteObjectRef ror = null;
ProxyDispatcher pd = null;
if (argPort == 0) {
... |
1018d519-0b4f-4915-a961-a6a10de55f11 | 9 | public static void main (String[] args) throws FileNotFoundException, IOException
{
String allString = "";
File dir1 = new File(onMac);
//"C:/Documents and Settings/fsimon0/My Documents/Cubisima Final/"
String[] datefolderChildren = dir1.list();
for (int... |
7b29a8b7-5ee4-40d9-8c8e-da94bd0cfe7e | 1 | public static void mailTo(final String receiver, final String subject, final String txt){
Properties props = new Properties();
props.put("mail.smtp.host", SMPT_GOOGLE);
props.put("mail.smtp.port", SMPT_PORT_GOOGLE);
props.put("mail.from", EMAIL_sean666666);
props.put("mail.password", "");
Session session = ... |
6bce529e-3b42-46b1-b9e4-4f6f01201621 | 6 | public static void loadModsFromFolder(File directory) {
if (!directory.isDirectory()) {
return;
}
ArrayList<File> files = new ArrayList<File>();
File[] filesAndDirectories = directory.listFiles();
if (filesAndDirectories != null) {
for (File file : filesA... |
1a0ba5f4-0589-4369-a234-fd6c93388efc | 8 | private static String invalidColonyReason(AIUnit aiUnit, Colony colony) {
String reason = invalidTargetReason(colony);
if (reason != null) return reason;
final Unit unit = aiUnit.getUnit();
final Player owner = unit.getOwner();
Player targetPlayer = colony.getOwner();
swi... |
b549ac91-3fcb-45a6-ac9b-4adaba538f88 | 5 | public int getResponse() {
if (result == -1 || result == JOptionPane.CANCEL_OPTION || this.options == null) {
return -1;
}
int i = 0;
for (JRadioButton rb : this.radioBtns) {
if (rb.isSelected()) {
return i;
}
++i;
}
return -1;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.