text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void die() {
this.animation = death;
if(!dead){
if (isCat()){
SoundLibrary.playSound("catdead.wav");
} else {
SoundLibrary.playSound("dogdead.wav");
}
death.start();
}
dead = true;
} | 2 |
public List<String> process(String query) throws IncorrectQueryException {
StringReader reader = new StringReader(query);
String sqlQuery = "";
String next = nextTerm(reader);
int count = 0;
while (!next.isEmpty()) {
++count;
i... | 4 |
public HashMap<String, ArrayList> income(Double amount)
{
HashMap<String, ArrayList> result = null;
int raw_amount = new Double(amount * 100).intValue();
try
{
List<String> commands = new ArrayList<String>();
commands.add("/bin/bash");
commands.ad... | 8 |
public double calculateScore(ArrayList<seed> seedlist) {
double total = 0.0;
for (int i = 0; i < seedlist.size(); i++) {
double score = 0.0;
double chance = 0.0;
double totaldis = 0.0;
double difdis = 0.0;
for (int j = 0; j < seedlist.size(); j++) {
if (j != i) {
totaldis = totaldis + Math.p... | 9 |
private static int[] getColorOccurrences(Image image, ChannelType color) {
int[] dataset = new int[Image.MAX_VAL + 1];
for (int x = 0; x < image.getWidth(); x++) {
for (int y = 0; y < image.getHeight(); y++) {
dataset[(int) Math.floor(image.getPixel(x, y, color))]++;
}
}
return dataset;
} | 2 |
public void removeItem(Item item, int amount) {
if (amount <= 0 || item.getMaxStackSize() == 0) return;
int totalAmount = getItemAmount(item);
int amt = (amount <= totalAmount ? amount : totalAmount);
int stackIndex;
while (amt > 0) {
stackIndex = getItemStackIndexBa... | 6 |
protected boolean isPrimitiveValue(Object value)
{
return value instanceof String || value instanceof Boolean
|| value instanceof Character || value instanceof Byte
|| value instanceof Short || value instanceof Integer
|| value instanceof Long || value instanceof Float
|| value instanceof Double || v... | 9 |
private UncaughtExceptionDialog(Dialog.ModalityType modalityType, String s, UncaughtExceptionParameters params) {
setResizable(false);
setTitle(params.getTitle());
setIconImage(params.getDialogIconImage());
setModalityType(modalityType);
setDefaultCloseOperation(DISPOSE_ON_CLOSE)... | 8 |
@Override
public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException {
if (str == null)
return;
StringBuilder sb = new StringBuilder();
if (((getLength() + str.length()) <= limit)) {
if (test(str)){
super.insertString(offs, str, a);
... | 3 |
private void checkResources() {
int level = 0;
int needed = 0;
int[] levels;
int[] resourcesInLevels;
Resource resource = null;
ResourceType resourceType = null;
for (int i = 0; i < resourceTypes.size(); i++) {
resourceType = resourceTypes.get(i);
... | 8 |
public TreeNode searchFirstCommonAncestor(TreeNode a, TreeNode b) {
ArrayList<TreeNode> pathA = searchReturnPath(tree.root, a,
new ArrayList<TreeNode>());
ArrayList<TreeNode> pathB = searchReturnPath(tree.root, b,
new ArrayList<TreeNode>());
TreeNode tmp=tree.root;
int i=0;
while(true){
if(i>=pathA... | 4 |
@Override
public void clearCache()
{
if (!clearLocalCacheOnly)
{
for (Painter<T> p : painters)
{
if (p instanceof AbstractPainter)
{
AbstractPainter<?> ap = (AbstractPainter<?>) p;
ap.clearCache();
}
}
}
super.clearCache();
} | 5 |
public boolean getBoolean(int index) throws JSONException {
Object o = get(index);
if (o.equals(Boolean.FALSE) ||
(o instanceof String &&
((String)o).equalsIgnoreCase("false"))) {
return false;
} else if (o.equals(Boolean.TRUE) ||
(o in... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Bigram other = (Bigram) obj;
if (word1 == null) {
if (other.word1 != null)
return false;
} else if (!word1.equals(other.word1))
retur... | 9 |
public static boolean isEffectivelyResting(Matter matter) {
return matter.getVerticalVelocity() < 0.1 && matter.getHeight() < 0.1;
} | 1 |
private int jjMoveStringLiteralDfa13_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 12);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 12);
}
switch(curChar)
{
case 45:
return jjMoveStringLiter... | 3 |
public void updateEdgeFlow(String src, String dest, int newFlow) {
boolean found = false;
Vertex v = vertexMap.get(src);
for (Edge e : v.adj) {
if (e.dest.name.equals(dest)) {
e.flow += newFlow;
found = true;
break;
}
... | 5 |
private void markExploredCell(String descriptor) throws ArenaMapException {
String binStr = null;
try{
binStr = hexToBinaryStr(descriptor);
}catch(NumberFormatException e){
throw new ArenaMapException(2, "The descriptor contains some non-hex digit");
}
if(binStr.length() != this.rowCount * this.colu... | 9 |
private void createGUIComponents(int players) {
table = new Table();
hand = new CardViewer(new InSearcherMouseAdapter(Zone.HAND));
playersInfo = new PlayerInfo[players];
for (int i = 0; i < playersInfo.length; i++) {
playersInfo[i] = new PlayerInfo(i, "...waiting...");
... | 6 |
private static boolean check(final double value) {
if (Double.isNaN(value)) {
if (Debug.DEBUG) {
System.out.println("NaN occurs.");
}
return false;
}
if (Double.isInfinite(value)) {
if (Debug.DEBUG) {
System.out.prin... | 4 |
public void filter(byte[] samples, int offset, int length) {
if (source == null || listener == null) {
// nothing to filter - return
return;
}
// calculate the listener's distance from the sound source
float dx = (source.getX() - listener.getX());
float ... | 5 |
public static void main(String[] args) throws Exception {
/** main method does the following:
* setup logging
* read and process commandline args
* fire CreateNewHrisPersonList()
* generates list of HRIS uri's
* fire IterateThroughHrisPersonList()
* iterates through list and fires proces... | 7 |
public String recorreIteractivo(){
String resultado = "";
if(this.inicio == null){
return "Lista vacia";
}else{
Nodo<T> nodoQ = this.inicio;
while(nodoQ != null){
resultado = resultado + nodoQ.getInfo().toString() + "->";
nodoQ = nodoQ.getLiga();
}
}
return resultado + "null";
} | 2 |
public void update(int x, int y, int button){
if(collides(x, y)){
setHover(true);
if(button != -1) setPressTime(5);
}else setHover(false);
color = 0xff505050;
if(hover) color = 0xff303030;
if(pressTime > 0){
color = 0xff505050;
pressTime--;
}
} | 4 |
private void initializeFrame() {
if (fullscreen) {
GraphicsEnvironment env=GraphicsEnvironment.getLocalGraphicsEnvironment();
device=env.getDefaultScreenDevice();
GraphicsConfiguration gc=device.getDefaultConfiguration();
frame=new Frame(gc);
frame.setUndecorated(true)... | 2 |
private void mostrar() {
String diaSemana = "";
switch (Obj.principal.mes[Obj.principal.mesActual].dia[Obj.principal.diaActual].getDiaSemana()) {
case 1:
diaSemana = "Lunes";
break;
case 2:
diaSemana = "Martes";
brea... | 7 |
public void run() throws InstantiationException, IllegalAccessException, SQLException {
try {
//Initalize connection to db
Class.forName(con.getDriver()).newInstance();
Connection conn = DriverManager.getConnection(con.getUrl() + con.getDbName(), con.getUser... | 5 |
protected ScorpionRed scorpionMove(short[][][] maze, Human man) {//Horizontal then vertical
// This method was written using a different logic than the current one
ScorpionRed tam = new ScorpionRed(this.getX(), this.getY());
if (tam.samePlace(man)) {
return tam;
} el... | 9 |
public final String getString() {
StringBuilder ret = new StringBuilder();
int c;
while ((c = getUByte()) != 0) {
if (c >= 128 && c < 160) {
char n = charSubs[c - 128];
if (n == 0) {
n = '?';
}
c = n;
}
ret.append((char) c);
}
return ret.toString();
} | 4 |
@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
g.setAntiAlias(false);
backgroundManager.draw();
tileManager.draw(camera);
playerShadows.draw( camera, ws.p1.getPosition(), ws.p1.getPlayerState() );
playerShadows.draw( camera, ws.p2... | 3 |
public static void main(String[] args) throws IOException {
File f;
ObjectOutputStream out;
char [][] seats = new char[26][40];
for(int i =0 ; i < 26; i++)
for(int j = 0; j < 40; j++)
seats[i][j] = 'L';
for(int i = 1; i <= 1500; i++){
f = new File(i+".txt");
if(!f.exists())
f.createNewF... | 4 |
public void reiniciar(){
formattedTextField.setText("");
textField.setText("");
comboBox_2.setSelectedItem("<Selecciona>");
textField_1.setText("");
textField_7.setText("");
textField_8.setText("");
textField_2.setText("");
textField_3.setText("");
formattedTextField_1.setText("");
textField_4.setTe... | 0 |
public void run() {
byte[] buffer = new byte[1536];
DatagramPacket packet = new DatagramPacket(buffer, 1536);
while (isListening) {
try {
packet.setLength(1536);
socket.receive(packet);
OSCPacket oscPacket = converter.convert(buffer, packet.getLength());
dispatcher.dispatchPacket(oscPacket);
... | 5 |
private int evaluateWave(int amplitude, int phase, int table) {
if (table == 1)
if ((phase & 0x7fff) < 16384)
return amplitude;
else
return -amplitude;
if (table == 2)
return sine[phase & 0x7fff] * amplitude >> 14;
if (table == 3)
return ((phase & 0x7fff) * amplitude >> 14) - amplitude;
if (... | 5 |
public static double[] read(File file) {
double[] solution = new double[FileHelper.countFiles(file) - 2];
BufferedReader bufferedReader = null;
try {
bufferedReader = new BufferedReader(new FileReader(file));
String str;
int ctr = 0, separtorCount = 0;
while ((str = bufferedReader.readLine()) ... | 8 |
@Override
public void subSample(int[] input, int[] output)
{
SliceIntArray src = new SliceIntArray(input, 0);
SliceIntArray dst = new SliceIntArray(output, 0);
this.dwt.forward(src, dst);
int offs = 0;
final int sh = this.shift;
final int h = this.height;
final int w = t... | 8 |
private void findDeviceParser(String type) throws ParseException {
if (type != null) {
logger.info(String.format(
Messages.getString("device_found"), type)); //$NON-NLS-1$
currentParser = parserFactory.getParser(type);
if (currentParser != null) {
logger.info(String.format(Messages.getString("pa... | 2 |
public boolean interrogateNewAgent_NETCAT_OLDER(BufferedReader brSocket)
{
try
{
String strThirdLine = brSocket.readLine();
if ((strThirdLine != null) && (strThirdLine.trim().equals("")))
{
Driver.sop("-->>> Almost there... Confidence level is 75% ...");
sendCommand_RAW_ToA... | 8 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Artikel)) {
return false;
}
Artikel other = (Artikel) object;
if ((this.id == null && other.id != null) || (thi... | 5 |
public void weightedLinkLayer(final int l1, final int l2) {
//
final Layer layer1 = this.layers.get(l1);
final Layer layer2 = this.layers.get(l2);
//
for (int i = layer1.arrayslbd; i <= layer1.arraysubd; i++) {
final CellArray a1 = this.arrays.get(i);
if (... | 4 |
public void solve() {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
BigInteger[] dp = new BigInteger[31];
for (int i = 0; i < dp.length; i++) {
dp[i] = BigInteger.ZERO;
}
dp[0] = BigInteger.ONE;
for (int i = 1; i < dp.length; i++) {
for (int j = 0; j < i; j++) {
... | 3 |
public Edge remove(Node from, Node to) {
//remove the edge from the EdgeCollection
edgeIterator.reset();
while(edgeIterator.hasNext()){
Edge edge = edgeIterator.next();
if((from.ID == edge.startNode.ID)&&(to.ID == edge.endNode.ID)){
edgeIterator.remove();
edge.removeEdgeFromGraph(); // does not free... | 3 |
@Override
public MatchResult checkKoota(Nakshatra boyStar, Nakshatra girlStar) {
MatchResult matchResult = MatchResult.ADHAMA;
if (vedhaiDetailsCache.get(boyStar) != null && !vedhaiDetailsCache.get(boyStar).equals(girlStar)) {
matchResult = MatchResult.UTTAMA;
}
if (vedhaiDetailsCache.get(boyStar) == null)... | 9 |
private void write_To_file() {
try {
WriteHand = new BufferedWriter(new FileWriter("table.txt"));
myDataList mytable = (myDataList) arrList.get(0);
for (int i = 0; i < mytable.size(); i++) {
WriteHand.write(((data) mytable.get(i)).getChar());
... | 2 |
private void performLayout(Automaton automaton, Set locStates) {
// Apply the graph layout algorithm to those states that
// appeared without the <x> and <y> tags.
if (locStates.size() == automaton.getStates().length)
return;
AutomatonGraph graph = new AutomatonGraph(automaton);
LayoutAlgorithm layout = ne... | 3 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
PopupMenuRetorna = new javax.swing.JPopupM... | 8 |
private void doLynch(int guilty) {
if (guilty == -1) {
return;
}
String guiltyStr = players2.get(guilty);
players2.kill(guilty);
if (!isInChannel(guiltyStr)) {
bot.sendMessage(gameChan, getFromFile("LYNCH-LEFT", CONTROL));
return;
}
String role;
if (players2.isSeer(guilty)) {
bot.sendMess... | 6 |
@Override
public void method1() {
System.out.println("ClassA method1()");
} | 0 |
public Inner inner() {
return new Inner();
} | 0 |
@EventHandler
public void CreeperNausea(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getCreeperConfig().getDouble("Creeper.Nause... | 6 |
public void initialiseWordsList() {
try{
final BufferedReader reader = new BufferedReader(new FileReader("MegaDictionary.txt"));
String current = reader.readLine();
while(current != null) {
Game.words.add(current.toLowerCase());
current = reader.readLine();
}
reader.close();
}
catch(fi... | 3 |
private FTPClient getFtpConnection (URL url) throws IOException {
logger.entering(getClass().getName(), "getFtpConnection", url);
String protocol = url.getProtocol();
String host = url.getHost();
String userInfo = url.getUserInfo();
String path = url.getPath();
String[]... | 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 |
@EventHandler
public void SlimeHarm(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSlimeConfig().getDouble("Slime.Harm.DodgeCha... | 6 |
public LineSegmentInt inflateYAlpha(InflateData inflateData) {
final int ypos = inflateData.getPos();
final int inflation = inflateData.getInflation();
if (isVertical()) {
return new LineSegmentInt(p1.inflateY(inflateData), p2.inflateY(inflateData));
}
if (getP1().getYint() == ypos && getP2().getYint() == ... | 7 |
public Item SwapBodyArmor(Item willBeSwappedItem) {
return bodyArmorSlot.swap(willBeSwappedItem);
//return false; // swap failed
} | 0 |
@Override
public double estimateMiceNumber(int nbOcc){
double comp = 0;
for(int i = b; i <= 32 ; i++)
for(Occurrence occ : strTab.get(i))
if(occ.nbOcc == nbOcc)
comp++;
return comp * Math.pow(2, b);
} | 3 |
public void draw(Graphics g) {
if(gender.equalsIgnoreCase("m")) {
g.setColor(Color.blue);
}else if(gender.equalsIgnoreCase("f")) {
g.setColor(Color.red);
}else if(gender.equalsIgnoreCase("b")) {
isBaby = true;
}
... | 3 |
public void startGame() {
tc.startGame();
Thread t = new Thread(new Runnable(){
@Override
public void run() {
while(tc.gameOn){
tick(TetrisController.DOWN);
}
count ++;
sum += tc.rowsCleared;
max = max == 0 || tc.rowsCleared > max ? tc.rowsCleared : max;
min = min == 0 || ... | 5 |
public Port()
{
super("Hello, World!");
mxGraph graph = new mxGraph() {
// Ports are not used as terminals for edges, they are
// only used to compute the graphical connection point
public boolean isPort(Object cell)
{
mxGeometry geo = getCellGeometry(cell);
return (geo != null) ? geo... | 2 |
public void updateTheGraph(Document doc) throws Exception{
ArrayList<Sentence> sentencesList = doc.getSentences();
String clusterID = doc.getId();
for (int sentenceIndex = 0; sentenceIndex < sentencesList.size(); sentenceIndex++) {
Sentence currentSentence = sentencesList.get(sentenceIndex);
ArrayList<... | 6 |
private void main() throws IOException {
while (true) {
byte[] data = new byte[Constants.MAX_UDP_BYTE_READ_SIZE];
DatagramPacket packet = new DatagramPacket(data, data.length);
localSocket.receive(packet);
MessageHeader header = new MessageHeader(packet);
Message message = messageFactory.buildMessageF... | 9 |
public Server() {
outputArray = new ByteArrayOutputStream();
try {
outputStream = new ObjectOutputStream(new BufferedOutputStream(outputArray));
} catch (IOException e) {
e.printStackTrace();
}
running = true;
clientList = new HashMap<InetSocketAd... | 7 |
public static ProbabilityOfOccurrenceEnum fromString(String v) {
if (v != null) {
for (ProbabilityOfOccurrenceEnum c : ProbabilityOfOccurrenceEnum.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} | 3 |
@Override
public boolean next() throws java.sql.SQLException
{
while (true)
{
if (!iter.hasNext())
return false;
final Backend.RecordInfo rowInfo = iter.next();
if (countValue != null)
{
currentRow++;
return true;
}
if (conditions.size() > 0)
{
final boolean[] dataLoaded = new... | 7 |
public static Vector Double(Vector Vec, boolean X, boolean Y, boolean Z) {
if (X) {Vec.setX(Vec.getX()*2);}
if (Y) {Vec.setY(Vec.getY()*2);}
if (Z) {Vec.setZ(Vec.getZ()*2);}
return Vec;
} | 3 |
public ArrayList<String[]> regresaCatalogoConId(String catalogo) {
String res = "";
ArrayList<String[]> resultado = new ArrayList<>();
String[] nombre = new String[2];
try {
Class.forName(driver);
Connection con = DriverManager.getConnection(connectString, user, p... | 2 |
public static void main(String[] args) {
User u;
if (args.length > 0) {
u = new User(args[0]);
}
else {
u = new User("localhost");
}
Console con = System.console();
String user_name = con.readLine("Insert your username for this session: ")... | 9 |
private boolean checkReturn(Node node, String scope){
if (node.getClass() == Block.class) {
LinkedList<Node> bl = ((Block)node).getContent();
for (Node n : bl) {
if(checkReturn(n, scope))
return true;
}
return false;
} else if (node.getClass() == ReturnStatement.class) {
return true;
} el... | 8 |
@SuppressWarnings("unchecked")
static <V> DenseImmutableGrid<V> create(Grid<? extends V> grid) {
if (grid instanceof DenseGrid) {
return new DenseImmutableGrid<V>((DenseGrid<V>) grid);
}
int rowCount = grid.rowCount();
int columnCount = grid.columnCount();
validat... | 4 |
public boolean setWindowHeight(int height) {
boolean ret = true;
if (height < UISizeInits.WINDOW.getHeight()) {
this.window_Height = UISizeInits.WINDOW.getHeight();
ret = false;
} else {
this.window_Height = height;
}
somethingChanged();
... | 1 |
public boolean hitWall(Wall w){
if(this.isLive && this.getRect().intersects(w.getRect())){
this.isLive = false;
return true;
}
else
return false;
} | 2 |
@Override
public boolean equals(Object other)
{
if(other == null || !((other instanceof Version) || (other instanceof Double)))
{
return false;
}
Double d = toDouble();
if(other instanceof Version)
{
return d.equals(((Version)other).toDouble());
}
else
{
return d.equals((Double)other);
}
... | 4 |
private void func_22183_a(File var1, ArrayList var2, ArrayList var3) {
ChunkFolderPattern var4 = new ChunkFolderPattern();
ChunkFilePattern var5 = new ChunkFilePattern();
File[] var6 = var1.listFiles(var4);
File[] var7 = var6;
int var8 = var6.length;
for(int var9 = 0; var9 < var8; +... | 3 |
protected void removerLinhaVenda(LinhaVenda lv) throws ExceptionGerenteVendas{
if(!linhas.contains(lv)){
throw new ExceptionGerenteVendas("Linha de Venda n�o existe para esta venda");
}else{
linhas.remove(lv);
lv.setVenda(null);
total-= lv.getTotaldaLinha();
desconto-= lv.g... | 1 |
public void inint(int n) {
d = new int[n][n];
for (int i = 0; i < n; i++)
for (int k = 0; k < n; k++)
if (i != k)
d[i][k] = INF;
} | 3 |
public static BooleanQuery randBoolQuery(Random rnd, boolean allowMust, int level, String field, String[] vals, Callback cb) {
BooleanQuery current = new BooleanQuery(rnd.nextInt()<0);
for (int i=0; i<rnd.nextInt(vals.length)+1; i++) {
int qType=0; // term query
if (level>0) {
qType = rnd.ne... | 8 |
public static void addPointsToLevel(Player p, double i){
if(warnLevel.get(p) == null){
addPlayer(p);
}
double oldValue = warnLevel.get(p);
warnLevel.remove(p);
warnLevel.put(p, oldValue + i);
} | 1 |
@Override
public void addNotify() {
super.addNotify();
if (thread == null) {
thread = new Thread(this);
addKeyListener(this);
thread.start();
}
} | 1 |
public void Iniciar() {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
... | 8 |
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (!ChatColor.stripColor(event.getInventory().getName()).equalsIgnoreCase("Shooting Star Commands")) {
return;
}
Player player = (Player) event.getWhoClicked();
event.setCancelled(true);
if((event.getCurrentItem() == null) || (eve... | 8 |
public String[] getTopFourMoves(int l) {
ArrayList<Integer> sort = new ArrayList<Integer>(list.keySet());
Collections.sort(sort, new Comparator<Integer>(){
public int compare(Integer o1, Integer o2) {
if (o1 > o2) {
return -1;
}
if (o1 < o2) {
... | 4 |
@Override
public List<Row> compose(List<Glyph> glyphs, ViewEventArgs args) {
List<Row> rows = new ArrayList<Row>();
if (glyphs == null || glyphs.size() == 0){
return rows;
}
Row currentRow = new Row();
int currentTop = args.getTop();
currentRow.setStartIndex(0);
currentRow.setLeft(args.getLeft(... | 5 |
boolean can_include_char_in_digest(byte ch) {
if (!(ch >= 'a' && ch <= 'z') && !(ch >= 'A' && ch <= 'Z')
&& !(ch >= '0' && ch <= '9') && ch != '\n' && ch != ' ')
return false;
return true;
} | 8 |
public boolean cargarDesdeCSV(String path) throws IOException {
File archivo = new File(path);
if (archivo.exists() && !archivo.isDirectory() && path.endsWith(".csv")) {
try {
BufferedReader br = new BufferedReader(new FileReader(archivo));
String cad = br.rea... | 5 |
void createColorAndFontGroup () {
/* Create the group. */
colorGroup = new Group(controlGroup, SWT.NONE);
colorGroup.setLayout (new GridLayout (2, true));
colorGroup.setLayoutData (new GridData (SWT.FILL, SWT.FILL, false, false));
colorGroup.setText (ControlExample.getResourceString ("Colors"));
colorAndFon... | 7 |
public TrainNumber getTrainNumber() {
return this._trainNumber;
} | 0 |
public void drawSelect(){
parent.background(0); // Refresh Background
display(); // Refresh display
parent.stroke(255); // Outline (255) or white
parent.noFill(); // Nothing drawn inside shape
parent.rect(listImages.get(listPosition).getX() - 3,
listImages.get(listPosition).getY() - 3,
lis... | 1 |
public void setId(String value) {
this.id = value;
} | 0 |
@Override
public void mouseMoved(MouseEvent e)
{
mX = e.getX();
mY = e.getY();
cX = (int) Math.floor((mX - Game.MAPOFFX) / (double) Game.TILESIZE) + Game.xOff;
cY = (int) Math.floor((mY - Game.MAPOFFY) / (double) Game.TILESIZE) + Game.yOff;
Game.gui.update(mX, mY, false,... | 0 |
public ArrayList<Stone> parsingSAX(){
try {
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
SAXParser parser = saxParserFactory.newSAXParser();
SAXHandler handler = new SAXHandler();
parser.parse(new File("src/resources/stone.xml"), handler);
... | 4 |
@Override
public boolean equals(Object obj)
{ if(obj instanceof Matrix)
{ Matrix that=(Matrix)obj;
if(this.matrix.length!=that.matrix.length || this.matrix[0].length!=that.matrix[0].length)
{ return false;
}
else
{ for(int i=0;i<this.matrix.length;i++)
{ for(int j=0;j<... | 6 |
@Override
public void init(List<String> argumentList) {
functionName = argumentList.get(0);
if (functionName.indexOf("<") != -1) {
functionName = functionName.substring(0, functionName.indexOf("<"));
}
startLineNumber = Integer.parseInt(argumentList.get(1));
endLi... | 1 |
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
if (ActionText == "Exiting...") {
// If the exit command is used, InvalidCommandText becomes equal to Exiting...
// When this happens, call the game container's exit function
gc.exit();
} else if (ActionText == "You... | 9 |
public void setAlgorithm(String value) {
this.algorithm = value;
} | 0 |
public void findRegistrations(Participant p){ //inserts workshops into the participants schedule
ArrayList<String>registrations = ReadFromFile.getRegistrationList();
for(int i = 0; i < registrations.size();i++){ //goes through WKSHP_REGISTRATIONS and finds participants registered to workshops
String line = regis... | 5 |
@MCCommand(cmds = { "setOptions" }, op = true, usage = PORT_SET_OPTIONS)
public boolean portSetOptions(CommandSender sender, Port port, String[] args)
{
List<String> portOptions = new ArrayList<String>();
for (int i = 2; i < args.length; i++)
{
String op = args[i];
if (!Port.checkOption(op))
{
send... | 6 |
private boolean overlapsWithObject(RenderObject other) {
return (x < other.x + other.getWidth() &&
x + getWidth() > other.x &&
y < other.y + other.getHeight() &&
y + getHeight() > other.y);
} | 3 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
String productionType = request.getParameter("i... | 7 |
public void onTick() {
for (int i = 0; i < enemyList.size(); i++) {
if (enemyList.get(i).onTick()) {
lives -= Constants.enemyDamage[enemyList.get(i).enemyID];
enemyList.remove(i);
i--;
}
}
for (Tower towerI : towers) {
towerI.onTick();
}
for (int i = 0; i < projectileList.s... | 7 |
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.