text stringlengths 14 410k | label int32 0 9 |
|---|---|
public List<Point> findPath(int startx, int starty, int endx, int endy) {
NodeSet openSet = new NodeSet();
nodes.get(startx).get(starty).costFromStart = 0;
nodes.get(startx).get(starty).predictedTotalCost = nodes.get(startx)
.get(starty).costFromStart
+ manhattanDistance(startx, starty, endx, endy);
ope... | 8 |
private void createWindow(){
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName() );
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} ... | 5 |
@Override
public int adjustedArmor(MOB mob)
{
int currDex=mob.charStats().getStat(CharStats.STAT_DEXTERITY);
final int maxDex = mob.charStats().getMaxStat(CharStats.STAT_DEXTERITY);
int dexBonus = 0;
if(currDex > maxDex)
{
dexBonus = currDex - maxDex;
currDex = maxDex;
}
double baseDex=mob.baseCha... | 7 |
public void drawDice(Graphics2D g, int dice)
{
if(dice == 1)
{
g.setColor(Color.WHITE);
g.fillRect(550, 400, field_size, field_size);
g.setColor(Color.BLACK);
g.fillOval(567, 417, 6, 6);
}
else if(dice == 2)
{
g.setC... | 6 |
public static AlgorithmTypeFactory getInstance() {
if (instance == null) {
instance = new AlgorithmTypeFactory();
}
return instance;
} | 1 |
public static int getSideSnowGrassTexture(IBlockAccess blockAccess, int x, int y, int z, int side) {
if (!isBetterGrass()) {
return 68;
} else {
if (isBetterGrassFancy()) {
switch (side) {
case 2:
--z;
break;... | 8 |
public static ArrayList<ItemSet> findRuleSubsets(ItemSet candidates, ArrayList<ItemSet> sets){
ArrayList<ItemSet> allRuleSets = sets;
if(!allRuleSets.contains(candidates)){
allRuleSets.add(candidates);
}
for(int i = 0; i < candidates.getItemSet().size();i++){
ArrayList<Item> subset = new ArrayLi... | 2 |
public boolean canMoveTo(int inLocX, int inLocY,Entity thnStore) {
Entity thnStore2;
DuskObject objStore = null;
Script scrStore;
boolean blnStore;
try {
objStore = objEntities[inLocX][inLocY];
} catch(Exception e) {}
if (SCR_IGNORE_COL != null) {
while (objStore != null) {
if (objStore.isLiving... | 7 |
private void checkEnd() {
if (end) {
throw new IllegalStateException(
"Cannot call a visit method after visitEnd has been called");
}
} | 1 |
private void setUpLookAndFeel() {
//<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://download.oracle.com/javase/tutorial/uiswing/lookandfee... | 6 |
private void createHtmlOutput ( Shell shell,
ICompilationUnit compUnit ) {
// TODO Auto-generated method stub
String directory;
IResource res = compUnit.getResource ();
boolean newDirectory = true;
directory = getPersistantProperty ( res, path );
if ( directory != null && directory.length() > 0 ) {
... | 5 |
public ComplexPoly nthDerivative(int n){
ComplexPoly dnydxn;
if(n>this.deg){
dnydxn = new ComplexPoly(0.0);
}
else{
dnydxn = new ComplexPoly(this.deg-n);
Complex[] nc = Complex.oneDar... | 3 |
private void copyCheckboxAndSlidderValuesToTextfield(final Component comp){
//final Component comp = event.getComponent();
if( comp instanceof MyComponent ){
final MyComponent myComp = (MyComponent)comp;
final int actvY = myComp.getCompRelationY(); //First time use!! LOL! (... | 7 |
public CountButton(int x, int y, int width, int min, int max, int step, int value) {
super(x, y, width, 32);
this.min = min;
this.max = max;
this.step = step;
this.value = value;
minus = new ArrowButton(x, y, 326, 16);
minus.addClickEvent(new ClickEvent() {
@Override
public void trigger() {
C... | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
KineticLaw other = (KineticLaw) obj;
if (math == null) {
if (other.math != null)
return false;
} else if (!math.equals(other.math))
r... | 6 |
public void close() throws IOException {
if (inStream != null) {
inStream.close();
}
if (errStream != null) {
errStream.close();
}
if (conn != null) {
conn.disconnect();
}
} | 3 |
public GUIManager getGUI() {
return this.gui;
} | 0 |
public void updateFromScorecard(Scorecard scorecard) {
ArrayList<Integer> scores = scorecard.getScoresForHole(holeNumber);
for (int score : scores) {
addTimePlayed();
if (score == 1) { addHolesInOne(1); }
if (score < bestScore) { bestScore = score; }
averageScore = (averageScore + score) / timesPlayed;
... | 4 |
private void SelectJButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_SelectJButtonMouseClicked
//if merchant was not selected then pop warning
int[] rowsSelected = loyaltyProgramJTable.getSelectedRows();
if(rowsSelected.length > 0 && rowsSelected.length < 2){
//st... | 4 |
public synchronized boolean isFull() {
if (getMaxSize() > getSize()) {
return false;
} else {
return true;
}
} | 1 |
public void addBloodStain( int x , int y ) {
BufferedImage stain = resource.getImage( Trollface.IMG_BLOODSTAIN );
int stainWidth = stain.getWidth( );
int stainHeight = stain.getHeight( );
// Gives the stain a random angle
BufferedImage maniStain = new BufferedImage( stain.getWidth( ) , stain.getHeight( ) ,... | 8 |
private void gameLoop() {
World.setDefaultThread(Thread.currentThread());
buffer=new FrameBuffer(width, height, FrameBuffer.SAMPLINGMODE_NORMAL);
buffer.enableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.setBoundingBoxMode(FrameBuffer.BOUNDINGBOX_NOT_USED);
buffer.optimizeBufferAccess()... | 9 |
public void output() {
ListElement current = head;
while (current != tail.next()) {
System.out.print(current.getValue() + " ");
current = current.next();
}
System.out.println();
} | 1 |
@Override
public void paint(Graphics g) {
if (state == GameState.Running) {
g.drawImage(background, bg1.getBgX(), bg1.getBgY(), this);
g.drawImage(background, bg2.getBgX(), bg2.getBgY(), this);
paintTiles(g);
ArrayList<Projectile> projectiles = robot.getProjectiles();
for (int i = 0; i < projectiles.... | 3 |
public void setImporte(float importe) {
this.importe = importe;
} | 0 |
@Override
public void fill(Parameter parameter, Type type, Annotation[] annotations)
{
boolean isFlag = false;
boolean isNamed = false;
for (Annotation annotation : annotations)
{
if (annotation instanceof Flag)
{
if (isNamed)
... | 7 |
private String formatClass(String str)
{
String class_abbrv = "";
String class_num = "";
String class_section = "";
String formattedString = "";
int firstSub = 0;
int secondSub = 0;
int thirdSub = 0;
int fourthSub = 0;
int fifthSub = 0... | 4 |
private void lineSelectHandler(Page currentPage, Point mouseLocation) {
if (currentPage != null &&
currentPage.isInitiated()) {
// get page text
PageText pageText = currentPage.getViewText();
if (pageText != null) {
// clear the currently sele... | 5 |
public void handleLeftClick(double x, double y, SUIComponent concerned){
if(host.equals(concerned))
frame.goTo(new HostPanel(frame));
else if(cancel.equals(concerned))
frame.goTo(new MainMenuPanel(frame));
else if(join.equals(concerned))
frame.goTo(new JoinPanel(frame));
else if(avatar_set.equals(conce... | 6 |
public void modify() throws IOException{ //Modify question - both prompt and answers
String s;
int val = 0;
Out.getDisp().renderLine("Would you like to change the prompt? (Y/N)");
s = Input.inputString();
if (s.equals("Y")||s.equals("y")){
Out.getDisp().renderLine(prompt);
Out.getDisp().renderLine("P... | 8 |
public static boolean isValidDate(String stringDate) {
if (stringDate.length() == 10) {
String stringDay = stringDate.substring(0, 2);
String separatorOne = stringDate.substring(2, 3);
String stringMonth = stringDate.substring(3, 5);
String separatorTwo = stringDa... | 7 |
public static void main(String... args) {
ExecutorService executors = Executors.newCachedThreadPool();
Runnable task = new Runnable() {
@Override
public void run() {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
... | 5 |
public long getElapsedTicks() {
long cur=System.currentTimeMillis();
long l=cur-ticks;
if (l>=granularity) {
ticks=cur-(l%granularity);
return l/granularity;
}
return 0;
} | 1 |
private void stop() throws IOException, InterruptedException {
if (responding && !action.isOther())
return;
GoogleResponse gr = null;
responding = true;
started = false;
if (!testMode) {
System.out.println("Stopped");
microphone.close();
microphone.open();
System.out.println("Process");
lcd.... | 8 |
protected Instances determineOutputFormat(Instances inputFormat)
throws Exception {
FastVector atts;
FastVector values;
Instances result;
int i;
// attributes must be numeric
m_Attributes.setUpper(inputFormat.numAttributes() - 1);
m_AttributeIndices = m_Attributes.getSelecti... | 8 |
public boolean isGrey() {
if (myColor.equals(GREY))
return true;
return false;
} | 1 |
public static void makeCompactGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
} catch (... | 7 |
public static String matchMovieFromRT(String jsonResponse, Movie movie)
throws JSONException
{
JSONObject jsonObject = new JSONObject(jsonResponse);
JSONArray jsonArray = jsonObject.getJSONArray("movies");
for (int i = 0; i < jsonArray.length(); i++)
{
JSONObj... | 5 |
public void processKeyboard()
{
if(Keyboard.isKeyDown(Keyboard.KEY_F1))
{
state_mgr_.setActive("Elevation");
}
else if(Keyboard.isKeyDown(Keyboard.KEY_F2))
{
state_mgr_.setActive("Temperature");
}
else if(Keyboard.isKeyDown(Keyboard.KEY_F3))
{
state_mgr_.setActive("Rainfall");
}
else if(Ke... | 6 |
public void visitingLocalitiesCheck()
{
// handles the home locality being 'North'
if (refereeClass.getHomeLocality().equals("North"))
{
// set the north check box to be selected,
// and un-select the other check boxes
northCheckBox.setSelected(true);
centralCheckBox.setSelected(false);
southCheck... | 3 |
@Override
public Operation create(Scanner scanner) throws FactoryException {
try {
String type = scanner.next();
if (type.equals("median"))
return new MedianOperation();
else if (type.equals("average"))
return new AverageOperation();
... | 3 |
public void updateQueue(Queue<core.GroupOfUnits> units)
{
int i = 0;
WidgetMap mapWidget = battle.getMapWidget();
queue.clearLevel(3);
queue.clearLevel(4);
p2u = new Position2Object<core.GroupOfUnits>();
for (core.GroupOfUnits u: units) {
queue.getImageStack(i/3, i%3).setLayer(3, new gui.WidgetImage(u.t... | 1 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
final Player s = (Player)sender;
if (plugin.getLookup().isEnabled()) {
final Player[] onlineplayer = Bukkit.getOnlinePlayers();
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnabl... | 7 |
public static String convert(String s, int nRows) {
String[] rows = new String[nRows];
int rowIndex = 0;
int next;
if (nRows == 1)
next = 0;
else
next = -1;
for (int i = 0; i < s.length(); i++) {
if (rowIndex == 0 || rowIndex == nRows - 1)
next = -next;
if(rows[rowIndex] == null) rows[rowInd... | 7 |
public void showValues() {
String attribute;
ArffSortedTableModel model;
ArffTable table;
HashSet values;
Vector items;
Iterator iter;
ListSelectorDialog dialog;
int i;
int ... | 7 |
public int[] sampling(int k) throws OutOfRangeSampleSize{
int centroidIndexes[]=new int[k];
//choose k random different centroids in data.
Random rand=new Random();
rand.setSeed(System.currentTimeMillis());
if(k <= 0 || k > this.distinctTuples)
throw new OutOfRangeSampleSize("Errore! - Numero di iterate... | 6 |
protected void act() {
if(state == -1) {
doBehavior(new DodgeBehavior());
}
else if(state == 0) {
float rotation = Robot.getInstance().getOdometryPoseProvider().getPose().relativeBearing(goal.getLocation())%360;
if(rotation > 180) {
rotation = -(360 - rotation);
}System.out.println(rotation);
A... | 7 |
public String toString()
{
String res = "";
for (int indiceParcoursLongueurMap=0; indiceParcoursLongueurMap<Plateau.LONGUEUR_DE_LA_MAP; indiceParcoursLongueurMap++)
{
for (int indiceParcoursLargeurMap=0; indiceParcoursLargeurMap<Plateau.LARGEUR_DE_LA_MAP; indiceParcoursLargeurMap++)
{
if (this.platea... | 3 |
public void keyPressed(KeyEvent key){
//WASD moves
origX = x;
origY = y;
switch (key.getKeyChar()){
case 'w' : this.y = this.y - logicHandler.getPlayer().getSpeed(); break;
case 'a' : this.x = this.x - logicHandler.getPlayer().getSpeed(); break;
case 'd' : this.x = this.x + logicHandl... | 5 |
protected void defineFeedTypeIfNecessary(String content) {
if (type == Type.Undefined) {
int maxSearchLen = Math.min(300, content.length() );
boolean isRSS = content.substring(0, maxSearchLen).indexOf("<rss") != NOT_FOUND;
type = isRSS ? Type.RSS : Type.Atom;
}
} | 2 |
private Object createNewAppContext() {
// Add the current thread to our disposeAppContextThreadMap if it does not exit already
if (!disposeAppContextThreadMap.containsKey(Thread.currentThread())) {
disposeAppContextThreadMap.put(Thread.currentThread(), new Disposal());
}
// same as SunToolkit.createNewAppCo... | 8 |
@Override
public List<String> getExpiredAcctOrCharsList()
{
final List<String> expired = new ArrayList<String>();
if(CMProps.getBoolVar(CMProps.Bool.ACCOUNTEXPIRATION))
{
final long now=System.currentTimeMillis();
if(CMProps.isUsingAccountSystem())
{
for(final Enumeration<PlayerAccount> e = CMLib.p... | 9 |
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner scan = new Scanner(System.in);
String userInput = scan.nextLine();
Pattern digitRegex = Pattern.compile("[\\d\\.]+");
Matcher digitMatch = digitRegex.matcher(userInput);
ArrayList<String> numbers = new ArrayList<>();
A... | 5 |
public static void main(String args[])
{
//total count is 41411,each time fetch 2000 records
int total=41411;
int limit=2000;
connection conn;
SQLconnection sqLconnection;
conn=new connection();
sqLconnection=conn.conn();
ExecutorService executorService = Executors.newFixedThreadPool(total/limit);
lo... | 2 |
public String getCmd()
{
return name;
} | 0 |
private Tuple hashJoin() throws TransactionAbortedException, DbException {
Tuple t;
Field f;
if (iterFirst) {
// First run-through, Create Hash Relations
hashBlock = new HashMap<Field, ArrayList<Tuple>>();
while(children[0].hasNext()) {
blockBlock = new ArrayList<Tuple>();
t = children[0].next();
... | 7 |
public void SetSolenoidValue(int channel, boolean value){
solenoid[channel - 1] = (byte) (value ? 1:0);
} | 1 |
@Override
public void caseADeclEnquantoDefinicaoComando(ADeclEnquantoDefinicaoComando node)
{
inADeclEnquantoDefinicaoComando(node);
if(node.getPontoVirgula() != null)
{
node.getPontoVirgula().apply(this);
}
if(node.getFimEnquanto() != null)
{
... | 8 |
public void onSignal(final long time, String loc, String cell) throws IOException {
boolean isInside = KbUtils.getInstance().isInside(loc, cell);
AccountSnapshot accountSnapshot = new AccountSnapshot(start, imsi, time, isInside, true, lastStart, lastTime, lastInside, lastRecentDays, lastStatus);
... | 9 |
private void createWindow()
{
frame = new JFrame("Wumpus World");
frame.setSize(840, 640);
frame.getContentPane().setLayout(new FlowLayout());
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
gamepanel = new JPanel();
gamepanel.setPreferredSize(... | 3 |
public int getId(){
return id;
} | 0 |
private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) {
char[] sa = src.array();
int sp = src.arrayOffset() + src.position();
int sl = src.arrayOffset() + src.limit();
sp = (sp <= sl ? sp : sl);
byte[] da = dst.array();
int dp = dst.arrayOffset() + dst.position();
int dl = dst.arrayOffset() + dst.l... | 9 |
public static Labo selectOne(EntityManager em, String code_lab) throws PersistenceException {
Labo unLabo = null;
unLabo = em.find(Labo.class, code_lab);
return unLabo;
} | 0 |
public void tapCard(String ID, boolean tapped) {
for (Object e : table.getComponents()) {
if ((e.getClass().equals(TCard.class)
|| e.getClass().equals(Token.class))
&&((TCard) e).getID().equals(ID)) {
if (tapped) {
((TCard) ... | 5 |
public User findUser(String userName) {
if (userList == null) {
loadUsers();
}
for (User u : userList) {
if (u.getUserData().getUserName().equals(userName)) {
return u;
}
}
return null;
} | 3 |
@Override
public void collisionCheck(ArrayList<BreakoutComponent> al) {
Rectangle cr = new Rectangle();
al.remove(super.r);
for (int i = 0; i < al.size(); i++) {
cr = al.get(i).r;
if (super.r.intersects(cr)) {
if (super.r.intersects(cr)){
verticalCollision();
System.out.println("r... | 3 |
public static void printAsTree(List<Integer> array, int i){
/*Checks if the tree isnt empty*/
if(array.isEmpty() != true){
/*Checks if there is a right node*/
if(i*2+1 <= array.size()){
printAsTree(array, i*2+1);
}
int s = i;
int level = (int)Math.ceil(Math.log(s+1)/Math.log(2));
/*Pri... | 4 |
public void process() {
for (int i = 0; i <= 5000; i++) {
if (globalItemID[i] != 0)
globalItemTicks[i]++;
if ((hideItemTimer+showItemTimer) == globalItemTicks[i]) {
// misc.println("Item Removed ["+i+"] id is ["+globalItemID[i]+"]");
if(!globalItemStatic[i]) {
removeItemAll(globalItemID[i], glo... | 6 |
public List<Order> findOrder(String accountName, String clientId) throws XStoreException{
List<Order> orders = null;
logger.info("accountName - " + accountName);
logger.info("clientId - " + clientId);
try {
TypedQuery<Order> qry = em.createQuery("select O from Order O where O.account.client.clientName=:clien... | 2 |
@After
public void after() throws Exception {
try {
proxy.exit();
} catch (Exception e) {
// This should not happen. In case it does, output the stack trace for easier trouble shooting.
e.printStackTrace();
}
try {
server.exit();
} catch (IOException e) {
// This should not happen. In case it ... | 3 |
public static int search3(int[] A, int target) {
if (A.length == 0)
return -1;
int l = 0;
int r = A.length - 1;
int m;
while (l <= r) {
m = (l + r) / 2;
if (target == A[m]) {
return m;
} else if (A[l] <= A[m]) {
// left sorted
if (target < A[m] && target >= A[l]) {
r = m - 1;
... | 8 |
public static void main(String[] args) throws Throwable {
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
int N=10000;
ArrayList<int[]> lAdy[]=new ArrayList[N];
dijkstra=new int[10000];
visitados=new boolean[10000];
for(int i=0;i<N;i++)lAdy[i]=new ArrayList<int[]>();
for(int H,M;(N... | 9 |
static BigInteger solve(int d, int l) {
if (l == n)
return BigInteger.ONE;
if (dp[d][l] != null)
return dp[d][l];
BigInteger cur = BigInteger.ZERO;
if (d - 1 >= 0)
cur = cur.add(solve(d - 1, l + 1));
cur = cur.add(solve(d, l + 1));
if (d + 1 <= k)
cur = cur.add(solve(d + 1, l + 1));
return dp[... | 4 |
public static String basename (String pathname) {
if (pathname == null || pathname.length () == 0) return ".";
String[] paths = pathname.split ("/");
for (int index = paths.length - 1; index >= 0; --index) {
if (paths[index].length () > 0) return paths[index];
}
return "/";
} | 4 |
private Matrix getMelFilterBanks()
{
//get boundaries of the different filters
double[] boundaries = getMelFilterBankBoundaries(minFreq, maxFreq, numberFilters);
//ignore filters outside of spectrum
for(int i = 1; i < boundaries.length-1; i++)
{
if(boundaries[i] > sampleRate/2 )
{
... | 4 |
public void startElement(String arg0, String arg1, String qname,
Attributes attrs) throws SAXException {
if(qname.equals("is:lineofsquares")){
this.environment = new Environment(Integer.parseInt(attrs.getValue("length")));
}
else if(qname.equals("is:white")){
((Environment)this.environment).addSquare(Squ... | 3 |
private Statement cnx()
{
Statement st = null;
try
{
if(usr != null && pwd != null && url != null)
{
Connection cnx = (Connection) DriverManager.getConnection(url, usr, pwd);
st = (Statement) cnx.createStatement();
}
} catch (SQLException e) {
e.printStackTrace();
}
return st;
} | 4 |
@Override
protected void generateFrameData(ResizingByteBuffer bb)
throws FileNotFoundException, IOException {
// TODO: don't just reload frame, regenerate it
bb.put(this.reload());
} | 0 |
public Spire makeSpire(int wall, int xR, int yR, int zR, int xsR, int ysR, int zsR, int dw) {
// When the wall was created, the variables were mapped as follows
// -Z wall: x = Wx y = Wy
// -X wall: x = Wy y = Wz
// -Y wall: x = Wx y = Wz
Spire temp;
switch (wall) {
... | 6 |
public synchronized boolean saveTemplates() {
if (templates==null)
return true;
if (directory==null || !directory.isDirectory())
return false;
// Blow away all old XML files to start anew, as some might be from
// templates we're removed from the template manager.
File[] oldXMLFiles = directory.listFi... | 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... | 5 |
public void enqueue (AbstractQueue<QueueElement> queue, QueueElement qe)
throws InterruptedException, TimeoutException {
Object[] params = new Object[2];
params[0] = queue;
params[1] = qe;
logger.entering(loggerName, "enqueue", params);
boolean bQStatus = fa... | 4 |
private static String listAllPrimeNumbersForGivenRange(int range) {
StringBuffer primeStr = new StringBuffer();
// set all values for the array to true
boolean[] primes = new boolean[range];
Arrays.fill(primes, true);
// prime number must be greater than 1, therefore int is as... | 3 |
@Override
public void run() {
} | 0 |
public void update(float dt) {
GameState g = gameStates.peekFirst();
boolean faded = game.getSpriteBatch().update(dt);
if(fading){
if(fadeType==1){
volume += dt * fadeType;
if (volume < 0)
volume = 0;
} else
volume = Game.musicVolume;
// g.getSong().setVolume(volume);
if(faded)
... | 5 |
public void executePQ(GraphNode<T> currentNode) {
//BinaryHeap<GraphNode<T>> minHeap = new BinaryHeap<>(graph.getNumV(), BinaryHeap.HeapType.MIN_HEAP);
//minHeap.enqueue(currentNode);
//for (GraphNode<T> node:graph.getNodes()){
// node.distance = IntegerAlgs.MAX_VALUE;
//}
... | 7 |
public void removePlayersBuildingsUnits(Player player) {
for (Cell[] cell1 : cells) {
for (Cell cell : cell1) {
// remove buildings
if (cell.getBuilding() != null) {
if (Teams.comparePlayers(cell.getBuilding().getOwner(),
player)) {
cell.building = null;
}
}
// remove units
... | 6 |
public static boolean compareBare(String ion, int ii){
boolean test = false;
if(ion.equals(IonicRadii.ions1[ii])||ion.equals(IonicRadii.ions2[ii])||ion.equals(IonicRadii.ions3[ii])||ion.equals(IonicRadii.ions4[ii])||ion.equals(IonicRadii.ions5[ii])||ion.equals(IonicRadii.ions6[ii])){
test = ... | 6 |
public String toString()
{
if (nome != null)
return nome.toString();
return id + "";
} | 1 |
public void setDays(int monthDays, int initWeek, int day) {
/**
* void setDays(int monthDays,int initWeek,int day)
*
* @para monthDays 本月天数
* @para initWeek 初始星期
* @para day 今天日 设置月历
*/
setDateNull();
for (int i = initWeek; i < initWeek + monthDays + 1; i++) {
if ((i - initWeek + 1) == day) ... | 5 |
@Override
public void and(Filter filter) {
if(filter == null
|| !(filter instanceof ThreadSafeCBloomFilter)
|| filter.vectorSize != this.vectorSize
|| filter.nbHash != this.nbHash) {
throw new IllegalArgumentException("filters cannot be and-ed");
}
ThreadSafeCBloomFil... | 9 |
public Route shortestPath(Node src)
{
PriorityQueue<Node> priorityQueue = new PriorityQueue<Node>();
Route r = new Route();
r.setDelayAtSrc(0);
r.getArrivalTime().add(0);
r.getRouteNodeList().add(src);
r.setRouteTravelTime(0);
src.setRouteUptoNode(r);
priorityQueue.add(src);
Node u = src;
while(u.g... | 8 |
public static int getIntegerValue(String attr) {
return Integer.parseInt(prop.getProperty(attr));
} | 0 |
public String getMethodName() {
return isSuper() ? "super" : "this";
} | 1 |
public void tick() {
super.tick();
// change in x and y
int dx = 0, dy = 0;
if (!this.getOuterBounds().intersects(player.getOuterBounds())) {
if (player.getX() > getX()) {
dx++;
} else if (player.getX() < getX()) {
dx--;
}
if (player.getY() > getY()) {
dy++;
} else if (player.getY(... | 8 |
public void addItemsToProductCombobox() {
productsComboboxItems.clear();
String item = "<html><font color='red'>Add New Product</font></html>";
productsComboboxItems.add(item);
if(driver.getPersonDB().getSupplierList().size()>0){
for (StockItem stockItem : driver.getStockDB().getStockList()) {
Product pr... | 3 |
public static int createAccount(String name, byte[] pass)
throws SQLException {
PreparedStatement checkStatement = DatabaseManager
.prepare("SELECT * FROM \"Users\" WHERE \"name\" = ?;");
checkStatement.setString(1, name);
ResultSet checkResult = checkStatement.executeQuery();
DatabaseManager.registerRes... | 3 |
public boolean safeTrigger(final EventEnum event, final C context) {
try {
return trigger(event, true, context);
} catch (LogicViolationError logicViolationError) {
return false;
}
} | 1 |
public OutOfBoardException(int x, int y) {
super("This square does not exist: "+x+","+y);
} | 0 |
@Override
public void populate(World world, Random random, Chunk source)
{
if (!source.getBlock(7, 0, 7).getBiome().equals(Biome.MUSHROOM_ISLAND))
return;
int treeNum = random.nextInt(5);
int mooNum = random.nextInt(4)+1;
ArrayList<Location> locs = Helper.getBlockLocations(source, Material.MYCEL);
Array... | 7 |
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.