text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void generate(int i, int j, int type, int ori){
if (type==0){
if (map[i][j] == suelo)
map[i][j] = obstacle0;
}else if (type==1){
if (ori == 0 && map[i][j] == suelo && map[i+1][j] == suelo){
map[i][j] = obstacle10;
map[i+1][j]... | 9 |
@Override
public void paintComponent(Graphics g)
{
g.clearRect(0, 0, getWidth(), getHeight());
for (int row = 0; row < board.getRows(); ++row)
{
for (int col = 0; col < board.getColumns(); ++col)
{
int r = board.getHeroLocation().getLocation().x;
int c = board.getHeroLocation(... | 7 |
@Override
public void update(Observable arg0, Object arg1) {
if(arg0.equals(model)){
while(tmodel.getRowCount() > 0){
tmodel.removeRow(0);
}
Vector<String> productVector;
Product p;
Iterator<fpt.com.Product> productIterator = model.iterator();
while(productIterator.hasNext()) {
productVect... | 3 |
public void printShuffle(Graphics g) {
int q = 0;
int z = 250;
String cardName = null;
for (int i = 0; i < deck.length; i++) {
if (deck[i].cardValue == 0) {
cardName = "A" + deck[i].suit;
} else if (deck[i].cardValue == 11) {
cardName = "J" + deck[i].suit;
} else if (deck[i].cardValue == 12... | 6 |
@Override
public void initialize(URL location, ResourceBundle resources) {
final WebEngine engine = webViewAuth.getEngine();
try {
engine.load(Auth.getUrl(Constants.APP_ID, Auth.getSettings()));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
... | 5 |
@Override
public Boolean StartApplainceCycle(String said)
{
//TODO Auto-generated method stub
for (ArrayentBackEndCommunication app : _applainces)
{
if(app._applInstance.get_said()== said)
{
try
{
if(app._applInstance.get_isApplianceInitialized() && !app._applInstance.get_isCycleStarted()... | 5 |
public int pickLvl()
{
int throwAway = (int)(Math.random()*4+baseLevel-2);
if(throwAway<5)
return 5;
else if(throwAway>100)
return 100;
else
return throwAway;
} | 2 |
@Override
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
ImageData.getInstance().initialize();
categories = ImageData.getInstance().getCategories();
elements = ImageData.getInstance().getElements();
backgroundSheet = new SpriteSheet("res/anims/background/Light.png", 560, 420);
... | 2 |
private void registerTasks(Environment environment) {
final Map<String, Task> beansOfType = applicationContext.getBeansOfType(Task.class);
for (String beanName : beansOfType.keySet()) {
Task task = beansOfType.get(beanName);
environment.admin().addTask(task);
logg... | 1 |
private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed
if (jRadioButtonMenuItem1.isSelected()) {
try {
byte[] encodeBase64Chunked = Base64.decodeBase64(jTextArea1.getText().getBytes("UTF-8"));
jTextArea1.setText(new... | 2 |
* @return Stella_Object
*/
public static Stella_Object unassert(Stella_Object proposition) {
{ Cons parsedprops = Logic.updateProposition(proposition, Logic.KWD_CONCEIVE);
Cons result = Stella.NIL;
if (parsedprops != null) {
{ Proposition prop = null;
Cons iter000 = parsedprops;
... | 6 |
@Override
public void unInvoke()
{
// undo the affects of this spell
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
super.unInvoke();
if((canBeUninvoked())&&(mob.location()!=null))
{
if((failed)||(!CMLib.flags().isSitting(mob))||(room==null)||(title==null)||(mob.location()!=roo... | 9 |
private void writeInputs(PrintWriter out) {
int curCycle = cycleOffset;
for (PlaybackOperation op : playback) {
for (Entry<Integer, Integer> input : op.getInputMap().entrySet()) {
boolean frameBoundary = curCycle + input.getKey() >= FRAME_CYCLES;
if (frameBoundary) {
curCycle -= ... | 4 |
private void calculateMinRequiredNumber(GameDescription game){
ArrayList<SpriteData> allSprites = game.getAllSpriteData();
for(SpriteData sprite:allSprites){
if(!sprite.type.equals(resource) && checkIsCreate(sprite.name, game, allSprites)){
minRequiredNumber.put(sprite.name, 0);
}
else{
if(getAl... | 7 |
@Override
public String execute() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
Campaign camp = (Campaign) session.get("campa");
Long campid = camp.getCampaignId();
// System.out.println("Camp is" + camp.toString());
... | 7 |
@Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
G.setColor(Color.gray);
G.fillRect((int)X-2-viewX, (int)Y-32-viewY, 4, 32);
G.setColor(Color.darkGray);
G.fillRect((int)X-16-viewX, (int)... | 4 |
private SettingsManager() {
} | 0 |
public static void triggerTraySelectionChanged() {
for (TraySelectionChangedListener listener : StorageUnitDisplayPanel.traySelectionChangedListeners) {
listener.onTraySelectionChanged();
}
} | 1 |
@SuppressWarnings("unchecked")
private static Number instantiateNumber(Class<? extends Number> cls,
String number) {
assert cls != null : "The class may not be null";
if (number == null || number.isEmpty()) {
return null;
}
try {
Constructor<Number> numberConstructor = (Constructor<Number>) cls
... | 9 |
private void checkErrors(JSONObject response) throws UniSenderMethodException, UniSenderInvalidResponseException{
if (response.has("error")){
try {
String errorMsg = response.getString("error");
String code = response.getString("code");
MethodExceptionCode mec = MethodExceptionCode.UNKNOWN;
i... | 9 |
public void Close() {
this.pconnect.LogOut();
} | 0 |
private void doPaintBucketNoDia(int x, int y, Color newCol, Color currentCol)
{
// make sure it's on the image
if (x > -1 && y > -1 && x < this.getDrawingWidth()
&& y < this.getDrawingHeight()
&& this.getPointColor(x, y).equals(currentCol))
{
this.drawPoin... | 5 |
private int getEarliestCarTime(Parking[] lots, MovingCar[] cars, int i, int dir) {
if (i < 0 || i >= lots.length || lots[i] == null) {
return Integer.MIN_VALUE;
}
if (!lots[i].isEmpty()) {
return lots[i].getFirst();
}
int lastBlock = dir == 1 ? nblocks[i] - 1 : 0;
for (int j = 0; j < cars.length; j+... | 9 |
@SuppressWarnings("LoopStatementThatDoesntLoop")
public <B, C> Trampoline<C> zipWith(final Trampoline<B> b, final F2<A, B, C> f) {
final Either<P1<Trampoline<A>>, A> ea = resume();
final Either<P1<Trampoline<B>>, B> eb = b.resume();
for (final P1<Trampoline<A>> x : ea.left()) {
for (final P1<Trampol... | 6 |
public static void Cliente_Apaga(String nome, InterfaceControlador ic_cliente){
/**Just a Scanner*/
Scanner sc = new Scanner(System.in);
System.out.println("\nDigite o nome do objeto a ser apagado");
nome = sc.next();
try
{
System.out.println("\nProcurando...\n");
ic_cliente.intControladorA... | 3 |
private SocketChannel accept() {
Socket sock = null;
try {
sock = handle.socket().accept();
} catch (IOException e) {
return null;
}
if (!options.tcp_accept_filters.isEmpty ()) {
boolean matched = false;
for (TcpAddress.Tcp... | 6 |
private void createButtonsMatrix() {
for (int i = 0; i < bMatrix.length; i++) {
for (int j = 0; j < bMatrix[0].length; j++) {
JButton button = new JButton();
button.setPreferredSize(new Dimension(50, 50));
bMatrix[i][j] = button;
}
... | 2 |
public void visit_lload(final Instruction inst) {
final int index = ((LocalVariable) inst.operand()).index();
if (index + 2 > maxLocals) {
maxLocals = index + 2;
}
if (inst.useSlow()) {
if (index < 256) {
addOpcode(Opcode.opc_lload);
addByte(index);
} else {
addOpcode(Opcode.opc_wide);
... | 8 |
static int scoreRange(LeafCollector collector, DocIdSetIterator iterator, TwoPhaseIterator twoPhase,
Bits acceptDocs, int currentDoc, int end) throws IOException {
if (twoPhase == null) {
while (currentDoc < end) {
if (acceptDocs == null || acceptDocs.get(currentDoc)) {
colle... | 8 |
public boolean more() throws JSONException {
this.next();
if (this.end()) {
return false;
}
this.back();
return true;
} | 1 |
@FXML
private void handleSliderAction() {
threadField.setText(Double.toString((int) threadSlider.getValue()));
numThreads = (int)threadSlider.getValue();
System.out.println((int)threadSlider.getValue());
} | 0 |
public void loadGameConfigValues() {
if (gameConfigValues.isEmpty()) {
try {
// config values were not loaded yet -> load it
Ini iniFile = new Ini(this.getClass().getResource("/" + LOTDConstants.INI_FILE_PATH_GAME_INI));
Section section = iniFile.get(LOTDConstants.INI_SECTION_GAME_INI_CONFIG_SECTION);
... | 5 |
private boolean jj_3R_27()
{
if (jj_3R_30()) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3R_31()) { jj_scanpos = xsp; break; }
}
return false;
} | 3 |
public int compareTo( Object obj ) {
if( obj == null ) {
return( 1 );
}
else if( obj instanceof GenKbPhoneByUDescrIdxKey ) {
GenKbPhoneByUDescrIdxKey rhs = (GenKbPhoneByUDescrIdxKey)obj;
if( getRequiredContactId() < rhs.getRequiredContactId() ) {
return( -1 );
}
else if( getRequiredContactId() ... | 9 |
public boolean shouldExecute()
{
if (this.targetEntityClass == EntityPlayer.class)
{
if (this.theEntity instanceof EntityTameable && ((EntityTameable)this.theEntity).isTamed())
{
return false;
}
this.field_48240_d = this.theEntity.worl... | 9 |
public static void main(String[] args) {
// -------------------------Initialize Job Information------------------------------------
String startJobId = "job_201301191915_0001";
//String startJobId = "job_201212172252_0001";
//String jobName = "uservisits_aggre-pig-256MB";
//String jobName = "SampleWordCountWi... | 4 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
CommentPage commentPage = new CommentPage();
String text = request.getParameter("comment");
if (text == null || text.equals("")) {
co... | 3 |
public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[50];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 0; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if... | 9 |
public TaskListClientView getTasksForDate(String dateKey) {
PersistenceManager pm = getPersistenceManager();
TaskListClientView result = null;
try {
Query q = pm.newQuery(DateBoundTasks.class, "dateString == ds");
q.declareParameters("java.lang.String ds");
List<DateBoundTasks> tasks = (List<DateBoun... | 7 |
public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextColDiff = ... | 6 |
public void initialise() {
switch( network.type ) {
case GENERAL: initialiseGeneral();
break;
case RANDOM:
initialiseRandom();
break;
case LINE: initialiseLine();
break;
case STAR: initiali... | 6 |
private void recursive_move(int count)
{
if(max_backup_files == 0)
{
File file= new File(log_file_path + log_file_name + log_file_ending);
file.delete();
return;
}
if (count == max_backup_files)
return;
File file_from;
... | 9 |
private boolean closeToOthers(Point p, int size) {
int xmin = p.x - 1;
int xmax = p.x + size;
int ymin = p.y - 1;
int ymax = p.y + size;
if (xmin < 0) // In case the coordinates are negative
xmin = 0;
if (ymin < 0)
ymin = 0;
for (int i = xmin; i <= xmax; i++)
for (int j = ymin; j <= ymax; j++)
... | 7 |
void fillRandom(double[][] map) {
for (int i = 0; i < map.length; i++) {
double[] row = map[i];
for (int j = 0; j < row.length; j++) {
map[i][j] = 1024*Math.random();
}
}
} | 2 |
private final int jjStopStringLiteralDfa_0(int pos, long active0)
{
switch (pos)
{
case 0:
if ((active0 & 0x2e00L) != 0L)
{
jjmatchedKind = 15;
return 5;
}
return -1;
case 1:
if ((active0 & 0x2e00L) != 0L)
{
jjma... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Triangle other = (Triangle) obj;
if (i != other.i)
return false;
if (j != other.j)
return false;
if (k != other.k)
return false;
i... | 9 |
public void clearAll() {
for (ArrayList<Key> keyList : keys.values()) {
for (Key key : keyList) {
key.clear();
}
}
} | 2 |
@Override
public void mouseUp(MouseEvent e, int x, int y) {
Position p = GfxConstants.getPositionFromXY(x, y);
if (p.getRow() >= 0 && p.getRow() < GameConstants.WORLDSIZE
&& p.getColumn() >= 0
&& p.getColumn() < GameConstants.WORLDSIZE) {
// check if a tile was clicked
Unit u = game.getUnitAt(p);
... | 6 |
public static void addCreature(Creature cr)
{
if(cr.id > 0)
pool.add(cr.id, cr);
else
{
pool.add(cr);
cr.id = pool.indexOf(cr);
}
} | 1 |
@Test
public void testGetWaitingQueues() throws Exception {
PreparedStatement ps = _connection.prepareStatement("INSERT INTO message (sender, receiver, queue) VALUES (1,2,3)");
for (int i = 0; i < 4; i++) { ps.execute(); }
ps = _connection.prepareStatement("INSERT INTO message (sender, recei... | 6 |
public static void main(String[] args) throws IOException {
Path destination = Paths.get("src/main/java/com/dodosoft/dpm");
Files.list(SOURCE).forEach(chapterDir -> {
if (Files.isDirectory(chapterDir) == false) {
return;
}
final String chapterPackageN... | 7 |
public void Update(GameTime gameTime)
{
if (lifeTimer == -1)
{
lifeTimer = gameTime.GetRuntime() + maxLife;
}
mPosition.PlusEquals(mVelocity.Times(new Vector2(1)));
mVelocity.DividedByEquals(new Vector2(1.05f));
sparkSizeFactor /= 1.05f;
float lifeDifference = lifeTimer - gameTime.GetRuntime();
... | 6 |
public boolean ModificarPropiedad(Propiedad p){
if (p!=null) {
cx.Modificar(p);
return true;
}else {
return false;
}
} | 1 |
public int read(int width) throws IOException {
if (width == 0) {
return 0;
}
if (width < 0 || width > 32) {
throw new IOException("Bad read width.");
}
int result = 0;
while (width > 0) {
if (this.available == 0) {
this... | 7 |
public static PermWriter getProject() {
return instance;
} | 0 |
public boolean checkShapeDate(long fechaDesde, long fechaHasta){
return (fechaAlta >= fechaDesde && fechaAlta < fechaHasta && fechaBaja >= fechaHasta);
} | 2 |
public void paint(Graphics g) {
for (int y = 0; y < 7; y++) {
for (int x = 0; x < 7; x++) {
if (this.chrArray[y][x] == -16711936) {
g.setColor(Color.GREEN);
} else {
g.setColor(Color.LIGHT_GRAY);
}
g.fillRect((x * 50 + 10), (y * 50 + 30), 40, 40);
}
}
} | 3 |
public List<ValidateException> validateYear(int yearOfBirth) {
List<ValidateException> validateExceptionList = new LinkedList<>();
Calendar calendar = new GregorianCalendar();
calendar.setTime(new Date());
int currentYear = calendar.get(Calendar.YEAR);
if ((yearOfBirth < 1582) |... | 2 |
public void pickUpWeapon(Weapon w){
for(int i = 0; i<3 ; i++){
if(weapons[i] == activeWeapon){
if(w != null){
weapons[i] = w;
activeWeapon = w;
}else{
weapons[i] = WeaponFactory.createPlayerDefaultWeapon();
activeWeapon = weapons[i];
}
}
}
} | 3 |
public boolean fValidateTrackDetails(WebElement trackItem,String detail)
{
if(detail.equalsIgnoreCase("title")){
WebElement title = objCommon.getChildObject(trackItem, txtTrackTitle);
if(title==null) return false;
//get text
String txtDetail = title.getAttribute("text").trim();
//che... | 8 |
private void checkPos() {
if ( pos == line.length() ) {
pos = -1;
}
} | 1 |
public Shader() {
program = glCreateProgram();
uniforms = new HashMap<String, Integer>();
if (program == 0) {
System.err
.println("engine.graphics.Shader creation failed: Could not find valid memory location in constructor");
System.exit(1);
}... | 1 |
public BufferedImage getImage(){
if(!running){
return images.get(0);
}else{
long curTime = (System.currentTimeMillis() - startTime) % totalTime ;
for(int i=0; i<times.size(); i++){
if(curTime - times.get(i) <= 0){
return images.get(i);
}else{
curTime -= times.get(i);
}
}
}
ret... | 3 |
public boolean ramasserObjet(Objet o)
{
if(o instanceof Arme)
{
Arme a = (Arme) o;
if(a.getCategorieArme() == this.typeArme && a.getLevel() > this.arme.getLevel())
{
this.arme = a;
if(a.getLevel() == 1)
this.ptMana = this.ptManaMax = 120; // bâton de l'érudit
else
this.ptMana = this... | 9 |
protected int processHeader (byte[] header)
{
// TBD
// if (Outliner.DEBUG)
// System.out.println ("\tStan_Debug:\tPdbReaderWriter:processHeader"); }
return SUCCESS ;
} // end protected method processRecord | 0 |
private void createUser() {
String name = JOptionPane.showInputDialog("Name");
String cpr = JOptionPane.showInputDialog("CPR (ddmmyy-MRRG)");
JPasswordField nPass = new JPasswordField();
JPasswordField qPass = new JPasswordField();
JOptionPane.showConfirmDialog(null, nPass, "Enter password", 0);
JOpti... | 3 |
public String getHudsonBuildNumber()
{
return getManifestMainAttribute(
new Attributes.Name("Hudson-Build-Number"), "unknown"
);
} | 0 |
private static double[][] calculateCovarianceMatrix(int userID, double[][] usersForUserMovies) {
double[][] covMatr = new double[UserMovieRatings.get(userID).size()][UserMovieRatings.get(userID).size()];
int movie1Index = 0;
for (Integer movie1ID : UserMovieRatings.get(userID).keySet()) {
int movie2Index = 0;
... | 8 |
public void testConstructor_int_int_int() throws Throwable {
TimeOfDay test = new TimeOfDay(10, 20, 30);
assertEquals(ISO_UTC, test.getChronology());
assertEquals(10, test.getHourOfDay());
assertEquals(20, test.getMinuteOfHour());
assertEquals(30, test.getSecondOfMinute());
... | 6 |
public Object getComponent() throws Exception {
URLClassLoader loader = getClassLoader();
Class c = null;
if (classname == null) {
// return getGeneratedComponent(loader);
// classname = getGeneratedComponent(loader);
c = getGeneratedComponent(loader);
} else {
try {
c = loader.loadClass(getComp... | 2 |
@Override
public Ptg calculatePtg( Ptg[] parsething )
{
Object o = null;
Formula f = ((Formula) getParentRec());
if( f.isSharedFormula() )
{
o = FormulaCalculator.calculateFormula( f.shared.instantiate( f ) );
}
else
{
Object r = null;
if( f.getInternalRecords().size() > 0 )
{
r = f.get... | 8 |
private int getCurrentPage(String command, String pageParam) {
int currentPage = 0;
int page = 0;
if (pageParam != null) {
page = Integer.valueOf(pageParam).intValue();
}
if (command == null) {
currentPage = 1;
} else {
currentPage = page;
if (COMMAND_NEXT.equals(command)... | 4 |
@Override
public Integer deleteNames(String... names) {
if (names == null || names.length == 0) {
throw new IllegalArgumentException("names must have at least one entry");
}
String query = "DELETE FROM `" + playerNamesTable + "` WHERE `name` ";
if (names.length == 1) {
... | 6 |
public Main() {
readConfig();
//下载文档
filedown = new FileDownload();
for(int i=0;i<HOSTSLIB.length;i++){
filedown.DownloadFile(HOSTSLIB[i], SAVEFILES[i]);
}
System.out.println("FileDownLoad OK");
//对下载的文档进行处理
updatetimecheck=new UpdateTimeCheck();
if(updatetimecheck.needUpdate()){
System.out.prin... | 4 |
public int getWidth() {
return anim.getImage().getWidth(null);
} | 0 |
public synchronized boolean setItem(FieldItem item, Position position) {
if (insideBounds(position) && this.getItemType(position) == ' ' && !isPositioned(item)) {
field[position.getX()][position.getY()] = item;
return true;
}
return false;
} | 3 |
public void tokenize(String line) {
StringTokenizer tokenizer = new StringTokenizer(line);
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
String[] metadata = token.split("/");
if (metadata.length > 2) {
String POS = null;
if (metadata[1].indexOf(":") > 0){
... | 9 |
private void drawCoordinates(java.awt.event.MouseEvent evt)
{
int length=graph_screen.getWidth();
int height=graph_screen.getHeight();
xmin=Double.parseDouble(Xmin.getText());
xmax=Double.parseDouble(Xmax.getText());
ymin=Double.parseDouble(Ymin.getText());
ymax=Doubl... | 4 |
protected char[][] build_ct(String v_key,int pos)
{
int row=v_key.length();
char[][] result=new char[row][26];
for(int i=0;i<row;i++)
{
result[i][pos]=v_key.charAt(i);
}
for(int i=0;i<row;i++)
{
for(int j=1;j<26;j++)
{
int cur_pos=pos+j;
if(cur_pos>=26)
{
cur_pos-=26;
}
char c... | 5 |
public static int qdepth() {
int ret = 0;
for (Loader l = loader; l != null; l = l.next)
ret += l.queue.size();
return (ret);
} | 1 |
@Override
public void actionPerformed(ActionEvent e) {
if (getGraphics() != null)
paint(getGraphics());
} | 1 |
@Override
protected void generateFrameData(ResizingByteBuffer bb)
throws FileNotFoundException, IOException {
if(this.rawFrameContents!=null) {
bb.put(this.rawFrameContents);
}
} | 1 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
m = new int[10];
m2 = new int[10];
while ((line = in.readLine()) != null && line.length() != 0) {
if (line.trim(... | 7 |
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (par3World.isRemote)
{
return true;
}
else
{
int var8 = par3World.getBlockId(par4, par5, par6);
p... | 6 |
public void m4t1() {
synchronized (this) {
int i = 5;
while (i-- > 0) {
System.out.println(Thread.currentThread().getName() + " : " + i);
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
}
... | 2 |
public static void changeDate(int rentTransID, String dateIn, String dateOut) {
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setA... | 4 |
public double removeCharge(double request) {
if (request <= 0.0)
return 0.0;
if (charge >= request) {
charge -= request;
lastTickDraw += request;
return request;
}
double ret = charge;
charge = 0.... | 2 |
@Override
public PlayerLeftMessage LeaveServer(int playerID) {
Player player = _state.TryGetPlayer(playerID);
if (player == null)
return MessageCreator.CreatePlayerLeftMessage(new LinkedList<>(), null, null, null);
List<Integer> idsToUpdate = new LinkedList<>(_state.Lobby.GetPl... | 4 |
public static int[] getLCP(char s[], int[] sufAr){
int n = s.length, i, j, l = 0;
int invSufAr[] = new int[n];
for(i=0; i<n; ++i) invSufAr[sufAr[i]] = i;
int lcp[] = new int[n];
for(i=0; i<n; ++i){
j = invSufAr[i];
if(j>0) while(sufAr[j]+l<n && sufAr[j-1]+... | 7 |
protected void processNodeOutgoing(TreeNode node)
{
mxIGraphModel model = graph.getModel();
TreeNode child = node.child;
Object parentCell = node.cell;
int childCount = 0;
List<WeightedCellSorter> sortedCells = new ArrayList<WeightedCellSorter>();
while (child != null)
{
childCount++;
double so... | 9 |
public static boolean isPublicStaticFinal(Field field) {
int modifiers = field.getModifiers();
return (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && Modifier
.isFinal(modifiers));
} | 2 |
public String toString(){
StringBuffer result = new StringBuffer();
for(Map.Entry<String, Integer> e : addressMap.entrySet()){
result.append(e.getKey());
result.append(" : ");
result.append(e.getValue());
result.append("\n");
}
result.append("\n");
for(Map.Entry<String, Descriptor> e : descript... | 3 |
public Sound(String fileName) {
// specify the sound to play
// (assuming the sound can be played by the audio system)
// from a wave File
try {
File file = new File(fileName);
if (file.exists()) {
AudioInputStream sound = AudioSystem.getAudioInputStream(file);
// load the sound into... | 5 |
public static void main( String [ ] args )
{
QuadraticProbingHashTable<String> H = new QuadraticProbingHashTable<>( );
long startTime = System.currentTimeMillis( );
final int NUMS = 2000000;
final int GAP = 37;
System.out.println( "Checking... (no more output means success)" )... | 8 |
private int clearExecList(int totalPE)
{
int removeSoFar = 0; // number of PEs removed so far
ResGridlet obj = null;
// first, remove unreserved Gridlets
int i = 0;
while ( i < gridletInExecList_.size() )
{
obj = (ResGridlet) gridletInExecList_.get(i);
... | 9 |
private ModuleLoader() {
super(null);
final String className = this.getClass().getCanonicalName()
.replace('.', '/')
+ ".class";
final URL url = Main.class.getClassLoader().getResource(className);
if (url.getProtocol().equals("file")) {
final Path classPath = Path.getPath(url);
this.jar = false;
... | 5 |
public Enumeration<Node> getSortedNodeEnumeration(boolean backToFront){
if(!Configuration.draw3DGraphNodesInProperOrder) {
return flatList.elements();
}
PositionTransformation t3d = Main.getRuntime().getTransformator();
int actualVersionNumber = t3d.getVersionNumber();
if((lastVersionNumber != actualVersio... | 5 |
public List<? extends Object> loadRelated (Class type, Object... relationAndRelated) {
Transaction transaction = _manager.currentTransaction ();
StringBuilder criteria = new StringBuilder ("");
List<? extends Object> results;
Query query;
String relation;
Object related;
... | 8 |
String getRawURI(URL url) {
String uri = url.getPath();
if (url.getQuery() != null && url.getQuery().length() != 0) {
uri += "?" + url.getQuery();
}
return uri;
} | 2 |
BulkScorer optionalBulkScorer(LeafReaderContext context) throws IOException {
List<BulkScorer> optional = new ArrayList<BulkScorer>();
Iterator<BooleanClause> cIter = query.iterator();
for (Weight w : weights) {
BooleanClause c = cIter.next();
if (c.getOccur() != Occur.SHOULD) {
contin... | 8 |
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.