method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8c88ecea-30f0-4e46-902e-30a392a5d58f | 0 | @Test
public void testGcdHappyPath() {
// the base case means that q == 0, so return p
int q = 100;
int p = 75;
int result = BasicMath.gcd(p, q);
assertEquals(result, 25);
} |
924defb5-6ec9-4707-8083-d98268ae86d4 | 4 | private ExpressionList expression_list(int fallbackLineNumber, int fallbackCharPosition) throws RequiredTokenException
{
enterRule(NonTerminal.EXPRESSION_LIST);
ArrayList<Expression> expressions = new ArrayList<Expression>();
if(firstSetSatisfied(NonTerminal.EXPRESSION0))
{
expressions.add(expression0());
... |
b8e9c428-02d2-4fbc-92bc-9426af8ae6aa | 4 | @Override
public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
if (cs instanceof Player) {
final Player player = (Player) cs;
if (Lobby.started && !Game.started) {
if (DatabaseHandler.isPremium(player)) {
//TODO START PARTY
} else {
player.sendMessage(Message... |
07065e72-e8cf-47a8-bf1c-70ee676862f7 | 4 | public Collection<Entidad> ordenar(final String nombreCampo) {
final Collection<Entidad> tmp = new TreeSet<Entidad>( // Crea una coleccion de entidades a partir de un TreeSet
new Comparator<Entidad>() { // Es necesario crear un comparador de entidades para el TreeSet
@Ove... |
415251e3-44b0-4f03-b584-f45d8d55617c | 4 | public void run() {
System.out.println("taskLauncher run");
while (!Thread.interrupted()) {
try {
TaskInstance taskIns;
synchronized (tasksToLaunch) {
while (tasksToLaunch.isEmpty()) {
tasksToLaunch.wait();
}
//get the TIP
... |
0e404b1e-f365-482e-9aad-9b3624f2a817 | 6 | public Item next() throws NoSuchElementException
{
if(postingListMemoryMapped!=null &&
entry >=0 &&
entry < lexiconSize &&
currentPos >=0 &&
currentPos < toPos)
{
numOfReads++;
int o=postingListMemoryMapped.get... |
aaa22e7f-238d-470f-b888-ee86680fda2f | 7 | protected static Ptg calcSlope( Ptg[] operands ) throws CalculationException
{
if( operands.length != 2 )
{
return new PtgErr( PtgErr.ERROR_VALUE );
}
double[] yvals = PtgCalculator.getDoubleValueArray( operands[0] );
double[] xvals = PtgCalculator.getDoubleValueArray( operands[1] );
if( (xvals == null)... |
48f2f325-971a-4015-b077-b70782728d41 | 5 | public ResultMessage updUncheckedSend(ArrayList<SendCommodityPO> poList) {
SendCommodityPO po;
for(int i = 0; i < poList.size(); i ++) {
po = poList.get(i);
Iterator<SendCommodityPO> iter = sendList.iterator();
SendCommodityPO s;
while(iter.hasNext()) {
s = iter.next();
if(po.date.getTime() == s... |
3e9fff64-4dc9-40aa-b010-91ca0ed4cb41 | 7 | public JPanel setBoard(int n)
{
players[n].setMyBoard(new JPanel(new GridLayout(11,11)));//panel to store board
JTextField k;
for (i=0;i<11;i++)
{
for (j=0;j<11;j++)
{
if ((j!=0)&&(i!=0))
{
players[n].getBboard(i-1,j-1).addActionListener(new BoardListener());
players[n].getM... |
aeadf284-1f63-487b-b01a-087a7166a5ac | 2 | @Override
public void run(Player interact, Entity on, InteractionType interaction) {
if(interaction != InteractionType.LEFT && interaction != InteractionType.RIGHT) return;
String[] vote = new String[1];
vote[0] = this.vote;
Vote.instance.execute(interact, vote);
} |
824d4fa0-59b4-48ed-b4d1-dd9a17f0741c | 5 | static void revertMove(String cmd, int specialPiece) throws IOException {
int v[][] = Board.translatePosition(cmd.charAt(0) + "" + cmd.charAt(1) + "" + cmd.charAt(2) + "" + cmd.charAt(3));
Board.board[v[0][0]][v[0][1]] = Board.board[v[1][0]][v[1][1]];
Board.board[v[1][0]][v[1][1]] = specialPiece... |
114f38b2-08e3-4088-9a1f-9fb71215a8cd | 1 | public static void main(String[] args){
String host;
int port;
String platform = null; //default name
boolean main = true;
host = "localhost";
port = -1; //default-port 1099
Runtime runtime = Runtime.instance();
Profile profile = null;
AgentContainer container = null;
profile = new Prof... |
96f5c7d0-efc5-4174-9933-9a864f13bc45 | 4 | public HashMap<Integer, Integer[]> countOfPassengerOnEveryStation(Train train) {
log.debug("Start countOfPassengerOnEveryStation select");
List stationFrom = em.createQuery("select station.id, count(ticket.id), 0, schedule.seqNumber - 1 \n" +
"from Train train \n" +
"left... |
922e04f2-c9e8-4a01-9141-ee835a0a2e38 | 3 | public List<Integer> WolfTargets(int inWolf){
ArrayList<Integer> output = new ArrayList<Integer>();
for(PlayerAction Action : AllActions){
if(Action instanceof Attack){
if(Action.getPlayer() == inWolf) output.add(((Attack) Action).getTarget());
}
}
return output;
} |
ce5bd4b9-a3c6-4827-aa27-0ac389531df4 | 0 | public String getTextColorOfParticipant(String id) {
return participants.get(id).getTextColor();
} |
0340f01e-dac6-4c38-b81f-94738867f752 | 2 | public static GameObjectType fromId(byte id) {
for (GameObjectType type : values()) {
if (type.id == id) return type;
}
return null;
} |
bbcac12d-0343-4b26-8884-6a09b5a2a14b | 3 | void DFS(String s, int start, ArrayList<String> tmp, ArrayList<ArrayList<String>> res) {
if (start == s.length()) {
res.add(new ArrayList(tmp));
}
for (int i = start; i < s.length(); ++i) {
if (isPalindrome(s, start, i)) {
tmp.add(s.substring(start, i + 1));
DFS(s, i + 1, tmp, res);
tmp.remove(t... |
eb88ecfa-958f-4498-8413-480eff6162df | 7 | public Object getProperty(String key) {
PreparedStatement pstmtGetProp = null;
Object result = null;
// build the query
StringBuffer query =
new StringBuffer("SELECT ").append(valueColumn).append(" FROM ");
query.append(table).append(" WHERE ");
query.appe... |
99b1ceac-7592-4647-a6d3-1cfedf9fe5a8 | 4 | public void siirra(Suunta suunta)
{
float x = siirtyma.x();
float y = siirtyma.y();
switch(suunta)
{
case OIKEA: siirtyma.aseta(x + 1, y); break;
case VASEN: siirtyma.aseta(x - 1, y); break;
case ALAS: siirtyma.aseta(x, y + 1); break;
... |
540709fa-fd3c-4447-b9dd-650973c3c595 | 5 | public void scriviTutto () {
System.out.println("Stato Iniziale: " + this.statoIniziale);
System.out.println("");
System.out.println("Configurazione stato:");
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
System.out.print("Stato[" + i + ... |
08e51e1d-8d25-4a37-a092-783bf9c976f7 | 1 | public SignatureVisitor visitInterfaceBound() {
separator = seenInterfaceBound ? ", " : " extends ";
seenInterfaceBound = true;
startType();
return this;
} |
e785f9c6-d638-4064-be34-69037b261b06 | 2 | private void createTablesIfNotExist(Connection cnn) {
if (tableExists("cb_users", cnn)) {
logger.info("table cb_users already exists");
} else {
logger.info("create table cb_users");
String sql =
"CREATE TABLE `cb_users` ( \n" +
... |
60d8fee1-e8fd-424e-ac93-6bf4805551c0 | 6 | private void removeBlock(final Block block) {
trace.remove(block);
subroutines.remove(block);
catchBlocks.remove(block);
handlers.remove(block);
// edgeModCount is incremented by super.removeNode().
// Dominators will be recomputed automatically if needed, so just
// clear the pointers to let the GC work... |
fd37d39e-51b2-4359-8144-ff7a97399697 | 3 | public Version(final String version) {
this.original = version;
if (version == null) {
this.major = null;
this.minor = null;
this.revision = null;
this.type = null;
this.build = null;
return;
}
final Matcher m = Pa... |
c8845f5c-cd09-459a-8226-df78360e801e | 4 | public java.lang.String getLastMessage() throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[11]);
_call.setUseSOAPAct... |
9a413154-0c1f-40cf-b88d-0a99047b63f6 | 6 | public void doTask() {
//
// Get the currently picked tile, fixture and mobile. See if they are
// valid as targets. If so, preview in green. Otherwise, preview in
// red. If the user clicks, perform the placement.
final Tile PT = UI.selection.pickedTile() ;
final Fixture PF = UI.selectio... |
93a08b04-ab6e-4da0-ad17-8ec6d921cc0b | 4 | public static String toString(JSONObject jo) throws JSONException {
StringBuffer sb = new StringBuffer();
sb.append(escape(jo.getString("name")));
sb.append("=");
sb.append(escape(jo.getString("value")));
if (jo.has("expires")) {
sb.append(";expires=");
s... |
28ec8704-ebf3-4662-a41f-999fa0c49390 | 0 | @Override
public void doAnswer(AnswerSide answerSide)
{
AnswerSideManager answerSideManager = AnswerSideManager.getInstance();
answerSideManager.setAnswerSide(answerSide);
MessageDialog.getInstance().show(answerSideManager.getAnswersName() + ", фальстарт!");
answerSideManager.set... |
b1962dae-1ee0-4482-9472-ea9adaf40048 | 8 | public int up(){
int movedNr = 0;
for(int i=0;i<getY();i++){
ArrayList<Integer> merged = new ArrayList<Integer>(2); //list of all tiles which are already merged and are not allowed to be merged again
for(int u=0;u<getX()-1;u++){//go from left to right
int cv = u+1;
if(cells[cv][i] != 0){
Boolean ... |
e7b6d131-509f-467c-9b89-5d5e534abc7b | 0 | @Test
public void testGetName() throws IOException {
System.out.println("getName");
String antBrainFile = "cleverbrain1.brain";
AntBrain instance = new AntBrain(antBrainFile);
String expResult = antBrainFile;
String result = instance.getName();
assertEquals(expResult,... |
d07e34c9-c96f-40b3-b6b4-025dab50fc0b | 3 | public static void toFile(String stats, String filename) {
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(filename + ".dat"));
writer.write(stats);
} catch (IOException ignored) {
} finally {
try {
if (w... |
64754871-e22e-4bf0-a799-95305bbe0d28 | 4 | public SQLTableModel(String sql, String connection) {
super();
Connection con = (Connection) Session.getCurrent().get(connection);
try {
Statement stat = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet res = stat.executeQuery(sql);
ResultSetMetaData meta = re... |
92be75c1-6bc6-4258-8dec-aaa2d777a2ac | 8 | public void recordValue(String name, long timeStamp, float value) throws IOException {
SensorData sd = (SensorData)paramStorage.get(name);
if (sd.list_bos != null && sd.list_bos.size() >= maxBulkSize){
adapter.storeRecord(sd.list_bos.getBuffer(), sd.list_bos.size());
sd.list_bos = null;
}
if (sd.list_... |
a037722d-4629-407a-a6be-276c9ce9c95c | 1 | public byte[] getFileData() throws IOException {
byte[] data = source.getPayload();
CRC32 check=new CRC32();
// todo: see how much this crc check is slowing us down
check.update(data);
if(check.getValue() != this.crc32.getValue()) {
throw new IOException("CRC mismatch reloading file");... |
0eb631b7-821d-4058-af9d-5aa0b43c4b9d | 5 | public final void keyPressed(int keyCode)
{
switch (keyCode)
{
case (KEY_UP):
facing = NORTH;
break;
case (KEY_DOWN):
facing = SOUTH;
break;
case (KEY_LEFT):
facing = WEST;
break;
case (KEY_RIGHT):
facing = EAST;
break;
case (KEY_DELE... |
8e6da1a7-cff4-41e2-a10c-c46f374c0060 | 3 | public static synchronized String[] getAzubuStreamList() {
//TODO ensure these streams are loaded up via text file
azubuStream.areStreamsUp();
ArrayList<String> streamList = AzubuStream.getStreamList(); //ids for stream
ArrayList<String> streamName = AzubuStream.getStreamName(); //name ... |
c22283f0-ce8d-44c5-8647-16009f7a1959 | 9 | private void setPesoLlaveEntera(int capa, int neurona, int llave, double valor){
switch (llave) {
case 0:
this.setPeso(capa, neurona, THRESHOLD, valor);
break;
case 1:
this.setPeso(capa, neurona, EMBARAZOS, valor);
break;
case 2:
this.setPeso(capa, neurona, CONCENTRACION_GLUCOSA, valor... |
4b0bdf95-9175-4457-88fd-8d0392b07a1f | 8 | @Test
public void testConcurrency1() {
final int clientThreadCount = 5;
int total = 0;
int count = 0;
for (int i = 0; i < mServerCount; i++) {
try {
mDhtClientArray[i].purge();
} catch (RemoteException e) {
e.printStackTrace();... |
0fad663d-5bfd-4f18-a21c-2a573cdbfc57 | 2 | private void handleGameStatusUpdate(GameStatusUpdateEvent event) {
if (event.getStatus() == Status.DRAW || event.getStatus() == Status.OVER) {
this.startNewGame();
}
} |
b3604549-4f15-4749-b598-f05ab1ed00d5 | 4 | @Override
public boolean checkLegal(String prev_pos, String new_pos)
{
String convert_old_pos = CUtil.pos_Finder(prev_pos);
String convert_new_pos = CUtil.pos_Finder(new_pos);
int pfile = Integer.parseInt(convert_old_pos.substring(0,1));
int prank = Integer.parseInt(convert_old_pos.substring(1));
int nfile... |
74c18d9f-5eb6-4ef9-99fa-a9009001895a | 0 | public double getHealth() {
return health;
} |
103f79bb-184c-409a-8902-cabead2e15fc | 3 | public void insertMedicineData(Medicine medicine) throws SQLException {
try {
databaseConnector = medicineConnector.getConnection();
SQLQuery = "INSERT INTO familydoctor.medicine " + "VALUES(?,?,?,?,?,?,?)";
PreparedStatement preparedStatement = databaseConnector.prepareStat... |
84fa6ac6-45c3-4c1b-a34f-20e8d147c5b5 | 2 | public void checkCollisions() {
Rectangle rBase = base.getBounds();
for (Enemy e: getEnemyList()){
Rectangle rEnemy = e.getBounds();
if(rEnemy.intersects(rBase)){
doOnCollisions(e);
}
}
} |
3d17bf52-0654-451b-a3e8-d3e46ca648fb | 4 | public void loadFromFile(String filename)
{
// Detect FILE Format
String getExtension=filename.toLowerCase();
String extension="NONE";
if (getExtension.contains(".jpg")||getExtension.contains(".jpeg"))
{
extension="JPG";
}
else if (getExtension.con... |
9afdb31e-4738-4ecd-8f8b-a2eac77e6581 | 6 | public CommandState getCommandState(String uniqueID)
{
if(currentCommand != null && currentCommand.transactionID.equals(uniqueID))
{
return CommandState.RUNNING;
}
synchronized (toProcessCommands)
{
for(CommandRequestInfo commReq:toProcessCommands)
{
if(commReq.transactionID.equals(uniqueID))
... |
a63603db-b43e-4335-bc0b-c7266f37ef6a | 8 | @Override
public void update(Graphics g) {
if (seleccionado) {
g.drawRect(x, y, Longitud_Casilla, Longitud_Casilla);
g.fillRect(x, y, Longitud_Casilla, Longitud_Casilla);
} else {
g.drawRect(x, y, Longitud_Casilla, Longitud_Casilla);
}
switch (ti... |
422f6743-dd33-49b5-b556-5df1935962f8 | 9 | public void onPlayerDamageBlock(int par1, int par2, int par3, int par4)
{
syncCurrentPlayItem();
if (blockHitDelay > 0)
{
blockHitDelay--;
return;
}
if (field_78779_k.func_77145_d())
{
blockHitDelay = 5;
netClientHandl... |
4ced1c8a-fd4b-4f10-975f-08b4abb861d8 | 5 | @Override
public void update() {
if ((modify.get(PhysicsComponent.class)).getDirection() != Direction.DOWN) {
switch ((modify.get(PhysicsComponent.class)).getDirection()) {
case DOWN:
setCurrentAnimation("down_walk");
break;
case UP:
setCurrentAnimation("up_walk");
break;
case LEFT:
s... |
6e6d61e5-f8e5-49ba-b3dc-dff9d54b365e | 8 | private void setOutliers() {
_minValue = Double.MAX_VALUE;
_maxValue = Double.MIN_VALUE;
_totalCount = 0;
_totalValue = 0d;
for (DMemeList dml : _grid) {
if (dml.Min() != null && dml.Max() != null) {
if (_minValue == null) {
... |
fdfd8266-e5ed-4497-9311-edced40379a1 | 5 | private boolean checaTipoRetornoFuncao(String tipoDoRetorno) {
if(!listaDeBlocos.isEmpty()){
for(int i=0 ; i< listaDeBlocos.size();i++){
String [] tabela = listaDeBlocos.get(i).split("~");
String ehFuncao = tabela[0];
if(ehFuncao.equals("Fu... |
d653e251-016a-4fe2-983d-46aaf5229544 | 6 | public final WaiprParser.inval_return inval() throws RecognitionException {
WaiprParser.inval_return retval = new WaiprParser.inval_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token set68=null;
CommonTree set68_tree=null;
try { dbg.enterRule(getGrammarFileName(), "inval");
if ( get... |
b35fed11-3717-4737-b32e-8a9109094de1 | 2 | public void paint(Graphics g) {
if (showingMessage) {
if (showMessageCount <= showMessage) {
g.setColor(Color.WHITE);
g.setFont(font);
g.drawString(message, 25, 350);
showMessageCount++;
} else {
showingMessage = false;
}
}
} |
503f1dd5-74b2-4065-ad1c-685855b5f57c | 0 | @Override
public YamlPermissionOp getOP() throws DataLoadFailedException {
checkCache(PermissionType.OP, "op");
return (YamlPermissionOp) cache.get(PermissionType.OP).get("op");
} |
f3789e30-1b64-4b41-af77-4709397abc8b | 3 | public PixImage boxBlur(int numIterations) {
// Replace the following line with your solution.
int i;
PixImage blureven = new PixImage(this);
PixImage blurodd = new PixImage(this);
for (i = 0; i < numIterations; i++) {
if (i % 2 == 0) {
blurodd = blureven.boxBluronce();
} else {
blureven = bluro... |
5252d839-8098-43ef-a729-b4726e400a41 | 6 | public void itemStateChanged (ItemEvent evt)
{
if (evt.getSource() == cbmi100)
{
appParent.intImageSizePalette = appParent.intImageOriginalSize;
cbmi100.setState(true);
cbmi75.setState(false);
cbmi50.setState(false);
cbmi25.setState(false);
} else if (evt.getSource() == cbmi75)
{
appParent.in... |
52cd4860-b0dd-466c-969c-22e3ef6f0545 | 6 | public boolean checkComplete() {
int count = 0;
//Check if all answers entered
for(int i=0;i<3;i++) {
for(int n=0;n<3;n++) {
for(int t=0;t<3;t++) {
for(int e=0;e<3;e++) {
if(grid[i][n][t][e].getText().equals("")) {
grid[i][n][t][e].setBackground(Color.RED);
count++;
... |
7e6c0b64-8cfb-4a92-896b-9ebe1e69ae7b | 9 | public ArrayList<Integer> findSubstring(String S, String[] L) {
// Start typing your Java solution below
// DO NOT write main() function
if(L==null || L.length==0) return null;
int n = L.length, m = L[0].length(), l=S.length();
ArrayList<Integer> res = new ArrayList<Integer>();
... |
df1f49a9-5d3b-4144-be53-9c001dc2249a | 3 | protected Date parseApproximateDate(String[] words, int code)
throws MalformedDateException {
int qualifier = Date.EXACT;
switch (code) {
case ABOUT:
qualifier = Date.ABOUT;
break;
case CALCULATED:
qualifier = Date.CALCULATED;
break;
case ESTIMATED:
qualifier = Date.ESTIMATED;
... |
a0ba9837-6f62-4ca6-89c7-d15b4db57342 | 2 | public String[] itemNames(){
if(!this.dataEntered)throw new IllegalArgumentException("no data has been entered");
String[] ret = new String[this.nItems];
for(int i=0; i<this.nItems; i++)ret[i] = this.itemNames[i];
return ret;
} |
83a6bee1-6904-427f-a790-48d1fe28704f | 7 | private void altaCuenta (){
DefaultMutableTreeNode node = (DefaultMutableTreeNode) JTreeConta.getLastSelectedPathComponent();
Cuenta loadcuenta = null;
if (node == null){
mensajeError("Primero debe seleccionar una Cuenta.");
}
else{
Object nodeInfo = node... |
880bb3dd-8c03-4992-ad01-25becefa99a9 | 4 | @Override
public void map(String key, String value, Context context) {
if(value != null && value.length() > 0 && value.charAt(0) != '#'){
String[] fields = value.split("\t");
if(fields.length == 2){
String inNode = fields[1];
context.write(inNode,"1");... |
bdd96bd3-44aa-414f-8912-cb6c1f8d2025 | 0 | public int highScore()
{
return high(0);
} |
7fb0530a-7cd3-48cd-9757-06f698a4cb92 | 2 | public static boolean divide() {
if ( !popTwo() ) return false;
if ( x == 0 ) {
System.out.println("Cannot divide by 0.");
calcStack.push(y);
calcStack.push(x);
return false;
}
else {
double result = y / x;
pushResul... |
f8f76970-3494-4643-ab5c-d24cd19ec758 | 7 | public void generateAmbit(String source, String word) {
for (Place p : places) {
int start = p.getLocation() - 60;
int end = p.getLocation() + 60;
while (start > 0 && source.charAt(start) != ' ') { // jump to space or string start
start--;
}
... |
fa940155-d4f1-4014-a6a8-c84589a833dd | 2 | public synchronized void closeEntityManagerFactory() {
if (emf != null) {
emf.close();
emf = null;
if (DEBUG)
System.out.println("n*** Persistence finished at " + new java.util.Date());
}
} |
fcd9bbe8-2b58-45ea-b4ec-776f1fcf2a20 | 0 | @Override
public String getDbConnString() {
return dbconnstring;
} |
93d08b11-1d66-4bf6-8e25-d24b98c17edd | 2 | public static void loadFromPreferences() {
clearRecents();
Preferences prefs = Preferences.getInstance();
prefs.resetIfVersionMisMatch(PREFS_MODULE, PREFS_VERSION);
for (int i = 0; i < MAX_RECENTS; i++) {
String path = prefs.getStringValue(PREFS_MODULE, Integer.toString(i));
if (path == null) {
break;... |
3e24ac75-030c-4051-b4cf-e34128e1f9c6 | 3 | public static ItemInfo itemByString(String string) {
// int
Pattern pattern = Pattern.compile("(?i)^(\\d+)$");
Matcher matcher = pattern.matcher(string);
if (matcher.find()) {
int id = Integer.parseInt(matcher.group(1));
return itemById(id);
}
//... |
bf0f4bb2-12ce-437c-af21-20b0baf5a80d | 1 | public SynthesisFilter(int channelnumber, float factor, float[] eq0)
{
if (d==null)
{
d = load_d();
d16 = splitArray(d, 16);
}
v1 = new float[512];
v2 = new float[512];
samples = new float[32];
channel = channelnumber;
scalefactor = factor;
setEQ(eq);
//setQuality(HIGH_QUALI... |
d5f9091a-35a9-4068-8a7a-5d33f5018998 | 6 | public void getPorts(String value, String type) {
ArrayList<String[]> data = new ArrayList<String[]>();
Vector<String[]> target = model.getCachedData();
int index = 0;
//no port case b/c default of index is 0.
switch (type) {
case "protocol":
index = 1;
break;
case "name":
index = 2;
break;... |
ba0727d1-bb54-42ce-8b7b-3b70b33395da | 4 | public void run(){
if (mode==1){
ready=false;
kill=false;
this.open(filename,auIndex);
}
else {
while(true){
ready=false;
kill=false;
if(mode==2){
this.open(filename,auIndex);
}
if(kill) break;
}
}
} |
34d11311-f9fb-468c-ac83-856e8ad5c7ef | 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... |
19acb3e2-a112-4208-b879-cfa387bdf743 | 8 | public void start() {
VoteFrame stemFrame = new VoteFrame(this);
ResultJFrame localUitslagJFrame = new ResultJFrame(this);
localUitslagJFrame.setVisible(true);
stemFrame.setVisible(true);
this.uitslagJFrame = localUitslagJFrame;
this.voteFrame = stemFrame;
bool... |
21bd19c3-b0e9-47cb-96b4-2b6e23d38621 | 9 | public void startupMapHook() {
super.startupMapHook();
ModeController mc = getController();
MindMap model = getController().getMap();
if (Tools.safeEquals(getResourceString("file_type"), "user")) {
if (model == null)
return; // there may be no map open
... |
6663fe12-4a9e-4c9d-9861-6f40e0b64858 | 8 | @Override
public boolean okMessage(Environmental host, CMMsg msg)
{
if((((msg.target()==affected)&&(affected instanceof Item))
||(msg.target() instanceof Item)&&(affected instanceof MOB)&&(((MOB)affected).isMine(msg.target())))
&&(msg.targetMinor()==CMMsg.TYP_WATER))
{
if(!dontbother.contains(msg.target()... |
67adade7-860e-4b2d-8636-7022df5d4b52 | 3 | private void isLegal() {
if ((null == binaryLogicalOperator)) {
throw new IllegalStateException("Operator cannot be null.");
} else if (((null == validatorLHS) || (null == validatorRHS))) {
throw new IllegalStateException("Atleast one validator must be set for a compound validator.");
}
} |
f4592245-0e67-4bf6-9d21-f505d24fd390 | 4 | public static boolean checkRunButton() {
File file = new File(outputDirField.getText());
if (!file.isAbsolute()) {
file = file.getAbsoluteFile();
}
if (checkFile(file) && (!file.exists() || file.isDirectory())) {
updateRunButton(true);
return true;
} else {
updateRunButton(false);
return fals... |
aa5ac56d-9fb9-43a6-a77c-68bfe361a691 | 7 | public Command scanInput() {
Scanner scanner = new Scanner(System.in);
input = scanner.nextLine();
input = input.toLowerCase();
scanner.close();
Command command = new Command();
if (input.contains("zug")) {
if(this.zugConverter(input)==null){
command.setCommand(CommandConst.E... |
b3e04ce7-16a9-4b53-aaee-3bd847d1f61d | 4 | @SuppressWarnings("unchecked")
@Override
public double getScore(Object userAnswer) {
if (userAnswer == null)
return 0;
ArrayList<String> ans = (ArrayList<String>) userAnswer;
ArrayList<String> trueAns = (ArrayList<String>) answer;
ArrayList<String> ques = (ArrayList<String>) question;
int matches = 0;
... |
a316e7b3-54ee-4f8d-9055-a0dfa934d8a4 | 1 | private void checkExpressionIsCorrect(String input) {
String regex = "(\\s*\\d+\\s*[\\+\\-\\*\\/]\\s*){1,}\\d+\\s*";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(input);
if (!matcher.matches()) {
int failPosition = getFailPosition(pattern, input... |
8c7a66f0-1c4a-4bb2-8c70-a426bf5c7f52 | 8 | public static void incorporateFirstInputParameter(MethodSlot method) {
{ List parametertypespecs = method.methodParameterTypeSpecifiers();
StandardObject firstargtype = ((StandardObject)(parametertypespecs.first()));
if (!method.methodFunctionP) {
if (parametertypespecs.emptyP()) {
{ ... |
83345bb2-8cb4-4e09-9c75-7968a500ab49 | 9 | public static void main(String [] args) {
int bestK = 0;
int bestJ = 0;
boolean solutionFound = false;
boolean noSmallerSolutionExists = false;
long smallestDifference = Long.MAX_VALUE;
for (int k=1; !solutionFound && !noSmallerSolutionExists; k++) {
long pk = penta(k);
for (int j=1; j<k; j++) {
... |
fc4bedf9-2c13-4c8c-92d3-36a1d90365c0 | 5 | private void drawOval(int rx1, int ry1, int w, int h, int c, boolean fill)
{
if (fill)
{
Ellipse2D e = new Ellipse2D.Double(rx1, ry1, w, h);
for (int x = rx1; x <= rx1 + w; x++)
for (int y = ry1; y <= ry1 + h; y++)
if (e.contains(x, y))
... |
2cdf7241-db3c-4603-a537-b3268d7050ab | 6 | @Override
public final void visit(final int version, final int access,
final String name, final String signature, final String superName,
final String[] interfaces) {
this.version = version;
this.access = access;
this.name = newClass(name);
thisName = name;
... |
b2d03030-f228-4708-945c-7beccd399d4f | 7 | @Override
public int attack(final Glacor glacor, final Entity target) {
target.setAttackedBy(glacor);
glacor.setNextAnimation(new Animation(9955));
int SPEED = 50;
glacor.setNextGraphics(new Graphics(905));
World.sendProjectile(glacor, new WorldTile(target), 963, 60, 40, SPEED,
30, 12, 0);
if (!tile.co... |
27225123-e956-45ed-99e1-20e675f130a7 | 9 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
// pour le jour meme
Calendar calendar = Calendar.getInstance();
String monthS = "", dayS = "";
int year = calendar.get(Calendar.YEAR);
int monthI = calendar.get(Calendar.MONTH);
month... |
7366182a-6185-42f5-9efc-635345842e88 | 3 | @Override
protected Value evaluate(ExecutionContext context) throws InterpretationException {
Value val = ((AbsValueNode) this.getChildAt(0)).evaluate(context);
if (val.getType() == VariableType.ARRAYLIST) {
ArrayList<Value> list = (ArrayList<Value>) val.getValue();
list.rem... |
47a8df5b-40c8-444d-ad53-29712b67608b | 9 | public static void doPrint(List ocFile, List compsub, String PDBID, double x[]){
/* Filename: putative_true
%
% Abstract:
% Print out predicted calcium location and associated ligand group
% version 0.3
% Kun Zhao
% Version: 0.2
% Author: Xue Wang
% Date: 1/25/2008
% Replace version 0.1
... |
69d9db2a-1d6d-4e66-a621-2b9d885e30a8 | 4 | private ArrayList<String> GetProductiveNonTerminals(ArrayList<String> i_productions)
{
ArrayList<String> res_array = new ArrayList<String>();
for(Rule rule : m_rules)
{
boolean is_productive_rule = true;
for(String str : rule.GetRightPart())
{
... |
d7f9cd42-a023-4db3-96d6-dc0815957d45 | 0 | @Inject
public UnmarshallerPool(@Named("unmarshalContext") JAXBContext context) {
this.context = context;
} |
83c2d895-5cbe-4c21-a3fb-689144370c40 | 2 | public byte[] readNibbleArray() throws IOException
{
final int size = this.readInt();
final int byteCount = ceilDiv(size, 2);
final byte[] nibbles = new byte[size];
final byte[] data = new byte[byteCount];
this.in.read(data);
for (int nibbleIndex = 0, byteIndex = 0, bitIndex = 1; nibbleIndex < size; nib... |
46f1286c-0888-412b-addc-2870d5492c13 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
f4cb3d02-e22d-4645-836e-fa30b81e802d | 7 | @Override
public void loop() {
switch (step) {
case 0:
if(Motors.movement.isMoving()){
if(Motors.tsf.isPressed()){
Motors.movement.backward();
reset();
step++;
}
}
else{
Motors.movement.forward();
}
break;
case 1:
if (delta()>500){
Motors.movement.stop();
if... |
395dd545-b92b-475b-8dee-c33a3664b1a5 | 0 | public int getRap_num() {
return rap_num;
} |
c816a151-ea52-4cd3-985c-21310c05a349 | 2 | public void nouveauTour() {
tourEnCours++;
if (tourEnCours >= nbTours) {
Game.gameOver();
}
else {
// RAZ des étapes
etape = 0;
indexJoueurEnCours = 0;
joueurEnCours = this.lstJoueurs.get(indexJoueurEnCours);
// Si le peuple n'a pas de joueur, il doit en choisi... |
9bfcc464-0c72-41b0-bf2e-658ae7bc2514 | 0 | @Override
public void speak()
{
System.out.println("The poodle says \"arf\"");
} |
5829fb71-df0b-44ef-90de-aa125632a220 | 4 | @Override
public boolean accept(CourseRec rec) {
if (!this.active || rec.getCategories().isEmpty())
return true;
for (DescRec r : rec.getCategories())
if (selected.contains(r))
return true;
return false;
} |
9ff511cb-1974-4fa7-a7a2-d4859448bf44 | 9 | void analyzePacket(Packet packet){
boolean[] isExpanded=new boolean[root.getChildCount()];
for(int i=0;i<root.getChildCount();i++) {
isExpanded[i] = tree.isExpanded(new TreePath(((DefaultMutableTreeNode) root.getChildAt(i)).getPath()));
}
root.removeAllChildren();
DefaultMutableTreeNod... |
49d1f7ff-44ab-4321-a6ef-0289fa60c28e | 3 | private void updateStatus() {
if (RobotMap.driveTrain_leftRearMotor != null){
Robot.driveTrain.updateStatus();
}
Robot.oi.updateStatus();
if (RobotMap.ratchetClimberRatchet != null){
Robot.ratchetClimber.updateStatus();
}
Robot.climberActuator.upda... |
3f8fe09b-7f31-436f-8a47-8e76ced3a259 | 8 | public static String getAttributeValue(Node node, String name) {
String results = null;
if(node != null && !isNullOrWhitespace(name) && node instanceof Element) {
NamedNodeMap attrs = node.getAttributes();
if(attrs != null) {
for(int j = 0; j < attrs.getLength(); ++j) {
Attr attr = (Attr)attrs.item(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.