text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static boolean isBattery(int s) {
if(s==62529)
return true;
return false;
} | 1 |
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... | 4 |
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 '\\':
... | 8 |
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... | 5 |
@Override
public void setHouseNumber(String houseNumber) {
super.setHouseNumber(houseNumber);
} | 0 |
@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... | 9 |
@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();
}
} | 2 |
@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... | 5 |
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... | 4 |
public String getThumbUrl() {
return thumbUrl;
} | 0 |
@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;
... | 3 |
@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... | 9 |
public String getSource() {
return this.source;
} | 0 |
void encode(OutputStream os) throws IOException {
os.write(initCodeSize);
countDown = imgW * imgH;
xCur = yCur = curPass = 0;
compress(initCodeSize + 1, os);
os.write(0);
} | 5 |
public void registerProjectile(Projectile p) {
if (!projectiles.containsKey(p.getId())) {
projectiles.put(p.getId(), p);
}
} | 1 |
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;
} | 3 |
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;
... | 4 |
private JLabel getJLabel0() {
if (jLabel0 == null) {
jLabel0 = new JLabel();
jLabel0.setText("sql:");
}
return jLabel0;
} | 1 |
public void setContestId(Integer contestId) {
this.contestId = contestId;
} | 0 |
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 ... | 5 |
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);
... | 6 |
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... | 4 |
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)) ... | 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(... | 2 |
@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... | 6 |
public CodeEditor()
{
Font f;
JScrollPane []scrollPane;
JSplitPane componentSplitter ;
LineBar line;
Data data;
modifyLooks();
jlblStatus = new JLabel();
jta = (JTextArea) new TextArea();
lineBar = new LineBar();
output... | 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... | 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;
} | 1 |
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... | 2 |
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... | 3 |
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 = ... | 7 |
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);
}
} | 1 |
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... | 4 |
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;
}
}
... | 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... | 5 |
@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... | 9 |
@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.... | 8 |
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));
}
}
} | 2 |
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... | 8 |
public void visitSwitchStmt(final SwitchStmt stmt) {
if (previous == stmt.index()) {
previous = stmt;
stmt.parent.visit(this);
}
} | 1 |
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];
... | 2 |
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... | 9 |
public void setId(String id) {
this.id = id;
} | 0 |
public void visit_ineg(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} | 1 |
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;
... | 7 |
private SubmissionResult compileWithTestsAndRun(Submission submission) {
CompilationResult compilation;
try {
compilation = compileWithTests(submission);
} catch (CodeStyleException e) {
SubmissionResult result = new SubmissionResult();
result.setPass(false);
... | 2 |
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... | 7 |
@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... | 8 |
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:... | 4 |
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... | 3 |
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
new Marquee();
}
});
} | 0 |
@Override
public void focusGained(FocusEvent e) {
handleUpdate();
} | 0 |
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... | 1 |
@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);
... | 3 |
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 == ... | 8 |
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... | 9 |
@Override
public void run () {
boolean backupOnlyWithPlayer = pSystem.getBooleanProperty(BOOL_BACKUP_ONLY_PLAYER);
if ((backupOnlyWithPlayer && server.getOnlinePlayers().length > 0)
|| !backupOnlyWithPlayer
|| isManuelBackup
|| backupName != null)
... | 5 |
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());
} | 1 |
public OutlinerDesktopManager() {
super();
} | 0 |
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... | 9 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} | 0 |
public double getFullCost()
{
double cost = 0;
for (Edge edge : edges)
cost += edge.getCost();
return cost;
} | 1 |
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 ... | 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";
} | 2 |
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() > 0 && e.getKeyCode() < 256) {
keys[e.getKeyCode()] = false;
}
} | 2 |
@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: ... | 5 |
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
... | 7 |
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... | 2 |
public Customer SingleCustomerData(int CustID)
throws UnauthorizedUserException, BadConnectionException, DoubleEntryException
{
/* Variable Section Start */
/* Database and Query Preperation */
PreparedStatement statment = null;
ResultSet results = null;
... | 8 |
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 ... | 9 |
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] == '@'
... | 8 |
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... | 7 |
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 ;
} | 4 |
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 == ... | 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... | 8 |
protected void computeAddressByteArray(OSCJavaToByteArrayConverter stream) {
stream.write(address);
} | 0 |
@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... | 8 |
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... | 1 |
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) {
... | 7 |
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... | 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;
} | 2 |
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?");
}
} | 3 |
@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... | 7 |
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);
} | 4 |
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;
} | 2 |
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... | 6 |
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;
... | 8 |
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... | 4 |
@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... | 5 |
public void mouseReleased(MouseEvent e) {
//Game Logic
if (!m_panel.getAnimationThread().isAlive()) {
if (getGame().getPlayer(getGame()
.getPlayerTurn() % TOTAL_PLAYERS)
.getPlayerType()
... | 5 |
@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... | 9 |
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)) {
... | 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;
}
}... | 8 |
@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... | 1 |
@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... | 5 |
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;
} | 3 |
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... | 4 |
@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... | 9 |
@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) {
... | 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... | 3 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.