text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void update(GameContainer gc, int delta) {
if (gc.getInput().isMousePressed(Input.MOUSE_LEFT_BUTTON)) {
if (playItem.isSelected(gc)) {
parent.changeScreen(parent.getPlayScreen());
}
}
} | 2 |
@Override
protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException {
Filter filter = query.getFilter();
// handle query filter
if (filter instanceof IncludeFilter) {
// don't care about this filter, ignore it
} else if (filter instanceof BBO... | 4 |
public boolean poll() {
boolean result = target.poll();
Event event = new Event();
EventQueue queue = target.getEventQueue();
while (queue.getNextEvent(event)) {
// handle button event
if (buttons.contains(event.getComponent())) {
Component button = event.getComponent();
int buttonIndex = button... | 4 |
public static int isPan( String s ) {
boolean[] digits = new boolean[9];
for(char c : s.toCharArray()) {
if( c == '0' || digits[c-'0'-1] )
return -1;
digits[c-'0'-1] = true;
}
for(boolean b : digits)
if(!b)
return 0;
return 1;
} | 5 |
private void refresh() {
if (currState == State.step1) {
//Enable step 1 components
editorBN.setBackground(Color.white);
editorBN.setEnabled(true);
optionsBN.setEnabled(true);
optionsDicts.setEnabled(true);
lockButton.setEnabled(true);
//Disable step 2 components
... | 2 |
private boolean doesTouchInternal(Polyline other) {
for (int i = 0; i < nbSegments(); i++) {
final LineSegmentInt seg1 = segments().get(i);
for (int j = 0; j < other.nbSegments(); j++) {
final LineSegmentInt seg2 = other.segments().get(j);
final boolean ignoreExtremities = i == 0 || i == nbSegments() - ... | 9 |
public InterfaceSelector(InterfaceSelectorReceiver callbackHandler) throws SocketException
{
setDefaultCloseOperation(EXIT_ON_CLOSE);
this.callbackHandler = callbackHandler;
ButtonGroup buttons = new ButtonGroup();
setLayout(new GridLayout(0,1));
setSize(100, 500);
Enumeration<NetworkInterface> inter... | 1 |
public ByteOrderMark(String charsetName, int... bytes) {
if (charsetName == null || charsetName.length() == 0) {
throw new IllegalArgumentException("No charsetName specified");
}
if (bytes == null || bytes.length == 0) {
throw new IllegalArgumentException("No bytes specif... | 4 |
public void run ()
{
try
{
String inputLine;
socketOutput = new PrintWriter(clientSocket.getOutputStream(), true);
socketInput = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
Scanner netScanner;
String instType;
System.out.print ("[SERVER]... | 5 |
public static void printContext(Context self, PrintableStringWriter stream) {
{ String typestring = null;
String name = null;
int number = self.contextNumber;
if (!Stella.$CLASS_HIERARCHY_BOOTEDp$) {
stream.print("|MDL|" + ((Module)(self)).moduleName);
return;
}
{ Surr... | 9 |
public void excecuteCommand(String channel, String sender, String message) throws Exception {
if(message.startsWith("!etip")) {
sendMessage(channel, "Such " + sender + " tipped much Ɖ" + message.split(" ")[2] + " to " + message.split(" ")[1] + "! (to claim /msg Doger help)");
sendMessage("Doger", "!tip " + mes... | 8 |
private ChartEntry readEntry(ScanfReader scanReader, TablePane pane)
throws IOException {
String entryName = scanReader.scanString("%S");
ChartEntry entry = new ChartEntry(entryName);
String attributeName;
while (!(attributeName = scanReader.scanString()).equals("end")) {
... | 6 |
protected void updateTimeFields() {
long timeAsSeconds = getTimeAsSeconds();
// Store the starting seconds minutes and hours so that we can compare
// this to the new minutes seconds and hours to set the hasChanged
// variable
long startS = seconds, startM = minutes, startH = hours;
seconds = timeAsSeconds... | 2 |
public boolean validate(String str) throws Exception {
str = str.toLowerCase();
if (isNameExists(str)) {
return searchingFile(str).equals("true");
} else {
String pattern = "^[a-z][a-z0-9\\.,\\-_]{5,31}$";
// Create a Pattern object
Pattern r = Pat... | 3 |
private void discoverDevices() {
tvDiscoveryService = TvDiscoveryService.getInstance(swingPlatform);
// discovering devices can take time, so do it in a thread
new Thread(new Runnable() {
public void run() {
showProgressDialog(resourceBundle.getString("progress.discoveringDevices"))... | 9 |
protected void buildAttributes(Node node, StringBuffer buf) {
// Iterator it = node.getAttributeKeys();
// if (it != null) {
// while (it.hasNext()) {
// String key = (String) it.next();
// Object value = node.getAttribute(key);
// buf.append(" ").append(key).append("=\"").append(escapeXMLAttribute(value.t... | 0 |
public Recipe openFile(File f) {
fileType = checkFileType(f);
Debug.print("File type: " + fileType);
if (fileType.equals("promash")) {
PromashImport imp = new PromashImport();
myRecipe = imp.readRecipe(f);
} else if (fileType.equals("sb") || fileType.equals("qbrew")) {
ImportXml imp = new ImportXml(f... | 4 |
@Override
public void initResources() {
playfield = new PlayField();
// Создание спрайт групп
firstBallGroup = new SpriteGroup("firstBalls");
secondBallGroup = new SpriteGroup("secondBalls");
thirdBallGroup = new SpriteGroup("thirdBalls");
playfield.addGroup(... | 5 |
public List<Chromosome> select(List<Chromosome> population)
{
List<Double> absoluteFitnesses = new LinkedList<Double>();
List<Double> proportionalFitnesses = new LinkedList<Double>();
double totalFitness = 0;
for (Chromosome i : population)
{
double fitness = Ma... | 7 |
void resetColorsAndFonts () {
super.resetColorsAndFonts ();
Color oldColor = selectionForegroundColor;
selectionForegroundColor = null;
setSelectionForeground ();
if (oldColor != null) oldColor.dispose();
oldColor = selectionBackgroundColor;
selectionBackgroundColor = null;
setSelectionBackground ();
... | 3 |
public boolean appliesToCurrentEnvironment() {
if (this.rules == null) return true;
Rule.Action lastAction = Rule.Action.DISALLOW;
for (Rule rule : this.rules) {
Rule.Action action = rule.getAppliedAction();
if (action != null) lastAction = action;
}
return lastAction == Rule.Action.AL... | 3 |
public static void generateGradeCSV(String courseID, String actName, String path, String name)
{
ResultSet res = GradeAccess.accessGrades(courseID, actName);
String s = "";
int x = 0;
try {
while(res.next()) {
if(x == res.getInt(1)) {
s += "," + res.getFloat(2);
} els... | 5 |
public HumanFirstPane(PumpingLemma l, String title)
{
super(l, title);
l.setFirstPlayer(PumpingLemma.HUMAN);
} | 0 |
public void setTextFieldValues()
{
List<User> theUsers = users.getUsers();
tasks = new AccessTasks();
tasks.getTasks();
theTask = null;
if(tasks != null && item != null)
{
theTask = tasks.getTask(Integer.parseInt(item.getText()));
}
if(theTask != null)
{
StaticWindowMethods.populateAss... | 5 |
@SuppressWarnings("unchecked")
public E[] toArray() {
if (root == null)
return null;
E[] array = (E[]) Array.newInstance(root.data.getClass(), size);
Stack<Node> stack = new Stack<Node>();
Node node = root;
int index = 0;
while (true) {
if (node != null) {
stack.push(node);
node = node... | 4 |
private void stopIfDone() {
if(isDone() && !(preStop || preStart)) {
mm.stopMinigame(this);
}
} | 3 |
public UndoController() {
undoStack = new SizedStack<>(25);
redoStack = new SizedStack<>(25);
} | 0 |
public void upgradeTables() {
// Add blocks_built into LOGIN
if (_sqLite.isTable("login")) {
try {
_sqLite.query("ALTER TABLE login ADD COLUMN blocks_placed INT;");
_log.info("[Statistics] Table LOGIN upgraded - column blocks_placed added");
} catch (SQLException e) {
}
}
// Add bloc... | 4 |
public static void main(String[] args) {
int op=0;
do{
System.out.println("1- Agregar Doctor");
System.out.println("2- Agregar Paciente");
System.out.println("3- Mantenimiento de Citas");
System.out.println("4- Reportes");
System.out.p... | 8 |
@Override
public Employee getById(Integer id) {
return map.get(id);
} | 0 |
public void input(){
if(Mouse.isGrabbed()){
pos.addXRot(-Mouse.getDY()*mouseSensivity);
pos.addYRot(Mouse.getDX()*mouseSensivity);
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)){
speed = 0.25f;
}
if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)){
speed =... | 9 |
boolean isCursorOnTopOf(int xCursor, int yCursor, int minRadius, Atom competitor) {
// XIE: the following should be used to prevent dx2 or dy2 > Integer.MAX_VALUE
if (screenX < 0 || screenX > SCREEN_SIZE.width || screenY < 0 || screenY > SCREEN_SIZE.height)
return false;
int r = screenDiameter / 2;
if (r < m... | 9 |
public static void main(String[] args) {
String encoding = "UTF-8";
int maxlines = 100;
BufferedReader reader = null;
BufferedWriter writer = null;
try {
reader = new BufferedReader(new InputStreamReader(new FileInputStream("/bigfile.txt"), encoding));
in... | 7 |
public boolean step() {
// controller.step();
boolean worked = false;
if (treePanel.next()){
stepAction.setEnabled(false);
worked = true;
}
treePanel.repaint();
return worked;
} | 1 |
public void setEndPoints(int x1, int x2, int y1, int y2) {
colourize();
switch (type) {
case LINE:
setStartingPoint(new Point(x1,y1));
setEndPoint(new Point(x2,y2));
break;
case CIRCLE:
case SQUARE:
if (x2>=x1 && y2>=y1) {
setStartingPoint(new Point(x1, y1));
int side = Math.min(x2-x1, y2-... | 9 |
protected Item getPoison(MOB mob)
{
if(mob==null)
return null;
if(mob.location()==null)
return null;
for(int i=0;i<mob.location().numItems();i++)
{
final Item I=mob.location().getItem(i);
if((I!=null)
&&(I instanceof Scroll)
&&(((SpellHolder)I).getSpells()!=null)
&&(((SpellHolder)I).getSpe... | 8 |
void classification() {
int pixels[][] = this.pixels;
int width = pixels.length;
int height = pixels[0].length;
// convert to indexed color
for (int x = width; x-- > 0;) {
for (int y = height; y-- > 0;) {
int pixel = pixel... | 8 |
public static Font openFont(String name)
{
if(fonts.containsKey(name))
return (Font) fonts.get(name);
Font font = null;
InputStream is = ClassLoader.getSystemResourceAsStream("org/analyse/core/gui/fonts/" + name);
if (is == null)
{
System.err.println("Utilisation de la Fonte impossible : " + name... | 3 |
public void setRoom(int room) {
this.room = room;
} | 0 |
private void currentCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_currentCheckActionPerformed
serverTable.clearSelection();
if(currentCheck.isSelected()){
try {
ServicioTablespace st = new ServicioTablespace(conexion.user,conexion.pass,conexion.ip... | 4 |
public static String readLine(ByteBuffer buf) {
boolean completed = false;
buf.mark();
while (buf.hasRemaining() && !completed) {
byte b = buf.get();
if (b == '\r') {
if(buf.hasRemaining() && buf.get() == '\n'){
completed = true;
}
}
}
if(!completed){
return null;
}
int limit = ... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ThreadTimingBean other = (ThreadTimingBean) obj;
if (atomicId != other.atomicId)
return false;
if (end != other.end)
return false;
if (... | 9 |
private static boolean canProcess(String line){
boolean processBit = true;
boolean foundAnnotationBit = false;
if (line.contains("None"))
processBit = true;
else{
for(String lines: ARGS){
if(line.contains(lines))
foundAnnotationBit = true;
}
if(foundAnnotationBit){
processBit = true;
... | 4 |
public static String[] getPercents() {
int a = 0;
String[] s1 = new String[100];
int i = Casino.conf.getInt("settings.SevenChance");
while(i>0) {
s1[a] = "➐";
i--;
a++;
}
i = Casino.conf.getInt("settings.HeartChance");
while(i>0) {
s1[a] = "❤";
i--;
a++;
}
i = Casino.conf.getInt("set... | 8 |
@Override
public void validate() {
if (dailybdgt == null) {
addActionError("Please Enter Daily Budget");
}
if (deliverytype == null) {
addActionError("Please Select Delivery Type");
}
if (campaignname == null) {
addActionError("Please... | 6 |
public static <TT> TypeAdapterFactory newFactoryForMultipleTypes(final Class<TT> base,
final Class<? extends TT> sub, final TypeAdapter<? super TT> typeAdapter) {
return new TypeAdapterFactory() {
@SuppressWarnings("unchecked") // we use a runtime check to make sure the 'T's equal
public <T> TypeA... | 5 |
private void BackspaceButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BackspaceButtonActionPerformed
if (FocusOwnerIndex == 1) {
if (NumberField1.getCaretPosition() != 0) { // only do something if the caret is not the at the beginning
int tmpcaretpos = Number... | 8 |
private boolean checkIfOutOfRange(int x, int y) {
return x < -1000000 || y < -1000000 || x > 1000000 || y > 1000000 ? true : false;
} | 4 |
public static void unlockDoor(int roomId) {
keyRequired[roomId-1] = 0;
} | 0 |
public MoveHandler(boolean pendown, boolean forward) {
this.pendown = pendown;
this.forward = forward;
} | 0 |
@Override
public boolean halt(Event lastEvent, OurSim ourSim) {
boolean halt = true;
List<Job> finishedJobsList = new LinkedList<Job>();
for (ActiveEntity entity : ourSim.getGrid().getAllObjects()) {
if (entity instanceof Broker) {
Broker broker = (Broker) entity;
List<Jo... | 6 |
public static void main(String[] args) {
try {
Files.createDirectories(Paths.get("/home/xander/test"));
Path file = Paths.get("/home/xander/test/test.txt");
// no need to check prior to deletion
Files.deleteIfExists(file);
Files.createFile(file);
... | 1 |
public final Image image(JPanel panel) {
Image image = panel.getToolkit().createImage(ClassLoader.getSystemResource(url));
MediaTracker tracker = new MediaTracker(panel);
tracker.addImage(image, 1, width, height);
try {
tracker.waitForAll();
} catch (InterruptedException e) {
throw new RuntimeException(... | 1 |
private void checkForPeakX(double x) {
if (isUpPeakX) {
if (x < lastX) {
peakX = lastX;
isUpPeakX = false;
}
} else {
if (x > lastX) {
peakX = lastX;
isUpPeakX = true;
}
}
lastX = x;
} | 3 |
private Map<String, BoundField> getBoundFields(Gson context, TypeToken<?> type, Class<?> raw) {
Map<String, BoundField> result = new LinkedHashMap<String, BoundField>();
if (raw.isInterface()) {
return result;
}
Type declaredType = type.getType();
while (raw != Object.class) {
Field[] f... | 8 |
private static Image enhance(Image image, int[]histogram) {
ImageData imageData = image.getImageData();
// Calculate cumulative histogram
int[] cumulativeHistogram = new int[256];
for (int i = 0; i < cumulativeHistogram.length; i++) {// height
if (i == 0)
cumulativeHistogram[i] = histogram[0];
else
... | 8 |
private void processDeleteMaster(Sim_event ev)
{
if (ev == null) {
return;
}
Object[] obj = (Object[]) ev.get_data();
if (obj == null)
{
System.out.println(super.get_name() +
".processDeleteMaster(): master file name is null");
... | 5 |
@SuppressWarnings("unchecked")
public static EventWriter createEventWriter(EventEntry eventEntry){
Properties unisensProperties = UnisensProperties.getInstance().getProperties();
String readerClassName = unisensProperties.getProperty(Constants.EVENT_WRITER.replaceAll("format", eventEntry.getFileFormat().getFileFor... | 9 |
@Override
public void paintComponent(Graphics g) {
int i = 0;
Home home;
super.paintComponent(g);
{
g.drawImage(this.image, 0, 110, getWidth(), getHeight(), null);
this.sliderPiece.paintComponent(g);
this.sliderValue.paintComponent(g);
... | 5 |
@Test
public void test_insertions() {
int m = 3;
int n = 5;
Matrix m1 = new MatrixArray(m,n);
for(int i = 1; i <= m; i++){
for(int j = 1; j <= n; j++)
m1.insert(i, j, (double)(i*j));
}
for(int i = 1; i <= m; i++){
for(int j = 1; j <= n; j++)
assertEquals(m1.get(i,j),(double)(i*j), 0.01)... | 4 |
public Grid(int width, int length) {
frame.setLayout(new GridLayout(width, length));
grid = new JButton[width][length]; //initialise jbutton grid array
for (int y = 0; y < length; y++) {
for (int x = 0; x < width; x++) {
grid[x][y] = new JButton("(" + x + "," + y + "... | 4 |
@Override
public String notation() {
return this.from.toString() + "x" + this.to.toString();
} | 0 |
public void discard() {
dealer.discard(pile);
player.discard(pile);
info.update(deck);
discardButton.setEnabled(false);
hitButton.setEnabled(false);
standButton.setEnabled(false);
resetButton.setEnabled(true);
if (player.getMoney() > 0) {
betButton.setEnabled(true);
}
doubleButton.setEnabled(fals... | 1 |
protected DataAccessLayer(){
//ensure that the JDBC connector exists.
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Could not locate JDBC driver");
}
//attempt database connection
dBConnect();
} | 1 |
public byte[] engineGenerateSeed(int numBytes) {
if (DEBUG && debuglevel > 8) debug(">>> engineGenerateSeed()");
if (numBytes < 1) {
if (DEBUG && debuglevel > 8) debug("<<< engineGenerateSeed()");
return new byte[0];
}
byte[] result = new byte[numBytes];
this.engineNextBy... | 7 |
private static int leapDays(Tm tm) {
if (tm.getMonth() < 3) {
return 0;
}
int year = tm.getYear();
return year % 4 == 0 && (year % 400 == 0 || year % 100 != 0) ? 1 : 0;
} | 4 |
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() >= 2) {
zoomInAnimated(new Point(mouseCoords.x, mouseCoords.y));
} else if (e.getButton() == MouseEvent.BUTTON3 && e.getClickCount() >= 2) {
zoomOutAnimated(new P... | 5 |
@Test
public void testTruncate_quotation()
{
String s = "It's ok to include \"quotation marks\" along with words.";
Assert.assertEquals(
"It's ok to include \"quotation marks\"…",
_helper.truncate(s, 40)
);
} | 0 |
private void convertYCBCRtoRGB(double Y, double Cb, double Cr) {
R = round(Y + (Cr - 128) * 1.402);
G = round(Y - (Cb - 128) * 0.34414 - (Cr - 128) * 0.71414);
B = round(Y + 1.772 * (Cb - 128));
R = R > 255 ? 255 : (R < 0 ? 0 : R);
G = G > 255 ? 255 : (G < 0 ? 0 : G);
B =... | 6 |
public static Keyword computeVarianceOrStandardDeviation(ControlFrame frame, Keyword lastmove, boolean standardDeviationP) {
{ Proposition proposition = frame.proposition;
Stella_Object listarg = (proposition.arguments.theArray)[0];
Stella_Object listskolem = Logic.argumentBoundTo(listarg);
Stella... | 9 |
public void getChar() {
try {
if (position >= line.length()){
line = input.nextLine();
line = line + "\n";
position = 0;
lineNumber++;
// only a period on a line means eof
if (".\n".equals(line))
eof = true;
}
current = line.charAt(position);
position++;
} catch (NoSuchEle... | 3 |
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
log.info("WANcostResummingServlet12h Got a GET...");
caches.reload();
link[][] linkArr = new link[caches.lSources.size()][caches.lDestinations.size()];
for (int i = 0; i < caches.lSources.size(); i++)
for (int j =... | 9 |
boolean isSalesTaxApplicable(String sItem)
{
for(String sExmpItem : exemptedItems)
if(sItem.contains(sExmpItem))
{
return false;
}
return true;
} | 2 |
public ENCODE getEncode() {
return encode;
} | 0 |
public int getCount()
{
return count;
} | 0 |
private static String getBrowserMessage() {
if (UserAgentPermutation.isGecko()) {
return "feels like a lizard";
} else if (UserAgentPermutation.isSafari()) {
return "is out on the savannah";
} else if (UserAgentPermutation.isOpera()) {
return "hits all the hig... | 7 |
public static boolean warnAboutFunctionShadowingSlotsP(MethodSlot function) {
{ Symbol name = function.slotName;
if (name.symbolSlotOffset != Stella.NULL_INTEGER) {
{ Cons slots = Stella.NIL;
{ Module module = null;
Iterator iter000 = Stella.allModules();
while (it... | 9 |
public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... | 7 |
public LinkedList<Bullet> applyAllUpgrades(String[] sprites) {
LinkedList<Bullet> bullets = new LinkedList<Bullet>();
LinkedList<Bullet> newBullets = new LinkedList<Bullet>();
Bullet firstBullet = new Bullet(sprites, baseAim, 10);
double centerx = rect.x + rect.width / 2 - firstBullet.ge... | 4 |
public FileTransfer(String fileName, Long fileSizeLeft){
this.fileName = fileName;
this.fileSizeLeft = fileSizeLeft;
this.file = new File(this.fileName,"");
try{
if(!this.file.exists()){
this.file.createNewFile();
}
this.fileOutputStream = new FileOutputStream(file,true);// 追加模式写文件
this.fileCha... | 2 |
@Override
public void update(Observable o, Object arg) {
switch (arg.toString()) {
case "parties":
this.popupParties.setLocationRelativeTo(null);
this.popupParties.setVisible(true);
this.afficherPopupParties(this._jeu.getProfilC... | 2 |
public static int[] getRegion(int x,int z){
int[] chunkCoords = getChuk(x, z);
return getChunkRegion(chunkCoords[0], chunkCoords[1]);
} | 0 |
public void move() {
PhysicsComponent ownPC = (PhysicsComponent)getOwningActor().getComponent("PhysicsComponent");
if(ownPC.getAngleRad() < ownPC.getTargetAngle() + 0.1 && ownPC.getAngleRad() > ownPC.getTargetAngle() - 0.1) {
ownPC.applyAcceleration(1.0f);
}
} | 2 |
public void analyze() {
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.println("Reachable: " + this);
ClassInfo[] ifaces = info.getInterfaces();
for (int i = 0; i < ifaces.length; i++)
analyzeSuperClasses(ifaces[i]);
analyzeSuperClasses(info.getSuperclass());
} | 2 |
public DocumentStatistics() {
super(true, true, true, INITIAL_WIDTH, INITIAL_HEIGHT, MINIMUM_WIDTH, MINIMUM_HEIGHT);
Outliner.statistics = this;
} | 0 |
public String toString() {
StringBuffer display = new StringBuffer();
display.append("---- " + name + " ----\n");
display.append(dough + "\n");
display.append(sauce + "\n");
for (int i = 0; i < toppings.size(); i++) {
display.append((String )toppings.get(i) + "\n");
}
return display.toString();
} | 1 |
private int handleZ(String value, DoubleMetaphoneResult result, int index,
boolean slavoGermanic) {
if (charAt(value, index + 1) == 'H') {
//-- Chinese pinyin e.g. "zhao" or Angelina "Zhang" --//
result.append('J');
index += 2;
} else {
... | 6 |
@Override
public VueVisiteur getVue() {
return (VueVisiteur) vue;
} | 0 |
public void checkPlayerCollision(Player player,
boolean canKill)
{
if (!player.isAlive()) {
return;
}
// check for player collision with other sprites
Sprite collisionSprite = getSpriteCollision(player);
if (collisionSprite instanceof PowerUp) {
... | 4 |
public static boolean nonNumeric( String k ){
for( int i = 0; i < k.length(); i++ ){
if( ( k.charAt(i) > '9' || k.charAt(i) < '0' ) && k.charAt(i) != ',' && k.charAt(i) != '+'
&& k.charAt(i) != '*' && k.charAt(i) != '/' && k.charAt(i) != '-' && k.charAt(i) != '%'){
return true;
}
}
return fal... | 9 |
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 |
private boolean containsElement(List<ElementInfo> elements, PlayerInfo element) {
for(ElementInfo e : elements)
if (e.equals(element))
return true;
return false;
} | 2 |
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int cases = 1;
while (true) {
int n = input.nextInt();
if (n < 3) return;
double A = input.nextDouble();
double angle = Math.PI * (n - 2) / (2 * n);
double s = Math.sqrt(4 * A / (n * Math.tan(angle)));
d... | 2 |
public Set<BankAccount> getReplacingAccounts(BiFunction<BigInteger,BigInteger,BankAccount> generator) {
Set<BankAccount> result = new HashSet<>();
for (BankAccount account: accounts)
result.add(generator.apply(account.getBalance().add(BigInteger.TEN),account.getCreditLimit()));
retur... | 1 |
public void actionPerformed(ActionEvent event)
{
Object source = event.getSource();
if (source == addButton)
{
String value = tfValue.getText();
if (value.length() == 0) return;
int typeIndex = typeCombo.getSelectedIndex();
if (typeIndex == -1) return;
int type = EXTHRecord.knownTypes[t... | 9 |
@Override
public void onEnable() {
instance = this;
FileConfiguration config = this.getConfig();
config.addDefault("PromptTitle", "Player Plus Accessories");
config.addDefault("TitleX", 190);
config.addDefault("Hot_Key", "KEY_U");
config.addDefault("GUITexture", "http://www.pixentral.com/pics/1duZT49LzMno... | 3 |
private void validateParameters() throws DriverJobParametersException {
if (!this.dgenInstallDir.isDirectory()) {
throw new DriverJobParametersException("Data generator install dir `" + this.dgenInstallDir
+ "` does not exist.");
}
if (!this.dgenNodePropertiesPath.isFile()) {
throw new DriverJobParamete... | 5 |
public int compare(Card other){
if(this == other){
return 0;
}
if(this.getCardNum() < other.getCardNum()){
return -1;
}
if(this.getCardNum() > other.getCardNum()){
return 1;
}
if(this.getCardNum() == other.getCardNum()){
return 0;
}
return 1;
} | 4 |
public LowLevelFeatureCommand(CommandParameter par) {
if(par == null)
throw new NullPointerException("LowLevelFeatureCommand has a null CommandParameter");
this.par= par;
} | 1 |
public void setValue(String name, String value) {
int i = indexOfName(name);
if (i == -1) {
if ((value != null) && (!value.equals(""))) {
add(name + ": " + value);
}
}
else {
if ((value != null) && (!value.equals(""))) {
set(i, name + ": " + value);
}
else {
delete(i);
}
}
} | 5 |
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.