method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4434d117-098b-4ce4-ad2c-401242bb9cbb | 1 | public static boolean isBattery(int s) {
if(s==62529)
return true;
return false;
} |
43f4f386-6342-4e47-8979-0b3d2e31dff4 | 4 | public boolean equals(Object other) {
if (other instanceof Recipe) {
Recipe that = (Recipe) other;
if (that.size() == this.size()) {
RNode k = that.head;
while (k != null) {
if (!bevat(k.getElement())) {
return false;
}
k = k.getNext();
}
return true;
}
}
return fals... |
d923e8dd-5bda-4fe4-b106-8f98c0482310 | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... |
a7271826-048d-4c3c-aa79-93ee3a366762 | 5 | private static Node addInteger(Node int1, Node int2){
int carry = 0;
Node newh = null;
Node curr = newh;
while(int1!=null && int2!=null){
if(newh==null){
newh=new Node((int1.v+int2.v+carry)%10);
newh.next = null;
curr = newh;
}else {
curr.next = new Node((int1.v+int2.v+carry)%10);
curr... |
fe780646-4e0e-4ae5-a3d6-2299f95ca279 | 0 | @Override
public void setHouseNumber(String houseNumber) {
super.setHouseNumber(houseNumber);
} |
0ea83fc7-9807-4996-a0c2-2e2cc070b710 | 9 | @Override
public void keyPressed(KeyEvent e) {
//MOVEMENT KEYS
if (e.getKeyCode() == KeyEvent.VK_W){
if (player.jumpCount < player.jumpMax) {
player.gravity = 20;
player.setY(player.getY() - 10);
player.jumpCount++;
}
}
if (e.getKeyCode() == KeyEvent.VK_A){
left = true;
}
if (e.getKeyC... |
f2b73f6b-ba34-452e-903d-a0201fdfa565 | 2 | @Override
public void run() {
for(int i = 0; i < 20 ; i ++)
{
try {
Thread.sleep((long)Math.random() * 1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SampleCalc.decrease();
}
} |
86343c54-7066-4b44-a445-acf0975a1e95 | 5 | @Override
public int hashCode() {
int hash = 7;
hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
hash = 97 * hash + (this.datapagamento != null ? this.datapagamento.hashCode() : 0);
hash = 97 * hash + (int) (Double.doubleToLongBits(this.valor) ^ (Double.doubleToLongBits... |
497e28e2-6ad4-407c-a4ec-e5ede612e514 | 4 | public static void dumpArrayOfLinesToFile(
File file,
String encoding,
List lines,
List lineEndings
) {
try {
// Create Parent Directories
File parent = new File(file.getParent());
parent.mkdirs();
// Write the File
Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputSt... |
3dacf96a-0a63-40bb-b1b1-5bf5fff8493a | 0 | public String getThumbUrl() {
return thumbUrl;
} |
8cf60178-e67c-41c3-a893-6d5c107dbba4 | 3 | @Override
public boolean status(int row, int col) {
if (this.copyPapan[row][col].equals("W")) {
return true;
} else if (this.copyPapan[row][col].equals("=")) {
if (this.banyakIC == 0) {
return true;
} else {
return false;
... |
c16388d6-b854-44a4-8ab9-bf5f95fc4f41 | 9 | @Override
public void solveVelocityConstraints(final TimeStep step) {
final Body b1 = m_bodyA;
final Body b2 = m_bodyB;
final Vec2 v1 = b1.m_linearVelocity;
float w1 = b1.m_angularVelocity;
final Vec2 v2 = b2.m_linearVelocity;
float w2 = b2.m_angularVelocity;
float m1 = b1.m_invMass, m2 = b2.m_invM... |
89443d07-cb30-468a-806b-0cfd3dfdb643 | 0 | public String getSource() {
return this.source;
} |
7b8139b7-9d8d-4099-a05b-8185c02ccf4d | 5 | void encode(OutputStream os) throws IOException {
os.write(initCodeSize);
countDown = imgW * imgH;
xCur = yCur = curPass = 0;
compress(initCodeSize + 1, os);
os.write(0);
} |
bb43dcc6-bb29-4eba-8a69-b87c29b87cea | 1 | public void registerProjectile(Projectile p) {
if (!projectiles.containsKey(p.getId())) {
projectiles.put(p.getId(), p);
}
} |
ac723705-ec4c-4950-ad55-6a3ef80d8c91 | 3 | private static Node search(Node r, int v) {
Node curr = r;
while (curr != null) {
if (curr.v == v) {
return curr;
} else if (curr.v < v) {
curr = curr.right;
} else {
curr = curr.left;
}
}
return null;
} |
88bb6e07-e685-4e82-b804-b9fd1479e4e6 | 4 | public static double calculate(String first, String second, String operation) {
double fNum = Double.parseDouble(first);
double sNum = Double.parseDouble(second);
double result = 0;
if (operation.equals("add")) {
result = fNum + sNum;
}
else if (operation.equals("subtract")) {
result = fNum - sNum;
... |
b1a15253-fbf7-4e01-83ab-9c53cfa0a55b | 1 | private JLabel getJLabel0() {
if (jLabel0 == null) {
jLabel0 = new JLabel();
jLabel0.setText("sql:");
}
return jLabel0;
} |
095610fd-9c7f-4fd7-9645-66bcb9ab4900 | 0 | public void setContestId(Integer contestId) {
this.contestId = contestId;
} |
571586d0-95cb-4708-ba9d-4614bf47012c | 5 | private static int[] merge(int[] array1,int[] array2){
int length1 = array1.length;
int length2 = array2.length;
int[] resultarray = new int[length1+length2];
int indexofarray1 = 0;
int indexofarray2 = 0;
int indexofresultarray = 0;
while(indexofarray1 < length1 && indexofarray2 < length2){
if ... |
43e5aac3-71b1-4775-aad2-fd1600e79488 | 6 | private void gameRender() {
if (dbImage == null) {
dbImage = createImage(pWidth, pHeight);
if (dbImage == null) {
System.out.println("dbImage is null");
return;
} else
dbg = dbImage.getGraphics();
}
// clear the background
dbg.setColor(Color.white);
dbg.fillRect(0, 0, pWidth, pHeight);
... |
9ce76a0c-700d-4a47-824e-da61defac198 | 4 | public static int placeOrder(Order incord)
throws TableException{
java.sql.Statement stmt;
java.sql.ResultSet rs;
int orderid;
//extract data from the order object
Order ord = incord;
ArrayList<OrderItem> itemlist = ord.getOrderItems();
OrderItem item;
try
{
String createString = "insert int... |
5df89999-d4c6-4ac4-a2ac-2e0e13d6da17 | 2 | public static double EuclideanDistance(ArrayList<Double> l1, ArrayList<Double> l2){
if(l1.size() != l2.size()){
System.err.print("erro in input size\n");
}
int size = l1.size();
double sum = 0;
for(int i = 0; i < size; i++){
sum += (l1.get(i) - l2.get(i)) ... |
5068613e-e5d7-4130-bca9-6687a2bd2441 | 2 | private void joinChat() {
if (isVerified && hasName) {
isInChat = true;
connection.send(NetMessage.newBuilder()
.setType(MessageType.REPLY)
.setReplyMessage(ReplyMessage.newBuilder()
.setType(MessageType.JOIN_CHAT)
.setStatus(true))
.build().toByteArray());
// connection.send(... |
0f6f0a26-0fac-48ac-96a5-3073b2dd4d1a | 6 | @Override
public Map<String, String> getSearchCritieras() {
Map<String, String> critieras = new HashMap<>();
if(!StringUtil.isEmpty(componentId.getText())) {
critieras.put("componentId", componentId.getText());
}
if(!StringUtil.isEmpty(date.getText())) {
criti... |
8168354b-24df-4ce8-be3a-d4c956804909 | 1 | public CodeEditor()
{
Font f;
JScrollPane []scrollPane;
JSplitPane componentSplitter ;
LineBar line;
Data data;
modifyLooks();
jlblStatus = new JLabel();
jta = (JTextArea) new TextArea();
lineBar = new LineBar();
output... |
8d160845-aa1a-4013-a25c-4cf687c71b98 | 1 | private double expectedScore(int[] distribution,int[] plate)
{
double[] problist = new double[numfruits * length + 1];
int minscore = numfruits * 1, maxscore = numfruits * length;
time01 = System.nanoTime();
initFruitProbs();
time11 += System.nanoTime() - time01;
time02 = System.nanoTime();
double e... |
624667da-0dd1-4234-8247-086a9c376776 | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("The power of Priest compells you!");
return random.nextInt((int) agility) * 3;
}
return 0;
} |
c9ed44de-2071-492a-8c15-5559ba40a53a | 2 | public long inserir(AreaFormacao areaformacao) throws Exception
{
String sql = "INSERT INTO areaformacao (nome) VALUES (?)";
long IdGerado = 0;
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
stmt.setString(1, areaformacao.getNom... |
20fb9926-28f4-43db-99dc-1b7933feebf7 | 3 | public StreamEngine (SocketChannel fd_, final Options options_, final String endpoint_)
{
handle = fd_;
inbuf = null;
insize = 0;
io_enabled = false;
outbuf = null;
outsize = 0;
handshaking = true;
session = null;
options = options_;
p... |
5c48fcab-9480-4643-809e-273ee480a2df | 7 | void makePairs() {
if (res > 1)
return;
boolean allVisited = true;
for (int i = 0; i < N; i++) {
allVisited &= visited[i];
}
if (allVisited) {
res++;
return;
}
for (int index = ... |
6188de61-dd5b-4323-bddd-f35ffd63399d | 1 | public void loadArgArray() {
push(argumentTypes.length);
newArray(OBJECT_TYPE);
for (int i = 0; i < argumentTypes.length; i++) {
dup();
push(i);
loadArg(i);
box(argumentTypes[i]);
arrayStore(OBJECT_TYPE);
}
} |
0fbdd2fa-dea1-4f0a-8fd6-663bc75a54ab | 4 | public void enterShop(HumanCharacter theHumanCharacter){
System.out.println("Welcome to the shop!");
System.out.println("What would you like to buy?");
System.out.println("Type 'mana potion' for Mana Potions --20g each");
System.out.println("Type 'health potion' for Health Potions --15g each");
System.out.pri... |
84c059f6-3e4a-4acf-862e-66d233860541 | 5 | public static final int getDimension(Object array) {
if (array != null) {
Class<?> clazz = array.getClass();
if (clazz.isArray()) {
String className = clazz.getName();
int len = className.length();
for (int i = 0; i < len; i++) {
if (className.charAt(i) != '[') {
return i;
}
}
... |
bcb784be-1d6c-49a6-ab21-dc406526f7de | 5 | @Override
public synchronized String format(LogRecord record) {
StringBuffer sb = new StringBuffer();
dat.setTime(record.getMillis());
args[0] = dat;
StringBuffer text = new StringBuffer();
if (formatter == null) {
formatter = new MessageFormat(format);
}
formatter.format(args, text, null);
sb.a... |
26a29920-2fca-4286-aa15-e73a057fc09c | 9 | @Override
public void onMove() { // Constante descendente e implementacion de onUp
// Movimiento del background
backgroundUX += (backgroundSpeed / Window.getW()) * App.getFTime();
// Movimiento del pajaro
pardal.move(); // Este es para que se mueva su sprite (animacion)
aceleracion += 750.0f * App.getFTim... |
48d9a1af-6434-4fde-ba1d-ce63318db9dc | 8 | @Override
public void paintComponent(Graphics g) {
g.setColor(Color.BLACK);
g.fillRect(0, 0, frame.getWidth(), frame.getHeight());
g.setColor(Color.WHITE);
if (ship != null) {
for (int i = 0; i < vh.vel.size(); i++) {
Moveable m = vh.get(i);
if (!m.isInScreen(frame.getSize()) && !isShip(m))
vh.... |
b2b6ab01-d9f1-4468-a34a-e08c1df2f89d | 2 | private void generateDeck()
{
Suit[] suits = Suit.values();
Figure[] figures = Figure.values();
for(Suit suit : suits)
{
for(Figure figure : figures)
{
cards.add(new Card(figure,suit));
}
}
} |
fc7403d1-3cd4-433d-a266-3a7e7f1186c8 | 8 | public static int getDirection(BoardNode node1, BoardNode node2){
int x1 = node1.getX();
int y1 = node1.getY();
int x2 = node2.getX();
int y2 = node2.getY();
if(isDown(node1, node2) == true){
node2.setDir(DOWN);
}
else if(isUp(node1, node2) == true){
node2.setDir(UP);
}
else if(isLeft(node... |
a9b9aadf-9e4b-4e14-bf6b-3460f5b2c9df | 1 | public void visitSwitchStmt(final SwitchStmt stmt) {
if (previous == stmt.index()) {
previous = stmt;
stmt.parent.visit(this);
}
} |
005bbddd-d955-4f6f-b8b8-1d1d96cfcc7b | 2 | private static void test_powerOf2(TestCase t) {
// Print the name of the function to the log
pw.printf("\nTesting %s:\n", t.name);
// Run each test for this test case
int score = 0;
for (int i = 0; i < t.tests.length; i += 2) {
boolean exp = (Boolean) t.tests[i];
int arg1 = (Integer) t.tests[i + 1];
... |
13af35ed-c26c-44d6-90cf-c91686ee07ec | 9 | public int evaluateState(State state) {
int evaluatedValue = 0;
if (state.getCellList().get(0).getCellValue() != 1)
evaluatedValue += 1;
if (state.getCellList().get(1).getCellValue() != 2)
evaluatedValue += 1;
if (state.getCellList().get(2).getCellValue() != 3)
evaluatedValue += 1;
if (state.get... |
62c799e5-6567-4184-8c03-ea4ed216e6e2 | 0 | public void setId(String id) {
this.id = id;
} |
99c6aaad-9dea-4f44-aabf-93d686f14803 | 1 | public void visit_ineg(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
e55415cd-d392-4d55-a7b8-743c38492ef2 | 7 | public static Cons yieldHardcodedInternRegisteredSymbolsTree() {
{ Cons interntrees = Cons.list$(Cons.cons(Stella.SYM_STELLA_STARTUP_TIME_PROGN, Cons.cons(Stella.KWD_SYMBOLS, Cons.cons(Stella.NIL, Stella.NIL))));
{ GeneralizedSymbol symbol = null;
Cons iter000 = Stella.$SYMBOL_SET$.theConsList;
... |
fd13c4a9-3cb4-4ed9-b1e9-735d9a25e0ea | 2 | private SubmissionResult compileWithTestsAndRun(Submission submission) {
CompilationResult compilation;
try {
compilation = compileWithTests(submission);
} catch (CodeStyleException e) {
SubmissionResult result = new SubmissionResult();
result.setPass(false);
... |
7305f7a1-edc6-4c04-9d0a-b580f2b17356 | 7 | private boolean zipPage(ZipOutputStream zipOut, File zipDir) {
if (zipOut == null)
return false;
boolean isChanged = saveReminder.isChanged();
saveTo(new File(zipDir, FileUtilities.getFileName(pageAddress)));
saveReminder.setChanged(isChanged); // reset the SaveReminder
nameModels(); // reset the model nam... |
2e265a7c-97d7-461f-ae21-ca7e9b5cde3c | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RectangleShape that = (RectangleShape) o;
if (entered != that.entered) return false;
if (currentPoint != null ? !currentPoint.equals(that.curre... |
c3b52fc8-6474-4f4a-bbdf-3c2c1d979553 | 4 | public static void main(String[] args) {
int direction = (int) (Math.random() * 5);
switch (direction) {
case NORTH:
System.out.println("travelling north");
break;
case SOUTH:
System.out.println("travelling south");
break;
case EAST:
System.out.println("travelling east");
break;
case WEST:... |
e7d3b213-bd38-445b-b30f-5869a6284f39 | 3 | public String[] getStreamInfo() {
String[] address = new String[4];
//get selectet Streams
if(browseTable.getSelectedRow() >= 0) {
Vector<String[]> streams = null;
//get Nr. of Stream
Object content = browseTable.getValueAt(browseTable.getSelectedRow(),0);
int nr = Integer.valueOf(content.toS... |
83a3ae0e-168b-454f-8483-ef3f701b2a09 | 0 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
new Marquee();
}
});
} |
a780f89a-831a-46a7-b244-14866ddd1e4d | 0 | @Override
public void focusGained(FocusEvent e) {
handleUpdate();
} |
6f48efe9-bf52-4692-8d86-568e9e2a2c65 | 1 | public void runInTheCloud() {
TestInfo testInfo = this.getTestInfo();
if (testInfo == null) {
BmLog.error("TestInfo is null, test won't be started");
return;
}
BmLog.info("Starting test " + testInfo.getId() + "-" + testInfo.getName());
TestInfoController.s... |
56731c1d-4480-4322-84c1-6a54da4f24b6 | 3 | @Test
public void testCoordPair() {
CoordPair pair = new CoordPair(676, 989);
assertTrue("toString contains values", pair.toString().contains("676") && pair.toString().contains("989"));
assertTrue("X value returned correctly", pair.getX() == 676);
assertTrue("Y value returned correctly", pair.getY() == 989);
... |
93ac5952-94b2-4a52-bbd7-15dad69a203d | 8 | public void dontPassLine(int bet) {
if (money > 0 && bet <= money && bet >= 0) {
if (combinedRoll == 2 || combinedRoll == 3) {
player.addMoney(bet);
info.updateMoney();
} else if (combinedRoll == 7 || combinedRoll == 11) {
player.loseMoney(bet);
info.updateMoney();
} else if (combinedRoll == ... |
b2486617-6ab3-416f-8641-ce98f5693e61 | 9 | private void setupMouseCallbacks() {
transferHandler = new GridMouseResultsTransferHandler();
constraintsModel = new GridMouseConstraintsModel(0, 0, maxWidth, maxHeight, CHR_PIXELS_WIDE, CHR_PIXELS_HIGH, PPUConstants.COLUMNS_PER_PATTERN_PAGE, PPUConstants.ROWS_PER_PATTERN_PAGE);
setTransferHand... |
106bab74-7d2c-485f-85cd-7e38dca755fc | 5 | @Override
public void run () {
boolean backupOnlyWithPlayer = pSystem.getBooleanProperty(BOOL_BACKUP_ONLY_PLAYER);
if ((backupOnlyWithPlayer && server.getOnlinePlayers().length > 0)
|| !backupOnlyWithPlayer
|| isManuelBackup
|| backupName != null)
... |
87004dc4-6493-48c8-9e4a-2775d02c9661 | 1 | public static Image convertStreamToPNG(InputStream is) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buf = new byte[defaultBufferSize];
int n;
while ((n = is.read(buf)) >= 0) {
baos.write(buf, 0, n);
}
baos.close();
return convertBlobToPNG(baos.toByteArray());
} |
71dcfe03-4e75-41bb-b44b-001452590e1c | 0 | public OutlinerDesktopManager() {
super();
} |
562fd880-61dc-4008-b591-e1585b6552ea | 9 | public Entity[] allInstancesAt(int x, int y) {
ArrayList<Entity> ans = new ArrayList<Entity>();
for(Entity e : entities) {
if(e.x == x && e.y == y && !e.willBeRemoved()) ans.add(e);
}
for(Entity e : addQueue) {
if(e.x == x && e.y == y && !e.willBeRemoved()) ans.add(e);
}
Entity[] ret = new Entit... |
33caf0df-791d-4b7d-9eb7-16a4038f4cd8 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
90cc3b8b-01b1-40cd-bcbd-1c8c0ace09ae | 1 | public double getFullCost()
{
double cost = 0;
for (Edge edge : edges)
cost += edge.getCost();
return cost;
} |
59744861-6a41-4ab1-9f89-da0c0f45746a | 2 | public Block[][] getBlocks(int x1, int y1, int x2, int y2){
Block[][] blocks = new Block[x2-x1+1][y2-y1+1];
for(int x = x1; x <= x2; x++){
for(int y = y1; y <= y2; y++){
blocks[x-x1][y-y1] = this.blocks[x/POSITION_MULTIPLYER+1][y/POSITION_MULTIPLYER+1]; //fucking no idea why there must be a +1 but otherwise ... |
442b9b38-2579-4faf-9af6-0407c4032e05 | 2 | public synchronized static String getConfigDirectoryPath() {
if(resourcePath == null) {
resourcePath = getUserHome();
}
if(resourcePath.charAt(resourcePath.length()-1) != File.separatorChar) {
resourcePath += File.separatorChar;
}
return resourcePath + "frontlinesms_h2_db";
} |
b43ab7c7-52e7-4ac2-9c24-aa8770434a55 | 2 | public void keyReleased(KeyEvent e) {
if (e.getKeyCode() > 0 && e.getKeyCode() < 256) {
keys[e.getKeyCode()] = false;
}
} |
7c499d32-3185-454a-838b-fb0f932c48b4 | 5 | @Override
public List<Invoker<T>> list(Invocation invocation) throws RpcException {
if (isDestroyed()) {
throw new RpcException("Directory already destroyed .url: " + tpURL);
}
List<Invoker<T>> invokers = doList(invocation);
if (routers != null && routers.size() > 0) {
for (Router router: ... |
7f02a204-a65d-4fba-8f33-99c6bb012081 | 7 | public void endArena(String arenaName) {
if (getArena(arenaName) != null) { //If the arena exsists
Arena arena = getArena(arenaName);
//Create an arena for using in this method
//Send them a message
... |
238005af-a30d-48cb-b842-8a42d8e3bcc0 | 2 | private static ParkerPaulTaxable getRandomTaxable(int selection, int index) {
index += 1;
if (selection < 20) {
return new ParkerPaulBoat("ParkerPaulBoat " + index, getNumberBetween(10, 50), getNumberBetween(1, 4));
} else if (selection < 60) {
return new ParkerPaulTerrai... |
0b5d9dd3-1295-4ddc-865a-e5857f8337af | 8 | public Customer SingleCustomerData(int CustID)
throws UnauthorizedUserException, BadConnectionException, DoubleEntryException
{
/* Variable Section Start */
/* Database and Query Preperation */
PreparedStatement statment = null;
ResultSet results = null;
... |
07f1839b-1fd4-491d-a754-5705002d6799 | 9 | public HashMap<String, Double> get_cosine_score_map(
ArrayList<String> url_list) throws SQLException {
HashMap<String, Result> temp_resultmap = null;
String query_word, url;
double score = 0, query_mag = 1;
double tfidf_doc, tfidf_query, doc_mag;
double temp_score;
String first_result=null;
for (int i ... |
ec16ebdf-e506-4c5b-95de-045fd94a06ae | 8 | private void floodFill(char[][] mapa, int[][] numMap, int i, int j, int m,
int n, int num) {
numMap[i][j] = num;
for (int k = i - 1; k <= i + 1; k++) {
for (int l = j - 1; l <= j + 1; l++) {
if (k >= 0 && k < m && l >= 0 && l < n && mapa[k][l] == '@'
... |
4936e061-016d-4484-b2bf-ba3c8dbaa1d6 | 7 | private static void compareStacks() {
System.out.println(stacks[0].peek() + " vs " + stacks[1].peek());
if (((Card) stacks[0].peek()).compareTo((Card)stacks[1].peek()) == 0) {
war();
} else if (((Card)stacks[0].peek()).compareTo((Card)stacks[1].peek()) > 0) {
for (int i = 0; i < stacks.length; i++) {
wh... |
501c6009-bba6-45d6-be9b-ef5561d30522 | 4 | final public T atIndex(int i) {
if (i < 0 || i >= size) return null ;
int d = 0 ;
for (ListEntry <T> l = this ; (l = l.next) != this ; d++)
if (d == i) return l.refers ;
return null ;
} |
171034c2-771e-4e6f-bf47-79d77a4ace28 | 8 | public final synchronized void writeValue(DataOutputStream out) throws IOException {
try {
if(_attribute.isArray()) {
out.writeInt(_count);
}
}
catch(ConfigurationException ex) {
throw new IOException(ex.getMessage());
}
if(_attributes == null) {
try {
if(_attribute.isArray() && _count == ... |
56b2268f-6097-4e23-b0b7-83c272aa2048 | 8 | public boolean execute(CommandSender sender, String[] args) {
String groupName = args[0];
GroupManager groupManager = Citadel.getGroupManager();
Faction group = groupManager.getGroup(groupName);
if(group == null){
sendMessage(sender, ChatColor.RED, "Group doesn't exist");
return true;
}
String senderN... |
70ab8bee-60e7-488a-b10b-427ba54bb01b | 0 | protected void computeAddressByteArray(OSCJavaToByteArrayConverter stream) {
stream.write(address);
} |
ad681b4d-ac27-4702-b402-a7a62513f42e | 8 | @FXML
private void doPowerMethod(ActionEvent event) {
Scanner s = new Scanner(pmInput.getText());
int row = 0;
int col = 0;
ArrayList<Double> vals = new ArrayList();
try {
while (s.hasNextLine()) {
String line = s.nextLine();
Scanne... |
e860eb71-ccc6-4452-96b6-d633323b47b7 | 1 | public void invert() {
invertedBevoreMoves = 0;
List<SchlangenGlied> glieder = new ArrayList<SchlangenGlied>();
addAllGlieder(glieder);
while (glieder.size() > 1) {
SchlangenGlied firstGlied = glieder.get(0);
SchlangenGlied lastGlied = glieder.get(glieder.size() - 1);
Point tmpLocation = firstG... |
6ebdd0dc-8050-4672-8c12-99de4ee8242c | 7 | private List<List<String>> importData(){
List<List<String>> artistData = new ArrayList<List<String>>();
// Find all .artistcleaned.
StringBuilder sb = new StringBuilder();
List<String> dataFiles = new ArrayList<String>();
File[] files = new File("lyricsdata").listFiles();
for (File file : files) {
... |
9cab9e87-2078-45b6-a509-e060252d5363 | 2 | public static String formatSql(String sqlNeedFormat, String[] tableNames) {
StringBuilder key = new StringBuilder();
for (String tableName : tableNames) {
key.append(tableName);
}
key.append(sqlNeedFormat);
String keyStr = key.toString();
String sql = formattedSql.get(keyStr);
if (sql == null) {
Mes... |
8c082627-3cc4-4132-8fda-ce7d43ce0318 | 2 | public static Object findAndClone(String name) {
for (int i = 0; i < total; i++) {
if (prototypes[i].getName().equals(name)) {
return prototypes[i].clone();
}
}
System.out.println(name + " not found");
return null;
} |
1c8e38ff-1fd5-44d4-9780-454bb63dd013 | 3 | public void setPF(PixelFormat pf) {
pf_ = pf;
if (pf.bpp != 8 && pf.bpp != 16 && pf.bpp != 32) {
throw new ErrorException("setPF(): not 8, 16, or 32 bpp?");
}
} |
72c007b5-8fc4-4831-88d5-a788e2aa9b14 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Regle other = (Regle) obj;
if (action == null) {
if (other.action != null)
return false;
} else if (!action.equals(other.action))
ret... |
51a0b36e-2537-41fc-83da-28604756d091 | 4 | public Result addArg(final Arg<?> a) {
final F<Arg<?>, F<List<Arg<?>>, List<Arg<?>>>> cons = List.cons();
return new Result(args.map(cons.f(a)), r, t);
} |
5c4c085d-f6fc-4297-bd72-d294e1bcb4f6 | 2 | public ArrayList<PhysicObject> getAllPhysicObjects()
{
ArrayList<PhysicObject> result = new ArrayList<PhysicObject>();
for ( GameObject child : children )
result.addAll( child.getAllPhysicObjects() );
if ( this instanceof PhysicObject )
result.add( (PhysicObject) this );
return result;
} |
d7554d5b-227d-4789-ab39-f819b60cc001 | 6 | private static void writeForLevel(String level) throws Exception
{
System.out.println(level);
BufferedWriter writer =new BufferedWriter(new FileWriter(new File(ConfigReader.getVanderbiltDir() + File.separator +
"spreadsheets" + File.separator +
"mergedKrakenRDP_" + level + ".txt")));
writer.write("samp... |
e8b94187-9ba8-468a-8b68-084837985cc1 | 8 | protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) {
g.setFont(font);
View v = getTextViewForTab(tabIndex);
if (v != null) {
// html
Graphics2D g2D = (Graphics2D) g;
... |
178bbe13-aba8-4836-b6d4-5f416147ba38 | 4 | public void set(final String area, final String name, final String value) {
if(area.contains("]")) throw new IllegalArgumentException("invalud area name: "
+ area);
if(name.contains("=")) throw new IllegalArgumentException("invalid name: " + name);
final Entry entry = new Entry(area.trim(), name.tri... |
9aaa0817-c579-4881-878c-9e1d172da543 | 5 | @Override
public void execute() {
Player receiver = getReceiver();
StringBuilder builder = new StringBuilder();
builder.append(TerminalUtil.createHeadline("TimeBan list")).append("\n");
List<Ban> result = plugin.getController().searchBans(search, reverse);
if (!result.isEmp... |
7b3321fa-5594-4b7c-a65d-3181c7090401 | 5 | public void mouseReleased(MouseEvent e) {
//Game Logic
if (!m_panel.getAnimationThread().isAlive()) {
if (getGame().getPlayer(getGame()
.getPlayerTurn() % TOTAL_PLAYERS)
.getPlayerType()
... |
b7f9e0a2-241f-46c6-841c-0da4b30b80ff | 9 | @Override
public Integer read(DataInputStream in, PassthroughConnection ptc, KillableThread thread, boolean serverToClient, DownlinkState linkState) {
while(true) {
try {
value = in.readInt();
if(serverToClient) {
if(value == ptc.clientInfo.getPlayerEntityId()) {
value = Globals.getDefaultPlay... |
d9393956-1a88-4da4-8da3-eafc0a2f225b | 8 | protected void checkCollisionWith(final Entity other) {
int shiftX = other.getPosition().getX() - pos.getX();
int shiftY = other.getPosition().getY() - pos.getY();
for (RectangularBounds trb : boundaries) {
for (RectangularBounds orb : other.getBoundaries()) {
if (trb.intersects(orb, shiftX, shiftY)) {
... |
177a7964-5ff3-4f98-af93-4907adb06ec6 | 8 | public static void start(String[] args){
int port = 80;
if(args.length == 1){
try {
port = Integer.valueOf(args[0]);
if(port < 0 || port > 65536){
throw new NumberFormatException();
}
} catch (NumberFormatException e) {
System.out.println("Invalid port value");
return;
}
}... |
3fbbb00f-4548-4052-aef6-8f4c56b618e1 | 1 | @Override
public void contextInitialized(ServletContextEvent arg0) {
Watch time = new Watch();
time.start();
System.out.println("Server startet - create tree... (this could take a while - depending on input filesize)");
//create tree
String pathOrig = Container.pathOrig;
String pathFolder = Container.pathF... |
c54a9f1c-7bff-4ca0-b7c1-5edeca48c8cd | 5 | @Override public RSTNode update( int x, int y, int sizePower, long time, MessageSet messages, UpdateContext updateContext ) {
int relevantMessageCount = 0;
int size = 1<<sizePower;
for( Message m : messages ) {
boolean relevance =
BitAddressUtil.rangesIntersect(this, m) &&
m.targetShape.rectIntersectio... |
6b594351-b9e6-49b2-9d10-e7104ccf95d2 | 3 | public static boolean isFlashEdgeCase(byte[] request, int requestsize) {
for (int i = 0; i < requestsize && i < FLASH_POLICY_REQUEST.length; i++) {
if (FLASH_POLICY_REQUEST[i] != request[i]) {
return false;
}
}
return requestsize >= FLASH_POLICY_REQUEST.length;
} |
b2a14a0b-60dc-4edb-bf87-153371b4319d | 4 | public void next(int width, int height) {
x += incX;
y += incY;
float random = (float)Math.random();
if (x + textWidth > width) {
x = width - textWidth;
incX = random * -width / 16 - 1;
}
if (x < 0) {
x = 0;
incX = random * width / 16 + 1;
}
if (y + textHeig... |
9fac0cf5-5761-48b9-9772-567e0c8888c9 | 9 | @Override
public Document getDocumentById(final String id) {
final File file = fileFor(id);
if (isExcluded(file) || !file.exists()) {
return null;
}
final boolean isRoot = isRoot(id);
final boolean isResource = isContentNode(id);
DocumentWriter writer = nu... |
860410fe-3898-45cc-b208-086eb94119ce | 3 | @Test
public void testProgressLocal() {
NetWork localNet = new NetWork(windows, linux, chrome);
PC[] pcAmount = localNet.getComputers();
// We're cheking start values
assertTrue(pcAmount[1].isInfected());
for (int i = 0; i < pcAmount.length; i++) {
if (i != 1) {
... |
3dc8d2a8-209b-4899-bb5a-45dc69af3ec7 | 3 | @Override
public List<BankDeposit> readXML(String xmlFilePath) throws XMLReaderDOMException {
try {
XMLValidator validator = new XMLValidator();
validator.validateXML(xmlFilePath, DataPath.XSD_FILE);
deposits = new ArrayList<>();
DocumentBuilderFactory dbFact... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.