text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void declaration(Declarations ds, Functions functions) {
// grab the Type
Type type = type();
while(currentToken.type() != Token.Type.Eof){
// grab variable name from current token
Variable v = new Variable(currentToken.value());
// skip identifier
match(Token.Type.Identifier);
if(cu... | 7 |
public void tick(GameMaster game) {
// update the collision box to move with the player
collisionBox.setBounds(x, y, width, height);
// Moving the player up
if(moveUp == true && y > 0) {
y -= speed;
}
// Moving the player down
if(moveDown == true && y + height <= game.getHeight()) {
y += speed;
... | 4 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
PrintWriter out = response.getWriter();
HttpSession session = request.getSession();
if (session == null || session.get... | 5 |
public void mousePressed(MouseEvent arg0) {
switch( choixBouton ){
case 0:
Partie.getInstance().cliqueFinTour();
break;
case 1:
Partie.getInstance().cliqueFinRedeploiement();
break;
case 2:
Partie.getInstance().cliqueDeclin();
break;
}
} | 3 |
@PostConstruct
public void init() {
LOG.info("Startup ...");
if (createDemoData) {
LOG.info("creat demodata...");
Viewport vp = vr.findOrCreateMainViewport();
vr.initViewport();
for (int c = 0; c < 5... | 2 |
public int donnerStock (int dons){
if(dons > 0)
this.compteur = 0;
if(this.stock + dons > MAX_STOCK){
int r = MAX_STOCK - this.stock;
this.stock = MAX_STOCK;
return r;
}
else{
this.stock += dons;
return 0;
}
} | 2 |
@Override
public void run() {
DatagramSocket ssdp = null;
try {
// Create socket bound to specified local address
ssdp = new DatagramSocket(new InetSocketAddress(ip, 0));
byte[] searchMessageBytes = searchMessage.getBytes();
... | 5 |
public void processFrames(String path)
{
GSR gsr = new GSR();
BufferedWrapper bWrap;
BufferedImage currentImage;
int cropStartX, cropStartY, cropWidth, cropHeight;
JFrame statusFrame = new JFrame();
statusFrame.setPreferredSize(new Dimension(500, 100));
JPanel content = new JPanel();
... | 8 |
static void withModeKeyGamesAndServer(final String mode, final String key, final int numberOfTurns, final URL serverUrl)
{
System.out.println("\nConnecting to Vindinium server at " + serverUrl);
State state = null;
final HashMap<String,String> initParams = new HashMap<String,String>(1);
... | 9 |
public void gameLoop() {
long startTime = System.currentTimeMillis();
long currTime = startTime;
while (isRunning) {
long elapsedTime =
System.currentTimeMillis() - currTime;
currTime += elapsedTime;
// update
update(elapsedTime);... | 1 |
public Message(String message) throws InvalidMessage {
int prefix_end = -1;
int trailing_start;
String[] tmp;
String trailing = null;
if (message == null || message.length() < 1) {
throw new InvalidMessage("<<empty message>>");
}
// grab the prefix
if (message.charAt(0) == ':') {
prefi... | 7 |
public void updateCombinedImage() {
//draw layers on top of one another
combinedImage = new BufferedImage(JIP.iWidth, JIP.iHeight, BufferedImage.TYPE_INT_ARGB);
Graphics g = combinedImage.getGraphics();
for (BufferedImage i : layers) {
g.drawImage(i, 0, 0, null);
}
//draw graphics layer on top of ever... | 2 |
public BenchControls() {
setTitle("Crosslink - Java");
getContentPane().setLayout(null);
setSize(1030, 514);
JLabel lblIp = new JLabel("IP :");
lblIp.setBounds(10, 54, 46, 14);
getContentPane().add(lblIp);
ipAddr = new JTextField();
ipAddr.setEnabled(false);
ipAddr.setBounds(33, 51, 86, 20);
g... | 1 |
static protected void AdjustBuffSize()
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = 0;
available = tokenBegin;
}
else
ExpandBuff(false);
}
else if (available > tokenBegin)
available = bufsize;
else if ... | 4 |
public List<DataRow> select(DataRow parameters)
{
synchronize();
List<DataRow> result = local.select(parameters);
for(DataRow row : result)
{
if(row.containsAttribute("date"))
{
row.removeAttribute("date");
}
if(row.cont... | 3 |
public static BmTestManager getInstance() {
if (instance == null)
synchronized (lock) {
if (instance == null)
instance = new BmTestManager();
}
return instance;
} | 2 |
public static boolean copyFolderContents(String src, String dst, boolean recursive){
File srcDirectory = new File(src);
File dstDirectory = new File(dst);
if(srcDirectory.exists() && srcDirectory.isDirectory()){
if(!dstDirectory.exists()){
MessageGenerator.briefError("ERROR: Could find destination director... | 9 |
public String getQueryString() {
if (options == null)
return "";
String s = name + "=";
int n = 0;
int count = options.size();
HtmlOption o = null;
if (model instanceof DefaultComboBoxModel) {
DefaultComboBoxModel cbm = (DefaultComboBoxModel) model;
for (int i = 0; i < count; i++) {
if (cbm.get... | 7 |
void write(JDefinedClass c) {
// first collect all the types and identifiers
mode = Mode.COLLECTING;
d(c);
javaLang = c.owner()._package("java.lang");
// collate type names and identifiers to determine which types can be imported
for( ReferenceList tl : collectedReferen... | 7 |
public boolean step() {
if (!assembler.execute(pc)) {
if (NOPcount == 0) {
done = true;
NOPcount++;
} else if (NOPcount == 6) {
return false;
} else {
NOPcount++;
}
}
registerFile.execute();
controller.execute();
alu.execute();
dataMemory.execute();
assembler.write();
regis... | 7 |
public void onTick(Instrument instrument, ITick tick) throws JFException {
if (ma1[instrument.ordinal()] == -1) {
ma1[instrument.ordinal()] = indicators.ema(instrument, Period.TEN_SECS, OfferSide.BID, IIndicators.AppliedPrice.MEDIAN_PRICE, 14, 1);
}
double ma0 = indicators.ema(instru... | 6 |
public void setV(int a){
velocity = a;
} | 0 |
public void rememberFile(String fileName, final JMenu recentFilesMenu) {
if (historyMap == null)
return;
if (fileName == null)
return;
int max = RECENT_FILES.length;
if (recentFiles.contains(fileName)) {
recentFiles.remove(fileName);
}
else {
if (recentFiles.size() >= max)
recentFiles.remove... | 8 |
public void cargarEstadisticas(JTextField idProd, JTextField dia, java.util.Date desde, java.util.Date hasta) {
if (desde != null && hasta != null) {
abrirBase();
tablaEstadisticas.setRowCount(0);
if (idProd.getText().trim().length() == 0) {
listaProd = Produc... | 5 |
public double getPhaseConstant(){
if(this.distributedResistance==0.0D && this.distributedConductance==0.0D){
this.generalPhaseConstant = this.omega * Math.sqrt(this.distributedInductance * this.distributedCapacitance);
}
else{
this.generalPhaseConstant = Complex.sqrt(this... | 2 |
public String toString() {
StringBuffer b = new StringBuffer();
for (int i = 0; i < getLocals(); ++i) {
b.append(getLocal(i));
}
b.append(' ');
for (int i = 0; i < getStackSize(); ++i) {
b.append(getStack(i).toString());
}
return b.toString... | 2 |
private void drawCoordinates(Graphics g) {
// Numbers
g.drawString("1", scale.getOriginX()+scale.getScale()-3, scale.getOriginY()+scale.getScale()+5);
g.drawString("1", scale.getOriginX()-20, scale.getOriginY()+scale.getScale()+scale.getScale()*(-2)+5);
// Right side
for(int i=sc... | 4 |
private SocketProvider initDataSocket(Command command, Reply commandReply)
throws IOException, FtpIOException, FtpWorkflowException {
setConnectionStatusLock(CSL_INDIRECT_CALL);
setConnectionStatus(FTPConnection.BUSY);
if(isPretSupport())
{
Command pretComma... | 5 |
public void download() {
try {
int i = 1;
File file = new File("xkcdImages.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String link = "";
while((link = reader.readLine()) != null) {
if(i == 100 || i == 1037 || i == 404) {
System.out.p... | 6 |
@Override
public void loop() {
switch (step) {
case 0:
if(Motors.movement.isMoving()){
if(System.currentTimeMillis()>time){
Motors.movement.stop();
reset();
step++;
}
}
else{
Motors.movement.forward();
}
break;
case 1:
if (delta()>500){
Motors.movement.stop();
... | 6 |
public void drawAlphaTextWithShadow(String text, int x, int y, int currentColour,
int seed) {
if (text == null)
return;
/*
* Set the seet for the RNG.
*/
random.setSeed(seed);
/*
* Generate a random alpha value that is more
* opaque than the shadow (192 is the alpha value
* for the sh... | 8 |
public String toString() {
if (x != 0 && y > 0) {
return x + " + " + y + "i";
}
if (x != 0 && y < 0) {
return x + " - " + (-y) + "i";
}
if (y == 0) {
return String.valueOf(x);
}
if (x == 0) {
return y + "i";
}
// shouldn't get here (unless Inf or NaN)
return x + " + i*" + y;
} | 6 |
public int Run(RenderWindow App) {
boolean Running = true;
Text VictoryText = new Text();
Font Font = new Font();
try {
Font.loadFromFile(Paths.get("rsc/font/Frank Knows.ttf"));
} catch (IOException e) {
e.printStackTrace();
return (-1);
... | 7 |
public void install(JTextComponent tc) {
boolean replaceTabs = false;
if (tc instanceof RSyntaxTextArea) {
RSyntaxTextArea textArea = (RSyntaxTextArea)tc;
markOccurrencesEnabled = textArea.getMarkOccurrences();
textArea.setMarkOccurrences(false);
replaceTabs = textArea.getTabsEmulated();
}
... | 8 |
@Override
public Command planNextMove(Info info) {
try{
this.enemies = info.getEnemies();
this.bullets = info.getGrenades();
this.position.x = info.getX();
this.position.y = info.getY();
this.direction_vector = this.getVectorFromAngle(info.getDire... | 9 |
public void showGame() {
image.setVisible(true);
for (Base b : Game.getInstance().getBaseManager().getBases()) {
b.setVisible(true);
}
for(GroupAgent a : Game.getInstance().getAgentManager().getAgents()){
a.setVisible(true);
}
for(Tower t : Game.getInstance().getTowerManager().getTowers()) {
t.setV... | 3 |
public static String descriptionFor(Trait trait, float level) {
String bestDesc = null ;
float minDiff = Float.POSITIVE_INFINITY ;
int i = 0 ; for (String s : trait.descriptors) {
float value = trait.descValues[i] ;
if (value > 0) value -= (trait.maxVal - level) / (trait.maxVal - 1) ;
if (... | 4 |
public static int associated(int from, int end) {
Queue<Point> q = new LinkedList<Point>();
BitSet vis = new BitSet(nNodes + 1);
Point node = new Point(from, -1);
int next = 0;
q.add(node);
vis.set(from, true);
while (!q.isEmpty()) {
node = q.poll();
for (int i = 0; i < ady[node.x].size(); i++) {
... | 4 |
@Override
public JView load() {
if (loaded) return this;
String body = null;
try {
body = JHttpClientUtil.postText(
context.getUrl() + JHttpClientUtil.Views.URL,
JHttpClientUtil.Views.GetView
.replace("{listName... | 7 |
void scrollPalette(ScrollBar scrollBar) {
if (image == null) return;
Rectangle canvasBounds = paletteCanvas.getClientArea();
int paletteHeight = imageData.palette.getRGBs().length * 10 + 20;
if (paletteHeight > canvasBounds.height) {
// Only scroll if the palette is bigger than the canvas.
int y = -scroll... | 3 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final MainMenu other = (MainMenu) obj;
if (this.enabled != other.enabled) {
return false;
}... | 5 |
public Moover(int b) {
super(b);
} | 0 |
public Object get(String key) throws JSONException {
if (key == null) {
throw new JSONException("Null key.");
}
Object object = this.opt(key);
if (object == null) {
throw new JSONException("JSONObject[" + quote(key) + "] not found.");
}
return obje... | 2 |
public void setMission(Mission mission) {
final Mission oldMission = this.mission;
if (mission == oldMission) {
return;
} else if (oldMission == null) {
if (!mission.isOneTime()) {
logger.fine("Replacing null mission with " + mission);
}
... | 7 |
static public void main(String args[]) {
double x, y;
String prefix = null;
OSNI osni = new OSNI();
if (args.length < 2) {
/*
* Slieve Donard
*/
x = 335788.01;
y = 327685.85;
} else {
if (args.length == 2) {
Double d;
d = new Double(args[0]);
x = d.doubleValue();
d = new ... | 6 |
public void login() throws Exception{
Member loginmem = new Member();
String id;
int loginputcomplete =1;
do{
System.out.println("[̵ Է]");
scan.nextLine();
id = scan.next();
//缭 缭 ̵ 123
if((id.equals("0000123")) == TRUE){ //Է id 0000123(缭 ID) ġʴ´ٸ
if(membercollect.getequal(id)==-1){ //i... | 6 |
private void t5CaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_t5CaretUpdate
jScrollPane1.setVisible(false);
jScrollPane2.setVisible(true);
DefaultTableModel model1 = (DefaultTableModel) jTable2.getModel();
int bookcode = 0;
int n = 0;
String query;
... | 5 |
@Test
public void itShouldSerializeAPoint() throws Exception
{
Point point = new Point(100, 0);
assertEquals("{\"coordinates\":[100.0,0.0],\"type\":\"Point\"}", mapper.toJson(point));
} | 0 |
@Override
protected void paintComponent(Graphics gc) {
super.paintComponent(GraphicsUtilities.prepare(gc));
Rectangle bounds = getBounds();
bounds.x = 0;
bounds.y = 0;
int step = getStep();
int count = getComponentCount();
for (int i = 0; i < count; i += step) {
Rectangle compBounds = getComponent(i).... | 1 |
@Test
public void testRollbackingState() throws ProcessExecutionException, ProcessRollbackException {
IProcessComponent<?> comp = TestUtil.executionSuccessComponent(true);
// use reflection to set internal process state
TestUtil.setState(comp, ProcessState.ROLLBACKING);
assertTrue(comp.getState() == ProcessS... | 5 |
public void open() {
Display display = Display.getDefault();
int result = createContents();
if (result == 1)
return;
shlFnirsDataProcessing.open();
shlFnirsDataProcessing.layout();
while (!shlFnirsDataProcessing.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
} | 3 |
public Parser(List<File> inputFiles, File outputFile, char[] wordCharacters, Locale locale, char[] additionalInnerWordCharacters, int maxListSize) throws IOException {
if (inputFiles.size() == 0)
throw new IllegalArgumentException("Files list should be at least 1 size.");
for (File inputFile... | 6 |
public void run() {
try {
PrintWriter pw = null;
if (os != null)
pw = new PrintWriter(os);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
while ((line = br.readLine()) != null) {
... | 5 |
@WebMethod(operationName = "RegistrarCierre")
public String RegistrarCierre(@WebParam(name = "validador") String validador, @WebParam(name = "rad_Numero") String rad_Numero, @WebParam(name = "rad_Comentarios") String rad_Comentarios) {
consultas con = new consultas();
utilidades ut = new utilidades(... | 9 |
public List<TransactionRecord> query(final Date startDate, final Date endDate, final int startRow, final int endRow, Criteria[] searchCriteria) throws BeanstreamApiException
{
if (endDate == null || startDate == null)
throw new IllegalArgumentException("Start Date and End Date cannot be null!");... | 6 |
public void findClosestCities()
{
System.out.println("Enter the number of closest cities to the current city you would like.");
input.nextLine();
int n= input.nextInt();
while(n<1||n>map.getSize()-1)
{
System.out.println("Sorry I think your input was invalid, please try again.");
System.out.println("En... | 6 |
*/
public void selectDestination(Unit unit) {
Location destination = gui.showSelectDestinationDialog(unit);
if (destination == null) return; // user aborted
if (setDestination(unit, destination)
&& freeColClient.currentPlayerIsMyPlayer()) {
if (destination instanceof... | 7 |
private void createContentPane() {
if (contentPane != null)
return;
contentPane = new JPanel(new BorderLayout());
ActionListener okListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
cancel = !confirm();
dialog.dispose();
}
};
JPanel p = new JPanel(new FlowLayou... | 9 |
private boolean r_Step_1c() {
int v_1;
int v_2;
// (, line 93
// [, line 94
ket = cursor;
// or, line 94
lab0: do {
v_1 = limit - cursor;
lab1: do {... | 7 |
public Deal RechercheParId(int idDeal) {
PrestataireDeServiceDAO psdao = new PrestataireDeServiceDAO();
try {
String sql = "SELECT * FROM deal WHERE idDeal='" + idDeal + "'";
ResultSet rs = crud.exeRead(sql);
Deal d = new Deal();
while (rs.next()) {
... | 2 |
@SuppressWarnings("unchecked")
boolean getBooleanValue(Object obj, int k) {
if ((obj instanceof ArgHolder<?>)
&& ((ArgHolder<?>) obj).getType().equals(Boolean.class)) {
return ((ArgHolder<Boolean>) obj).getValue();
} else if (obj instanceof boolean[]) {
return ((boolean[]) obj)[k];
} e... | 5 |
private boolean validate(String userID) {
// TODO Auto-generated method stub
if(userID.equals(user)){
if(occurance<3)
return true;
else
return false;
}
else{
occurance=0;
return true;
}
} | 2 |
private int getNumberOfPages(int listSize) {
int numOfPages = listSize / RECORDS_PER_PAGE;
if (listSize % RECORDS_PER_PAGE > 0) {
numOfPages++;
}
return numOfPages;
} | 1 |
@Override
public void run() {
long diff;
while (monitor.isAlive()) {
while ((diff = waitTime - System.currentTimeMillis()) > 0) {
try {
Thread.sleep(diff);
} catch (InterruptedException e) {
throw new RTInterrupted(... | 3 |
public boolean achievements(MOB mob, List<String> commands)
{
final boolean accountSys = CMProps.isUsingAccountSystem();
if(commands.size()<((accountSys)?4:3))
{
if(accountSys)
mob.tell(L("You have failed to specify the proper fields.\n\rThe format is MODIFY ACHIEVEMENT (PLAYER/ACCOUNT/ALL) [TATTOO]\n\r")... | 8 |
@Override
public void drop(DropTargetDropEvent dtde) {
if (mDragWasAcceptable) {
dtde.acceptDrop(dtde.getDropAction());
if (mModel.getDragColumn() != null) {
dropColumn(dtde);
} else {
Row[] rows = mModel.getDragRows();
if (rows != null && rows.length > 0) {
dropRow(dtde);
}
}
dt... | 5 |
protected JPanel createDaysGUI()
{
JPanel dayPanel = new JPanel(true);
dayPanel.setLayout(new GridLayout(0, dayNames.length));
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.YEAR, year);
... | 8 |
public void addNode(Node newNode)
{
int comp = newNode.data.compareTo(data);
if (comp < 0)
{
if (left == null)
{
left = newNode;
left.parent = this;
}
... | 4 |
public String convertHarga(int harga){ // jadi tar kalo 50000 jadi 50.000 dst...
// harga = 444;
int ribuan[] = new int[10];
int counter=0;
String temphasil="";
while(harga/1000!=0){
ribuan[counter] = harga%1000;
counter++;
//temphasil = temphasil + ribuan+".";
... | 9 |
public Object open(boolean _restoreBackup) {
restoreBackup=_restoreBackup;
createContents();
shell.open();
shell.layout();
mySelf = this;
if( _restoreBackup )
{
setText(Messages.Backup_0);
} else {
setText(Messages.Backup_1);
}
Display display = getParent().getDisplay();
while (!shell.isDi... | 3 |
public void sendString(String msg, MultipleTalkServer server, String str) {
try {
for (int i=0; i < server.socket.size()-1; i++){
if(str.equals(server.socket.get(i).getName())){
OutputStream ostream = server.socket.get(i).getSocket().getOutputStream();
... | 3 |
public int getID(){
return id;
} | 0 |
public void initComponents() {
UIManager.put("TextArea.margin", new Insets(10, 10, 10, 10));
jPanel = new JPanel();
jScrollPane1 = new JScrollPane();
output = new JTextArea();
jScrollPane2 = new JScrollPane();
input = new JTextArea();
font = new Font(Font.SANS_SERIF, Font.PLAIN, 20);
undo = new UndoMan... | 4 |
public static void startupGenerate() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Mod... | 7 |
private void gameSetup() {
playerGrid = new BattleFieldGrid(game, true);
JButton buttonApplyShips = new JButton("Apply ship settings");
buttonApplyShips.addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
... | 1 |
private boolean backupEFS() {
new Thread() {
@Override
public void run() {
BufferedReader reader = null;
List<String> args = null;
ProcessBuilder process = null;
Process pr = null;
String line = null;
... | 5 |
@Override
public String getText() {
BufferedReader br = null;
String everything = "";
try {
br = new BufferedReader(new FileReader(file));
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != nul... | 5 |
public ArrayList<ArrayList<Integer>> levelOrder(TreeNode root) {
ArrayList<ArrayList<Integer>> order = new ArrayList<ArrayList<Integer>>();
if (root == null)
return order;
Queue<TreeNode> queue = new LinkedList<TreeNode>();
queue.offer(root);
int currentLevelCount = 0;
int next... | 5 |
private void draw(LineSegment lineSeg, long initialTime, long endTime) {
long drawTime = endTime - initialTime;
double initX = originX + lineSeg.start.x;
double initY = originY - lineSeg.start.y;
double finalX = originX + lineSeg.end.x;
double finalY = origi... | 6 |
public StdImage getImage() {
StdImage offscreen = null;
synchronized (getTreeLock()) {
Graphics2D gc = null;
try {
Rectangle bounds = getVisibleRect();
offscreen = StdImage.createTransparent(getGraphicsConfiguration(), bounds.width, bounds.height);
gc = offscreen.getGraphics();
Color saved = g... | 2 |
private static int _getScore(Proxy proxy)
{
byte[] imageBytes = proxy.send(new ProxyScreenshotMessage());
int score = -1;
BufferedImage image = null;
try {
image = ImageIO.read(new ByteArrayInputStream(imageBytes));
}
catch (IOException e) {
e.printStackTrace();... | 4 |
public MethodVisitor visitMethod(final int access, final String name,
final String desc, final String signature, final String[] exceptions) {
String s = remapper.mapMethodName(className, name, desc);
if ("-".equals(s)) {
return null;
}
if ((access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) == 0) {
... | 6 |
public static int updateHeadFile(int tid, File fileName) {
int result = 0;
Connection con = DBUtil.getConnection();
PreparedStatement pstmt = null;
FileInputStream fis = null;
try {
fis = new FileInputStream(fileName);
pstmt = con.prepareStatement("update mstx_head set tdata=? where tid=?");
pstmt.se... | 7 |
public PlotBuilder() {
} | 0 |
private void clickPixel(int x, int y) {
int pixel_x = x / this.pixelSize;
int pixel_y = y / this.pixelSize;
// int tmp_s = 0;
while (pixel_x < 1)
pixel_x++;
while (pixel_x >= this.tabSizeX - 1)
pixel_x--;
while (pixel_y < 1)
pixel_y++;
while (pixel_y >= this.tabSizeY - 1)
pixel_y--;
if (pi... | 7 |
public static String toString(JSONObject o) throws JSONException {
StringBuffer sb = new StringBuffer();
sb.append(escape(o.getString("name")));
sb.append("=");
sb.append(escape(o.getString("value")));
if (o.has("expires")) {
sb.append(";expires=");
sb.ap... | 4 |
public void download() {
this.share(0);
} | 0 |
private InputStream getInputStream(String url) {
// TODO: Sanitize strings
InputStream is = null;
HttpGet lyricsGet = new HttpGet(url);
try {
HttpResponse response = this.httpClient.execute(lyricsGet);
is = response.getEntity().getContent();
} catch (ClientProtocolException e) {
// TODO Auto-genera... | 2 |
public void setFirstpoint(Point firstpoint) {
this.firstpoint = firstpoint;
} | 0 |
private static void LogicalOperators() {
System.out.println("Start of LogicalOperators");
boolean b1 = false;
boolean b2 = true;
boolean b3;
System.out.println("Value of b1: " + b1 + " Value of b2: " + b2);
b3 = b1 && b2;
System.out.println("Value of b1 && b2: " + b3);
System.out.println("\n");
... | 3 |
private static boolean isREWhiteSpace(int c)
{
return (c == '\u0020' || c == '\u0009'
|| c == '\n' || c == '\r'
|| c == 0x2028 || c == 0x2029
|| c == '\u000C' || c == '\u000B'
|| c == '\u00A0'
|| Character.getType((char)c) == Ch... | 9 |
protected void doStop() throws Exception
{
MultiException mex=new MultiException();
Thread thread= Thread.currentThread();
ClassLoader lastContextLoader= thread.getContextClassLoader();
try
{
// Context listeners
if (_context... | 8 |
public void zoomOut() {
if (tileSize - TILE_SIZE_STEP < TILE_MIN_SIZE)
return;
int oldSize = tileSize;
Container c = GraphicPanel.this.getParent();
int newX, newY;
tileSize -= TILE_SIZE_STEP;
revalidateScroll();
if (c instanceof JViewport) {
JViewport jv = (JViewport) c;
Point pos = j... | 2 |
protected void drawVertical(Graphics2D g2, Rectangle2D area) {
Rectangle2D titleArea = (Rectangle2D) area.clone();
g2.setFont(this.font);
g2.setPaint(this.paint);
TextBlockAnchor anchor = null;
float y = 0.0f;
VerticalAlignment verticalAlignment = getVerticalAlignment();
... | 8 |
public float mineralsAt(Tile t, byte type) {
byte m = minerals[t.x][t.y] ;
if (m == 0) return 0 ;
if (m / NUM_TYPES != type) return 0 ;
switch (m % NUM_TYPES) {
case (DEGREE_TRACE) : return AMOUNT_TRACE ;
case (DEGREE_COMMON) : return AMOUNT_COMMON ;
case (DEGREE_HEAVY ) : return AMO... | 5 |
public static Tile getRandomTile(Map map, int x, int y) { //gets random tile
Tile tile;
if (Math.random() < 0.92) {
tile = new Grass(map, x, y);
} else if (Math.random() < 0.25){
tile = new Flowers(map, x, y);
} else if (Math.random() < 0.25) {
tile = new Tree(map, x, y);
} else if (Math.rando... | 5 |
private void collectTweets(int tokenIdx, int tokenOffset, int tweetFileIdx,
long skip, String filePrefix, String endId) throws Exception {
BufferedReader userIdReader = new BufferedReader(new FileReader(
Constants.USER_ID_FILE_PATH));
userIdReader.skip(skip);
// set the writer's buffer to 2MB to improve pe... | 9 |
private CompWrap(ComponentWrapper c, CC cc, int eHideMode,
UnitValue[] pos, BoundSize[] callbackSz) {
this.comp = c;
this.cc = cc;
this.pos = pos;
if (eHideMode <= 0) {
BoundSize hBS =
(callbackSz != null && callbac... | 8 |
public void tick() {
tickTime++;
if (level.getTile(x >> 4, y >> 4) == Tile.lava) {
hurt(this, 4, dir ^ 1);
}
if (health <= 0) {
die();
}
if (hurtTime > 0) hurtTime--;
} | 3 |
private int lookForNearbyHero(int uid, int dist) {
/* Buscamos el mas cercano */
ConcurrentHashMap<Integer,Actor> a = scenario.actores;
Actor me = a.get(uid);
for(Map.Entry m : a.entrySet()){
if (((Actor)m.getValue()).health >0 && !((int)m.getKey()== uid) && ((Actor)m.getValu... | 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.