text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void updateKingCoor(String color, int xCoor, int yCoor){
if (color.equals("W")){
whiteKingXCoor = xCoor;
whiteKingYCoor = yCoor;
}
else if (color.equals("B")){
blackKingXCoor = xCoor;
blackKingYCoor = yCoor;
}
} | 2 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TabelProdSize other = (TabelProdSize) obj;
if (!Objects.equals(this.sizeId, other.sizeId)) {
... | 3 |
public void chooseDirection()
{
if (this.walkType == 0)
{
if (probabiltyA >= (Math.random() * 100))
{
// chooses a random direction to move in
}
else
{
// no movement
chosenDirection = 0;
}
}
else
{
// line walk type movement
... | 3 |
public int getPixel(int x, int y) {
if (x < 0 || x >= width || y < 0 || y >= height) {
throw new RuntimeException("That escalated quickly...");
}
return pixels[x + y*width];
} | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AUsersFacade other = (AUsersFacade) obj;
if (users == null) {
if (other.users != null)
return false;
} else if (!users.equals(other.user... | 6 |
private double findSplitNominalNumeric(int index) throws Exception {
double bestVal = Double.MAX_VALUE, currVal;
double[] sumsSquaresPerValue =
new double[m_Instances.attribute(index).numValues()],
sumsPerValue = new double[m_Instances.attribute(index).numValues()],
weightsPerValue = new d... | 8 |
public String getDotSource() {
return graph.toString();
} | 0 |
private void writeStringAMF0(List<Byte> ret, String val) throws EncodingException
{
byte[] temp = null;
try
{
temp = val.getBytes("UTF-8");
}
catch (UnsupportedEncodingException e)
{
throw new EncodingException("Unable to encode string as UTF-8: " + val);
}
ret.add((byte)0x02);
ret.add((byte)... | 2 |
public static void main(String[] args) {
serverConsole = new ServerConsole(PORT);
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
frame = new MainFrame();
frame.setVisible(true);
frame.getLoginPanel().setVisible(true);
} catch (Exception e) {
e.printStackTrace();
... | 4 |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void handleItemFrameRotation(PlayerInteractEntityEvent event) {
Player player = event.getPlayer();
User user = EdgeCoreAPI.userAPI().getUser(player.getName());
if (user == null)
return;
if (event.getRightClicked().getType... | 5 |
private void serveTheClient()
{ // обслуживание клиента (прием/отправка сообщений)
String inMsg = new String();
ReadyToSendMessage msgToSend = null;
while (true)
{
/*Отправка сообщения из общей рассылки чата*/
msgToSend = serverController_.getMessageToSend(handlerThreadId_);
if (msgToSend != null)
... | 9 |
public Alien(int courtWidth, int courtHeight, int INIT_X, int INIT_Y) {
super(INIT_VEL_X, INIT_VEL_Y, INIT_X, INIT_Y, SIZE, SIZE, courtWidth,
courtHeight);
// Set img1 to the alien ship file
try {
img1 = ImageIO.read(new File(img_file1));
} catch (IOException e) {
System.out.println("Internal Error:" ... | 2 |
public static void main(String[] args) {
// TODO Auto-generated method stub
LLint op1=new LLint(6);
op1.insert(1);
op1.insert(7);
LLint op2=new LLint(2);
op2.insert(9);
op2.insert(5);
LLint ans=null;
Stack<Integer> st1=new Stack<Integer>();
Stack<Integer> st2=new Stack<Integer>();
Stack<I... | 9 |
@Override
public void updateAll(MiniGame game)
{
try
{
game.beginUsingData();
// MOVE THE PLAYER ACCORDING TO ITS PATH
player.update(game);
if (player.getCurrentIntersection() == level.destination)
{
endGame... | 5 |
static String randomTime() {
String hours = random(0,23);
if (hours.length() == 1) {
hours = "0" + hours;
}
String minutes = random(0,59);
if (minutes.length() == 1) {
minutes = "0" + minutes;
}
String seconds = random(0,59);
if (se... | 3 |
private Match getBestMatch()
{
Set<Match> keys = table.keySet();
Iterator<Match> iter = keys.iterator();
Match biggest = null;
Match other = null;
while ( iter.hasNext() )
{
Match m = iter.next();
if ( m.freq == 1 && (biggest==null||m.length>biggest.length) )
biggest = m;
else if ( m.freq > 1 ... | 7 |
@Override
public void executeTask() {
try {
System.out.println("preparing UDP broadcast");
byte senddata[] = "$$$".getBytes();
DatagramSocket clientN = new DatagramSocket();
clientN.setBroadcast(true);
try {
DatagramPacket sendPacket = new DatagramPacket(senddata,
senddata.length,
Inet... | 9 |
public int maxDepth(TreeNode root) {
// Start typing your Java solution below
// DO NOT write main() function
if (root == null)
return 0;
Queue<TreeNode> q = new LinkedList<TreeNode>();
q.offer(root);
int depth = 0;
while (!q.isEmpty()) {
int n = q.size();
while ((n--) > 0) {
TreeNode tmpNode... | 5 |
public Dispatcher(Vector<GPRMC> myQueue, Vector<String> myLogQueue, Vector<GPRMC> myInsertQueue, Vector<GPRMC> myPushQueue)
{
packetQueue=myQueue;
logQueue=myLogQueue;
insertQueue=myInsertQueue;
pushQueue=myPushQueue;
Properties prop = new Properties();
try {
//load a properties fi... | 8 |
@Override
public void surveySucces(EventObject e) {
jTextArea1.setText("");
if (Stale.question1 == 5) {
jTextArea1.append(Stale.answers[Stale.type][0]);
jTextArea1.append("\n");
}
if (Stale.question2 == 5) {
jTextAre... | 7 |
public int evalRPN(String[] tokens) {
int len=tokens.length;
Stack<Integer> stack=new Stack<Integer>();
for(int i=0;i<len;i++){
if(!tokens[i].equals("+")&&!tokens[i].equals("-")&&!tokens[i].equals("*")&&!tokens[i].equals("/")){
stack.push(Integer.valueOf(tokens[i]));
}else{
... | 9 |
@Override
public State nextState(Random random) {
State newState;
int value = random.nextInt(10000);
if (Utils.isBetween(value, 0, P_UM)) {
newState = new Modified();
} else if (Utils.isBetween(value, P_UM, P_UD)) {
newState = new Deleted();
} else {
newState = new Unmodified();
}
return n... | 2 |
public Object getObject(String id)
{
Object obj = null;
if (id != null)
{
obj = objects.get(id);
if (obj == null)
{
obj = lookup(id);
if (obj == null)
{
Node node = getElementById(id);
if (node != null)
{
obj = decode(node);
}
}
}
}
return obj;
} | 4 |
public boolean isMatch(String s, String p) {
int i = 0;
int j = 0;
int star = -1;
int mark = -1;
while (i < s.length()) {
if (j < p.length()
&& (p.charAt(j) == '?' || p.charAt(j) == s.charAt(i))) {
++i;
... | 9 |
public void insert(SkipListsNode searchKey)
{
int i, lvl=0;
ArrayList<SkipListsNode> update = new ArrayList<SkipListsNode>();
SkipListsNode x = header;
for(i=topLevel; i>-1; i--)
{
while(x.forwards.get(i).key.compareTo(searchKey.key) < 0)
x = x.forwards.get(i);
update.add(0, x);
}
x ... | 6 |
public static <T extends Comparable<? super T>> T[] merge(T[] ls, T[] hs,
T[] t) {
int i = 0;
int j = 0;
int pos = 0;
while (i < ls.length && j < hs.length) {
if (ls[i].compareTo(hs[j]) <= 0) {
t[pos] = ls[i];
i++;
} else {
t[pos] = hs[j];
j++;
}
pos++;
}
if (i == ls.length &... | 8 |
public List<Recipe> getSearchListFromIndex() {
if (searchList.isEmpty()) {
return searchList;
}
int toIndex = searchIndex + 4;
if (toIndex > searchList.size()) {
toIndex = searchList.size();
}
List<Recipe> returnlist = searchList.subList(searchInde... | 3 |
private static void lsschedule() {
Registry jobTrackerRegistry;
try {
jobTrackerRegistry = LocateRegistry.getRegistry(MapReduce.Core.JOB_TRACKER_IP,
MapReduce.Core.JOB_TRACKER_REGISTRY_PORT);
JobTrackerRemoteInterface jobTrackerStub =
(JobTrackerRemoteInterface) jobTrackerRegistry.lo... | 7 |
public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
super.paintComponent(g2);
if (grid == null)
return;
Insets insets = getInsets();
g2.setColor(backgroundColor);
g2.fillRect(insets.left, insets.top, numCols * (cellSize + 1) + 1, nu... | 2 |
public boolean imageUpdate(Image img, int infoflags, int x, int y, int w,
int h) {
if ((infoflags & (ALLBITS | ABORT)) == 0) {
return true;
} else {
if ((infoflags & ALLBITS) != 0) {
if (clip != null) {
synchronized(clip) {
Graphics2D graphi... | 3 |
private static Holder findInListOrNull(List<Holder> list, String contig, int startPos, int endPos)
throws Exception
{
Holder h = null;
int overlap =0;
for(Holder h2 : list)
{
if( h2.conting.equals(contig) && startPos >= h2.startPos && endPos <= h2.endPos )
{
if( h != null )
{
System.... | 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 |
public void run() { // run method for Graph
// stops after 5 changes
int runCount = 0;
while (! isEmpty() && runCount<5) {
Random rand2 = new Random(); int nextFunction = rand2.nextInt(4);
// 3/4 chance the government will add a new road, 1/4 chance it will restructure graph (delete road not in min span t... | 9 |
private void getContent() {
totalnum.setText("48892");
tcpnum.setText("22009");
udpnum.setText("25002");
} | 0 |
public boolean loadFromJsonStream(InputStream is) {
BufferedReader br;
try {
br = new BufferedReader(new InputStreamReader(is));
StringBuffer buf = new StringBuffer();
String line = null;
while ((line = br.readLine()) != null) {
buf.append(line);
}
JSONObject obj = new JSONObject(buf.toStr... | 8 |
private boolean func_151634_b(int p_151634_1_, int p_151634_2_)
{
if (compareBiomesById(p_151634_1_, p_151634_2_))
{
return true;
}
else if (BiomeGenBase.getBiome(p_151634_1_) != null && BiomeGenBase.getBiome(p_151634_2_) != null)
{
BiomeGenBase.TempCa... | 5 |
private void addRowToChoiceWindow(TreePath selPath){
String name = selPath.getPathComponent(selPath.getPathCount()-1).toString();
AlgorythmFile currentAlgorithm = null;
for(int i = 0; i<Main.getFileBase().getLength(); i++){
if (Main.getFileBase().getFile(i).getAlgorythmName().equals(... | 3 |
@Override
public int search(int l, int r) {
if (l <= r) {
_count++;
int k = interpolatePosition(l, r);
int locelem = _list[k];
if (locelem == _element) {
_count++;
return k;
} else {
int m = (int) Math.ceil(Math.sqrt(r - l + 1));
int i = 1;
_count += 2;
if (locelem > _element) ... | 7 |
private boolean execUpdateProfile(VectorMap queryParam, StringBuffer respBody, DBAccess dbAccess) {
try {
boolean success = true;
int clntIdx = queryParam.qpIndexOfKeyNoCase("clnt");
String clientName = (String) queryParam.getVal(clntIdx);
int t0, t;
... | 9 |
@Override
final public void compute() {
//
// reset time.
//
final int last = this.frameidx;
//
// from first to last layer.
//
for (int l = 0; l < this.structure.layers.length; l++) {
//
if (l == this.structure.inputlayer) cont... | 7 |
public Object put(Object key, Object value) {
// check for nulls, ensuring symantics match superclass
if (key == null) {
throw new NullPointerException("Null keys are not allowed");
}
if (value == null) {
throw new NullPointerException("Null values are not allowed... | 4 |
public void checkInitialization(){
if(addEntityStateObj)
temporary=new AddEntityStateObjectView();
if(removeEntityStateObj)
temporary=new RemoveEntityStateObjectView();
if(addEntityState)
temporary=new AddEntityStateView();
if(removeEntityState)
... | 7 |
private String textToString(AbstractComponent component)
throws BookException {
StringBuilder sb = new StringBuilder();
try {
Iterator<AbstractComponent> iterator = component.getIterator();
while (iterator.hasNext()) {
AbstractComponent c = iterator.next();
if (c.getType() == EComponentType.PARAGRA... | 4 |
public static long compareKeys(int[] key1, int[] key2) throws pval_error, make_key_error
{
int i=keyLength-1;
long pval=1,dist=0;
if (i==-1) return 0;
long dec=(long)Math.pow(2,b);
pval=(long)Math.pow(2,keyLength*b);
//outputtoScreen("\nStarting pval="+pval);
for (int j=0;j<=i;j++)
{
pval=pval/dec;
... | 7 |
public void setMatrix(String str) {
String[] row_strings = str.split(";");
if (row_strings.length != height)
return;
int[][] new_array2d = new int[height][width];
String[] row_list;
for (int j=0; j<height; j++) {
row_list = row_st... | 4 |
public static PyschosensoryNeedEnumeration fromValue(String v) {
for (PyschosensoryNeedEnumeration c: PyschosensoryNeedEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} | 2 |
@Override
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
Map<String, Object> pageVariables = new HashMap<>();
HttpSession httpSession = request.getSession();
UserSession session = sessions.get(httpSessi... | 6 |
public Node remove() {
if (linkSimple.getNext() == null || linkSimple == null) {
linkSimple = null;
throw new NoSuchElementException(
"L'element a enlever est inexistant.");
} else {
linkSimple = (LinkSimpleNode) linkSimple.getNext();
listCount--;
return linkSimple.getNode();
}
} | 2 |
int startGoalCount(int col){
int count = 0;
if (col == Chip.WHITE) {
for (int i = 1; i<7; i++) {
if(board[0][i].returnColor() == Chip.WHITE)
count++;;
}
}
if (col == Chip.BLACK) {
for (int i = 1; i<7; i++) {
if(board[i][0].returnColor() == Chip.BLACK)
... | 6 |
public static void collectSubsumingParentsBelow(LogicObject self, Description renamed_Super, List newparentdescriptions, MarkerTable alreadyvisitedtable, MarkerTable selfisbelowtable, java.lang.reflect.Method subsumptiontest) {
if ((Stella.$TRACED_KEYWORDS$ != null) &&
Stella.$TRACED_KEYWORDS$.membP(Logic.K... | 6 |
public boolean nextStep() {
if (!done())
return false;
step++;
switch (step) {
case FIRST_SETS:
parseAction.setEnabled(false);
firstFollow.getFFModel().setCanEditFirst(true);
firstFollow.getFFModel().setCanEditFollow(false);
directions
.setText("Define FIRST sets. ! is the lambda characte... | 7 |
public Gebruiker zoekGebruiker(String nm, ArrayList<Gebruiker> a){
Gebruiker antw = null;
for(Gebruiker g: a){
if(g.getNaam().equals(nm)){
antw = g;
break;
}
}
return antw;
} | 2 |
public void buildSettingsWindow(){
getCurrentSettings();
final JFrame settingsFrame = new JFrame("Settings");
JPanel settingsPanel = new JPanel();
ButtonGroup buttonGroup = new ButtonGroup();
rndCheck = new JRadioButton("Set random order");
allWordsCheck = new JRadioButt... | 8 |
private static <T> T showMenu(String menuName, List<T> options, Function<T, String> toString) {
while (true) {
try {
int selection;
System.out.println("*** " + menuName + " ***");
for (int i = 0; i < options.size(); ++i) {
System.out.println((i + 1) + ".) " + toString.apply(options.get(i)));
}... | 6 |
public void startTimer(){
Integer defaultTime = 120;
Timer timer = new Timer();
String timeString = timerText.getText();
int time = 5;
try {
time = Integer.parseInt(timeString);
} catch (NumberFormatException e){
JOptionPane.showMessageDialog(this,
"Bitte eine vern���������nftige Zahl angeben!")... | 2 |
@Override
public void keyPressed(int key, char c) {
boolean tileWasMoved = false;
switch (key) {
case KEY_RIGHT:
tileWasMoved = gameBoardManipulator.moveRight();
break;
case KEY_LEFT:
tileWasMoved = gameBoardManipulator.moveLef... | 5 |
public static boolean isReverse(String string1, String string2) {
/* not the same length */
if (string1.length() != string2.length()) {
return false;
}
if (string1.length() == 0 && string2.length() == 0) {
return true;
}
/* compare two substrings */
if (string1.charAt(0) == string2.charAt(string2.l... | 4 |
@Override
protected void checkingNorms()
{
for ( Action action : getAllActions().values() )
action.setNormType(null);
for( Belief belief : getAllBeliefs().values() )
belief.setNormType(null);
for( Norm norm : getAllRestrictNorms().values() )
{
getPlayer().addRestrictNorm(norm.getName(), norm);
... | 7 |
public static void main(String[] args){
//given a CDC network, output a x-IA and a y-IA solution.
//get an input CDC network
//int type,n,i,j;
String inputFile = "input.csv";
String outputFile = "output.html";
BufferedReader br = null;
String line = "";
CDCNetwork aCDCNetwork = new CDCNetwork();
tr... | 6 |
public static boolean edgeAdjacent(Tile a, Tile b) {
if (a.x == b.x) return a.y == b.y + 1 || a.y == b.y - 1 ;
if (a.y == b.y) return a.x == b.x + 1 || a.x == b.x - 1 ;
return false ;
} | 4 |
public static boolean isEnd(Point p) {
if (p.equals(_end)) {
return true;
}
return false;
} | 1 |
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://dow... | 7 |
@BeforeClass
public static void setUpClass() {
} | 0 |
@Override
public E set(int index, E element) {
if (index < 0 || index > count) {
throw new IndexOutOfBoundsException();
}
Node<E> aux = null;
if (index < count / 2) {
aux = header.next;
for (int i = 0; i < index; i++) {
aux = aux.ne... | 5 |
public void setSecret(BinaryDataType value) {
this.secret = value;
} | 0 |
public EigenvalueDecomposition(Matrix Arg) {
double[][] A = Arg.getArray();
n = Arg.getColumnDimension();
V = new double[n][n];
d = new double[n];
e = new double[n];
issymmetric = true;
for (int j = 0; (j < n) & issymmetric; j++) {
for (int i = 0; (i < n) & issymmetric; i++) {
... | 7 |
public void testRemovePartialConverterSecurity() {
if (OLD_JDK) {
return;
}
try {
Policy.setPolicy(RESTRICT);
System.setSecurityManager(new SecurityManager());
ConverterManager.getInstance().removeInstantConverter(StringConverter.INSTANCE);
... | 2 |
public void interact(Particle p) {
if (contains(p.rx, p.ry)) {
if (viscosity > Particle.ZERO) {
double dmp = MDModel.GF_CONVERSION_CONSTANT * viscosity / p.getMass();
p.fx -= dmp * p.vx;
p.fy -= dmp * p.vy;
}
if (reflection) {
if (p instanceof Atom) {
internalReflection((Atom) p);
}
... | 7 |
protected void takeDown() {
if(log.isLoggable(Logger.INFO))
log.log(Logger.INFO, "takeDown() WumpusAgent");
try {
if(log.isLoggable(Logger.INFO))
log.log(Logger.INFO, "DEregister game '" + WumpusConsts.GAME_SERVICE_TYPE + "'");
DFService.deregister(this, dfd);
} catch (FIPAException e)... | 4 |
public static final int getShadedColor(int color, int lightness, int flag) {
if (color == 65535) {
return 0;
}
if ((flag & 2) == 2) {
if (lightness < 0) {
lightness = 0;
} else if (lightness > 127) {
lightness = 127;
}
lightness = 127 - lightness;
return lightness;
}
lightness = ligh... | 6 |
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
switch (COLUMNS.values()[columnIndex]) {
case ID:
case CUSTOMER:
case CAR:
return false;
case FROM:
case TO:
case COST:
return true;
default:
throw new IllegalArgumentException("columnIndex");
}
} | 6 |
public int getDef(int npc) {
switch (npc) {
case 2627:
return 30;
case 2630:
return 50;
case 2631:
return 100;
case 2741:
return 150;
case 2743:
return 300;
case 2745:
return 500;
}
return 100;
} | 6 |
public static void main(String[] args) {
PairManager
pman1 = new PairManager1(),
pman2 = new PairManager2();
testApproaches(pman1, pman2);
} | 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 void addTokens(String... tks)
{
for (String tk : tks)
{
if (tk == null || tk.equalsIgnoreCase("") || tk.contains("\n") || this.tokens.contains(tk))
{
continue;
}
this.tokens.add(tk);
}
} | 5 |
public float priorityFor(Actor actor) {
if (GameSettings.hardCore && ! hasNeeded()) return 0 ;
//
// Don't work on this outside your shift (or at least make it more
// casual.)
final int shift = venue.personnel.shiftFor(actor) ;
if (shift == Venue.OFF_DUTY) return 0 ;
if (shift == Venue.SE... | 7 |
private void collision(){
Rectangle r1 = pika1.getBounds();
Rectangle r2 = pikaBall.getBounds();
Rectangle r4 = pika2.getBounds();
Line2D.Double leftLine = new Line2D.Double(0, 600, 410, 600);
Line2D.Double rightLine = new Line2D.Double(410, 600, 800, 600);
Line2D.Double leftStickLine = new Line2D.Double(40... | 9 |
@EventHandler
public void SnowmanBlindness(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.getsnowgolemConfig().getDouble("Snowman.... | 6 |
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
programmerThread.stop();
lastPane = buttonPanel;
hidePanels(lastPane);
}//GEN-LAST:event_jButton3ActionPerformed | 0 |
public void init()
{
canvas = new MinecraftApplet$1(this);
boolean fullscreen = false;
if(getParameter("fullscreen") != null)
{
fullscreen = getParameter("fullscreen").equalsIgnoreCase("true");
}
minecraft = new Minecraft(canvas, this, getWidth(), getHeight(), fullscreen);
minecraft.host = getDocu... | 9 |
public void menuTextCrypt() {
int choice;
do {
System.out.println("\n");
System.out.println("Text Cryption Menu");
System.out.println("Select Cryptology Type");
System.out.println("----------------------\n");
System.out.println("1 - Asymmetric... | 6 |
private byte[] getHash(byte[] data, boolean nullData) {
int byteLen = data.length;
int intLen = ((byteLen + 9 + 63) / 64) * 16;
byte[] bytes = new byte[intLen * 4];
System.arraycopy(data, 0, bytes, 0, byteLen);
if (nullData) {
Arrays.fill(data, (byte) 0);
}
... | 7 |
public void onBlockPhysics(BlockPhysicsEvent e) {
if (e.isCancelled()) return;
CBlock conBlock = parent.getControllerBlockFor(null, e.getBlock().getLocation(), null, true);
if (conBlock == null) return;
if (conBlock.isBeingEdited()) {
// Scheduled event should normally do this for us
if (!parent.blockPhys... | 8 |
@EventHandler(priority = EventPriority.HIGHEST)
public void onStop(PlayerCommandPreprocessEvent event) {
if((event.getMessage().equalsIgnoreCase("/stop") || event.getMessage().equalsIgnoreCase("stop")) && event.getPlayer().isOp()) {
plugin.getLogger().info(ChatColor.AQUA + "Server is stopping, sync everyone's inv... | 5 |
public String treeToString(int level) {
int i;
StringBuffer text = new StringBuffer();
if (!m_isLeaf) {
text.append("\n");
for (i = 1; i <= level; i++) {
text.append("| ");
}
if (m_instances.attribute(m_splitAtt).name().charAt(0) != '[') {
text.append(m_instances.attribute(... | 8 |
public void testGetInstantConverterRemovedNull() {
try {
ConverterManager.getInstance().removeInstantConverter(NullConverter.INSTANCE);
try {
ConverterManager.getInstance().getInstantConverter(null);
fail();
} catch (IllegalArgumentException ex... | 1 |
public void printDungeon() {
for (int i = 0; i < dungeon.length; i++) {
for (int j = 0; j < dungeon[0].length; j++) {
System.out.print(dungeon[i][j].getGlyph());
}
System.out.println();
}
} | 2 |
@Override
public void render(GameContainer gc, Graphics g) throws SlickException {
g.setBackground(new Color(20, 20, 20));
g.setColor(new Color(230, 230, 230));
g.setAntiAlias(true);
switch (state) {
default:
case MENU:
menu.render(gc, g);
break;
case PAUSED:
break;
case PLAYING:
... | 3 |
private void fillCities(List<City> cities, AbstractDao dao) throws DaoException {
if (cities != null) {
for (City city : cities) {
Criteria descCrit = new Criteria();
descCrit.addParam(DAO_ID_DESCRIPTION, city.getDescription().getIdDescription());
List... | 4 |
public MelhorRotaDTO encontrarMelhorRota() throws NenhumaRotaEncontradaException {
procurarRotas();
List<Rota> melhorRotaEncontrada = null;
Integer distanciaMenorRotaEncontrada = null;
for (List<Rota> list : rotasEncontradas) {
int index = 1;
Integer distanciaDestaRota = 0;
for (Rota rota : list) {... | 9 |
public float[] toAngles(float[] angles) {
if (angles == null)
angles = new float[3];
else if (angles.length != 3)
throw new IllegalArgumentException("Angles array must have three elements");
float sqw = w * w;
float sqx = x * x;
float sqy = y * y;
float sqz = z * z;
float unit = sqx + sqy + sqz + s... | 4 |
public CloseWindowAction(EnvironmentFrame frame) {
super("Close", null);
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_W,
MAIN_MENU_MASK));
this.frame = frame;
} | 0 |
public static void evalStates(BoolExpTree tree)
{
LinkedHashSet<String> table = tree.getTable();
boolean sat = false; // satisfiability
boolean fal = false; // falseability
printTable(table);
System.out.println();
for(int i = 0; i < Math.pow(2, table.size()); i++)
{
HashMap<String, Boolean> state = U... | 9 |
public static void main(String args[]){
play();
} | 0 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... | 7 |
public void saveRanking(String player){
if( player == null || player.equals(""))
player = "无名";
int score = Game.enemy_killed * 100 + Game.propScore ;
PreparedStatement pstmt = null ;
try{
pstmt = ConnectionUtil.getInstance().prepareStatement(""
+ "insert into t_ranking(id, player, score, stage, tim... | 5 |
public TreeRow selectDown(boolean extend) {
TreeRow scrollTo = null;
if (mRoot.getChildCount() > 0) {
int count = mSelectedRows.size();
if (extend && count > 0) {
scrollTo = getFirstSelectedRow();
if (scrollTo == mAnchorRow) {
scrollTo = getAfterLastSelectedRow();
if (scrollTo != null) {
... | 9 |
public boolean existsConnection(Neuron other){
for(int i=0;i<outputs.size();i++)
if(outputs.get(i).getGiveNeuron()==other||outputs.get(i).getRecieveNeuron()==other)
return true;
for(int i=0;i<inputs.size();i++)
if(inputs.get(i).getGiveNeuron()==other||inputs.get(i... | 6 |
public Tabla(ArrayList<Computador> computadores, Encuesta encuesta) {
this.encuesta=encuesta;
String[] nombres = {"Marca", "Disco Duro", "Procesador", "RAM", "GPU", "Valor"};
String [][] data = new String[computadores.size()][6];
initComponents();
for (int i = 0; i < dat... | 8 |
protected Stage getStage() {
return this.stage;
} | 0 |
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.