text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public Connection crearConexion() {
try {
Class.forName("com.mysql.jdbc.Driver");
Conexion oConexion = new Conexion();
Connection connection = DriverManager.getConnection("jdbc:mysql://" + Conexion.getDatabaseHost() + ":" + Conexion.getDatabasePort() + "/" + Con... | 1 |
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String data = "";
response.setContentType("text/plain");
response.setCharacterEncoding("UTF-8");
PrintWriter writer = response.getWriter();
String dbDriver = "org.postgresql.Driver";
... | 5 |
@Test
public void WhenFailedPath0011_ExpectHostWithPrefix001() throws UnknownHostException {
// localhost: "000"
// failed: "0011"
// resulted prefix: "001"
RoutingTable routingTable = new RoutingTable();
Host localhost = new PGridHost("127.0.0.1", 3000);
localhost.se... | 1 |
@Override
public StatusType getInput(Object object) {
StatusType status = StatusType.PLAYING;
do {
try {
this.display(); //displays the display method from this class
//get the input command entered by user
String input = this.getCommand()... | 4 |
private void click() {
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
_clics.add(e.getPoint());
Insets insets = getInsets();
double h = getHeight() - insets.top - insets.bottom;
... | 8 |
public int getId() {
return id;
} | 0 |
public FindAlbumArtist(String artist, String album, String title)
throws FindAlbumArtistException {
this.artistName= artist;
this.albumName= album;
this.title= title;
if (title.equals("") == false)
this.find();
} | 1 |
public boolean shouldExecute()
{
this.func_48286_h();
if (this.field_48289_e && this.theEntity.worldObj.isDaytime())
{
return false;
}
else
{
Village var1 = this.theEntity.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_doubl... | 6 |
public void createUI(final JPanel parent) {
final GridBagConstraints c = new GridBagConstraints();
final JLabel label = new JLabel(this.name);
if ((this.value != null)
&& (this.value.getClass().equals(boolean.class) || this.value
.getClass().equals(Boolean.class))) {
final JCheckBox checkBox =... | 9 |
private void checkMoveFrom(int x, int y, int numMoves, ArrayDeque<Point> path){
path.add(new Point(x, y));
worldMap[x][y].setPath(path);
worldMap[x][y].setReachableByActive(true);
if(numMoves==0) return;
if(validMove(x+1, y, path))
checkMoveFrom(x+1, y, numMoves-1, path.clone());
if(validMove(x-1, y, p... | 5 |
public static void showHelp() {
System.out.println();
System.out.println("Uso: java Setup -i [interface ROUTER_NAME NAME:NEIGHBOR:COST [NAME:NEIGHBOR:COST ...]]");
System.exit(1);
} | 0 |
public void testPlus_Weeks() {
Weeks test2 = Weeks.weeks(2);
Weeks test3 = Weeks.weeks(3);
Weeks result = test2.plus(test3);
assertEquals(2, test2.getWeeks());
assertEquals(3, test3.getWeeks());
assertEquals(5, result.getWeeks());
assertEquals(1, Weeks.ON... | 1 |
public void consultarEstudiantes() {
estudiantes = new LinkedList<Estudiante>();
String sql = "select DISTINCT u.id, u.cedula, u.first_name, u.last_name, u.phone_1, u.phone_2, u.direccion, u.email, u.username, u.activated, u.user_types_id, u.sections_id, u.created_at, e.monitoreo, e.investigacion, s.nom... | 9 |
public static void print(Object[] array) {
int i = 0;
int rowCount = 1;
int indent = array.length;
int spaces = 0;
while (i < array.length) {
indent = (int)Math.floor((float)(indent) / 2.0);
for (int k = indent; k > 0; k--) {
System.out.print(" ");
}
for (int j = rowCount; j > 0 && i ... | 5 |
public void ensureCapacity(int minCapacity){
modCount++;
int oldCapacity=tasks.length;
if (minCapacity > oldCapacity) {
int newCapacity = (oldCapacity *3)/ 2+1;
if(newCapacity < minCapacity)
newCapacity = minCapacity;
//minCapacity is uasually close to size, so this is a win:
tasks = Array... | 2 |
public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column ) {
ResultSetTableModel model;
Component result;
boolean found;
result = super.getTableCellRendererComponent(
... | 7 |
private static void saveGrid() {
File mapFolder = FileSystem.getFolder(worldFolder, "map");
for (Quadrant q : world.getGrid().QUADRANTS) {
StringBuilder quadText = new StringBuilder();
for (int y = 0; y < q.getChunks().size(); y++) {
for (int x = 0; x < q.getChunks().get(y).size(); x++) {
for (int... | 6 |
public int partition(int left, int right) throws InterruptedException{
int i = left, j = right;
int pivot = values[(left + right) / 2]; //middle element as pivot
while (i <= j) {
sortStateLock.lock();
try{
pivotPos = (left+right)/2;
while (values[i] < pivot){
i++;... | 4 |
@Override
protected boolean isAttackPlacesForPositionNotHarmingToAnotherFigures(int position, char[] boardElements, int dimension) {
return isPerpendicularAttackPlacementNotHarming(position, dimension, boardElements)
&& isDiagonalAttackPlacementNotHarming(position, boardElements, dimension);... | 1 |
public String decrypt(String str){
try{
ArrayList<Byte> tmp = new ArrayList<Byte>();
int flag = 0;
for(int i=0; i<str.length(); i++){
if(str.charAt(i)=='x'){
tmp.add(Byte.parseByte(str.substring(flag, i)));
flag = i+1;
... | 4 |
public int compareTo(Employee other)
{
if (salary < other.salary) return -1;
if (salary > other.salary) return 1;
return 0;
} | 2 |
public void FileReading(String filename){
RemoteClientAuctionService client = new RemoteClientAuctionService();
String name = "";
String id;
String date = null;
String bidsRemaining;
String current;
long endsBy = 0;
double currentBid = 1;
long itemId = 0;
int Bid;
int bidsRem = 0;
// byte[] b = ... | 7 |
public void fillStatement(PreparedStatement stmt, Object... params)
throws SQLException {
// check the parameter count, if we can
ParameterMetaData pmd = null;
if (!pmdKnownBroken) {
pmd = stmt.getParameterMetaData();
int stmtCount = pmd.getParameterCount();
... | 8 |
public void renderSpriteWithAlpha(int xp, int yp, Sprite sprite, int alphaPercentage) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < sprite.SIZEY; y++) {
int ya = y + yp;
for (int x = 0; x < sprite.SIZEX; x++) {
int xa = x + xp;
if (xa < - sprite.SIZEX || xa >= width || ya < 0 || ya >= height) ... | 8 |
public void checkHit(Car incommingCar) throws GameEndException{//untersucht ob an den angegebenen korrdinaten bereits ein auto steht und ob es ein hit ist
synchronized(this){
if(currentCars.size() > 0){
for(Car c : currentCars){
if(incommingCar.getDirection().opposedTo(c.getDirection())){
try{
... | 5 |
public Status runGame(Board board) throws ExitException{
boolean repeat = true;
final Timer timer = new Timer();
int time = 0;
final SecondTask add = new SecondTask(time);
timer.scheduleAtFixedRate(add, 0, 1000);
board.displayGrid();
while (repeat) {
... | 4 |
private VariablePrecisionTime getId3v2ReleaseDate() {
/* id3v1, v2.2, v2.3 */
VariablePrecisionTime id3year_yyyy=(VariablePrecisionTime)(getParent().queryBestResult(MediaProperty.ID3_YEAR));
Integer id3v2date_mmdd=(Integer)getParent().queryBestResult(MediaProperty.ID3V2_DATE);
Integer id3v2time_hhmm=(Integer)ge... | 7 |
private void resetImageProducers() {
if (topLeftCanvas != null) {
return;
}
super.graphicsBuffer = null;
aGraphicsBuffer_1166 = null;
minimapCanvas = null;
aGraphicsBuffer_1163 = null;
gameScreenCanvas = null;
aGraphicsBuffer_1123 = null;
... | 2 |
private int getFbo() {
if (fbo == 0) {
fbo = device.createRenderTarget(width, height, id);
}
return fbo;
} | 1 |
private void updateBoard(int x, int y, boolean doBacktrack) {
b[x][y] = (-1)*b[x][y];
for(int i = 0; i < springer.length;i+=2) {
int newX = x+ springer[i]; //x position of next jump point
int newY = y+ springer[i+1];
//check if springer can jump on this position
if(fieldAvailable(newX,newY)) {
... | 3 |
public void getInput()
{
Scanner scanner=new Scanner(System.in);
int a, b, count=0,val1, startSquare=0;
double value, newValue, m;
while(scanner.hasNextInt())
{
a=scanner.nextInt();
b=scanner.nextInt();
if(a==0 && b==0)
break;
value=Math.sqrt(a);
val1=(int) Math.sqrt(a);
newVal... | 8 |
public void start() {
//Set up Display
try {
Display.setDisplayMode(new DisplayMode(800,600));
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
System.exit(-1);
}
// init OpenGL
GL11.glMatrixMode(GL11.GL... | 5 |
public void start2 () {
wm = new double[20][Data.windows_size];
String QueryKinasesName = "%" + Data.kinease + "%";
//data.code = data.codenames[3];
String QueryCodeName = Data.code;
int windows_size = Data.windows_size;
//int windows_size = 9;
int shift = windows_s... | 9 |
private static boolean fieldsLegit(Level level, Field currentField,
Field currentFieldNeighbour, List<Field> bannedFields) {
if(currentField == null || currentFieldNeighbour == null) return false;
if(bannedFields.contains(currentField) || bannedFields.contains(currentFieldNeighbour)) return false;
if(... | 7 |
@SuppressWarnings("unchecked")
private void loadPlayerMap() {
checkFile();
try {
FileInputStream fileInputStream = new FileInputStream(getFile());
ObjectInputStream objInputStream = new ObjectInputStream(
fileInputStream);
PlayerMap = (HashMap<String, Player>) objInputStream.readObject();
objInput... | 3 |
static void lucasReeks(int aantal) {
int lucasEen, lucasTwee, lucasNieuw;
lucasEen = 2;
lucasTwee = 1;
if(aantal == 2) {
System.out.print("De eerste " + aantal + " Lucas-getallen: " + lucasEen + " " + lucasTwee);
} else if(aantal == 1) {
System.out.print("De eerste " + aantal + " Lucas-getallen: " + l... | 5 |
public static Packet unpackPacket(SocketAddress address, short id, ByteBuffer data){
switch (id){
case 1: return new RegisterUserPacket(address, data.array());
case 2: return new GetUserPacket(address, data.array());
case 3: return new GetUsersPacket(address);
cas... | 5 |
public Venda finalizarVendaAvista(double desconto) throws ExceptionGerenteVendas {
if(atual != null){
return this.finazilarVenda(desconto, FormaPagamento.A_VISTA.titulo, atual.getCliente(), atual.getDependente());
}
throw new ExceptionGerenteVendas( "A venda deve ser criada antes de ser finalizada"... | 1 |
ModelAndView handle(HttpServletRequest request, HttpServletResponse response) throws Exception {
final HandlerMapping handlerMapping = applicationContext.getBean(HandlerMapping.class);
final HandlerExecutionChain handler = handlerMapping.getHandler(request);
Assert.assertNotNull("No handler found for request, che... | 2 |
@Override
public ArrayList<String> lisaaViite(Viitetyyppi tyyppi, Map arvot) {
Viite lisattava;
Syotetarkastaja tarkastaja = new Syotetarkastaja();
if (tyyppi == Viitetyyppi.article) {
lisattava = new Article(tarkastaja);
} else if (tyyppi == Viitetyyppi.book) {
... | 6 |
public void setCompressed(boolean compressed) {
if (compressed != compressed_) {
this.compressed_ = compressed;
if (!compressed) {
this.setSize(getNormalSize());
this.setPreferredSize(getNormalSize());
this.setMaximumSize(getNormalSize());
for (Component c : getComponents())
c.setVisible(tr... | 5 |
public void actionPerformed(ActionEvent ae) {
//
// Process the action command
//
// "new" - Add a transaction
// "edit" - Edit a transaction
// "delete" - Delete a transaction
// "help" - Display help for loan accounts
//
try {
int ro... | 9 |
public void setRenderer(int row, int column) {
if (highlightedLines.contains(new Integer(row)))
setBackground(Color.yellow);
else
setBackground(null);
if (emphasizedLines.contains(new Integer(row)))
setForeground(Color.red);
... | 8 |
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
if(arg0.getComponent() == updateItem){
}else if(arg0.getComponent() == menuItem){
menuItem.setBackground(clickedColor);
}
} | 2 |
public ListIterator(Node<Item> first) {
current = first;
} | 0 |
public String generaTabla(String busqueda) {
ArrayList<String[]> equipos = bd.regresaMarcaSerieDeparta(Integer.parseInt(busqueda));
String tablaIn = "<table style=\"width:100%\" id=\"tablaResultado\">";
String tablaFin = "</table>";
String tr1 = "<tr>";
String tr2 = "</tr>";
... | 1 |
private String generateSignature(URL url, String consumerSecret,
String tokenSecret, String httpMethod, List<QParameter> parameters,
StringBuffer normalizedUrl, StringBuffer normalizedRequestParameters) {
String signatureBase = generateSignatureBase(url, httpMethod,
parameters, normalizedUrl, normalizedReq... | 6 |
@SuppressWarnings("unchecked")
public Map<String, String> getDBStats() {
return imageTemplateRepository.getDBStats().toMap();
} | 0 |
public String[] getOptions() {
String[] superOptions = super.getOptions();
String[] options = new String[4 + superOptions.length];
int current = 0;
if (getMarkovBlanketClassifier())
options[current++] = "-mbc";
options[current++] = "-S";
switch (m_nCVType) {
case (LOOCV) :
options[current++] =... | 7 |
public Automaton getAutomaton() {
return (Automaton) getSource();
} | 0 |
public static String formatPlayerNameForDisplay(String name) {
name = name.replaceAll("_", " ");
name = name.toLowerCase();
StringBuilder newName = new StringBuilder();
boolean wasSpace = true;
for (int i = 0; i < name.length(); i++) {
if (wasSpace) {
... | 3 |
public void testIsAfter_LocalTime() {
LocalTime test1 = new LocalTime(10, 20, 30, 40);
LocalTime test1a = new LocalTime(10, 20, 30, 40);
assertEquals(false, test1.isAfter(test1a));
assertEquals(false, test1a.isAfter(test1));
assertEquals(false, test1.isAfter(test1));
asse... | 1 |
public @Override void execute() throws CommandException {
final Module module = getModule();
final Namespace<? extends Kind> kindNamespace = module.getKindNamespace();
assert (kindNamespace != null): "Module supplied null kind namespace";
final Namespace<? extends Functor> functorNamespace = module.getFunctorNa... | 9 |
public float low(float x) {
if (x <= a)
return 1;
else if (x > a && x <= b)
return (1f / (a - b)) * x - ((float) b / (a - b));
else
return 0;
} | 3 |
public static void main(String[] args) {
stringWorld = new StringWorld();
try {
ServerSocket serverSocket = new ServerSocket(5000);
while(true) {
Socket socket = serverSocket.accept();
System.out.println("accept connection " + serverSocket.getInetA... | 2 |
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof User))
return false;
User other = (User) obj;
if (id == null)
{
if (other.id != null)
return false;
}
else if (!id.equals(other.id))
return false;
return... | 6 |
private int fastMaybeExtractCountryCode(StringBuilder nationalNumber, PhoneMetadata defaultRegionMetadata)
throws NumberParseException
{
String possibleCountryIddPrefix = "NonMatch";
if (defaultRegionMetadata != null)
{
possibleCountryIddPrefix = defaultRegionMetadata... | 9 |
public void setUser(ProfileBean pb) throws Exception{
Connection conn =null;
Statement stmt = null;
int rs;
try{
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection(url);
stmt = conn.createStatement();
St... | 5 |
public long read4bytes() throws IOException {
long b0 = read();
long b1 = read();
long b2 = read();
long b3 = read();
if (le)
return b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
else
return b3 | (b2 << 8) | (b1 << 16) | (b0 << 24);
} | 1 |
public boolean isError(SoapObject body) {
boolean flag = false;
try {
SoapObject error = (SoapObject) body.getProperty("error");
System.out.print(error);
String error_value = (String) error.getProperty("description");
String error_number = (String) error.g... | 2 |
private boolean checkJob(int arrive , int burst , int priority)
{
if( arrive < 0 || arrive > 999999999 ) {return false;}
if( burst <= 0 || burst > 999999999 ) {return false;}
if( priority <=0 || priority > 999999999) {return false;}
return true;
} | 6 |
* @param arg
* @param client
*/
private void cmd_flag(final String arg, final Client client) {
// @flag <object> = <flags
// ex. @flag me=D, should add the dark flag
final String[] args = arg.split("=");
final Player player = getPlayer(client);
final Room room = getRoom( player.getLocation() );
final... | 9 |
@Override
public boolean execute(AdrundaalGods plugin, CommandSender sender, String... args) {
if(args.length < 1)
return false;
final Shrine s = AGManager.getShrineHandler().getShrine(args[0]);
if(!(sender instanceof Player))
Messenger.sendMessage(sender, "You're not a player");
else if(s ==... | 3 |
@Override
public Object callFunction(String name, List<Object> arguments) {
Function function = functions.get(name.toLowerCase());
if (function != null){
Object returnValue = function.invoke(this,arguments);
return returnValue == null ? Nothing.VALUE : returnValue;
} else {
errorReporter.reportError(... | 2 |
public String getName() {
return this._name;
} | 0 |
private boolean isPossibleToPlaceDiagRightBelow(int boardElementsLength, int position, int dimension, int positionRightBelow) {
return elementDiagonallyRightBelow(dimension, position, positionRightBelow) < boardElementsLength
&& (elementDiagonallyRightBelow(dimension, position, positionRightBelo... | 1 |
public String getDescription() {
return "JFLAP 4 Beta File";
} | 0 |
private CellGui cellGuiAt(int row, int col, BoardGui board) {
for (CellGui cell : board.getCellGuis()) {
if (cell.underlying().row == row && cell.underlying().column == col) return cell;
}
throw new RuntimeException();
} | 3 |
public PDFXrefEntry makeXrefStreamEntry(int field2, int field3) {
switch (this) {
case FREE:
return forFreedObject();
case OBJ_IN_BODY:
return toBodyObject(field3, field2);
case OBJ_IN_STREAM:
return ... | 3 |
protected Class getTransitionClass() {
return automata.pda.PDATransition.class;
} | 0 |
@Override
public void executeTask() {
try {
sendingSocket = new DatagramSocket(SENDING_PORT);
sendingSocket.setBroadcast(true);
client = new Client();
client.setCurrentIP(InetAddress.getLocalHost().getHostAddress());
client.setHostname(InetAddress.getLocalHost().getHostName());
client.setPort(Serv... | 5 |
static void quickSort(long arr[], byte[] values, int sizeOf, int left, int right) {
if (left < right) {
int index = partition(arr, values, sizeOf, left, right);
if (left < index - 1)
quickSort(arr, values, sizeOf, left, index - 1);
if (index < right)
... | 3 |
public Deck() {
for (i = 0; i < 52; i++) {
if (z >= 13)
z = 0;
if (i < 13) {
Spades sCard = new Spades();
sCard.makeCard(z);
deck[i] = sCard;
z++;
}
if (i >= 13 && i < 26) {
Clubs sCard = new Clubs();
sCard.makeCard(z);
deck[i] = sCard;
z++;
}
if (i >= 26 && i < 3... | 9 |
public void SetAnimation(String type, ArrayList<Coordinate> changes){
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: SetAnimation() BEGIN");
}
getDrawing().SetAnimation(type, changes);
if (test || m_test) {
System.out.println("GameWindow :: SetAnima... | 4 |
public static List<SkeletonStream> getSkeletonStreams(OggPacketReader r) throws IOException {
Map<Integer, SkeletonStream> skelIds = new HashMap<Integer, SkeletonStream>();
List<SkeletonStream> skels = new ArrayList<SkeletonStream>();
int streams = 0;
OggPacket p;
while( (p = r.... | 6 |
@Override
public boolean posNeg(int a, int b, boolean negative) {
if (negative) {
return (a < 0 && b < 0);
}
else {
return ((a < 0 && b > 0) || (a > 0 && b < 0));
}
} | 5 |
public static int runGame() throws IOException{
initializeGame();
while(isGameNotOver()){
try {
game.printBoard(boardSize);
System.out.println("\nEnter your guesses \n" +
"------------------------------------------");
if(startWith >= playerCount)
startWith = 0;
for(currPlayer = startWi... | 7 |
public Vector getObjects(String prefix,int cidmask,boolean suspended_obj,
JGRectangle bbox) {
Vector objects_v = new Vector(50,100);
int nr_obj=0;
JGRectangle obj_bbox = tmprect1;
int firstidx=getFirstObjectIndex(prefix);
int lastidx=getLastObjectIndex(prefix);
for (int i=firstidx; i<lastidx; i++) {
JGO... | 8 |
static ResourceData createNegativeRR(byte rrtype, long expiry) {
switch (rrtype) {
case Resolver.QTYPE_A:
return new RR_A(null, 0, expiry);
case Resolver.QTYPE_PTR:
return new RR_PTR(null, 0, expiry);
case Resolver.QTYPE_NS:
return new RR_NS(null, null, expiry);
case Resolver.QTYPE_MX:
return new ... | 9 |
public Class<?> getReturnComponentType() {
return returnComponentType;
} | 1 |
private static void drawVerticalGripper(Graphics gc, DockLayoutNode secondary) {
int x = secondary.getX() + (secondary.getWidth() - GRIP_LENGTH) / 2;
int y = secondary.getY() - DIVIDER_SIZE + (DIVIDER_SIZE - GRIP_WIDTH) / 2;
int top = GRIP_HEIGHT / 2;
int bottom = GRIP_HEIGHT - top;
for (int xx = x; xx < x + ... | 1 |
private boolean checkState() {
while (paused && (player != null)) {
synchronized (player) {
if (player != null) {
try {
player.wait();
} catch (InterruptedException e) {
// ignored
}
}
}
}
return stopped();
} | 4 |
public static void call(final String mapping, final String data) throws Exception {
final Parser pzparser = DefaultParserFactory.getInstance().newFixedLengthParser(new File(mapping), new File(data));
final DataSet ds = pzparser.parse();
final String[] colNames = ds.getColumns();
while ... | 2 |
private void isDead(Character character) {
if (player == character) {
System.out.println("Zuul Tharn appears from nowhere and walks slowly towards you as Hrangst Jaltibrond cuts his own throat and falls to the ground on the other side of the room.");
System.out.println("Zuul Tharn: How d... | 3 |
@Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
String data;
try {
ArrayList<FilterBean> alFilter = new ArrayList<>();
if (request.getParameter("filter") != null) {
if (request.getParameter("filterop... | 7 |
@Override
public boolean hasNext() {
return _index < this._source.length;
} | 0 |
public String getReasonForStopping() {
return reasonForStopping;
} | 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 |
public boolean saveZutat(String zutatId, String zutatName, String zutatPreis, String zutatLager, String zutatEinheit){
boolean isValid = true;
int zId = Integer.parseInt(zutatId);
// Validation
if(!formValidator.isValidName(zutatName)){
isValid = false;
this.appendFormError("Feld \"Name\" fehlerhaft: "+f... | 8 |
public DataOut getOut(){
return out;
} | 0 |
static long div(long dividend, long divisor) {
if (divisor < 0) {
throw new IllegalArgumentException("divisor must be positive: " + divisor);
}
if (dividend >= 0) {
return dividend / divisor;
} else {
return (dividend + 1) / divisor - 1;
}
... | 2 |
public static boolean unbanPlayer(String[] args, CommandSender s) {
//Various checks
if(Util.isBannedFromGuilds(s) == true){
//Checking if they are banned from the guilds system
s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you be... | 6 |
public void act(List<Actor> newGrass)
{
incrementAge();
if(isAlive()) {
giveBirth(newGrass);
// Try to move into a free location.
Location newLocation = getField().freeAdjacentLocation(getLocation());
if(newLocation != null) {
... | 2 |
public InputStream getData() {
return data;
} | 0 |
public void processStimulus(Enumeration e) {
WakeupCriterion wc;
AWTEvent[] awtea;
while (e.hasMoreElements()) {
wc = (WakeupCriterion) e.nextElement();
if (!(wc instanceof WakeupOnAWTEvent)) {
continue;
}
awtea = ((WakeupOnAWTEvent) wc).getAWTEvent();
for (int i = 0; i < awtea.length; i++) {
... | 4 |
public static boolean isMD5( String str )
throws NullPointerException {
// MD5 hashes are 32 hex-characters long (representing 16 bytes)
if( str.length() != 32 )
return false;
// Each char must be a hex-character
try {
for( int i = 0; i < str.length(); i++ ) {
int tmp = hex2int( str.charAt(i) );... | 3 |
@Override
public PaymentResponse requestPayment(PaymentRequest request) throws ArsenalPayApiException {
ApiCommandProducer producer = new InitPayMkProducer(request, credentials);
ApiCommand command = producer.getCommand();
try {
final ApiResponse apiResponse = apiClient.executeCo... | 1 |
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int x = Integer.parseInt(st.nextToken());
ArrayLi... | 8 |
protected void setupStreams(ITestResult result, boolean printMethodName) {
String test_name=result.getTestClass().getName();
File dir=new File(output_dir + File.separator + test_name);
if(!dir.exists())
dir.mkdirs();
File _tests=new File(dir, TESTS), _stdout=new File(dir, STD... | 8 |
public boolean purchaseSpecialTile(String name, Tile t){
Player p = getPlayer(name);
if(p== null ||!p.equals(getCurrentPlayer())){
return false;//not your turn;
}
if(t==null || !(t instanceof SpecialTile)){
return false;
}
SpecialTile st = (SpecialTile) t;
if(p.getPoints() < st.getPrice())
return... | 5 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.