text stringlengths 14 410k | label int32 0 9 |
|---|---|
public List<Bomb> collectBombs() {
List<Bomb> bombs = new ArrayList<Bomb>();
for (Tile[] tiles : this.map) {
for (int i = 0; i < tiles.length; i++) {
Tile tile = tiles[i];
if (tile.getBomb() != null) {
bombs.add(tile.getBomb());
... | 3 |
public static void loadConstants() {
try {
//get a connection to the constants file and read it
final String fileName = "file:///" + CONSTANTS_FILE_NAME;
printIfDebug("Opening constants file: " + fileName);
FileConnection commandFileConnection = (FileConnection) C... | 5 |
@Test
public void testGetLastCheckpoint()throws Exception{
Tracking trackingGet1 = new Tracking("GM605112270084510370");
trackingGet1.setSlug("dhl-global-mail");
Checkpoint newCheckpoint = connection.getLastCheckpoint(trackingGet1);
Assert.assertEquals("Should be equals message", "De... | 2 |
/* */ public Object getTeleportPacket(Location loc)
/* */ {
/* 134 */ Class<?> PacketPlayOutEntityTeleport = Util.getCraftClass("PacketPlayOutEntityTeleport");
/* */
/* 136 */ Object packet = null;
/* */ try
/* */ {
/* 139 */ packet = PacketPlayOutEntityTeleport.getConstru... | 7 |
public void run() {
try {
Map<String, String> requestHeaders = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
formParams.put(CommunityConstants.BASE64_PUBLIC_KEY, Base64.encode(pair.getPublic().getEncoded()));
formParams.put(CommunityConstants.NICKNAME, "t... | 5 |
static void prob4() {
/*
* A palindromic number reads the same both ways. The largest palindrome
* made from the product of two 2-digit numbers is 9009 = 91 99.
*
* Find the largest palindrome made from the product of two 3-digit
* numbers.
*/
long start = System.currentTimeMillis();
int max =... | 8 |
@Override
public Integer call() throws Exception {
System.out.println("子线程在进行计算");
Thread.sleep(3000);
int sum = 0;
for(int i=0;i<100;i++)
sum += i;
return sum;
} | 1 |
@SuppressWarnings({ "rawtypes", "unchecked" })
public static int partition(Comparable[] a, int min, int max){
int i = min;
int j = max + 1;
Comparable element = a[min];
while(true){
while(a[++i].compareTo(element) < 0){
if(i == max) break;
}
while(element.compareTo(a[--j]) < 0){
if(j == min... | 6 |
private final int calcHPChange(final MapleCharacter applyfrom, final boolean primary) {
int hpchange = 0;
if (hp != 0) {
if (!skill) {
if (primary) {
hpchange += alchemistModifyVal(applyfrom, hp, true);
} else {
hpchange... | 7 |
public static void main (String[] args) {
System.out.println("Irule! YEAR BOIIII");
System.out.println("LIKEABOSSSSS");
String name = "Dencho";
int x = 3;
x = x *17;
System.out.print("x is " + x);
while (x > 12) {
x = x -1;
}
while (x > 10) {
x = x - 1;
System.out.println("subbin... | 4 |
public Production getSimplifiedProduction(Production production) {
String lhs = (String) MAP.get(production.getLHS());
String rhs = production.getRHS();
int leftIndex, rightIndex; // Position of left and right parentheses.
StringBuffer newRhs = new StringBuffer();
while ((leftIndex = rhs.indexOf('(')) != -1
... | 2 |
private OrderReport processMarketOrder(Order quote, boolean verbose) {
ArrayList<Trade> trades = new ArrayList<Trade>();
String side = quote.getSide();
int qtyRemaining = quote.getQuantity();
if (side =="bid") {
this.lastOrderSign = 1;
while ((qtyRemaining > 0) && (this.asks.getnOrders() > 0)) {
Order... | 6 |
@SuppressWarnings("unchecked")
public CepService(String cep) {
try {
URL url = new URL("http://cep.republicavirtual.com.br/web_cep.php?cep=" + cep + "&formato=xml");
Document document = getDocumento(url);
Element root = document.getRootElement();
for (Iterator<Element> i = root.elementIterat... | 9 |
protected void read(InputStream in, int maxLength) throws IOException, ParsingException {
InputBuffer buffer = new InputBuffer(in, 24, 24);
if (!Arrays.equals(magic, buffer.get(0, 4))) {
throw new ParsingException("Unknown magic bytes: " + Arrays.toString(buffer.get(0, 4)));
}
byte[] ascii = buffer.get(4, ... | 8 |
private void returnStatement()
{
if (accept(NonTerminal.RETURN_STATEMENT))
{
expression0();
expect(Token.Kind.SEMICOLON);
}
} | 1 |
@Override
public double getProgress() {
switch (getState()) {
case READY:
return 0.0;
case EXECUTING:
case ROLLBACKING:
case PAUSED:
return 0.5;
case EXECUTION_SUCCEEDED:
case EXECUTION_FAILED:
case ROLLBACK_SUCCEEDED:
case ROLLBACK_FAILED:
return 1.0;
default:
return 0.0;... | 8 |
public void run() {
try {
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream());
login = in.readLine();
password = in.readLine();
DbConnect DBC = new DbConnect();
stat... | 3 |
public static boolean addArtist(boolean manually, String prefName, String name, String ... moreNames) {
try {
check();
int aid = createArtist(prefName, manually);
createName(name, aid);
if(moreNames != null) {
for(int i = 0; i < moreNames.length; i++) {
String mn = moreNames[i];
creat... | 3 |
public CoordVizualizer() {
super(new BorderLayout());
mapKit = new JXMapKit();
mapKit.setName("mapKit");
mapKit.setPreferredSize(new Dimension(413, 218));
add(mapKit, BorderLayout.CENTER);
mapKit.setDefaultProvider(DefaultProviders.OpenStreetMaps);
mapKit.setCen... | 7 |
public double rollOut()
{
StateObservation rollerState = state.copy();
int thisDepth = this.m_depth;
while (!finishRollout(rollerState,thisDepth)) {
int action = m_rnd.nextInt(num_actions);
rollerState.advance(actions[action]);
thisDepth++;
}
... | 3 |
public <V extends Collection<T>> V fetchContainingIntervals(V target,
U queryPoint) {
if (target == null) {
throw new NullPointerException("target is null");
}
if (queryPoint == null) {
throw new NullPointerException("queryPoint is nu... | 5 |
private boolean jj_2_68(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_68(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(67, xla); }
} | 1 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
* to str... | 9 |
private void init() {
if (Double.compare(getWidth(), 0) <= 0 ||
Double.compare(getHeight(), 0) <= 0 ||
Double.compare(getPrefWidth(), 0) <= 0 ||
Double.compare(getPrefHeight(), 0) <= 0) {
setPrefSize(PREFERRED_SIZE, PREFERRED_SIZE);
}
if (Double.co... | 8 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... | 7 |
public static void populate()
{
Random rand = Randomizer.getRandom();
field.clear();
for(int row = 0; row < field.getDepth(); row++) {
for(int col = 0; col < field.getWidth(); col++) {
if(rand.nextDouble() <= FOX_CREATION_PROBABILITY) {
Locatio... | 7 |
private Rule _NextRule(String nonterm){
HashSet<Rule> prog_rules = m_mapping.get(nonterm);
Rule rule = new Rule();
m_possible_lexems = new HashSet<ArrayList<String>>();
for(Rule cur_rule : prog_rules)
{
ArrayList<String> terminals = new ArrayList<String>();
... | 6 |
public void addSample(double value) {
if(value < min) {
min = value;
}
if(value > max) {
max = value;
}
sum += value;
squared_sum += value * value;
num_samples++;
} | 2 |
public void updateNeighbors() throws RemoteException {
neighborsTable = new HashMap<String, Double[]>();
double distValue;
List<String> listOfOffices = registry.list();
try {
Double maxDistance = 0.0;
Object removeNodeName = null;
Iterator<String> iter = listOfOffices.iterator();
while (iter.ha... | 9 |
private void jButtonFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFilesActionPerformed
Logger.getLogger(UserInterface.class.getName()).log(Level.FINE, "FileChooser");
JFileChooser f = new JFileChooser();
f.setMultiSelectionEnabled(true);
if (f.showOpenDi... | 3 |
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... | 7 |
public void zip(File source)
{
try
{
File[] files = source.listFiles();
if (files != null)
{
for (int i = 0; i < files.length; i++)
{
if (files[i].isDirectory())
{
zip(files[i]);
}
else
{
FileInputStream fis = new FileInputStream(files[i]);
bis ... | 8 |
public void downloadFiles() {
recursiveDelete(new File(OS.getFolderFile(), "bin"));
File downloadDir = new File(OS.getFolderFile(), "bin");
downloadDir.mkdirs();
File nativesDir = new File(downloadDir, "natives");
nativesDir.mkdirs();
List<DownloadFile> files = new ArrayL... | 6 |
public void removeTaxis(int taxis) {
int i = 0;
try {
int loops = 0;
while (i < taxis) {
loops++;
if (items.get(loops) instanceof Taxi) {
if (!((MovingMapItem) items.get(loops)).dying()) {
((MovingMapItem) items.get(loops)).kill();
i++;
}
... | 4 |
public void keyPressed(KeyEvent e)
{
switch(e.getKeyCode())
{
case KeyEvent.VK_RIGHT:
if (gameBoard.isValidMove(Direction.RIGHT))
{
gameBoard.moveSide(Direction.RIGHT);
repaint();
}
break;
case KeyEvent.VK_LEFT:
if (gameBoard.isValidMove(Direction.LEFT))
{
gameBoard.moveSide(D... | 8 |
private void radixSort0(int[] a, int i, int low, int high) {
if (i < 0)
return;
for (int j = low; j < high; j++)
registers[getDigit(a[j], i)].offer(a[j]);
//printInfo(i);
int index = low;
for (Queue register : registers) {
int low2 = index;
... | 4 |
public void listeningPort(){
BufferedReader entradaCliente;
DataOutputStream salidaServer;
String peticion = "";
int tamano = 0;
try (ServerSocket puertoServidor = new ServerSocket(PUERTO)) {
Socket puerto = puertoServidor.accept();
entradaCliente = new Bu... | 7 |
public Model method202(int i) {
if (stackIDs != null && i > 1) {
int j = -1;
for (int k = 0; k < 10; k++)
if (i >= stackAmounts[k] && stackAmounts[k] != 0)
j = stackIDs[k];
if (j != -1)
return forID(j).method202(1);
}
Model model = Model.method462(modelID);
if (model == null)
return nul... | 9 |
public static List<Double> changeOfCoords(List<Poi> oldPoiList, List<Poi> newPoiList){
List<Double> changes = new ArrayList<Double>();
HashMap<String, Poi> newPoiMap = new HashMap<String, Poi>();
for (Poi new_poi : newPoiList) {
newPoiMap.put(new_poi.getId(), new_poi);
}
for(Poi old_poi : oldPoiList){
i... | 7 |
public Main(){
try{
Display.setDisplayMode(new DisplayMode(800, 500));
Display.setResizable(false);
Display.setTitle("Hexagon Mapping");
PixelFormat pf = new PixelFormat().withSamples(4).withDepthBits(24);
Display.create(pf);
width = 800;
height = 500;
AL.create();
}catch(LWJGLEx... | 2 |
public Response serve(IHTTPSession session) {
Map<String, String> header = session.getHeaders();
Map<String, String> parms = session.getParms();
String uri = session.getUri();
if (!quiet) {
System.out.println(session.getMethod() + " '" + uri + "' ");
Iterator<St... | 5 |
public void playFanFare() throws InterruptedException{
try
{
in = new FileInputStream(fanFare);
as = new AudioStream(in);
ap.player.start(as);
}
catch(Exception e)
{
System.out.println("Got an IOException: " + e.getMessage());
e.printStackTrace();
... | 1 |
public World getWorld(){
if(server != null)return server.getWorld();
return null;
} | 1 |
@Override
public boolean equals(Object obj) {
if(obj == null) {
return false;
}
if(getClass() != obj.getClass()) {
return false;
}
final TerminalPosition other = (TerminalPosition) obj;
if(this.row != other.row) {
return false;
... | 4 |
public void setCount(int value) {
this._count = value;
} | 0 |
public static BigInteger check() {
for (BigInteger a : primes) {
for (BigInteger b : primes) {
for (int i = 0; i < 80; i++) {
int sum = i * i + a.intValue() * i + b.intValue();
BigInteger test = new BigInteger(String.valueOf(sum));
... | 5 |
public static Stack<Integer> sortStack(Stack<Integer> s){
Stack<Integer> r = new Stack<Integer>();
while(!s.isEmpty()){
Integer e = s.pop();
while(!r.isEmpty() && r.peek() > e){
s.push(r.pop());
}
r.push(e);
}
return r;
} | 3 |
public static final int GetLenToPosState(int len)
{
len -= 2;
if (len < 4)
return len;
return 3;
} | 1 |
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... | 5 |
@SuppressWarnings("static-access")
@EventHandler(priority = EventPriority.HIGH)
public void onMobDeath (EntityDeathEvent event) {
Random rand = new Random();
int dropAmount = rand.nextInt(3);
Entity entity = event.getEntity();
World world = event.getEntity().getWorld();
i... | 4 |
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... | 6 |
public void update() {
bgX += speedX;
if (bgX <= -2160) {
bgX += 4320;
}
} | 1 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SpecificationSubModel other = (SpecificationSubModel) obj;
if (featureSpecSet == null) {
if (other.featureSpecSet != null)
return false;
... | 9 |
public void setContent(String content) {
this.content = content;
} | 0 |
private void getDataFromEvent(Sim_event ev)
{
IO_data io = (IO_data) ev.get_data();
// if the sender is not part of the overall network topology
// whereas this entity is, then need to return back the data,
// since it is not compatible.
if (link_ != null)
{
... | 3 |
public static void renderNormalBlock(float x, float y, float z,
boolean clear, int id, int rendermode) {
// GL11.glTranslatef(x, y, z);
if (clear) {
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glLoadIdentity();
}// GL20.glUseProgram(0);
if (id == 1) {
// GL11.glColor3f(0... | 4 |
public void setEventName(String eventName) {
this.eventName = eventName;
} | 0 |
public void addAdj(TrieNode node){
adj[getIndex(node.ch)]=node;
} | 0 |
@Test
public void testNull() {
RedBlackTree<Integer> tree = new RedBlackTree<Integer>();
try {
tree.insert(null);
Assert.fail();
} catch (NullPointerException e) {
}
try {
tree.getPredecessor(null);
Assert.fail();
} catch (NullPointerException e) {
}
try {
... | 6 |
public void replaceCards(Card oldCard, Card newCard){
// We need to find the index of the old card
for(int i = 0; i < this.cards.size(); i++) {
if(this.cards.get(i).equals(oldCard)) {
// Set the new object
this.cards.set(i, newCard);
}
}
} | 2 |
public static void main(String[] args) throws InterruptedException {
Thread.currentThread().setName("Startup");
try {
LOG.info("The \"Java GWCAConstants\" (version {}) is starting", Version.getVersion());
addShutdownHook();
// Fill in the PID here
gwcaCon... | 4 |
@Override
public Set<Election> getNominationsForUser(User user) {
Set<Election> electionsNominated = new HashSet<Election>();
Collection<Election> col = electionMap.values();
Iterator<Election> it = col.iterator();
while (it.hasNext()) {
DnDElection el = (DnDElection) it.next();
if (el.getElectionState(... | 3 |
public double[] getBbox()
{
return bbox;
} | 0 |
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
} | 1 |
public static int hashCode(final Node node) {
class Int {
int value = 0;
}
;
final Int hash = new Int();
node.visit(new TreeVisitor() {
public void visitExprStmt(final ExprStmt stmt) {
hash.value = 1;
}
public void visitIfCmpStmt(final IfCmpStmt stmt) {
hash.value = stmt.comparison() + ... | 3 |
public String toString(String input) {
return name + calc(input);
} | 0 |
public static boolean handle(SyncSettings settings) throws UnknownHostException, IOException {
HttpRequestor rq = settings.getRequestorFor(SyncPage.NEW);
Request r = rq.getRequest();
buildRequest(settings, r);
// only actually request if necessary
int minSize = settings.isUsingPassword() ? 1 : 0;
if (r.g... | 7 |
public void uglyjoglhack() throws InterruptedException {
try {
rdr = true;
display();
} catch (GLException e) {
if (e.getCause() instanceof InterruptedException) {
throw ((InterruptedException) e.getCause());
} else {
e.printStackTrace();
throw (e);
}
} finally {
rdr = false;
}
} | 2 |
private static void postOrderTraversal(Node root) {
if (root == null)
return;
postOrderTraversal(root.left);
postOrderTraversal(root.right);
System.out.println(root.v);
} | 1 |
private boolean edge_adj(Edge e1,Edge e2) {
if(e1.source.getId()==e2.source.getId() &&
e1.target.getId()==e2.target.getId()) return false;
else if(e1.target.getId()==e2.source.getId() &&
e1.source.getId()==e2.target.getId()) return false;
else if(e1.source.getId(... | 8 |
private boolean validCommand(String command) {
String[][] items = this.menuItems;
for (String[] item : this.menuItems) {
if (item[0].equals(command)) {
return true;
}
}
return false;
} | 2 |
public boolean hasTransitionsInCorrectForm(Automaton automaton) {
Transition[] transitions = automaton.getTransitions();
for (int k = 0; k < transitions.length; k++) {
if (!isPushLambdaTransition(transitions[k])
&& !isPushTwoTransition(transitions[k])) {
return false;
}
}
return true;
} | 3 |
public void write(){
try {
log.info("Writing to "+ to +" file");
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element rootElement = doc.createElement("highscores")... | 5 |
protected boolean fireAndHandleEvent(WordTokenizer tokenizer, SpellCheckEvent event) {
fireSpellCheckEvent(event);
String word = event.getInvalidWord();
//Work out what to do in response to the event.
switch (event.getAction()) {
case SpellCheckEvent.INITIAL:
break;
case SpellCheckEv... | 9 |
private void postPlugin(final boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
final PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
final StringBuilder data =... | 9 |
public byte[] extractFile(FAT32DIRElement f32DIRElement) {
int countFileClusters = 0;
if (f32DIRElement.getDIR_FileSize() < BPB_BytsPerSec) {
countFileClusters = 1;
} else {
countFileClusters = f32DIRElement.getDIR_FileSize() / BPB_BytsPerSec + 1;
}
//счет... | 7 |
public int getDividerMaximum() {
if (isFull()) {
return Math.max((mHorizontal ? mWidth : mHeight) - Dock.DIVIDER_SIZE, 0);
}
return 0;
} | 2 |
public void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative");
if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative");
double xs = scaleX(x... | 4 |
public void closePromoteConnection(){
try {
//Rollback any outstanding transactions - there shouldn't be any, so this is probably an internal mistake
//If this rollback isn't performed, closing the connection issues a commit which is potentially dangerous
if(isTransactionActive(mPromoteConne... | 4 |
public ArrayList<Account> pay(Account seller, String amount, Account buyer) {
buyer.pay(amount);
seller.receive(amount);
ArrayList<Account> accounts = new ArrayList<Account>();
accounts.add(buyer);
accounts.add(seller);
return accounts;
} | 0 |
public void addYoungerLab(){
TD tD1 = new TD(1);
TD tD2 = new TD(2);
TD tD3 = new TD(3);
if(!this.getListofLabs().containsKey(1)
&& this.getListoflessons().containsKey(1)){
this.getListofLabs().put(1, tD1);
System.out.println("You attended the first lab.");
}else if(!this.getListofLabs().contains... | 9 |
public void moveLeft()
{
if (units1.size() == 6) {
QMessageBox.warning(this, "Nie można przenieść jednostek", "Bohater może mieć maksymalnie 6 jednostek");
} else if (units2.size() == 0) {
QMessageBox.warning(this, "Nie można przenieść jednostek", "Bohater nie ma żadnych jednostek");
} else if (list2.curre... | 3 |
@Override
public void startBehavior(PhysicalAgent forMe)
{
if((forMe!=null)&&(forMe instanceof MOB))
{
if(stomachR==null)
stomachR = CMClass.getLocale("StdRoom");
lastKnownEaterM=(MOB)forMe;
lastKnownLocationR=((MOB)forMe).location();
if(lastKnownLocationR!=null)
stomachR.setArea(lastKnownLoca... | 8 |
public static final boolean checkTrashOkazari(Body b) {
if(b.hasOkazari()) return false;
if(b.isVerySad()) return false;
Obj found = null;
int minDistance = b.getEyesight();
int wallMode = b.getAgeState().ordinal();
// 飛行可能なら壁以外は通過可能
if(b.canflyCheck()) {
wallMode = AgeState.ADULT.ordinal();
}
... | 7 |
public static Vector<Place> getPlacesDisponibles (String numS, String date) throws BDException {
Vector<Place> res = new Vector<Place>();
String requete = "select norang, noplace, numz from lesplaces MINUS select lestickets.norang, lestickets.noplace, numz from LesTickets, lesplaces where lestickets.noplace = lespl... | 2 |
public void viewAccepted(View view) {
if(bridge_view != null && bridge_view.getViewId().equals(view.getViewId()))
return;
int prev_members=bridge_view != null? bridge_view.size() : 0;
bridge_view=view;
switch(view.size()) {
case 1:
... | 7 |
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... | 6 |
@Override
public int attack(double agility, double luck) {
System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn...");
return 0;
} | 0 |
protected void loadPrestigeList(){
//print all prestige buttons
prestigeContainer.clear();
for(int classId : DDOCharacter.getTakenClasses()){//loop over all possible prestige classes
if(DDOCharacter.prestigeToClassMap.containsValue(classId)){ //check to see if there is any valid
Set<String> prestigeSet ... | 3 |
public boolean vaincu(){
int actifs = 0;
for (int i=0; i<recensement(); i++)
if (!soldats[i].estMort())
return(false);
return(true);
} | 2 |
public void update() throws SteamCondenserException, TimeoutException {
SourceServer ss = new SourceServer(sock.getAddress(), sock.getPort());
Map<String, Object> info = ss.getServerInfo();
Map<String, String> rules = ss.getRules();
Map<String, SteamPlayer> players = ss.getPlayers();
... | 9 |
private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... | 8 |
public void draw() {
timer--;
if (timer == 0) {
//if a player died reset all players and detonate all bombs
if (BombermanGame.players.stream().anyMatch(player -> !player.living)) {
BombermanGame.players.forEach(Player::resetPosition);
for (Bomb b :... | 5 |
@Before
public void init(){
MockitoAnnotations.initMocks(this);
} | 0 |
private boolean handlePlaceAllowed(Player player, Block block, Material type) {
if (WorldRegionsPlugin.getInstanceConfig().ENABLE_ALLOWED_PLACE && WGCommon.willFlagApply(player, WorldRegionsFlags.ALLOWED_PLACE)) {
// Disabled?
if (WGCommon.areRegionsDisabled(player.getWorld())) return true;
// Bypass?
... | 8 |
public void refresh()
{
GlobalLogger.getLogger().logp(Level.INFO, "CalendarPanel", "refresh",
"Refresh called.");
// We need to go through the task list and update all items that match
// the current date
// Clear it out first
itemsToPaint.clear();
for (Scheduleable t : Timeflecks.getSharedApplicati... | 6 |
public Difficulty difficulty(String functionString){
Difficulty difficulty;
if (functionString != null){
if (functionString.toLowerCase().equals("easy")){
difficulty = Difficulty.EASY;
}else if (functionString.toLowerCase().equals("hard")){
difficulty = Difficulty.HARD;
}else if (functionString.toL... | 5 |
public static void copyFolder(String srcFileDir, String destFileDir, String includePattern, String excludePattern) {
File srcFile = new File(srcFileDir);
File destFile = new File(destFileDir);
Project project = new Project();
Copy copy = new Copy();
copy.setProject(project);
... | 2 |
public boolean match(Sim_event ev) {
// checks for errors first
if (ev == null || lfn_ == null) {
return false;
}
boolean result = false;
try {
// find an event with a matching tag first
if (ev.get_tag() == tag_) {
Object obj ... | 6 |
public void addChildren(int x) {
if(x >= 3) {
propChildren[x] = new PropQuad(this, new Rectangle2D.Double(container.getX() + (container.getWidth()/2), container.getY() + (container.getHeight()/2),
container.getWidth()/2, container.getHeight()/2), props, rects, flatRects);
} else {
if(x < 2) {
propChi... | 2 |
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.