text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Comment comment = (Comment) o;
if (text != null ? !text.equals(comment.text) : comment.text != null) {
... | 8 |
public static String solve(String str) throws UnsupportedEncodingException{
StringBuffer sb = new StringBuffer();
StringBuffer sb2 = new StringBuffer();
System.out.println(str.length());
byte[] bytes = str.getBytes("UTF-8");
int blen = bytes.length;
int slen = str.length();
printbyte(bytes);
System.ou... | 9 |
private static final boolean isNonTerminal(int x)
{
return x >= FIRST_NON_TERMINAL && x < FIRST_SEMANTIC_ACTION;
} | 1 |
public MenuManager(ProBotGame game) {
this.upgradeMenu = new UpgradeMenu(game);
this.mainMenu = new MainMenu(game);
this.pauseMenu = new PauseMenu(game);
} | 0 |
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 |
protected final void doGet(final HttpServletRequest request,
final HttpServletResponse response) throws ServletException,
IOException {
final HttpSession session = request.getSession(true);
final User loggedUser = UserManagement.getCurrentlyLoggedInUser(session);
if (loggedUser == null) {
// Not logged... | 4 |
@Override
public void render()
{
if(currentAchievement != null)
{
Textures.bind("/assets/textures/ui/compsTemplate.png");
Tessellator t = Tessellator.instance;
int type = 0;
float w = 300;
float h = 80;
x = Bloc... | 7 |
public boolean verificaCaminhos(Posicao posicaoInicial, Posicao posicaoFinal) {
Peca peca = getCasas(posicaoInicial.getColuna(),
posicaoInicial.getLinha());
switch (peca.toString()) {
// verificacao do peao
case "P":
return verificaCaminhoPeao(po... | 5 |
public static void main(String[] args) {
try {
List<Parking> parkings = new ParkingGenerator().generateParkingList(50, 10);
ParkingList.getInstence().addParking(parkings);
List<Car> cars = new CarGenerator().generateCars(3000);
CarExecuter executer = new CarExecuter();
executer.execute(cars);
} catch... | 2 |
public Element getParameterElement(String xml,String attribute, String value)
{
if(xml==null){System.out.println("ERROR:SSAP_XMLTools:getParameterElement: XML message is null");return null;}
Document doc=null;
try {
doc = builder.build(new ByteArrayInputStream(xml.getBytes()));
} catch (Exception e) {
/... | 6 |
@Override
public void parseWearLocation(short[] layerAtt, short[] layers, long[] wornLoc, boolean[] logicalAnd, double[] hardBonus, String wearLocation)
{
if(layers != null)
{
layerAtt[0] = 0;
layers[0] = 0;
wearLocation=parseLayers(layerAtt,layers,wearLocation);
}
final double hardnessMultiplier = ... | 8 |
public void setGoldOnPotionPurchase(int amount, int type){
if(type == 1){
int healthPotionCost = 10;
int playerGold = this.getGold();
if(healthPotionCost * amount > this.getGold()){
System.out.println("You dont have enough!");
}
else{
this.setGold(playerGold -= healthPotionCost * amount);
}
... | 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 boolean execute()
{
long time = peersim.core.CommonState.getTime();
if ((time % epoch) == 0) {
initvar = -1.0;
}
/* Initialization */
final int len = Network.size();
IncrementalStats stats = new IncrementalStats();
/* Compute max, min, average */
for (int i=0; i < len; i++) {
Node node = Network.g... | 9 |
public int getDlc() {
return dlc;
} | 0 |
public String[] insertionSort(String[] arreglo, String[] targets){
int aux, j;
String aux2;
int[] positions = new int[arreglo.length];
ArrayList<String> fill = new ArrayList<String>(1);
// array of indexs
for (int i=0; i<positions.length; i++)
for (int k=0; k<targets.length; k++)
if(arreglo[i].equa... | 9 |
public boolean equals(Object _other)
{
if (_other == null) {
return false;
}
if (_other == this) {
return true;
}
if (!(_other instanceof GroupMembersPk)) {
return false;
}
final GroupMembersPk _cast = (GroupMembersPk) _other;
if (groupId != _cast.groupId) {
return false;
}
... | 7 |
public void run()
{
this.Sender_enabled = true;
int l_tmp_error_count = 0;
while( this.Sender_enabled )
{
try {
Send();
Thread.sleep( this.Sender_time_wait );
l_tmp_error_count = 0;
}
catch (SocketException e)
{
if(this.Sender_enabled)
{
l_tmp_error_count++;
Logger.... | 8 |
public static int findNumDays(String fileName)
{
int lineNumber = 0;
String line;
try {
BufferedReader br = new BufferedReader( new FileReader(fileName));
while( (line = br.readLine()) != null)
{
lineNumber++; ... | 3 |
public void testGetFieldType() {
TimeOfDay test = new TimeOfDay(COPTIC_PARIS);
assertSame(DateTimeFieldType.hourOfDay(), test.getFieldType(0));
assertSame(DateTimeFieldType.minuteOfHour(), test.getFieldType(1));
assertSame(DateTimeFieldType.secondOfMinute(), test.getFieldType(2));
... | 2 |
public void doStep() {
boolean v1 = volts[0] > 2.5;
boolean v2 = volts[1] > 2.5;
if (v1 && !pins[0].value) {
ff1 = true;
}
if (v2 && !pins[1].value) {
ff2 = true;
}
if (ff1 && ff2) {
ff1 = ff2 = false;
}
double o... | 9 |
@Override
public void onEnable() {
updateConfigFile();
getBadWords();
migrateToUUID();
loadConfiguration();
loadIgnoredPlayers();
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(playerChatListener, this);
pm.registerEvents(playerJoinListener, this);
getCommand("badw").setExecutor... | 3 |
@EventHandler
public void onSkeletonSpawnEvent(CreatureSpawnEvent e){
r = new Random();
Entity entity = e.getEntity();
if("SKELETON".equals(entity.getType().toString())){
Skeleton barbarianSkeleton = (Skeleton) e.getEntity();
Skeleton goldenSkeleton = (Skeleton) e.get... | 4 |
public static long checksum(final byte[] data) {
long sum = 0;
for (int i = 0; i < data.length; i++) {
final int lookupidx = ((int) sum ^ data[i]) & 0xff;
sum = (sum >>> 8) ^ LOOKUPTABLE[lookupidx];
}
return sum;
} | 1 |
private static ArrayList<Configuration> sautRecursif(Configuration conf, byte[] triplet, byte typeSauteFirst, boolean noirEnPlayer){
ArrayList<Configuration> listeConf = new ArrayList<Configuration>();
byte caseDebut = triplet[0];
byte typeSaute = triplet[1];
byte caseFin = triplet[2];
byte newTurttle... | 7 |
public static void startpriv(InetAddress inetaddress) {
threadliveid = (int) (Math.random() * 99999999D);
if (active) {
try {
Thread.sleep(500L);
} catch (Exception _ex) {
}
active = false;
}
socketreq = 0;
threadreq = null;
dnsreq = null;
savereq = null;
urlreq = null;
socketip = inet... | 4 |
public void setLoadingStatusAnimation(Animation animation) {
if (animation == null) {
this.loadingAnimation = UIAnimationInits.LOADINGSTATUS.getAnimation();
} else {
this.loadingAnimation = animation;
}
somethingChanged();
} | 1 |
static void dedupWithDownsample() throws IOException{
dup=0;
int memoryPolicy = 5;
resultRecord.println("Total " + storageLoad() + " entries added into the index");
File[] incomingFile = null;
incomingFile = new File(outputpath).listFiles();
int cacheSizeControl = 0;
// int sampleNum = (int) ((Math.log(2)... | 5 |
@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 AgendaPK)) {
return false;
}
AgendaPK other = (AgendaPK) object;
if ((this.dataHora == null && other.dataHora !... | 8 |
public boolean matches(Operator loadop) {
return (loadop instanceof InvokeOperator || loadop instanceof GetFieldOperator);
} | 1 |
@Override
public List<T> doInCollection(DBCollection collection) {
DBCursor cursor = collection.find(queryDbObject);
if (skip != -1) {
cursor.skip(skip);
}
if (limit != -1) {
cursor.limit(limit);
}
if (sort != null) {
cursor.sort(sort);
}
cursor.batchSize(batchSize);
return mapperDBObjec... | 3 |
private void nearest_knn(KDNode node, double[] targetPoint) {
tryToSave(node, targetPoint);
int dMinus1 = node.d-1;
if(dMinus1 < 0){
dMinus1 = dimensionCount - 1;
}
double perpendicularDistance = Math.abs(node.values[node.d] - targetPoint[dMinus1]);
if (perpendicularDistance < resultKNN.maximum().... | 7 |
public Vector toVector() {
Vector vec = new Vector(last.getIndex() + 1);
LinkedElement<E> elem = first;
for (int i = 0; i <= last.getIndex(); i++) {
vec.addElement(elem);
elem = elem.getNext();
}
return vec;
} | 1 |
public void depthFirstTraversal()
{
boolean[] visited;
visited = new boolean[gSize];
for (int index = 0; index < gSize; index++)
visited[index] = false;
for (int index = 0; index < gSize; index++)
if (!visited[index])
dft... | 3 |
private final boolean cons(int i)
{ switch (b[i])
{ case 'a': case 'e': case 'i': case 'o': case 'u': return false;
case 'y': return (i==0) ? true : !cons(i-1);
default: return true;
}
} | 7 |
public float[] getEquation(float p[][], int c[]) {
float sum = 0;
float avg;
float[] esum = new float[c.length];
float temp = 0;
for (int i = 0; i < c.length; i++) {
if (c[i] < 2)
esum[i] = 0;
else {
for (int j = 0; j < p[i].length; j++)
sum = sum + p[i][j];
avg = sum / c[i];
for (... | 4 |
public static TruthValue weakenTruthValue(TruthValue tv1, TruthValue tv2) {
if ((tv2 == Logic.UNKNOWN_TRUTH_VALUE) ||
(tv2 == null)) {
return (Logic.UNKNOWN_TRUTH_VALUE);
}
else if ((tv2 == Logic.DEFAULT_TRUE_TRUTH_VALUE) ||
(tv2 == Logic.DEFAULT_FALSE_TRUTH_VALUE)) {
if ((tv1 ==... | 8 |
private int readHexDigit() throws PDFParseException {
// read until we hit a non-whitespace character or the
// end of the stream
while (buf.remaining() > 0) {
int c = (int) buf.get();
// see if we found a useful character
if (!PDFFile.isWhiteSpac... | 9 |
public void stop() {
try {
safeClose(myServerSocket);
closeAllConnections();
if (myThread != null) {
myThread.join();
}
} catch (Exception e) {
e.printStackTrace();
}
} | 2 |
public static boolean batch( WebSocketImpl ws, ByteChannel sockchannel ) throws IOException {
ByteBuffer buffer = ws.outQueue.peek();
WrappedByteChannel c = null;
if( buffer == null ) {
if( sockchannel instanceof WrappedByteChannel ) {
c = (WrappedByteChannel) sockchannel;
if( c.isNeedWrite() ) {
... | 9 |
private static void cleanUp() {
try {
if (hostServer != null) {
hostServer.close();
hostServer = null;
}
} catch (IOException e) {
hostServer = null;
}
try {
if (socket != null) {
socket.close();
socket = null;
}
} catch (IOException e) {
socket = null;
}
try {
if (i... | 7 |
void parseEnumeration() throws java.lang.Exception
{
char c;
dataBufferAppend('(');
// Read the first token.
skipWhitespace();
dataBufferAppend(readNmtoken(true));
// Read the remaining tokens.
skipWhitespace();
while (!tryRead(')')) {
re... | 1 |
private void createConnection(Node peer, DatagramSocket datagramSocket) {
NodeList childNodes = peer.getChildNodes();
String ipAddress = null;
String port = null;
for (int i = 0; i < childNodes.getLength(); ++i) {
Node node = childNodes.item(i);
String nodeName = ... | 8 |
public void eliminarAntesDeX(T x){
Nodo<T> nodoQ = null;
Nodo<T> nodoT = null;
Nodo<T> nodoR = null;
boolean bandera = true;
if(this.inicio == null){
}else{
if(this.inicio.getInfo() == x){
System.out.println("No existe elementos antes de X");
}else{
nodoQ = this.inicio;
nodoT = this.in... | 7 |
private ActionListener makeSaveButtonListener() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
programSettings.rootPathToTextDatabase = PATH_SOURCE.getText();
programSettings.rootPathToDownloads = PATH_DOWNLOADS.getText();
programSettings.autoLoadDataba... | 1 |
public int toLineNumber(int pc) {
int n = tableLength();
int i = 0;
for (; i < n; ++i)
if (pc < startPc(i))
if (i == 0)
return lineNumber(0);
else
break;
return lineNumber(i - 1);
} | 3 |
public void removeBlockTileEntity(int var1, int var2, int var3) {
TileEntity var4 = this.getBlockTileEntity(var1, var2, var3);
if (var4 != null && this.scanningTileEntities) {
var4.invalidate();
} else {
if (var4 != null) {
this.loadedTileEntityList.remove... | 4 |
public Bag() {
first = null;
N = 0;
} | 0 |
public static void maintainDirection(Entity snake){
switch(Movement.returnMovementDirection()){
case 0:
snake.getPosition().updateYPosition(1);
break;
case 1:
snake.getPosition().updateYPosition(-1);
break;
case ... | 4 |
protected static Ptg calcMMult( Ptg[] operands )
{
if( operands.length != 2 )
{
return PtgCalculator.getNAError();
}
try
{
// error trap params: must be numeric arrays with no empty spaces
double[][] a1 = PtgCalculator.getArray( operands[0] );
double[][] a2 = PtgCalculator.getArray( operands[1]... | 4 |
public static Field findNearestFreeField(Level level, Field from, List<Field> bannedFields, HashMap<Field, ArrayList<Object>> conflictingHashMap){
LinkedList<Field> frontier = new LinkedList<Field>();
frontier.add(from);
HashSet<Field> closedSet = new HashSet<Field>();
Field currentField = frontier.po... | 8 |
public void test_printParseLongNameWithLookup() {
Map<String, DateTimeZone> lookup = new LinkedHashMap<String, DateTimeZone>();
lookup.put("Greenwich Mean Time", LONDON);
lookup.put("British Summer Time", LONDON);
DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder()
... | 1 |
public boolean attempt(long msecs) throws InterruptedException {
// log.debug("attempt()::" + Thread.currentThread().toString());
if (Thread.interrupted()) {
throw new InterruptedException();
}
Thread caller = Thread.currentThread();
synchronized (this) {
... | 9 |
public NodeGui(String name) {
super(name);
} | 0 |
private Controller() {
log.debug("Starting Controller()");
try {
init();
// TimerBO
timerBo = new TimerBO(timerPanel);
Dao.getInstance().addObserver(timerBo);
ActivityDao.getInstance().addObserver(timerBo);
TimeDao.getInstance().addObserver(timerBo);
// ActivityBO
activityBo = new Ac... | 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... | 6 |
private Scenery AStarAlgorithm(MovableEntity goal, List<Scenery> opened, List<Scenery> closed) {
while (opened.size() > 0) {
for (Scenery scenery : closed) {
scenery.highLight();
}
for (Scenery scenery : opened) {
scenery.highLight2();
}
// choose the best Scenery (base... | 9 |
public void appendConnected() {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter("connectedfrom/"+playerName+".txt", true));
bw.write(connectedFrom);
bw.newLine();
bw.flush();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
if (bw != null... | 3 |
public String makeMap(int x, int y, int numPits, int numBats){
int size = x * y;
if(size <= 0){
return "error :(";
}
String[][] map = new String[x][y];
littleRoom[][] rooms = new littleRoom[x][y];
for(int i = 0; i < x; i++){
for(int... | 8 |
public boolean equals(Object obj) {
if(obj instanceof Write) {
Write new_w = (Write) obj;
if((new_w.csn == this.csn) &&
(new_w.sID == this.sID) &&
(new_w.acceptStamp == this.acceptStamp) &&
((new_w.command).equals(this.command)) &&
((new_w.song).equals(this.song)) &&
((new_w.URL).equals... | 8 |
double[] VectorSub(double[] a, double[] b) {
double sum[] = new double[a.length];
for (int i = 0; i < a.length; i++) {
sum[i] = a[i] - b[i];
}
return sum;
} | 1 |
public static String eliminarComillas(String s){
String ret = new String();
for (int x = 0; x < s.length(); x++)
if (s.charAt(x) != '"') ret += s.charAt(x);
return ret;
} | 2 |
public static Set getCompleteUsefulVariableSet(Grammar grammar) {
Set set = getNewUsefulVariableSet();
while (areMoreVariablesThatBelongInUsefulVariableSet(grammar, set)) {
String variable = getVariableThatBelongsInUsefulVariableSet(
grammar, set);
addToUsefulVariableSet(variable, set);
}
return set;... | 1 |
private String makeBoardMove(CardGame game) {
if (topRow) {
return game.moveCardOntoTopRowFromBoard(toMoveTop, boardIndexFrom, boardIndexTo);
} else {
//Need this in case we undo to see how many we moved easily (or at all?).
//If size = 6 and toMoveTop = 5, we moved ... | 1 |
public static void CountItems(int Room) {
ItemCount = 0;
for(int i=0; i<Items.roomItems[Room-1].length; i++) {
if(Items.roomItems[Room-1][i] != 0) {
ItemCount++;
}
}
} | 2 |
public boolean isReference() {
return type != null
&& (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY);
} | 2 |
final NpcDefinition method794(ConfigHandler interface17, int i) {
anInt1394++;
int i_2_ = i;
if (anInt1368 == -1) {
if (anInt1354 != -1)
i_2_ = interface17.getRawConfig(anInt1354);
} else
i_2_ = interface17.getSetting(anInt1368);
if (i_2_ < 0
|| ((i_2_ ^ 0xffffffff)
<= (-1 + ((NpcDefinition) thi... | 6 |
public boolean canRotate(){
int i,j;
Tetrimino r= new Tetrimino();
r.setMatrix(t.getMatrix());
r.setMatrix(r.rotateLeft(r.getMatrix(), 4, 4));
for(j=0;j<t.getySize();j++){
for(i=0;i<t.getxSize();i++){
if((!r.isEmpty(i, j) && !p.isEmpty(i+t.getPosX(), j+t.getPosY()))
|| ((!r.isEmpty(i, j) &&... | 6 |
private boolean continueDividing() {
// out of pizels
if(intensities.length < 4)
return false;
if(depth > 6)
return false;
int tot = 0;
for(int i = 0; i < intensities.length; i++){
tot += intensities[i];
}
if(tot/intensities.length > 20){
return true;
}
else{
return false;
}
} | 4 |
protected void loadComplex2HasComponent() {
String fileName = dirName + "Complex_2_hasComponent.txt";
if (verbose) Timer.showStdErr("Loading Complex_2_hasComponent from '" + fileName + "'");
int i = 1;
for (String line : Gpr.readFile(fileName).split("\n")) {
// Parse line
String rec[] = line.split("\t");... | 6 |
public static Parameter.Direction randomDir() {
Parameter.Direction dir = Parameter.Direction.STOP;
switch((int)Math.floor(8*Math.random())) {
case 0 :
dir = Parameter.Direction.U;
break;
case 1 :
dir = Parameter.Direction.D;
break;
case 2 :
dir = Parameter.Direction.L;
break;
case 3 :
... | 8 |
private void returnToHomePage() {
driver.findElement(By.linkText("home page")).click();
} | 0 |
public int newPassword(User userToUpdate) {
try {
// Erforderlicher SQL-Befehl
String sqlStatement = "UPDATE bookworm_database.users SET username = '"
+ userToUpdate.getUserName()
+ "', userpassword = md5('"
+ userToUpdate.getUserPassword()
+ "')"
+ ", userrole = '"
+ userToUpdate... | 1 |
public void setText (String value) {
checkWidget ();
if (value == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
if (value.equals (super.getText ())) return; /* same value */
super.setText (value);
GC gc = new GC (parent);
computeDisplayText (gc);
gc.dispose ();
if (parent.drawCount <= 0 && parent.getHeaderVisi... | 4 |
public void update()
{
xa = ya = 0;
counter++;
counter2++;
if(counter > 60)
{
shoot();
counter = 0;
}
if(counter2 > 3)
{
positioning();
counter2 = 0;
}
if(xa != 0 || ya != 0) {
move (xa, ya);
walking = true;
} else {
walking = false;
}
if(health <= 0)
{
rem... | 5 |
public static void main(String[] args) {
// TODO Auto-generated method stub
VirtualChess object = new VirtualChess(); // Create a new object
AbstractPiece [][] x = object.board();
String user_input = " ";
i... | 4 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS... | 8 |
@Override
public void documentAdded(DocumentRepositoryEvent e) {} | 0 |
private Object readResolve() throws ObjectStreamException {
if (this.equals(TextBlockAnchor.TOP_CENTER)) {
return TextBlockAnchor.TOP_CENTER;
}
else if (this.equals(TextBlockAnchor.TOP_LEFT)) {
return TextBlockAnchor.TOP_LEFT;
}
else if (this.equals(TextBl... | 9 |
protected void insererNoeudAB(NoeudArbre<E> noeud) {
boolean stop = false;
NoeudArbre<E> pivot = root;
NoeudArbre<E> pivotPere = NIL;
// l'arbre est il vide ?
if (root == NIL) {
root = noeud;
} else {
// tant qu'on a pas atteint une feuille, on che... | 5 |
public static JList<String> getJListString(ArrayList<String> list) {
int size = list.size();
final DefaultListModel<String> model = new DefaultListModel<String>();
for (int i = 0; i < size; i++) {
model.addElement(list.get(i));
}
return new JList<String>(model);
} | 1 |
private void readData(File dataFile) {
Scanner s = makeScanner(dataFile);
try { // in case the input doesn't match the specification
while (s.hasNextDouble()) { // while there is another row of
// values
Double[] values = new Double[NumChannels];
for (int channel = 0; channel < NumChannel... | 8 |
public static void main(String[] args) {
try {
URL url = new URL(
"http://localhost:8080/com.powershare.rest/rest/json/metallica/get");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
if (con... | 4 |
@DELETE
@Path("/v2.0/subnets/{subnetId}")
public Response deleteSubnet(@PathParam("subnetId") String subnetId) throws MalformedURLException, IOException{
//Send the HTTP request to the REST service
HttpURLConnection conn=HTTPConnector.HTTPConnect(new URL(this.URLpath+"/"+subnetId), OpenstackNetProxyConstants.HTTP... | 1 |
protected boolean handleOutgoingEvent(ChannelEvent event) throws Exception
{
if( !(event instanceof ChannelStateEvent) )
return false;
ChannelStateEvent stateEvent = (ChannelStateEvent) event;
switch(stateEvent.getState())
{
case CLOSE:
close0();
break;
case CONNECT:
if( stateEvent.getV... | 8 |
public static void main(String[] args) {
if (args.length == 3)
{
int row = 0;
int column = 0;
int victory = 0;
boolean good = true;
try
{
row = Integer.parseInt(args[0]);
column = Integer.parseInt(args[1]);
victory = Integer.parseInt(args[2]);
}
catch(NumberFormatException e)... | 5 |
@Override
public void actionPerformed(ActionEvent event) {
synchronized (var.monitor) {
var.monitor.notify();
}
int x = ((Button)event.getSource()).geTx();
int y = ((Button)event.getSource()).geTy();
if (!var.exit) {
if (Engine.field.isCellEmpty(x,y))... | 5 |
public void testCompareTo() {
Instant test1 = new Instant(TEST_TIME1);
Instant test1a = new Instant(TEST_TIME1);
assertEquals(0, test1.compareTo(test1a));
assertEquals(0, test1a.compareTo(test1));
assertEquals(0, test1.compareTo(test1));
assertEquals(0, test1a.compareTo(t... | 1 |
public static void UpdatePlaytable() {
for(int i = 0; i < mo.users.size(); i++){
if(mo.users.get(i).getUser_ID() == client_ID){
Login.playtable.myRank = i;
System.arraycopy(mo.users.get(i).getHand(),0, Playtable.handcopy,0,13);
System.arraycopy(mo.users.get(i).getHand(),0, Playtable.newhand,0,13);
... | 6 |
@Override
public PlayerAction chooseAction(State state, IPlayer player) {
lastAction = new PlayerAction();
lastAction.oldStake = player.getCurrentBet();
PlayerAction.ACTION[] actionArray = PlayerAction.ACTION.values();
lastAction.action = actionArray[generator.nextInt(actionArray.length)];
if(state.getBig... | 4 |
public boolean canPassHere(Physical affected)
{
if(affected instanceof MOB)
{
final MOB M=(MOB)affected;
final Room R=M.location();
if(R!=null)
{
switch(R.domainType())
{
case Room.DOMAIN_OUTDOORS_CITY:
case Room.DOMAIN_OUTDOORS_SPACEPORT:
case Room.DOMAIN_OUTDOORS_UNDERWATER:
c... | 7 |
public void handleGuiKeyInput() {
if(KeyHandler.isPressed(KeyHandler.ESCAPE)){
world.displayGui(null);
}
if(KeyHandler.isPressed(KeyHandler.ESCAPE2) && XboxController.controller != null){
world.displayGui(null);
}
} | 3 |
public String toString()
{
String s = "{";
for (Location loc : getOccupiedLocations())
{
if (s.length() > 1)
s += ", ";
s += loc + "=" + get(loc);
}
return s + "}";
} | 2 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
PrintWriter out = response.getWriter();
HttpSession session = request.getSession();
if (session == null || session.getA... | 8 |
private double checkRow(int rowC, int rowZeroC, int playerID, int column, int row, int[][] gameBoard) {
// The amount of pieces needed to get 4 in a row
int need = 4 - rowZeroC - rowC - 1;
// The amount of pieces needed to get 4 in a row, updated throughout the method
int left = need;
// Check the field to t... | 9 |
public String toString() {
String format = "";
if(this.a == 0)
if(this.b == -1)
return "-i";
else if(this.b == 0)
return "0";
else if(this.b == 1)
return "i";
else
return String.format("%di", this.b);
else
if(this.b == -1)
return String.format("%d-i", this.a);
else if(this.b =... | 8 |
public boolean[][] fillIn(int[] order, boolean[][] bAdjacencyMatrix) {
int nNodes = bAdjacencyMatrix.length;
int[] inverseOrder = new int[nNodes];
for (int iNode = 0; iNode < nNodes; iNode++) {
inverseOrder[order[iNode]] = iNode;
}
// consult nodes in reverse order
for (int i = nNodes - 1; i >= 0; i--) {... | 9 |
public Colour(int alphaComponent, int redComponent, int greenComponent, int blueComponent){
if(alphaComponent > 255 || alphaComponent < 0){
throw new Error("Alpha Component has an invalid value.");
}
if(redComponent > 255 || redComponent < 0){
throw new Error("Red Component has an invalid value.");
}
... | 8 |
public void merge(int A[], int m, int B[], int n){
if (n == 0)
return;
if (m == 0){
for (int i = 0; i < n; i++)
A[i] = B[i];
return;
}
int l = m + n;
for (int i = m - 1, j = n - 1; i >= 0 || j >= 0; ){
int valA = i >= 0 ? A[i] : Integer.MIN_VALUE;
int valB ... | 9 |
public void checkForAllCollisions(Collection<Entity> entities) {
for (Entity e1 : entities) {
for (Entity e2 : entities) {
if (!(e1.type == EntityType.ENTITY_WALL && e2.type == EntityType.ENTITY_WALL) && !e1.equals(e2)) {
if (existsACollisionBetween(e1, e2)) {
... | 6 |
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.