method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
32094c05-2bd7-4b34-a12c-3d1d63119436 | 9 | public void debugOutput(int topK, String filePrefix) {
File parentTopicFolder = new File(filePrefix + "parentTopicAssignment");
File childTopicFolder = new File(filePrefix + "childTopicAssignment");
File childLocalWordTopicFolder = new File(filePrefix
+ "childLocalTopic");
if (!parentTopicFolder.exists()... |
5b2367ba-0640-4911-a6c1-461557254fc9 | 9 | static final public int Sentence() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case create:
Create();
{if (true) return 0;}
break;
case insert:
Insert();
{if (true) return 0;}
break;
case select:
Select();
{if (true) return 0;}
break;
... |
2af7bf49-2ed1-4f62-83fd-ff88abb0c7d2 | 3 | public ArrayList<String> getDomains() {
ArrayList<String> result = new ArrayList<String>(this.amount);
String domainName;
long beforeExec;
long afterExec;
boolean isRegistered;
for (int i = 1; i <= this.amount; i++) {
domainName = this.gen.generate() + this.tld;
beforeExec = System.currentTimeMillis... |
c136d1b5-2101-4675-aceb-3b188092cf40 | 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... |
ba48411a-7af9-4e6f-a19c-a8f1f4425f56 | 3 | public AbstractMob NPCAtLocation(int x, int y){
for (int i = 0; i < mobs.size(); i++){
AbstractMob mob = mobs.get(i);
if (mob.getX() == x && mob.getY() == y){
return mob;
}
}
return null;
} |
0aeae4e8-1b9a-41b7-acaa-b81b1e89a360 | 3 | public static Integer getGirlToBoyNakshatraDistance(Nakshatra boyStar, Nakshatra girlStar) {
int boyNumber = boyStar.ordinal() + 1;
int girlNumber = girlStar.ordinal() + 1;
int distance = 0;
if (boyNumber > girlNumber) {
distance = boyNumber - (girlNumber - 1);
}
if (boyNumber < girlNumber) {
distanc... |
3cfeaf00-6dfe-4352-90f4-c03618115f2a | 0 | public TVC(int id, double intencity) {
this.id = id;
this.intencity = intencity;
} |
38b799bd-b6d3-4663-a705-51e647604db4 | 5 | public void startMultipulLearning(){
double error = 1;
int flag=1;
int incValuesPos=0;
while(flag!=0){
flag=0;
for(incValuesPos = 0;incValuesPos<incomeParamsArrLearn.size();incValuesPos++){
for(int i=0;i<incomeLayoutNeuronCount;i++){
... |
0c8f45b7-c770-4895-913a-f4fea9291481 | 9 | private void decodeHeader(final BufferedReader in, final Map<String, String> pre, final Map<String, String> parms, final Map<String, String> header) throws InterruptedException {
try {
// Read the request line
final String inLine = in.readLine();
if (inLine == null) {
return;
}
final... |
ae6a7438-2c12-483e-a9bc-853346310d3d | 1 | public void initDataDir() {
File dataDir = new File(VCNConstants.WORK_FOLDER);
boolean dirAndExist = dataDir.isDirectory();
if (!dirAndExist) {
dataDir.mkdir();
}
} |
d0ce6f97-dcc2-493e-9f67-6a5ce2d6bd12 | 2 | public static String reverse(String s) {
if(s.length() <= 1) {
return s;
}
// initialize array and pointers
char[] c = s.toCharArray();
int start = 0;
int end = s.length() - 1;
while(start < end) {
// swap characters
... |
f8190f54-cde9-4ddc-a3a8-2095dad1d4ff | 4 | @Override
public void deserialize(Buffer buf) {
spouseAccountId = buf.readInt();
if (spouseAccountId < 0)
throw new RuntimeException("Forbidden value on spouseAccountId = " + spouseAccountId + ", it doesn't respect the following condition : spouseAccountId < 0");
spouseId = buf.r... |
76f235f9-4583-4ad2-a541-68bf23d0d83c | 8 | public void printWithMask() {
System.out.println(" A B C D E F G H I J");
for (int x = 0 ; x < size ; x++) {
if (x == size) {
System.out.print(x + "|");
} else {
System.out.print(x + " |");
}
for (int y = 0; y < size; y++) {
if (y == (size - 1)) {
if (board[x][y].isHit()) {
if (... |
a1304381-ee6b-4d74-be93-050b995c1274 | 4 | public static void printAncestors(Class<?> clazz) {
Class<?> superClass = clazz.getSuperclass();
print(clazz.getSimpleName());
Field[] fields = clazz.getDeclaredFields();
for(Field field : fields) {
print("\t" + field);
}
if(superClass != null) {
p... |
8d75a99c-562b-445c-8aee-b7cabe29c9e5 | 0 | public boolean isIgnore() throws InterruptedException {
return false;
} |
02e59744-4ed1-453b-86b0-bd7f84de2a27 | 7 | @Override
public void readData(byte[] data) {
String gameData = new String(data);
String[] parts = gameData.split("\\@");
String gameState = parts[0];
String[] properties = gameState.split("\\'");
// System.out.println("gamestate: " + gameState);
Tank player1;
Tank player2;
if (level != null && leve... |
3ec03276-7a9f-482d-88a0-5dd5ff73488c | 9 | @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 SubscriptionPK)) {
return false;
}
SubscriptionPK other = (SubscriptionPK) object;
if ((this.uid == null && oth... |
e03a9cee-acf9-462f-bd49-18513057a399 | 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... |
e91f7208-008b-4196-988b-35a8df3dd59c | 2 | public void addTableToJoin(String tableName, String asName)
{
if (!joinTableIds.contains(asName)
&& !joinPropertyTableIds.contains(asName))
{
joinTables.add(tableName);
joinTableIds.add(asName);
}
} |
d374f878-9790-4f8c-949b-8c3d419dd063 | 9 | public void pushTasset() {
int len = this.tassetMaintQueue.size();
Tasset t;
// Flush out the maintenance queue, move ready tassets to free queue
for (int i=0; i<len; i++) {
t = this.tassetMaintQueue.remove(0);
if (t.getDelay() > 0)
t.setDelay(t.getDelay() - 1);
// If the maintenance delay expires,... |
366b5790-27d0-4a17-becc-608ae220750b | 8 | public Coordinate addDirection(DIRECTION d) {
int newX = 0, newY = 0;
if (d == DIRECTION.NORTH) {
newY--;
} else if (d == DIRECTION.EAST) {
newX++;
} else if (d == DIRECTION.SOUTH) {
newY++;
} else if (d == DIRECTION.WEST) {
newX--;... |
10979f54-5b34-4f29-beed-201c07b329d9 | 4 | public void recursivePrint(TreeNode root, int parentPosition, Node innerNode, Node p, int i) {
Node innerParent;
int position;
if (root != null) {
int height = heightRootToNode(root);
int nextTop = getRectNextTop(height);
if (innerNode != null)
... |
798672bc-5636-4ae9-a2be-8fc0c0d3bb07 | 4 | public static void main(String args[])
{
Logger log = Logger.getLogger("MAIN");
Properties ptSource = new Properties();
ptSource.setProperty("connection.host","172.25.13.149");
ptSource.setProperty("connection.port","21");
ptSource.setProperty("user.login","ftpuser")... |
9da307d8-e852-45fe-a981-d358173c6c96 | 3 | public Matrix(int n) {
if (n < 0)
throw new IllegalArgumentException("n = " + n);
HashMap<Integer, HashMap<Integer, Node>> a = new HashMap<Integer, HashMap<Integer, Node>>();
matrix = a;
size = n;
// Initiates all x-coordinates and each x-coordinate's HashMap
// (y-dimension, each coordinate features ... |
7b150c9b-adf5-4a08-8b6c-3c4ea8c221dc | 6 | static double grad (int hash, double x, double y, double z)
{
int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE
double u = h < 8 ? x : y, // INTO 12 GRADIENT DIRECTIONS.
v = h < 4 ? y : h == 12 || h == 14 ? x : z;
return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? ... |
449f263f-2dd8-4795-aa1d-e0f16f4c71c8 | 2 | public static void writeBytesToFile(File theFile, byte[] bytes) throws IOException {
BufferedOutputStream bos = null;
try {
FileOutputStream fos = new FileOutputStream(theFile);
bos = new BufferedOutputStream(fos);
bos.write(bytes);
} finally {
if... |
a3e96ddd-be8f-49f1-b5fa-9e98f8bb92be | 4 | public static void process(Process process, String[] cmd, IoSession session)
throws IOException {
try {
BufferedReader infoBr = null;
BufferedReader errorBr = null;
sendNormalMsgToClient(process, infoBr, session);
sendErrorMsgToClient(process, errorBr, session);
int val = process.waitFor();
if... |
646add73-1ae0-4495-a2e6-95f7b872ac63 | 5 | public void hyperlinkUpdate(HyperlinkEvent event)
{
if(event.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
{
try
{
if(!Desktop.isDesktopSupported())
return;
Desktop desktop = Desktop.getDesktop();
if(desktop.isSupported(Desktop.Action.BROWSE))
{
... |
f46d136b-13c0-47b4-8bb1-967c3f8aa28f | 2 | public boolean equals( Vertex3f r )
{
return x == r.getX() && y == r.getY() && z == r.getZ();
} |
78888cc7-0acd-486e-be5c-936a62f76398 | 6 | private static byte[][] generateSubkeys(byte[] key) {
byte[][] tmp = new byte[Nb * (Nr + 1)][4];
int i = 0;
while (i < Nk) {
tmp[i][0] = key[i * 4];
tmp[i][1] = key[i * 4 + 1];
tmp[i][2] = key[i * 4 + 2];
tmp[i][3] = key[i * 4 + 3];
i++;
}
i = Nk;
while (i < Nb * (Nr + 1)) {
byte[] temp ... |
b2af9f73-a050-4ed9-9aa7-a99c2f7ed93a | 4 | public String getRandomSequence(int length) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < length; ++i) {
double rand = Math.random();
if (rand > 0.75) {
builder.append("C");
} else if (rand > 0.5) {
builder.append("G");
} else if (rand > 0.25) {
builder.append("T");
}... |
572bcdcb-b65a-4c49-b8f4-90e18b906d7d | 7 | public static void main(String[] args) {
// TODO Auto-generated method stub
Deal deals[] = new Deal[10];
for(int i = 0 ; i < 10 ; i++ ){
int type = (int) (Math.random() * 3);
int amount = (int) (Math.random() * 2000 + 3000);
int year = (int)(Math.random()*13 + 10);
int month = (int)(Math.random()*12);... |
ca5d0b62-e149-4186-867c-3a9ac366baac | 4 | private void loadDataFromSparseFile(String file, InstanceType type, int featureCount) throws IOException
{
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
ArrayList<Double> features = new ArrayList<Double>();
String line = null;
while((line = br.readLine()) != null)
{
... |
e081a7a5-6513-40ec-8018-3d047f799ca4 | 4 | @Override
protected void handleActionRequestInternal(ActionRequest request, ActionResponse response) throws Exception {
final String entryIndex = StringUtils.defaultIfEmpty(request.getParameter("entryIndex"), null);
//Get the BookmarkSet from the store
final BookmarkSet bs = this.bo... |
795eef4f-a705-421e-bf4a-7f797c24c14b | 4 | public static void readFile(String fileName) {
if (fileName == null) // Go back to reading standard input
readStandardInput();
else {
BufferedReader newin;
try {
newin = new BufferedReader( new FileReader(fileName) );
}
catch (Exception e) {
... |
13466d20-2fc0-4649-ae95-1ed18bcbd9ea | 8 | void undump(StringTokenizer st) {
reset();
int e = new Integer(st.nextToken()).intValue();
if (e == -1)
return;
elm = sim.getElm(e);
speed = new Integer(st.nextToken()).intValue();
value = new Integer(st.nextToken()).intValue();
int flags = new Integer(st.nextToken()).intValue();
minMaxV = new Double(st.ne... |
5db5565d-82f5-4e3d-bf8d-8c6b2d8a3ca1 | 4 | @Override
public String getPlotString() {
String dataString = "";
synchronized (data) {
if (data.size() > 0 && data.get(0).getMetaData().containsKey("StdDev")) {
for (LinkInfo i : data) {
dataString += i.timestamp + " " + i.power + " " + (Double) i.get... |
95d0e946-f32e-440f-85bf-c13bc10cf261 | 4 | public String toString()
{
int l = getPortalLevel();
StringBuilder sb = new StringBuilder(8);
int[] sresos = new int[resos.length];
System.arraycopy(resos, 0, sresos, 0, resos.length);
Arrays.sort(sresos);
for ( int i = 7; i >= 0; i--) sb.append(sresos[i]);
int hackLevel = Mat... |
9ea6895f-8200-4e3c-bf02-0abe946045a5 | 1 | static public int count(String a, String contains) {
int i = 0;
int count = 0;
while (a.contains(contains)) {
i = a.indexOf(contains);
a = a.substring(0, i)
+ a.substring(i + contains.length(), a.length());
count++;
}
return count;
} |
a302feb6-1cf9-4a64-9a3c-129de1269bd5 | 1 | @Override
public void update(long deltaMs) {
if(getTargetedActor() == null)
checkEnemies();
target();
} |
b7dd928f-8097-444b-bb56-461455010213 | 8 | public String toString(){
StringBuffer sb = new StringBuffer();
switch(type){
case TYPE_VALUE:
sb.append("VALUE(").append(value).append(")");
break;
case TYPE_LEFT_BRACE:
sb.append("LEFT BRACE({)");
break;
case TYPE_RIGHT_BRACE:
sb.append("RIGHT BRACE(})");
break;
case TYPE_LEFT_SQUARE:
... |
72d87dc6-a86e-481a-aef2-58deadd25b91 | 6 | public static File findJavaFolder() {
//"where" on Windows and "whereis" on Linux/Mac
if (System.getProperty("os.name").contains("win") || System.getProperty("os.name").contains("Win")) {
String path = getCommandOutput("where javac");
if (path == null || path.isEmpty()) {
... |
687d810a-7978-45b4-90ba-8be7bffe34eb | 0 | public int V() {
return V;
} |
4f3e1086-4904-4b91-abe5-70af41948fc7 | 5 | @Override
public boolean equals(Object o )
{
if(o == null)
return false;
if(!(o instanceof BauteilDTO))
return false;
BauteilDTO b = (BauteilDTO)o;
if(b.getNr() != this.getNr())
return false;
if(!b.getName().equals(this.getName()))
... |
6e8072be-dffc-46af-89ba-1d2509136dea | 3 | public void clearCells() {
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
for (int k = 0; k < depth; k++) {
cells[i][j][k].clearParticles();
}
}
}
} |
f5d45ab7-a90f-45c0-a8f4-45438692cd34 | 5 | private Point findClosestEnding(Point start, int rivnum) {
Point closest = null;
for (Point p : riverEndings) {
Tile t = MyzoGEN.getOutput().getTile(p);
if (t != null && t.riverID != rivnum) {
if (closest == null) {
closest = p;
} else {
if (Utils.getManhattanDistance(start, p) < Utils.getMa... |
dd15ae35-1f31-4471-bd67-b737e9020c77 | 4 | public ArrayList<Track> returnTracks()
{
ArrayList<Track> trackList = new ArrayList<Track>();
int nextID = 1;
ArrayList<String> paths = new ArrayList<String>();
System.err.println("[INFO] Begin scanning filesystem at " + musicFolderPath);
pathRecurse(musicFolderPath, paths);
System.err... |
cc1ebae4-653b-44d0-858d-bcbf8adcebc1 | 6 | private static void generateQueryFiles(String file) {
HashSet<String> hs = new HashSet<String>();
try {
BufferedReader bReader = new BufferedReader(new FileReader(file));
String line = bReader.readLine();
while ((line = bReader.readLine()) != null) {
String[] lineArray = line.split(",");
if (lineAr... |
74c634c1-e13d-4b2b-afac-94e69e127986 | 4 | public String buyStock(Stock st, int numShares){
if (money > numShares * st.getPrice()){ // they have enough money
money = money - st.getPrice() * numShares; // decrement money
portfolio = qs.qsort(portfolio, 0); // 0 sorts by ticker name
int index = -1;
// check if they already own some shares in ... |
2e70e30b-18c9-43af-b5b1-7d7b784bbb4c | 9 | private void botonCrearPersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCrearPersonaActionPerformed
borrando = false;
// Crea una nueva persona en la lista actual NO en el map, para que sea permante hay que guardar
DefaultTableModel modelo = ((DefaultTableModel) jTa... |
bce15e29-875a-470f-a7f2-498564e04be6 | 5 | private Connection getConnectionByName(String aDbName) throws DAOException {
Connection result = null;
String dbConnString = getConnectionString(aDbName);
if( ! Util.textHasContent(dbConnString) ){
throw new IllegalArgumentException("Unknown database name : " + Util.quote(aDbName));
}
... |
7a466c4f-78fb-4c9f-ae8e-b71c27c520a4 | 3 | public void moveRight() {
if (StartingClass.gameMode.equals("halloween")) {
if (centerX < 610)
centerX += speed;
} else if (centerX < 650)
centerX += speed;
} |
2a346ec1-8888-49cf-a1ca-16b7c7e48247 | 6 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
lbNome = new javax.swing.JLabel();
lbCidade = new javax.swing.JLabel();
tfNome = new javax.swing.JTextField();
tfEndereco = ne... |
485edc01-d472-484e-bc59-7e3704990c9b | 9 | private StringBuilder createSelectStatement(String cf, Object key,
List<Object> params) {
TableMetadata def = ContextFactory.getMapTableMetadata().get(cf);
StringBuilder selectSql = new StringBuilder("select * from " + Utils.getFullOriginalCF(cf) + " where ");
Boolean isHashMap = false;
HashMap<String, Objec... |
d882fdd6-f044-42fe-afce-c83c95eeb0fb | 1 | public void displaygrade() {
System.out.println("Grade report:");
if (counter != 0) {
double average = (double) total / counter;
System.out.println("Average:" + average);
System.out
.printf("Number of students whos received each grade:\nA:%d \nB:%d \nC:%d \nD:%d \nF:%d",
acount, bcount, ccount,... |
543a6177-d34b-4bec-9276-1829ff70aa83 | 9 | private void setIllegalMonumentsDisabled() {
switch (gamestate.getNumPlayers()) {
case 1:
for (int i = 8; i <= 14; i++) {
checkboxes[i].setEnabled(false);
}
for (int i = 24; i <= 34; i++) {
checkboxes[i].setEnabled(false);
}
for (int i = 48; i <= 62; i++) {
checkboxes[i].setEnabled(false)... |
c8c94a43-060f-4188-9d14-37a7c293be82 | 6 | public static void main(String[] args)
{
while (true)
{
Scanner keyIn = new Scanner(System.in);
String c = "J";
c = keyIn.nextLine();
if (c.equals("exit") || c.equals("quit"))
break;
if(c.contains("->")) //is reaction (Reaction)
{
R... |
c5f287c5-b87e-4be5-b7db-8b4dfb59a73a | 5 | public void deleteNode(CircularNode node){
CircularNode last=listHead;
CircularNode current=listHead;
if(listHead==null){
return;
}
else if(listHead.equals(node)){
while(last.getNextNode()!=listHead){
last=last.getNextNode();
}
... |
80cbc717-0b26-46c6-be2b-24b58d93f27e | 5 | public void Solve() {
List<Integer> primes = Euler.GetPrimes(_max);
ArrayList<Integer> circularPrimes = new ArrayList<Integer>();
for (int i = 0; i < primes.size(); i++) {
int prime = primes.get(i);
if (prime < 10) {
System.out.println(prime);
... |
071cfebc-4a8b-41c8-baa0-dd1f51783f00 | 4 | public static void Select_Size_R(String Size_Main) {
String xPath_Start = "html/body/ul[1]/li[";
String xPath_End = "]/a";
int i =2;
boolean end=false;
while (true) {
try {
String Size_Val = driver.findElement(By.xpath(xPath_Start+i+xPath_End)).getText();
double temp1 = Double.parseDoubl... |
302816ac-dd79-4672-88e0-94ef42597bf0 | 1 | public void lock()
{
if (lockCount++ == 0) {
//QMessageBox.about(this, "LOCK", "");
QCursor cursor = new QCursor();
cursor.setShape(CursorShape.WaitCursor);
QApplication.setOverrideCursor(cursor);
statusPlayer.setText("-");
statusGold.setText("-");
statusOre.setText("-");
statusWood.setText("... |
e2a86d98-dd69-4f9e-9871-e9d72b6f3249 | 1 | private static int decodeSequenceNumber(short sequenceNumber) {
return (int) (sequenceNumber < 0 ? sequenceNumber - 2*Short.MIN_VALUE : sequenceNumber);
} |
fe117dbb-25b3-4552-b437-e791eb3418cd | 5 | public void parse(String[] args) {
int from = 0;
int to = 1;
while(from < args.length) {
to = from + 1;
if (isKey(args[from]) && isThisKey(args[from])) {
while(to < args.length && !isKey(args[to])) {
to++;
}
doParse(removeKey(Arrays.copyOfRange(args, from, to)))... |
19f179eb-e063-4a59-93bf-f215e2fa7796 | 3 | @Override
public Class<?> getColumnClass( int column ) {
switch( column ){
case 0: return Integer.class;
case 5: return Integer.class;
default: return String.class;
}
} |
677c4ca4-ca14-4c4a-9013-8cb514a88774 | 0 | public String potwierdzOsobe(){
return "Potwierdzenie1";
} |
08a6f183-71cb-4bf4-b807-1885622b637e | 3 | private Tree jumpConditionPro(){
Tree expression = null;
if(accept(Symbol.Id.PUNCTUATORS,"\\(")!=null){
if((expression = expressionPro()) != null){
if(accept(Symbol.Id.PUNCTUATORS,"\\)")!=null){
return expression;
}
}
}
return null;
} |
c48fbcc3-52d4-4820-ba8d-4559ae388823 | 2 | private void renderAcePile(Graphics2D g) {
double x = X_BOARD_OFFSET + CARD_WIDTH * 6 + CARD_X_GAP * 6;
double y = Y_BOARD_OFFSET;
g.setColor(Color.white);
g.drawString("Ace Up", (int) x, (int) y - 1);
for (List<Card> acePile : game.getAcePiles()) {
if (acePile.size()... |
fc29067d-4d80-4642-9281-9fcac8dd2fe4 | 8 | private void originalKrislet() {
ObjectInfo object;
// first put it somewhere on my side
if (Pattern.matches("^before_kick_off.*", m_playMode))
m_krislet.move(-Math.random() * 52.5, 34 - Math.random() * 68.0);
while (!m_timeOver) {
object = m_memory.getObject("b... |
629becc7-3d07-4f28-833b-abe40021696a | 9 | public int wrap(final Body s, final int sides) {
Vector2D pos = s.getPosition();
double px = pos.getX();
double py = pos.getY();
int event = 0;
boolean pChange = false;
if (px < -s.getWidth()) {
if ((sides & SIDE_WEST) != 0) {
px = width;
pChange = true;
}
event = SIDE_WEST;
} else if (p... |
4fa4d693-67a1-40be-936c-1b36e08c2ed2 | 6 | public int read( int lo, int hi ) {
BufferedReader input =
new BufferedReader( new InputStreamReader(System.in) );
int response = -1;
while ( response < lo || response > hi ) {
//************Reads input.**************************
try {
response = Integer.parseInt(input.readLine());
... |
0181f08d-077f-46f5-bf1b-cdf5ebf10499 | 6 | public static void addByChance(LivingEntity entity, MobAbilityConfig ma)
{
if (ma == null || !isValid(entity))
return;
if (ma.sunProofRate <= 1.0 && ma.sunProofRate != 0.0)
{
// If the random number is lower than the sunproof rate we make the entity sun proof :D
if (ma.sunProofRate == 1.0F || RandomU... |
5c0012b2-9ba9-4a4d-ac49-35139f1ef5e1 | 5 | public BinaryNode getSuccessor()
{
if(hasChildren()){
if(getLeft() == null && getRight() != null)
return getRight();
else if(getLeft() != null && getRight() == null)
return getLeft();
else // the two children case
return getRight().getLeftmostNode();
}
return null;
} |
52e7ecf6-e7df-49d7-b522-35ef9869ef53 | 8 | public static XLSRecord getPrototype( int type )
{
FrtWrapper frt = new FrtWrapper();
frt.type = type; // save wrapped type
frt.setOpcode( FRTWRAPPER );
byte[] b = null;
switch( type )
{
case DEFAULTTEXT:
b = frt.P_0; // generate a default text record with 0=show labels
bre... |
2d0438e1-222b-49d5-aec1-7a10a45f3434 | 8 | public void insert(String tabName, ArrayList arguments) {
connect();
if(msg.equals("OK")) {
ShowTableBean stb = new ShowTableBean();
int size = arguments.size() * 2;
stb.connect();
ArrayList fields = stb.getAttributies(tabName, "Field");
//Arra... |
c31abc7f-f824-4a2f-b87d-fd6c35a124d2 | 7 | @Reflectable
public static Boolean isActivePID(Integer pid)
{
Map<String, List<String>> result = null;
String windows_cmds[] = SyscallCreatorUtils.generate("tasklist /FO CSV | findstr \"java\"");
String unix_cmds[] = SyscallCreatorUtils.generate("ps -A -o pid,command | grep -i \"java\"" );
try {
if(... |
630fed59-e581-439f-9a58-44f006b1829b | 7 | @Override
protected Void doInBackground()
{
JSONArray arr = null;
if (directURL != null)
return directDownload();
try
{
String search = "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=";
if (customSearch != null)
search += customSearch.replace(" ", "+");
... |
887c3fd5-46db-423d-ab8d-0080040d2f17 | 5 | public static void main(String[] args) {
ThirteensBoard board = new ThirteensBoard();
int wins = 0;
for (int k = 0; k < GAMES_TO_PLAY; k++) {
if (I_AM_DEBUGGING) {
System.out.println(board);
}
while (board.playIfPossible()) {
if (I_AM_DEBUGGING) {
System.out.println(board);
}
}
if... |
14964431-3479-4677-bc6a-303870c4cf5e | 9 | protected void addTrees( GridNode64 terrain, double x, double y, double size, List<double[]> atCoords ) {
double subSize = size/8;
if( size <= 8 ) {
for( int sy=0; sy<8; ++sy ) {
for( int sx=0; sx<8; ++sx ) {
Block[] stack = terrain.blockStacks[sx + 8 * sy];
boolean canPlaceHere = false;
for( ... |
51f7ad3a-2436-4269-8066-2714d366858c | 2 | public double[] vectorize() {
int nRows = getRowDimension();
int nCols = getColumnDimension();
/*
* if ((nRows == 0) || (nCols == 0)) { throw new MatrixIndexException(
* "Matrix: either number of rows or number of columns is 0."); }
*/
double data[][] = getDat... |
f574ae38-7174-4753-b00c-3b7cc839e4fc | 9 | private void loadPrefs(boolean sortOnly)
{
if (!sortOnly)
{
DefaultComboBoxModel<String> model = (DefaultComboBoxModel<String>) cmbFilter.getModel();
for (int i = 0; i < 20; i++)
{
String item = prefs.get(PREFS_KEY_FILTER + i, " ");
... |
0440fa18-1c6b-4d5c-bfdd-a5f398c3b487 | 7 | public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
String elementName = localName;
if ("".equals(elementName)) {
elementName = qName;
}
if(elementName.equals("systemlist")){
currentElement = ProcessingElement.SYSTEMLIST;
collection = new... |
eb5a07f0-01c0-4e19-a79c-44c90dc64501 | 6 | public static void startupRdbms() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/RDBMS", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Module... |
c1293887-0dd9-41fb-9bf5-b58d626de789 | 8 | private String makeComment(){
String c=((ComboText)command.getSelectedItem()).getValue();
String t=((ComboText)command.getSelectedItem()).getText();
String ico=((ComboText)command.getSelectedItem()).getIcon();
String obj=logoObj.getText();
//if(global.useJLabels)
// t=... |
868bf6a4-88db-4944-86d3-455b59bccdd9 | 0 | private static boolean isDiffLegal(long toCheck, long ref) {
return ((toCheck - ref) % TIME_UNIT) == 0;
} |
27744078-8541-44e9-b375-8f06fcc6b434 | 4 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result
+ ((lastName == null) ? 0 : lastName.hashCode());
result = prime * result + ((login == null) ? 0 : login.hashCode());
result = ... |
3b2feeb1-7a02-42c7-bea7-3733028d725e | 2 | public static byte[] stringToBytes(String str) {
if (str.length() % 2 == 1) {
throw new IllegalArgumentException("Invalid length");
}
int len = str.length() / 2;
byte[] bytes = new byte[len];
for (int i = 0; i < len; i++) {
int i... |
1cb41ac0-bee4-4f03-85cf-7604f7b17acd | 5 | private JoinList deSerializza()
{
FileInputStream fin;
ObjectInputStream input = null;
JoinList letto = null; //file che deve essere letto dal .dat
File f = new File("plugins/" + name + "/giocatori.dat");
if(f.exists())
{
//System.out.println("File dati giocatori esiste");
try{
fin = new F... |
efb4b6bd-9127-42d2-a023-8ffdfa50ea56 | 1 | public static Integer calculateFactorial(Integer n) {
Integer factorial = 1;
for (int i=1; i<=n; i++) {
factorial *= i;
}
return factorial;
} |
f341f786-d0d7-49ea-88cb-125122e6c242 | 8 | public Set<Map.Entry<Short,Short>> entrySet() {
return new AbstractSet<Map.Entry<Short,Short>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TShortShortMapDecorator.this.isEmpty();
}
p... |
abd0100b-8784-4525-a785-db90b3a3dce5 | 3 | public void ouvrirFichier() {
JFileChooser jFileChooserXML = new JFileChooser();
jFileChooserXML.setDialogTitle(title);
jFileChooserXML.setCurrentDirectory(new File(starting_directory));
if(is_saving_mode) {
jFileChooserXML.setDialogType(JFileChooser.SAVE_DIALOG);
if (jFileChooserXML.showSaveDialo... |
ccdc4d44-5480-437d-b0bd-08c9cb2c76b5 | 6 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (taskId >= 0) {
return true;
}
// Begin hitting the se... |
aac66af6-9ed8-4679-a34c-07bf489d3fef | 4 | public void viewAutomaton(JTableExtender table){
InputTableModel model = (InputTableModel) table.getModel();
if(model.isMultiple){
int row = table.getSelectedRow();
if(row < 0) return;
String machineFileName = (String)model.getValueAt(row, 0);
updateV... |
6cb4d23a-2ecf-407b-a21c-cb55190f08c3 | 0 | @Override
public String adiciona(HttpServletRequest request,
HttpServletResponse response) {
String filtro = request.getParameter("filtro");
EmpresaDAO empresa = new EmpresaDAO();
Collection<Empresa> empresas = empresa.buscaPorSimilaridade(filtro);
request.setAttribute("empresas", empresas);
return "WE... |
e7777a1f-dbdd-491f-ae02-4c7d4516e5ee | 2 | public void render(GameContainer gc, StateBasedGame sbg, Graphics g)throws SlickException
{
if(!isGameOver)
{
if(!isPause)
{
}
else
{
}
}
else
{
}
} |
f306da26-44f4-49c6-bb58-6c1a51a93637 | 3 | public boolean playerHasItemAmount(int itemID, int itemAmount) {
//if(itemID == 0 || itemAmount == 0) return true;
playerItemAmountCount = 0;
for (int i=0; i<playerItems.length; i++)
{
if (playerItems[i] == itemID+1)
{
playerItemAmountCount = playerItemsN[i];
}
if(playerItemAmountCount >=... |
6cfac817-c8bc-4976-86ba-4940c2962a45 | 7 | private void updateTestdataValue(TestcaseStep tcStep , Map<String, String> testdataRow) {
String testdataValue;
logger.info("UpdateTestdata value - \n TestcaseID:"+ tcStep.getTestcaseID() + " , StepID:"+tcStep.getStepID());
logger.info("TestdataName::" + tcStep.getTestDataName()+ " , TestdataType::"+tcStep.getTes... |
16cbcc7b-467c-4d14-aba6-fda1de06ff58 | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!(affected instanceof MOB))
return super.tick(ticking,tickID);
if((tickID==Tickable.TICKID_MOB)&&(STEPS!=null))
{
if((STEPS!=null)&&((STEPS.size()==0)||(STEPS.isDone())))
{
if(((MOB)ticking).isInCombat())
return true; // let them... |
b1fe1cd7-b45f-43b5-b095-0a3bcb89f9fc | 0 | public static void testSeqWrite() throws IOException{
Write wr = new Write();
wr.startTest();
} |
d62b7587-8f11-4ffc-8e04-97d8de261b23 | 1 | private void stopRealServer() throws Exception {
if ( _itpServer != null ) {
_itpServer.stop();
}
} |
910e7af2-cd2d-454c-b7f1-32e1f18cf843 | 2 | public void act(){
if (clicked){
this.setImage (bg[2]);
}
else if (selected){
selected = false;
this.setImage (bg[1]);
}
else{
this.setImage (bg[0]);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.