text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void onEnable(){
getDataFolder().mkdirs();
instance = this;
FruitManager fm = new FruitManager();
try {
FruitManager.getInstance().loadFruits();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e... | 2 |
@Override
public void run() {
Session session = plugin.getSession();
while (true) {
try {
List<String> queuedJobs = plugin.getQueuedJobs();
for (String jobID : queuedJobs) {
int status = -1;
try {
... | 9 |
public static void main(String[] args) throws FileNotFoundException, IOException{
Set<String> sw = StopWord.getStopWords();
List<String> dataFiles = new ArrayList<String>();
File[] files = new File("data").listFiles();
// Detect what files to clean.
for (File file : files) {
if (file.isFile()) {
... | 7 |
public synchronized void scheduleLeakCheck(Object target, String desc, final boolean forceClean) {
try {
if (forceClean)
scheduledThreadPoolExecutor.schedule(new CleanerTask(target), Math.min(waitTimeSeconds / 2, 20),
TimeUnit.SECONDS);
final long id = UnsafeUtils.addressOf(target);
final String oD... | 5 |
public Node<Integer> partition(Node<Integer> head, int x) {
if (head == null)
return null;
Node<Integer> newHead = head;
Node<Integer> tail = head;
Node<Integer> p = head.next;
while (p != null) {
Node<Integer> q = p;
p = p.next;
if (q.data <= x) {
q.next = newHead;
newHead = q;
} else... | 3 |
public void move() {
int roverXCor = getXCoordinate();
int roverYCor = getYCoordinate();
if (direction.equals("S") && plateau.isSpaceValid(roverXCor, roverYCor - 1)) {
y -= 1;
} else if (direction.equals("W") && plateau.isSpaceValid(roverXCor - 1, roverYCor)) {
... | 8 |
public static void IfPotion() {
for (int i = 0; i < playerInventory.length; i++) {
Item playerInventoryVariable = playerInventory[i];
if (playerInventoryVariable != null) {
if (playerInventory[i].getId() == 2) {
// playerInventoryVariable = true;
playerHealth = playerHealth + 125;
System.out... | 3 |
public static void main(String[] args) {
final String method = CLASS_NAME + ".main()";
try {
if (3 != args.length) {
throw new IllegalArgumentException("Invalid number of arguments. " + USAGE_HELP);
}
if (!Peer.start(args)) {
throw ... | 7 |
protected <R extends Model> R[] getConnectionArray(String field,
Class<R> type, Connection c) {
field = field.toLowerCase();
if (!fetched.containsKey(field)) {
R[] objs = (R[]) factory.fetch(type, this, c);
List<Model> list = new ArrayList<Model>();
String id = factory.getCache().getModelI... | 7 |
protected HttpURLConnection makeConnection(String localMd5) throws IOException {
HttpURLConnection connection = (HttpURLConnection)this.url.openConnection(this.proxy);
connection.setUseCaches(false);
connection.setDefaultUseCaches(false);
connection.setRequestProperty("Cache-Control", "no-store,max-age... | 1 |
public static String extractWord(List<Location> wordPlayed){
if(wordPlayed == null ||
getDirection(wordPlayed)==INVALID_DIR ||
!isContinuous(wordPlayed)){
return null;
}
StringBuffer sb = new StringBuffer();
sortLocation(wordPlayed);
for(int i=0;i<wordPlayed.size();i++){
Location loc = wordPlaye... | 6 |
public long count(int[] skill){
int total=0;
int max=0;
for(int value : skill){
total+=value;
max=Math.max(value, max);
}
int lower = total/2+1;
int upper = Math.min(max+(total-1)/2, total-1);
long result=0;
for(int i=0; i<skill.len... | 8 |
public PrimitiveOperator combineRightNRightOnLeft(PrimitiveOperator other) {
boolean[] newTruthTable = new boolean[8];
// the other gate is on the left side - on the MSB
newTruthTable[0] = truthTable[((other.truthTable[0]) ? 4 : 0) | 0]; //000
newTruthTable[1] = truthTable[((other.truthTable[1]) ? 4 : ... | 8 |
public void reloadPlugins() {
try {
createNewClassLoader();
}
catch(MalformedURLException ex) {
// big problem here, should not happen because of check at
// construction
ex.printStackTrace();
}
erasePluginClasses();
loadPlugins();
} | 1 |
public boolean[][] read() throws IOException{
if (size<=0) return null;
boolean[][] polyomino = new boolean[size][size];
int numBytes = (polyomino.length * polyomino[0].length + 7)/ 8;
byte[] b = new byte[numBytes];
if (-1 == i.read(b)) return null;
... | 6 |
public void modifyBookLanguage(BookLanguage lng) {
Connection con = null;
PreparedStatement pstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... | 4 |
public static <E extends Comparable<E>> E[] getTop(E[] array, int k) {
if (array == null || array.length == 0 || k <= 0)
return null;
MinHeap<E> minHeap = new MinHeap<E>();
minHeap.add(array[0]);
for (int i = 1; i < array.length; i++) {
if (minHeap.size() < k)
minHeap.add(array[i]);
else if (... | 6 |
@Override
public void run() {
//Bandera para salir del hilo si una de las conexiones falla
boolean continuar = false;
/*Gavarela: se pasará la excepción para poner en pantalla en mensaje de esta
switch(pruebaOlib()){
case 0://Conexión Exitosa
continuar = ... | 7 |
public int getMin() {
return this.lowerBound;
} | 0 |
public void addMark(Service service) {
// Service service = (Service) node.getUserObject();
List<Mark> markList = service.getMark();
List<BigInteger> mIdList = new ArrayList<BigInteger>();
for (Mark m : markList) {
mIdList.add(m.getId());
}
List<BigInteger> idList = new ArrayList<BigInteger>();
List<St... | 9 |
public void setCityCode(String cityCode) {
this.cityCode.set(cityCode);
} | 0 |
public static String htmlEscape(String text) {
if (text == null) {
return "";
}
StringBuilder escapedText = new StringBuilder();
for (int i = 0; i < text.length(); i++) {
char ch = text.charAt(i);
if (ch == '<')
escapedText.append("<");
else if (ch == '>')
esca... | 6 |
public double bonusDefense(Territoire t, Peuple attaquant) {
return t.has(SallePartiel.class) ? Double.POSITIVE_INFINITY : 0;
} | 1 |
private static void initModules() {
for (File f : ModuleUtil.getModuleList()) {
ModuleUtil.loadModule(f);
ModuleUtil.loadExtJars(f.getParentFile().getAbsolutePath());
}
Settings setting = SettingsUtils.getSettings();
ArrayList<BaseModule> modules = ModuleUtil.getModules();
for (BaseModule m : modu... | 4 |
@EventHandler
public void SkeletonSpeed(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Skeleton.Speed... | 7 |
public int[] minmax(Board curr)
{
// base case
if(curr.children.size()==0||curr.isOver())//has no children
{
this.bottom=curr.player;
int [] result=new int [2];
result[0]=curr.computeUtility(curr.player);
return result;
}
// recursive case
ArrayList<Board> myChildren=curr.children;
in... | 4 |
public DtoExtractor(ArrayList<ClientHandeler> clients){
this.clients = clients;
} | 0 |
private boolean turn_left_or_right() {
boolean has_turned;
Random random = new Random();
int r = random.nextInt(2);
boolean keep_right;
if(r == 0) { keep_right = false; } else { keep_right = true; }
Direction d = new Direction(dx,dy);
//has_turned = true;
if(keep_right && can_go_right()) {
d.turnR... | 4 |
public boolean check(BattleFunction iface, PokeInstance user, PokeInstance target, Move move) {
if (disabled && target.battleStatus.flags[4]) {
iface.print("The move failed...");
return false;
}
if (isAsleep && target.status != Status.Sleep) {
iface.print("The move failed...");
return false;
}
ret... | 4 |
public static AccommodationFacilityEnumeration fromValue(String v) {
for (AccommodationFacilityEnumeration c: AccommodationFacilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} | 2 |
private void put(JsonElement value) {
if (pendingName != null) {
if (!value.isJsonNull() || getSerializeNulls()) {
JsonObject object = (JsonObject) peek();
object.add(pendingName, value);
}
pendingName = null;
} else if (stack.isEmpty()) {
product = value;
} else {
... | 5 |
public void remove(int key) {
HashPrinter.tryRemove(key);
/** Run along the array */
int runner = 0;
int hash = (key % table.length);
while (table[hash] != null && runner < table.length) {
if (table[hash].getKey() == key) {
break;
}
runner++;
hash = ((key + runner) % table.length);
... | 6 |
@Override
public void playbackFinished(PlaybackEvent playbackEvent) {
if(gamePlayList != null) {
if(playOnce) {
gamePlayList.removeByFileName(filePath);
}
}
stop();
if(gamePlayList != null) {
gamePlayList.stoppedCurrentSong();
... | 3 |
public boolean unifyStatement(Statement rule, Structure query) {
if (unify(rule.left, query)) {
HashMap<String, Argument> tempMap = new HashMap<String, Argument>();
boolean ok = true;
if (rule.right==null) return true;
// pullUpVariables();
Lin... | 9 |
private ArrayList<Node> getNodes() {
Node node = null;
try {
//Get time, Connection and ResultSet
Long time = System.currentTimeMillis();
String sql = "SELECT * FROM [jonovic_dk_db].[dbo].[nodes];";
Connection con = cpds.getConnection();
Prep... | 2 |
public BlockMap$Slot init(float var1, float var2, float var3) {
this.xSlot = (int)(var1 / 16.0F);
this.ySlot = (int)(var2 / 16.0F);
this.zSlot = (int)(var3 / 16.0F);
if(this.xSlot < 0) {
this.xSlot = 0;
}
if(this.ySlot < 0) {
this.ySlot = 0;
}
if(this.... | 6 |
public boolean crafting() {
if (playerLevel[playerCrafting] >= crafting[1] && playerEquipment[playerWeapon] >= 0) {
if (actionTimer == 0 && crafting[0] == 1) {
actionAmount++;
actionTimer = 4;
OriginalShield = playerEquipment[playerShield];
OriginalWeapon = playerEquipment[playerWeapon];
player... | 7 |
private Unit getAppCntxtInsPt(){
for(Unit u : b.getUnits()){
Iterator it = u.getUseBoxes().iterator();
while(it.hasNext()){
Value v = ((ValueBox)it.next()).getValue();
if(v instanceof IdentityRef){ //includes ThisRef and ParameterRef
continue;
}
else{
return u;
}
}
}
return... | 3 |
private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... | 8 |
public static <T> Set<T> getAdjecentTrackObjects(World world, int x, int y, int z, Class<T> type) {
Set<T> tracks = new HashSet<T>();
T object = getTrackObjectFuzzyAt(world, x, y, z - 1, type);
if (object != null)
tracks.add(object);
object = getTrackObjectFuzzyAt(world, x,... | 4 |
public HashMap<String,String> getFileMsg(String IP_PORT,String apiKey,String id){
HttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://"+IP_PORT+"/cms/api/file?apikey="+apiKey+"&id="+id);
String backRes = "-1";
try {
HttpResponse httpResponse... | 3 |
public WarGameGUI()
{
setTitle("War");
going=true;
this.setBounds(100, 100, 800, 800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
buildPanel();
add(panel);
setVisible(true);
while(going)
{
while(start.isVisible())
{
start.doClick();
}
while(fight.isVisible())
{
fight.do... | 5 |
public static Date parsDateString2Date(String theDateStr)
throws ParseException {
theDateStr = theDateStr.trim();
if (!startsWithYear(theDateStr)) {
theDateStr = getCurrentDate("yyyy")+"-"+theDateStr;
}
String sepRegEx = "[^0-9]";
Pattern pattern = Pattern.compile(sepRegEx);
String[] terms = pattern.s... | 4 |
@Override
public void render() {
Game.getUserInterface().drawTextCentered(Game.WIDTH / 2, 100, UserInterface.PRIMARY_FONT_SIZE, "Tank Game",
Color.white);
Game.getUserInterface().drawTextCentered(Game.WIDTH / 2, 150, UserInterface.SECONDARY_FONT_SIZE, "Singleplayer",
selectedOption == 0 ? Color.red : Color... | 2 |
public int pageout(Page og){
// all we need to do is verify a page at the head of the stream
// buffer. If it doesn't verify, we look for the next potential
// frame
while(true){
int ret=pageseek(og);
if(ret>0){
// have a page
return (1);
}
if(ret==0){
/... | 4 |
public Boolean actualizar_propietario(String propietario, String propietarioNuevo) {
Boolean est = false;
List DNList = new cDN().leer_por_propietario(propietario);
System.out.println("tamanio con propietario igual:" + DNList.size());
Transaction trns = null;
sesion = HibernateUt... | 3 |
public static void main(String []arg) throws IOException{
int numBanks, i, loanCount;
double limit;
Bank[] bankList;
Stack<Integer> unsafeBanks = new Stack<Integer>();
String filepath;
Scanner fileinput = new Scanner(System.in);
Scanner input = null;
try {
//gets the location of the file co... | 5 |
public boolean addModerator(User mod){
if(isModerator(mod)) return false;
this.moderators.add(mod);
save();
return true;
} | 1 |
public void CopyBlock(int distance, int len) throws IOException
{
int pos = _pos - distance - 1;
if (pos < 0)
{
pos += _windowSize;
}
for (; len != 0; len--)
{
if (pos >= _windowSize)
{
pos = 0;
}
... | 4 |
static public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[14];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 7; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
... | 8 |
public void moveItem(final ThePacman theItem, final PacmanItem.Direction theDirection) {
controlTouch = false;
if (theDirection == null) {
return;
}
theItem.setFacingDirection(theDirection);
final byte itemInNextDirection = getItemInNextMove(pacman, theDirection);
if (itemInNextD... | 7 |
public boolean estEnLocation(){
if(this.situation == LOUE){
return true ;
}
else {
return false ;
}
} | 1 |
void mutateSelectedAtom() {
if (!(selectedComponent instanceof Atom))
return;
final Atom at = (Atom) selectedComponent;
if (at.isAminoAcid()) {
EventQueue.invokeLater(new Runnable() {
public void run() {
if (acidPopupMenu == null)
acidPopupMenu = new AminoAcidPopupMenu();
acidPopupMenu.s... | 9 |
public void render(Graphics g){
// render the header and footer
g.drawImage(header_ss.grabImage(1, 4, 642, 50), 0, 50, null);
g.drawImage(header_ss.grabImage(1, 5, 642, 50), 0, Cong.HEIGHT * Cong.SCALE - 65, null);
// render the score
for(int i = maxScore; i >= 1; i--){
... | 3 |
public void setTopics4GibbsCluster(int k, double[] alpha, int clusterNum, int vocalSize){
createSpace(k, 0);
setWordTopicStatCluster(k, vocalSize);
boolean xid = false;
m_alphaDoc = 0;
for (int i = 0; i < k; i++) {
xid = m_rand.nextBoolean();
m_topicIndicator[i] = xid;
if (xid == true) {
m_ind... | 5 |
public ResultSet preencherTabelaEncarregado(String Departamento) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(S... | 6 |
public void drawBackground(Graphics g) {
// draw the background graphics from the superclass
super.drawBackground(g);
ImageManager im = ImageManager.getSingleton();
Image img;
Position p;
// draw the map as a matrix of tiles with cities on top
for ( int r = 0; r < GameConstants.WORLDSI... | 4 |
public static int minPathSum(int[][] grid) {
int r = grid.length;
int c = grid[0].length;
int[][] s = new int[r][c];
for (int i = 0 ; i < r ; i++) {
for (int j = 0 ; j < c ; j++) {
int v1 = Integer.MAX_VALUE;
int v2 = Integer.MAX_VALUE;
... | 7 |
@Override
public void close() throws IOException {
if (fileChannel != null) {
fileChannel.close();
}
if (rf != null) {
rf.close();
}
} | 2 |
@Override
public void close() {
//Connection connection = open();
try {
if (connection != null)
connection.close();
} catch (Exception e) {
this.writeError("Failed to close database connection: " + e.getMessage(), true);
}
} | 2 |
public void capture (int i, int j, Node n)
// capture neighboring groups without liberties
// capture own group on suicide
{
int c = -P.color(i, j);
captured = 0;
if (i > 0) capturegroup(i - 1, j, c, n);
if (j > 0) capturegroup(i, j - 1, c, n);
if (i < S - 1) capturegroup(i + 1, j, c, n);
if (j < S - 1) ... | 8 |
public Quantity add (Quantity target) throws IllegalArgumentException
{
if(target.unit == null || !target.unit.equals(this.unit))
{ throw new IllegalArgumentException(); }
Quantity result = new Quantity (this.value + target.value, target.numerator, target.denominator);
return result;
} | 2 |
@Override
public boolean accept(File f) {
// Allow directories to be seen
if (f.isDirectory()) {
return true;
}
// Exit if no extensions exist
if (extensions == null) {
return false;
}
// Only show files with extensions we defined
... | 4 |
public static AccesBDInfo getInstance() {
if (instance == null) {
instance = new AccesBDInfo();
}
return instance;
} | 1 |
public boolean matches(int material, int data) {
if (this.material != material) {
return false;
}
if (this.data == null) {
return true;
}
for (int i = 0; i < this.data.length; i++) {
int val = this.data[i];
... | 7 |
@Override
public BencodeDictionary parse(BufferedInputStream inputStream) throws IOException, BencodeParseException {
readAndCheckFirstByte(inputStream);
TreeMap<BencodeString, BencodeType> bencodeValuesMap = new TreeMap<BencodeString, BencodeType>();
int currentByte;
while ((curren... | 2 |
public void act()
{
if (canMove())
move();
else
turn();
} | 1 |
public void mouseEntered(MouseEvent paramMouseEvent) {
String str = null;
if (ImageButton.this.Enabled)
{
if (ImageButton.this.MouseOverImage != null)
{
if (ImageButton.this.ImageMap != null)
{
str = ImageButton.this.checkMap(paramMouseEvent.getX(), par... | 7 |
@Override
public ValueType returnedType(ValueType... types) throws Exception {
// Check the number of argument
if (types.length == 1) {
// if array
if (types[0] == ValueType.NONE) {
return ValueType.NONE;
}
// If numerical
if (types[0].isNumeric()) {
return ValueType.DOUBLE;
}
// if ... | 4 |
public void testGetIntervalConverterRemovedNull() {
try {
ConverterManager.getInstance().removeIntervalConverter(NullConverter.INSTANCE);
try {
ConverterManager.getInstance().getIntervalConverter(null);
fail();
} catch (IllegalArgumentException... | 1 |
public void nextScene()
{
if (current_scene < scene_texture.size())
{
current_scene++;
}
else if (current_scene == scene_texture.size())
{
current_scene = scene_texture.size();
}
} | 2 |
@Override
public void leenUit(Product product) throws DomainException {
if(product.getStaat().equals(UitgeleendState.class))
throw new DomainException("Product is al uitgeleend");
if(product.getStaat().equals(BeschadigdState.class))
throw new DomainException("Product is beschadigd");
if(product.getStaat().... | 3 |
private void collisionCheck() {
Map<Double, Double> corners = new HashMap<Double, Double>();
corners.put(ball.getX(), ball.getY()); //left-top
corners.put(ball.getX(), ball.getY() + diameter); //left-bottom
corners.put(ball.getX() + diameter, ball.getY()); //right-top
corners.put(ball.getX() + diam... | 7 |
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected instanceof Item)
&&(((Item)affected).owner() instanceof Room)
&&(((Room)((Item)affected).owner()).isContent((Item)affected))
&&(msg.sourceMinor()==CMMsg.TYP_SPEAK)
&&(invoker!=null)
... | 7 |
public int[] remplissageMax(){
int positionMax = 0;
// On veut bien commencer par la premiere case non null
// pour ne pas avoir des problemes a la comparaison plus tard
for (int i=0; i<table.length; i++)
if (table[i] != null){
positionMax = i;
... | 6 |
private void getRoom(Element roomElement) {
String spriteName=roomElement.getAttribute("sprite");
String name=getTextValue(roomElement,"name");
String description=getTextValue(roomElement,"description");
String backgroundLayer=getTextValue(roomElement, "background");
String objectLayer=getTextValue(roomElemen... | 6 |
public static void polygon(boolean fill, double... points) {
int[] xPoints = new int[points.length / 2];
int[] yPoints = new int[points.length / 2];
for (int i = 0; i < points.length; i ++) {
if (i % 2 == 0) {
xPoints[i/2] = (int)points[i];
} else {
yPoints[i/2] = (int)points[i];
}
}
if (fill... | 3 |
public static String cleanPath(String path) {
if (path == null) {
return null;
}
String pathToUse = replace(path, WINDOWS_FOLDER_SEPARATOR, FOLDER_SEPARATOR);
// Strip prefix from path to analyze, to not treat it as part of the
// first path element. This is necessary to correctly parse paths like
// "f... | 8 |
public Boolean checkBalance(privAVLNode x)
{
if(x == null)
return true;
int bal = 0;
if(x.getChild(0) != null)
bal = x.getChild(0).getHeight()+1;
if(x.getChild(1) != null)
bal = bal-(x.getChild(1).getHeight()+1);
if(!(bal==-1 || bal==0 || bal==1))
return false;
return true;
} | 6 |
public static boolean resetSeason() {
File f = new File(pathGame);
f.delete();
File fB = new File(pathBonus);
fB.delete();
List<User> users=GameData.getCurrentGame().getAllUsers();
File fUser; //remove all of users previous answers
for(User u:users){
fUser = new File(pathUserAnswer+u.getID()+".dat")... | 3 |
public void update() {
if (end) gsm.setState(lastState);
handleInput();
ticks++;
if (ticks > wait) {
if (speed == 0) pos--;
else if (ticks % speed == 0) pos--;
}
if ((pos + line(8) + (lineGap / 2)) < 0) end = true;
} | 5 |
private static Normalization determineNormalization(Element model) {
Normalization normMethod = Normalization.NONE;
String normName = model.getAttribute("normalizationMethod");
if (normName.equals("simplemax")) {
normMethod = Normalization.SIMPLEMAX;
} else if (normName.equals("softmax")) {
... | 8 |
public void addCarEventCount(int count) {
if(count < 0) count = 0;
if(carEvents.getSize() == 0) {
carEventMin = count;
carEventMax = count;
} else {
if(count < carEventMin) carEventMin = count;
if(count > carEventMax) carEventMax = count;
}
... | 4 |
private void update() {
if(menu==null){
if(story==null){
lvl.update(inHandler);
long timeElapsed = System.currentTimeMillis() - oldTime;
// System.out.println(timeElapsed);
if (timeElapsed < 40) {
try {
Thread.sleep((long) 40 - timeElapsed); // ~25 updates per second
} catch (InterruptedException... | 4 |
String readFile(String fileName) {
File file = new File(fileName);
if (!file.exists()) fatalError("No such file '" + fileName + "'");
if (!file.canRead()) fatalError("Cannot open file '" + fileName + "'");
return Gpr.readFile(fileName);
} | 2 |
@Override
public int compareTo(Card o) {
if (o == null) {
throw new NullPointerException();
}
if (getSorting() == o.getSorting()) {
int sign = Main.ascending ? 1 : -1;
if (rank == 1 && o.rank != 1) {
return sign;
} else if (o.rank == 1 && rank != 1) {
return -sign;
}
return sign * Integ... | 7 |
public static void Read(String book) {
if(!book.startsWith("Book:")) {
book = "Book:" + book;
}
for(int j=0; j<Inventory.length; j++) {
if(GetItemName(Inventory[j]).equalsIgnoreCase(book)) {
GUI.log(Books.getName(Inventory[j]) + "\n~~~~\n" + Books.getBook(Inventory[j]));
break;
}
}
} | 3 |
public ResultSet retrieveStockData() throws SQLException {
try {
databaseConnector = medicineConnector.getConnection();
stmnt = databaseConnector.createStatement();
SQLQuery = "SELECT * FROM familydoctor.medicine";
dataSet = stmnt.executeQuery(SQLQuery);
... | 3 |
public void updateStatus(Object obj) {
Space p = (Space) obj;
if (spaceObj_.getName() == p.getName()) {
spaceObj_ = p;
String status = "";
status += spaceObj_;
bg_pic.setToolTipText(status);
if (spaceObj_ instanceof PropertySpace) {
... | 9 |
public PlayerPanel(Player p) {
this.player = p;
this.hand = this.player.getHand();
this.books = this.player.getBooks();
this.playerName = new JLabel(p.getName());
this.add(this.playerName);
// Add the player's books to the panel
BookStack bs;
for (int i = 0; i < this.books.size(); i++) {
bs = new B... | 2 |
@Override
public void processPacket(Client c, int packetType, int packetSize) {
int itemId = c.getInStream().readSignedWordA();
if (!c.getItems().playerHasItem(itemId,1))
return;
switch (itemId) {
case 11694:
c.getItems().deleteItem(itemId,1);
c.getItems().addItem(11690,1);
c.getItems().add... | 6 |
public void testConstructor_long_long3() throws Throwable {
DateTime dt1 = new DateTime(2005, 7, 10, 1, 1, 1, 1);
DateTime dt2 = new DateTime(2004, 6, 9, 0, 0, 0, 0);
try {
new MutableInterval(dt1.getMillis(), dt2.getMillis());
fail();
} catch (IllegalArgumentExce... | 1 |
@SuppressWarnings("empty-statement")
public JDialog initJdAdd() {
jd_add = new JDialog(this);
jd_add.setModal(true);
if (temp == false) {
jd_add.setTitle("添加键值对");
} else {
jd_add.setTitle("编辑键值对");
}
jd_add.setLayout(null);
// jd_add.s... | 2 |
@Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) {
if (!Commands.isPlayer(sender)) return false;
Player p = (Player) sender;
if (args.length != 1) return false;
channel.removeChannel(p, args[0]);
return true;
} | 2 |
public void removeIrrelevantArtists() throws SQLException
{
List<Integer> nonPersonnel = new LinkedList<Integer>();
String sql = "select * from artist LEFT JOIN personnel ON artist_id = artistnumber WHERE artistnumber IS NULL";
PreparedStatement ps = Connect.getConnection().getPreparedStatement(sql... | 5 |
public void HangupBridgeCalls(){
Iterator<Entry<CallFrame, List<String>>> bridgeIterator = bridgeLines.entrySet().iterator();
while (bridgeIterator.hasNext()) {
Entry<CallFrame, List<String>> entry = bridgeIterator.next();
List<String> bridgeList = (List<String>) entry.getValue();
if(bridgeList.get(0).star... | 2 |
public static int search_function_by_name(Function_table function_table, String name) {
int num = function_table.function_name.size();
for (int i = 0; i < num; i++) {
if (function_table.function_name.get(i).toString().equals(name)) {
return i;
}
}
... | 2 |
private void formLine(boolean create,
int playBookNumber,
int setNumber,
int formationNumber,
int playNumber,
Connection database,
PrintWriter webPageOutput)
{
... | 8 |
public void paint( Graphics g ){
super.paint(g);
// actualizamos dimensiones
int cantAtr = getSizeAtributos();
int cantMet = getSizeMetodos();
int px=this.getX();
int py=this.getY();
int w=this.getWidth();
int h=this.getHeight();
... | 5 |
public void click(Point loc) {
Rectangle[] rects = buildHeaders();
for (int i = 0; i < rects.length; i++) {
if (rects[i].contains(loc)) {
if (i == defaultTab)
defaultTab = -1;
else
defaultTab = i;
break;
}
}
if (curTab != -1) {
Rectangle rect = getMainRect(curTab);
if (rect.con... | 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.