text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static void displayEmployees(ResultSet rs)throws SQLException{
StringBuilder bf = new StringBuilder();
while (rs.next()){
bf.append(rs.getString("name")).append(" ");
bf.append(rs.getString("username")).append(" ");
bf.append(rs.getString("pass")).append(" ");
bf.append(rs.getDate("dob")).app... | 1 |
@Override
public void run() throws Exception {
try {
ConfigFile importFile = new ConfigFile(plugin);
ConfigSQL importSQL = new ConfigSQL(plugin);
if (!importSQL.checkDatabase()) {
throw new Exception("Could not connect to database !");
}
for (String player : importFile.getAllPlayers()) {
for ... | 7 |
private float[] getColors() {
int c = r.nextInt(8);
float[] b = new float[3];
switch (c) {
case 0: // yellow
b[0] = 181f / 255f;
b[1] = 137f / 255f;
b[2] = 0f / 255f;
break;
case 1: // orange
... | 8 |
private static void applyLocalAddressSetting(String strLclAdr,
List<InetAddress> lTmp) {
for(InetAddress iaTmp: lTmp)
if (strLclAdr.equals(iaTmp.getHostAddress()))
EzimNetwork.localAddress = iaTmp;
if (null == EzimNetwork.localAddress)
{
EzimLogger.getInstance().warning
(
"I... | 3 |
private void bottomPossibleMoves(Piece piece, Position position)
{
int x1 = position.getPositionX();
int y1 = position.getPositionY();
if(y1 >= 1 && y1 <= 7)
{
boolean pieceNotFound = true;
for (int i = y1 - 1; pieceNotFound && (i >= 0) && (board.getChessBoardSquare(x1, i).getPiece().getPieceColor... | 7 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int times = Integer.parseInt(line.trim());
for (in... | 9 |
public void writeResultes() {
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(zoneID + "-results.txt"));
if (!created.isEmpty()) {
bw.write("New Planets\n---------------------\n");
for (Planet p : created) {
bw.write(p.out... | 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 |
static String findTableName(String cmd) {
if (cmd != null) {
StringBuilder buffer = new StringBuilder();
Scanner scanner = new Scanner(cmd);
try {
while (scanner.hasNextLine()) {
final String line = scanner.nextLine();
b... | 8 |
public int getAtk(int npc) {
switch (npc) {
case 2627:
return 30;
case 2630:
return 50;
case 2631:
return 100;
case 2741:
return 150;
case 2743:
return 450;
case 2745:
return 650;
}
return 100;
} | 6 |
public void A_Vote(String AID, String UID, int vote) // vote can be 0 or 1
{
//check if this user have previously voted for this question
int __c__=0;
int currentVote;
try (Connection conn = DriverManager.getConnection(dbURL, username, password))
{
//Update the DB
String sql = "SELECT ID,VOTE FROM UTA.... | 8 |
private void calcHeading() {
int lastCoordIndex = mCoordIndex - 1;
if (lastCoordIndex < 0) {
lastCoordIndex = COORD_BUFFER_SIZE - 1;
}
// only continue if all of the coords exist
if (!Double.isNaN(mLat[mCoordIndex])
&& !Double.isNaN(mLon[mCoordIndex])
&& !Double.isNaN(mLat[lastCoordIndex])
&& ... | 6 |
public static String escape(String string) {
char c;
String s = string.trim();
StringBuffer sb = new StringBuffer();
int length = s.length();
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' ... | 6 |
public double getSpeedY(){
return speedY;
} | 0 |
@Override
public void includeSource() {
for (File f : layout.asdFiles()) {
this.addPackage(f);
}
} | 1 |
@Override
public T deserialize(JsonParser jp, DeserializationContext dc) throws IOException, JsonProcessingException {
T entity = createEntity();
while (true) {
JsonToken token = jp.nextValue();
if (token == null) {
break;
}
if (token.e... | 6 |
public static void computeSlotInverses(Slot self) {
if (((Symbol)(KeyValueList.dynamicSlotValue(self.dynamicSlots, Stella.SYM_STELLA_SLOT_INVERSE, null))) == null) {
return;
}
if (Slot.multiValuedSlotWithDuplicatesP(self)) {
Stella.STANDARD_WARNING.nativeStream.println("Warning: Can't define an ... | 6 |
private void createHelper() {
for (Map.Entry<String, XMLLayoutData> entry : componentsLayoutMap.entrySet()) {
String componentId = entry.getKey();
XMLLayoutData xmlLayoutData = entry.getValue();
Object topData = null;
Object bottomData = null;
Object ... | 9 |
public boolean getCell(int x, int y) {
return grid[x][y];
} | 0 |
private boolean contactsExist(Set<Contact> contacts) {
Iterator contactsIterator = contacts.iterator();
while(contactsIterator.hasNext()) {
if(!contactExists((Contact) contactsIterator.next())) {
return false;
}
}
return true;
} | 2 |
public final Pino etsiPolku(int alkuX, int alkuY, int loppuX, int loppuY, String tietorakenne) {
if (!tarkistaX(alkuX) || !tarkistaY(alkuY) || !tarkistaX(loppuX) || !tarkistaY(loppuY)) {
throw new IllegalArgumentException("Annetun koordinaatin täytyy olla kartalla.");
}
Pino polku; ... | 7 |
private byte[] readBytes( int db, int ln )
{
byte[] b = new byte[ln];
RandomAccessFile f = ( db==0 ? fdbf : db==1 ? ffpt : fcdx );
try { f.read(b); } catch (IOException e) { e.printStackTrace(); }
return b;
} | 3 |
@Override
protected void onStart() {
frame = new AuthFrame(this);
MineOS.getDesktop().addFrame(frame);
} | 0 |
@Override
public void writeAVLData(OutputStream out) {
PrintStream ps = new PrintStream(out);
ps.print("\n#=======================================\n"); // SURFACE | (keyword)
ps.print("SURFACE\n"); // SURFACE ... | 6 |
private void goRoom(Command command) {
if (!command.hasSecondWord()) {
// if there is no second word, we don't know where to go...
System.out.println("Go where?");
return;
}
String direction = command.getSecondWord();
if (direction.equals("bac... | 8 |
private void run() {
ElevatorStrategy str = strategies[strategy];
//we expect 300 arrivals in an hour
//lambda = 1/4 since we expect 1 arrival per 12 sec == 4 time units, the mean is therefore 1/0.25
// new value for 2hrs/300 persons: 1/0.125
ExponentialDistribution e = new ExponentialDistribution((1/0.25));
... | 9 |
public static String booleanToString(boolean bool) {
if(bool)
return "ON";
else
return "OFF";
} | 1 |
private boolean fill() {
if (fill)
return true;
if (cMap.size() < tMap.size())
return false;
for (Character key : cMap.keySet()) {
if (cMap.get(key) < tMap.get(key))
return false;
}
fill = true;
return true;
} | 4 |
@Override
public ArrayList<BoardPosition> getPossibleMoves(Board board, BoardPosition startingPosition) {
ArrayList<BoardPosition> possibleMoves = new ArrayList<BoardPosition>();
DiagonalMove toTopLeft = new DiagonalMove();
DiagonalMove toTopRight = new DiagonalMove();
DiagonalMove t... | 4 |
boolean isInsertionValid(int toInsert, int x, int y)
{
//toInsert MUST be between 1 and TABLE_SIZE:
if(toInsert < 1 || toInsert > TABLE_SIZE)
{
return false;
}
//location is not empty
if(table[x][y] != 0)
{
return false;
}
//check column
for(int i = 0; i < TABLE_SIZE; ++i)
{
if(i ... | 9 |
public settings(){
initialize();
prefl = Preferences.userRoot().node("com.camray.bill.login$1");
db=new DBConnection();
con=db.acquireConnection();
prefs = Preferences.userRoot().node(this.getClass().getName());
tbl=new JTextField(15);
tbl.setText(prefs.getInt("table", 40)+""... | 9 |
@Override
public void onEnable() {
this.saveDefaultConfig();
listeners.register();
try {
this.getConfig().load(configFile);
} catch (IOException e) {
e.printStackTrace();
} catch (InvalidConfigurationException e) {
e.printStackTrace();
... | 2 |
public void updateTable() {
if(_table != null) {
_table.putNumber("Value", get()*2/255.0-1);
}
} | 1 |
public ActionDispatch(View _v) {
this.v=_v;
v.autorize.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if ((v.port1.getText()!=null)||(v.adress1.getText()!=null)||(v.name.getText()!=null))
{
port=Integer.parseInt(v.port1.getText().trim());... | 3 |
public static BranchGroup crear(Vector3f posInicial,
tipoFigura tipoFigura,
Float ancho, Float alto, Float largo,
Appearance apariencia,
String urlObjeto, Float escala) throws Exception {
// Creamos el BranchGroup que vamos a devolver
BranchGroup objetoBG ... | 4 |
public String[][] getResultSetTable(String where, int pageNo, int rowCount) {
System.out.println("getResultSetTable" + tableNameSup);
String[][] ret = new String[tableFieldSup.length][1]; //col,rowの順
Properties props = new Properties();
props.setProperty("user", rolename);
props.... | 9 |
ENCODE(String value){
this.value = value;
} | 0 |
public List<KrakenMove> actions(String color) {
ArrayList<KrakenMove> moves=new ArrayList<KrakenMove>();
for(int i = 0;i<rowBoard;i++)
for(int j = 0;j<colBoard;j++)
if (board[i][j] != null &&
board[i][j].getColor().equals(color))
addActionsItem(new XYLocation(i,j),moves);
return moves;
} | 4 |
public void setLabo(Labo labo) {
this.labo = labo;
} | 0 |
@Override
public String format( Cell cell )
{
// make sure to return the empty string for blank cells
// getting the calendar coerces to double and thus gets zero
if( ((cell instanceof CellHandle) && ((CellHandle) cell).isBlank()) || "".equals( cell.getVal() ) )
{
return "";
}
if( cell.getCellType() =... | 4 |
private E getResult(boolean findMax) {
int index = 0;
Entry<Integer, Double> result = null;
if (findMax == true) {
Iterator<Entry<Integer, Double>> s = fitScores.entrySet().iterator();
for (; s.hasNext(); )
{
Entry<Int... | 7 |
private int[] getBoundaryPositions(ByteBuffer b, byte[] boundary) {
int matchcount = 0;
int matchbyte = -1;
List<Integer> matchbytes = new ArrayList<Integer>();
for (int i = 0; i < b.limit(); i++) {
if (b.get(i) == boundary[matchcount]) {
... | 5 |
public GamePanel(final SupportPanel supportPanel, final int numberOfPlayers) {
this.numberOfPlayers = numberOfPlayers;
setLocation(0, 0);
setSize(600, 600);
setLayout(null);
setBackground(Color.BLACK);
this.supportPanel = supportPanel;
map = new HashMap<String, Im... | 7 |
public static void main(String[] args) {
int x = 1, y = 1;
int a = 0, b = 0;
x++; ++y;
System.out.println("a = " + a + ", b = " + b + ", x = " + x + ", y = " + y);
//a = 0, b = 0, x = 2, y = 2
a = x++; b = ++y;
System.out.println("a = " + a + ", ... | 0 |
private void setupShells(HashMap<String, String> shells) {
String sh = "";
String shclassstr = "";
// temporary storage for fully qualified classnames,
// serves the purpose of not loading classes twice.
HashMap<String, Class<?>> shellclasses = new HashMap<String, Class<?>>(shell... | 7 |
public void Displaymessage(String msg) {
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: Displaymessage() BEGIN");
}
getDrawing().Message(msg);
if (test || m_test) {
System.out.println("GameWindow :: Displaymessage() END");
}
} | 4 |
public static void conexion()
{
try
{
connection = DriverManager.getConnection("jdbc:sqlite:usuarios.db");
statement = connection.createStatement();
try
{
statement.executeUpdate("create table usuarios (Telefono string, Nombre string, Apellido1 string, Apellido2 string, Nick string, Contrasenya s... | 5 |
@Override
public int compareTo(Player otherPlayer) {
if (otherPlayer == null)
throw new IllegalArgumentException("The given arguments are invalid!");
final int res = Integer.compare(this.playerNumber, otherPlayer.playerNumber);
if (res == 0)
return Integer.compare(this.getRemainingActions(), otherPlayer... | 2 |
public String getUrl() {
return url;
} | 0 |
public void setGaussianKernelWidth(int gaussianKernelWidth) {
if (gaussianKernelWidth < 2)
throw new IllegalArgumentException();
this.gaussianKernelWidth = gaussianKernelWidth;
} | 1 |
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((msg.source().location()!=null)
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&((msg.value())>0)
&&(msg.tool()==this)
&&(msg.target() instanceof MOB))
{
final int chance = (int)Math... | 7 |
public static void startupModules() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if (S... | 7 |
private void node() {
// Grab the string up to the colon
int start = position;
for (char c = current(); hasNext(); c = next()) {
if (c == ':') break;
if (c == '#') error("Illegal character in key. The pound sign # is reserved for comments.");
}
//... | 8 |
private void addRelatedTag(ArrayList<Integer> tagList) {
for (int tag : tagList) {
if (!selectedTags.contains(tag) && !relatedTags.contains(tag)) {
relatedTags.add(tag);
}
}
} | 3 |
private static void addFileToTarGz(TarArchiveOutputStream tOut, String path, String base) throws IOException {
File f = new File(path);
String entryName = base + f.getName();
TarArchiveEntry tarEntry = new TarArchiveEntry(f, entryName);
tOut.setLongFileMode(TarArchiveOutputStream.LONGFIL... | 3 |
public void playGame(ArrayList<Player> players, Dealer dealer, int numPlayers){
initialDeal(players, dealer, numPlayers);
updatePlayers(players, dealer, numPlayers);
checkForWin(players,dealer,numPlayers);
while (winner.isEmpty()){
moreDeals(players, dealer, numPlayers);
}
PlayAgain();
} | 1 |
public boolean playGenerateScriptFile(String device, String host,
String port, String path, String name) {
serialNumber = device;
ClientManipulationScript.host = host;
ClientManipulationScript.port = port;
File fOutputDir = new File(path);
if (!fOutputDir.exists()) {
fOutputDir.mkdirs();
}
outpu... | 3 |
@Override
public void run() {
try {
String line;
while ((line = this.in.readLine()) != null) {
int space_pos = line.indexOf(" ");
if (space_pos != -1) {
try {
Object obj = this.decodeData(line.substring(space... | 5 |
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (!plugin.hasPerm(sender, "spawnmob", false)) {
sender.sendMessage(ChatColor.YELLOW
+ "You do not have permission to use /" + label);
return true;
}
Player player = (Player) sender;
int[] ignore = { 8... | 6 |
public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... | 7 |
@Override
public String format(LogRecord arg) {
String resultat = "";
Level lvl = arg.getLevel();
if (lvl.equals(Level.CONFIG)) {
resultat += "<tr class=\"config\">";
}
if (lvl.equals(Level.WARNING)) {
resultat += "<tr class=\"warning\">";
}
... | 7 |
private void requestHitStay(Player activePlayer, Dealer dealer, DeckInterface deck,
Message mg) {
if (activePlayer.getHand().getValue() == 21){
mg.displayMessage(12);
}
//loops while not busted
while (activePlayer.getHand().getValue() < 21){
String input = null;
//hit or stay message
mg... | 6 |
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 static int checksMultiples(int[][] numberArray, int rowNumber, int columnNumber){
int largestProduct = 0;
int sum = 0;
//checks vertical, horizontal, and diagonal
try {
sum = numberArray[rowNumber][columnNumber]*numberArray[rowNumber][columnNumber+1]*numberArray[rowN... | 8 |
public void paint(Graphics g) {
g.setColor(Color.WHITE);
g.fillRect(0, 0, getWidth(), getHeight());
Ball[] balls = model.getBalls();
MyBall myBall = model.getMyBall();
for(int i = 0; i < balls.length; i++){
if(!balls[i].isDead){
g.setColor(colors[i]);
g.fillOval(balls[i].getX(), balls[i].getY(),
... | 5 |
private void postPlugin(Plugin plugin, boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
String data = encode("g... | 8 |
public void print(AbstractPiece [][] chessboard){
int x = 8;
System.out.println(" \tA\tB\tC\tD\tE\tF\tG\tH");
for(int row = 0; row < chessboard.length; row++){
System.out.print(x);
x--;
... | 4 |
public int cellToOffset(int row, int col) {
// Check row and column individually to prevent them being invalid
// values but still pointing to a valid offset in the buffer.
if (row<0 || row>=getRowCount() ||
col<0 || col>15) { // Don't include last column (ascii dump)
return -1;
}
int offs = row*16 + c... | 6 |
public static boolean areCompatible(Class a, Class b) {
if (a.isAssignableFrom(b)) return true;
if (a == Integer.class && b == int.class) return true;
if (a == int.class && b == Integer.class) return true;
if (a == BigDecimal.class && b == Integer.class) return true;
if (a == Integer.class && b == BigDec... | 9 |
@Override
public void init()
{
super.init();
rwFirst = ByteTools.readShort( getByteAt( 0 ), getByteAt( 1 ) );
rwLast = ByteTools.readShort( getByteAt( 2 ), getByteAt( 3 ) );
colFirst = (short) getByteAt( 4 );
colLast = (short) getByteAt( 5 );
cchFile = ByteTools.readShort( getByteAt( 6 ), getByteAt( 7 ) )... | 4 |
public void printIterative(JTreeNode n){
final Deque<JTreeNode<T>> nodeTracker = new ArrayDeque<>();
nodeTracker.push(n);
while(!nodeTracker.isEmpty()){
while(n.getLeftNode()!= null && !n.getLeftNode().isVisited()) {
nodeTracker.push(n.getLeftNode());
n = n.getLeftNode();
}
System.out.printl... | 5 |
protected String separateExternalScripts(String script) {
// externalScripts.clear();
// when external blocks intertwine with mouse blocks, they will be reduced to "external #". When
// they are passed to the mouse callback, setScript(String) will be called, which subsequently
// calls this method. If we clear ... | 9 |
protected void processOtherEvent(Sim_event ev)
{
switch ( ev.get_tag() )
{
case GridSimTags.SEND_AR_CREATE:
case GridSimTags.SEND_AR_CREATE_IMMEDIATE:
handleCreateReservation(ev);
break;
case GridSimTags.SEND_AR_COMMIT_ONLY:
... | 9 |
public boolean equals( Object other ) {
if ( _set.equals( other ) ) {
return true; // comparing two trove sets
} else if ( other instanceof Set ) {
Set that = ( Set ) other;
if ( that.size() != _set.size() ) {
return false; // different sizes, no need ... | 6 |
private int testaaPystyrivi(Piste p0) {
Piste p1 = new Piste(p0.getX(), p0.getY() - hahmonKorkeus);
for (int i = 0; i < hahmonKorkeus; i++) {
if (testaaPiste(p1)) {
break;
}
p1.siirra(0, 1);
}
return p0.getY() - p1.getY();
} | 2 |
public RequestLauncher(){
InputStream stream = null;
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder builder = factory.newDocumentBuilder();
stream = new FileInputStream(".... | 7 |
private void fixUpdateFile(String updatesFilename) throws IOException {
File original = new File(updatesFilename);
FileReader fr = new FileReader(original);
BufferedReader br = new BufferedReader(fr);
File converted = new File(updatesFilename + ".converted");
FileWriter fwr = new FileWriter(converted);
Buf... | 8 |
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 static List<Class<?>> processDirectory(File directory, String pkgname) {
ArrayList<Class<?>> classes = new ArrayList<Class<?>>();
log("Reading Directory '" + directory + "'");
// Get the list of the files contained in the package
String[] files = directory.list();
for (int i = 0; i < files.le... | 7 |
public POP3Server(){
sTrace = new SystemTrace();
sTrace.setDebug(Proxy.DEBUG);
internAccounts.put("collector", "123");
int counter = 0; // Z�hlt die erzeugten Bearbeitungs-Threads
try {
/* Server-Socket erzeugen */
welcomeSocket = new ServerSocket(POP3_TEST_PORT_NUMBER);
while (true) { // Server ... | 2 |
private void notCriticalMove() {
int center = gameField.getFieldSize()/2;
if(!gameField.isFill(center,center)){
gameField.putO(center,center);
}
else {
if(checkVerticalWin(2)) {
finishVerticalLine(criticalVertical,1);
}
... | 8 |
@Override
public void focusGained(final FocusEvent e) {
JTextField tf = (JTextField) e.getComponent();
tf.selectAll();
oldValue = tf.getText();
} | 0 |
public WorldPanel(World world) {
this.model = world;
this.worldMap = model.getWorldMap();
this.worldGUI = new WorldNodePanel[4][4];
try {
gold = ImageIO.read(new File("src/main/resources/images/gold2.png"));
pit = ImageIO.read(new File("src/main/resources/images/pit2.png"));
wumpus ... | 8 |
public Tile(String type){
id = type;
if(type.equals("G")){
tileType = TileType.GRASS;
grassTiles++;
}
else if(type.equals("V")){
tileType = TileType.VOID;
voidTiles++;
}
else if(type.equals("S")){
tileType = TileType.SPAWN;
spawnTiles++;
}
else if(type.equals("E")){
tileType =... | 7 |
private void computeCanBeAvail(final ExprInfo exprInfo) {
final Iterator blocks = cfg.nodes().iterator();
// Go through every PHI-statement of the exprInfo.
while (blocks.hasNext()) {
final Block block = (Block) blocks.next();
final Phi phi = exprInfo.exprPhiAtBlock(block);
if (phi == null) {
cont... | 6 |
public String addStation(String stationName) throws IOException {
String message = "";
log.debug("Start method \"addStation\"");
if (stationName == null || "".equals(stationName)) {
message = "Введите название станции";
return message;
}
List<String> allSt... | 4 |
private int getLastActivity(ASPlayer data, TableType table) {
switch(table) {
case DAY: return data.lastDay.activity;
case WEEK: return data.lastWeek.activity;
case MONTH: return data.lastMonth.activity;
default: plugin.severe("Invalid Type in getLastActivity");
}
return 0;
} | 3 |
public static Field loadFieldFromFile(){
Field field = null;
int wigth;
int height;
int[][] bombs;
int[][] visibleCells = null;
int[][] flags = null;
try (FileInputStream inpFile = new FileInputStream(DEFAULT_SAVE_PATH)) {
int flag = inpFile.read();
... | 9 |
public void run() {
long lastTime = System.nanoTime();
double unprocessed = 0;
double nsPerTick = 1000000000.0 / 60;
int frames = 0;
int ticks = 0;
long lastTimer1 = System.currentTimeMillis();
init();
while (running) {
long now = System.nanoTime();
boolean shouldRender = false;
unprocess... | 5 |
private void swap(int[] array, int left, int right){
int temp = array[left];
array[left] = array[right];
array[right] = temp;
} | 0 |
private Tuple<Integer, Integer> computeResizeBox(int cssWidth,
int cssHeight, FSImage fsImage) {
if (cssWidth == -1 && cssHeight == -1) {
return null;
}
int newWidth = -1;
int newHeight = fsImage.getHeight();
// Downsize an maintain aspect ratio...
if (fsImage.getWidth() > cssWidth && cssWidth > -1)... | 9 |
public static void main( String[] args ) {
System.out.println("Hello item2!");
BuilderPattern bp = new BuilderPattern.Builder("Readme of item2", "2nd day")
.location("Toronto")
.pageno(80)
.build();
System.out.println(bp.val(99));
System.out.println(bp.val());
} | 0 |
@Override
public void execute(CommandSender arg0, String[] arg1) {
if(arg0.hasPermission("bungeesuite.whois")){
if(arg1.length>0){
if(PlayerManager.playerExists(arg1[0])){
PlayerManager.getPlayerInformation(arg0, arg1[0]);
}else{
arg0.sendMessage(Messages.PLAYER_DOES_NOT_EXIST);
}
}else{
... | 3 |
public void rotate() {
shape = block.rotate();
point.setLocation(location);
// Check if by rotating we've gone out of bounds, and make corrections
while (point.x + shape.getMinX() < 0) { point.translate(1, 0); }
while (point.x + shape.getMaxX() >= pane.getCols()) { point.translate(-1, 0); }
// Check a... | 3 |
public CollisionBox getCollisionBox() {
if(box == null) {
box = new ComplexShape();
if(hasNorthWall()) {
box.addShape(new Rectangle(this.getPosition().getX(), this.getPosition().getY() -
0.05f, 1f, 0.1f));
}
if(hasWestWall()) {
box.addShape(new Rectangle(this.getPosition().getX() - 0.05f,
... | 5 |
public void addTotal(FacWarStat stat) {
if (stat instanceof CharacterKills) {
characterKillsTotal.add((CharacterKills) stat);
} else if (stat instanceof CharacterVictoryPoints) {
characterVictoryPointsTotal.add((CharacterVictoryPoints) stat);
} else if (stat instanceof CorporationKills) {
corporationKill... | 6 |
public void drawPieces() {
/* Iterate over pieces here */
/* xCoord and yCoord points start at the top left corner with (0,0)
* and go to the bottom left corner with (n,m) where n and m are the
* x and y dimensions of the board, respectively */
if (game != null) {
for (int i = 0; i < yBoardDim; i++) {
... | 7 |
public void secondDFSwithG() {// nodesSortedbyFt is in f(n) increasing
// order, so get from the last
for (int fromNode = totalNumNodes - 1; fromNode > 0; fromNode--) {
curLeader = nodesSortedbyFt[fromNode];
// if not explored then go ahead, otherwise break
if (!nodesStatus.get(curLeader)) {
// ... | 2 |
private void templateWithWordList( String wikiText, String templateId ) {
int idx = findTemplate( wikiText, templateId );
if( idx < 0 ) {
return;
}
int endIdx = wikiText.indexOf( '}', idx );
if( endIdx < 0 ) {
return;
}
String wordStr = wi... | 4 |
public int readLatestLoginId(String playerName) {
int idLogin = 0;
try {
ResultSet rs = _sqLite.query("SELECT login.* FROM player, login "
+ "WHERE player.playername = '" + playerName + "' "
+ "AND player.id = login.id_player "
+ "ORDER BY login.time_login DESC LIMIT 1;");
... | 3 |
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.