text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void drawVerticalLine(int x, int y, int h, int color) {
if (x < startX || x >= endX)
return;
if (y < startY) {
h -= startY - y;
y = startY;
}
if (y + h > endY)
h = endY - y;
int j1 = x + y * width;
for (int k1 = 0; k1 < h; k1++)
pixels[j1 + k1 * width] = color;
} | 5 |
public static void avanzar(Cancha cancha, int equipo, int jugador, Pelota pelota){
float avance=cancha.getEquipoX(equipo).getJugadorX(jugador).getVelocidad();
avance=avance*Factorf.factorF();
int posX;
posX=cancha.getEquipoX(equipo).getJugadorX(jugador).getPosX();
... | 7 |
public boolean apply_wprime2w_edge_rule()
{
boolean changed = false;
ClosureOperation wop = null;
ClosureOperation wprime_op = null;
// 1) only the master process holds Read operations
for(BasicOperation bop : this.getProcess(masterPid).getOpList())
{
// 2) for each Read operation (R)
if(bop.isRead... | 8 |
private static void merge(Comparable[] items, Comparable[] helper, int begin, int mid, int end) {
for (int i = begin; i <= end; i++) {
helper[i] = items[i];
}
int i = begin;
int j = mid + 1;
for (int k = begin; k <= end; k++) {
if (i > mid) {
... | 5 |
private static void recibirCanales() {
try {
AudioChatService.recibirObjeto(getIn().readObject());
} catch (IOException e) {
throw new ConexionException("Error al recibir el objeto: "
+ e.getMessage(), e);
} catch (ClassNotFoundException e) {
throw new ConexionException("Error al recibir el objet... | 2 |
public static void renderText(String text, float x, float y, float width, float z){
if(USED_FONT == null){
OutputUtility.outputLine("GameFontRender Error: font not set");
}
OpenGLTexture[] textures = USED_FONT.getText(text);
float char_width = width/((float)textures.length... | 2 |
public static void loadText(String file) {
Scanner s = null;
InputStream is = Text.class.getResourceAsStream("/shoddybattleclient/languages/" + file);
try {
s = new Scanner(is);
} catch (Exception e) {
System.err.println("Failed to load language file");
... | 9 |
@Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {
if (e.getDocument() == null) {
setEnabled(false);
} else {
JoeTree tree = e.getDocument().getTree();
if (tree.getComponentFocus() == OutlineLayoutManager.ICON) {
setEnabled(true);
} else {
setEnabled(false);
... | 2 |
@Override
public void OpenDoors() {
int dir = getMyDirection();
int flr = getFloor();
if (dir == DIRECTION_UP && myUpBarriers[flr].waiters() > 0) {
// System.out.println("Waking up " + myUpBarriers[flr].waiters() +
// " on floor " + myFloor);
myUpBarriers[flr].raise();
}
if (dir == DIRECTION_DOWN &&... | 7 |
public void load(TaggedStorageChunk chunk)
{
this.cookedTime = chunk.getInteger("cookedTime");
this.burnTime = chunk.getInteger("burnTime");
if(chunk.hasTag("inID") && chunk.hasTag("innbr"))
{
this.in = new ItemStack(Item.get(chunk.getString("inID")), chunk.getInteger("innbr"));
}
if(chunk.hasTag(... | 6 |
@Override
public void actionPerformed(ActionEvent e) {
if (mIsRunning) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
repaint();
}
});
mAngle += 3;
if (mAngle >= 3... | 6 |
public void multiplyBy(double factor, int cx, int cy, int radius) {
int ci = getI(cx);
int cj = getJ(cy);
int iradius = getI(radius);
for (int i = ci - iradius; i < ci + iradius; i++) {
for (int j = cj - iradius; j < cj + iradius; j++) {
if (i < 0 || j < 0 || i >= voxels.length
|| j >= voxels[0].l... | 7 |
private static String encode(String value) {
String encoded = null;
try {
encoded = URLEncoder.encode(value, HTTP_ENCODING);
} catch (UnsupportedEncodingException ignore) {
}
StringBuilder buffer = new StringBuilder(encoded.length());
char focus;
for (int i = 0; i < encoded.length(); i++) {
focus = ... | 8 |
public double maxProbability(int x_i) {
int n = potentials.chainLength();
int k = potentials.numXValues();
double best = Double.NEGATIVE_INFINITY;
double current = 0;
for (int v = 1 ; v <= k ; v++) {
current = messageFactor2Node(n,n,v) + messageFactor2Node(2*n-1,n,v);
if (current > best) {
best =... | 2 |
public void setMsgContent(byte[] msgContent) {
MsgContent = msgContent;
} | 0 |
public boolean pickAndExecuteAnAction() {
synchronized (indecisiveCustomers) {
for (DavidCustomerRole cust : indecisiveCustomers) {
cust.msgAvailability(getAvailability());
indecisiveCustomers.remove(cust);
return true;
}
}
for (Table table : DavidRestaurant.tables) {
if (!table.isOccupied(... | 8 |
public String getLecturaPrimitivaJava() {
if (nombre.equals("String")) {
return "in.nextLine()";
}
if (nombre.equals("int")) {
return "in.nextInt()";
}
if (nombre.equals("float")) {
return "in.nextFloat()";
}
if (nombre.equals("... | 9 |
public int getRandomNumber(int min, int max) {
return (int) Math.floor(Math.random() * (max - min + 1)) + min;
} | 0 |
@Override
public boolean verificaAcesso(Funcionario funcionario) {
try {
conn = ConnectionFactory.getConnection();
String sql = "SELECT * "
+ " FROM funcionario "
+ " JOIN acesso ON funcionario.idacesso = acesso.id "
... | 2 |
public RaavareBatchDTO getRaavareBatch(int rbId) throws DALException {
ResultSet rs = Connector.doQuery("SELECT * FROM raavarebatch WHERE rb_id = " + rbId);
try {
if (!rs.first()) throw new DALException("Raavarebatchen " + rbId + " findes ikke");
return new RaavareBatchDTO (rs.getInt(1), rs.getInt(2)... | 2 |
public double side(Box box) {
final Point2DInt corners[] = box.getCorners();
final double s0 = side(corners[0]);
final double s1 = side(corners[1]);
final double s2 = side(corners[2]);
final double s3 = side(corners[3]);
if (s0 > 0 && s1 > 0 && s2 > 0 && s3 > 0) {
return 1;
}
if (s0 < 0 && s1 < 0 && ... | 8 |
@Override
public void endElement(String uri, String localName, String name) throws SAXException {
if (name.equalsIgnoreCase("gameName")) {
gameName = currentValue;
}
if (isAchievement) {
if (name.equalsIgnoreCase("iconClosed")) {
currentA.setIconOpenU... | 9 |
public void saveWorldInfoAndPlayer(WorldInfo var1, List var2) {
NBTTagCompound var3 = var1.getNBTTagCompoundWithPlayer(var2);
NBTTagCompound var4 = new NBTTagCompound();
var4.setTag("Data", var3);
try {
File var5 = new File(this.saveDirectory, "level.dat_new");
File var6 = new... | 4 |
@Override
public EntidadBancaria get(int id) {
PreparedStatement preparedStatement;
EntidadBancaria entidadBancaria;
ResultSet resultSet;
Connection connection = connectionFactory.getConnection();
try {
preparedStatement = connection.prepareStatement("SELECT * FRO... | 3 |
public static Message parse(String message) {
switch(Message.parseType(message)) {
case ID_REQUEST:
return new IdRequestMessage().decode(message);
case ID_RESPONSE:
return new IdResponseMessage().decode(message);
case SPAWN:
return new SpawnMessage().decode(message);
case DESPAWN:
return n... | 7 |
public boolean getObtained() {
return this.obtained;
} | 0 |
public boolean writeStore(ReservationStation resStation, String result) {
if (resStation.getQk() == null) {
String b = resStation.getDest();
ROB.updateValue(Integer.parseInt(b), result);
return true;
}
return false;
} | 1 |
protected static BmUrlManager getBmUrlManager() {
if (bmUrlManager == null)
bmUrlManager = new BmUrlManager();
return bmUrlManager;
} | 1 |
@Override
public void onUpdate(World apples) {
if (!apples.inBounds(X, Y)||life--<0)
{
alive = false;
//apples.explode(X, Y, 32, 8, 16);
}
if (!apples.isSolid(X, Y-10))
{
Y-=10;
}
for (int i = 1; i < 10; i++)
{
if (... | 5 |
@Override
public void end(String nick){
if(end == false){
end = true;
if(!nick.equals("computer")) {
Player p = em.find(Player.class, nick);
p.setScore();
em.merge(p);
}
}
} | 2 |
public static boolean intersects( String rng, int[] rc )
{
int[] rc2 = getRangeCoords( rng );
if( (rc[0] >= rc2[0]) && (rc[2] <= rc2[2]) && (rc[1] >= rc2[1]) && (rc[3] <= rc2[3]) )
{
return true;
}
return false;
} | 4 |
public List<Cliente> listar() {
String sql = "SELECT * FROM CLIENTE";
try {
conn = GerenciaConexaoBD.getInstance().getConnection();
PreparedStatement stmt = conn.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
List<Cliente> listaCliente = new ArrayList<Cliente>();
while (rs.next()... | 2 |
public double calcUntersumme()
{
double hoehe, erg;
erg = 0.0;
for(double i=intervalLeft; i<=intervalRight-dx+(dx/4); i+=dx)
{
int j1, j2;
j1 = 0;
while(points.get(j1).getX()<=i && j1 < points.size()-1)
{
j1++;
}
j2 = j1;
while(points.get(j2).getX()<=i+dx && j2... | 7 |
public CheckboxListener(JCheckBox checkbox, Preference pref) {
setCheckBox(checkbox);
setPreference(pref);
} | 0 |
public void tableau_manuel_suivant()
{
tcon.gridy=tcompteur++;
float max =0;
for(int i=1;i<data.get(0).size();i++)
{
if(Float.parseFloat(data.lastElement().get(i))>max)
max = Float.parseFloat(data.la... | 6 |
@Override
public void setMiscText(String newText)
{
super.setMiscText(newText);
operation = null;
mask=null;
selfXP=false;
String s=newText.trim();
int x=s.indexOf(';');
if(x>=0)
{
mask=CMLib.masking().getPreCompiledMask(s.substring(x+1).trim());
s=s.substring(0,x).trim();
}
x=s.indexOf("SEL... | 9 |
@Override
public Rectangle getBoundingBox() {
int smallestx = Integer.MAX_VALUE;
int smallesty = Integer.MAX_VALUE;
int biggesty = Integer.MIN_VALUE;
int biggestx = Integer.MIN_VALUE;
for (int i = 0; i <= px.length - 1; i++) {
if (px[i] < smallestx) {
smallestx = px[i];
}
}
for (int i = 0; i <=... | 8 |
public void paint(Graphics g) {
g.drawImage(image, 0, 0, this);
// Notify method splash that the window
// has been painted.
// Note: To improve performance we do not enter
// the synchronized block unless we have to.
if (! paintCalled) {
paintCalled ... | 1 |
private final static BitPayResponse toBitPayResponse(Invoice invoice) {
BitPayResponse response = new BitPayResponse();
if (invoice == null) return response;
response.btcPrice = invoice.getBtcPrice();
response.status = invoice.getStatus();
response.price = invoice.getPrice();
... | 4 |
public static void addBuff(Unit owner, Unit target, Buff buff) {
if (owner != null && target != null && buff != null) {
// check if buff already had a target -> if so then remove the buff from the current target
if (buff.getTarget() != null)
GameLogic.INSTANCE.removeBuff(buff.getTarget(), buff);
// set ... | 6 |
* @param sizecutoff
*/
public static void printExtensionSizes(Module module, int sizecutoff) {
if (sizecutoff == Stella.NULL_INTEGER) {
sizecutoff = 10;
}
if (module == null) {
module = ((Module)(Stella.$MODULE$.get()));
}
{ List descriptions = List.newList();
String size = nu... | 8 |
static void next_move(int posr, int posc, int dimh, int dimw, String[] board) {
char[][] chars = new char[board.length][board[0].length()];
for (int i = 0; i < board.length; i++) {
chars[i] = board[i].toCharArray();
}
String ret = null;
if (chars[posr][posc] == 'd') ... | 8 |
public static Mask buildLogMask(int size, double sigma) {
if (size % 2 == 0) {
size++;
}
Mask mask = new Mask(size);
for (int i = -mask.getWidth() / 2; i <= mask.getWidth() / 2; i++) {
for (int j = -mask.getHeight() / 2; j <= mask.getHeight() / 2; j++) {
//1/(sqrt(2*pi)*sigma^3)
dou... | 3 |
public static void main(String[] args)
{
JFrame frame = new JFrame();
frame.setSize(WIDTH, HEIGHT);
frame.setTitle("AsteroidTester");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Random r = new Random();
ArrayList<Asteroid> asteroidList = ne... | 5 |
public static void addItem(Hero owner, Item item) {
if (owner != null && item != null && !owner.equals(item.getOwner())) {
item.setOwner(owner);
switch (item.getCategory()) {
case CONSUMABLE: {
// add item to pouch
owner.getPouch().add(item);
if (LOGGER.isDebugEnabled())
LOGGER.debug("S... | 9 |
private void report(String name, double value, Hashtable attributes) {
Frame frame = new Frame(name);
Label label = null;
// Resize the frame so it can contain all the text.
// XXXX Ideally we need to find the longest property and resize horizontally as well.
i... | 3 |
public Expression(String expression) {
this.expression = expression;
addOperator(new Operator("+", 20, true) {
@Override
public BigDecimal eval(BigDecimal v1, BigDecimal v2) {
return v1.add(v2, mc);
}
});
addOperator(new Operator("-", 20, true) {
@Override
public BigDecimal eval(BigDecimal v1... | 4 |
private void initialize( String h, int p, String n )
{
if ( h == null )
{
throw new IllegalArgumentException( "Hostname cannot be null" );
}
if ( "".equals( h ) )
{
throw new IllegalArgumentException( "Hostname cannot be empty" );
}
if ... | 9 |
public static void numDecodingsHelper(String s, int[] helper, String last) {
if (s.length() == 0)
return;
boolean flag = false;
String newLast;
if (s.length() >= 2) {
if (Integer.parseInt(s.substring(1, 2)) == 0) {
helper[0]++;
numDecodingsHelper(s.substring(2), helper, s.substring(1, 2));
} el... | 7 |
public void setIdTpv(int idTpv) {
this.idTpv = idTpv;
} | 0 |
void menuOpenURL() {
animate = false; // stop any animation in progress
// Get the user to choose an image URL.
TextPrompter textPrompter = new TextPrompter(shell, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
textPrompter.setText(bundle.getString("OpenURLDialog"));
textPrompter.setMessage(bundle.getString("En... | 7 |
public void scoreCountCorrelate() {
double totalScore = 0;
int totalBusinessCnt = 0;
Map<Double, List<Integer>> businessScoreCountMap = new TreeMap<Double, List<Integer>>();
for (Business business:businessMap.values()) {
//System.out.println("hello");
totalBusinessCnt += 1;
double star = business.stars... | 4 |
public ListNode rotateRight(ListNode head, int n) {
// Start typing your Java solution below
// DO NOT write main() function
if (n == 0 || head == null || head.next == null)
return head;
ListNode firstNode = head;
ListNode secNode = head;
while (n > 0) {
n--;
firstNode = firstNode.next;
if (firs... | 6 |
public void setVersion(String value) {
this.version = value;
} | 0 |
public boolean isAValidMethod(Request request) {
return isAURIMatch(request) && getRoutesMap(request).get(request.getURI()).containsKey(request.getHTTPMethod());
} | 1 |
public boolean hit(ArrayList<Bullet> bullets,int damage){
if( this.isAlive() ){
for(Bullet b:bullets){
//ӵŵʱɱ
if( b.isAlive() && b.getId()!=id ){
if(inside(b)){
//HP
if( hp>0 ){
hp = hp - damage;
}
if( hp<=0 ){
this.setAlive(false);
cx = this.x;
... | 7 |
* @param arguments
* @return int
*/
public static int applyIntegerMethod(java.lang.reflect.Method code, Cons arguments) {
switch (arguments.length()) {
case 0:
throw ((StellaException)(StellaException.newStellaException("Can't call method code on 0 arguments.").fillInStackTrace()));
cas... | 6 |
@Override
public void paint(Graphics g) {
//if in fog draw the foggy images
if (tower.isInFog()) {
if (getTower() instanceof DefTower)
g.drawImage(defFog, x, y, null);
else if (getTower() instanceof DmgTower)
g.drawImage(dmgFog, x, y, null);
else if (getTower() instanceof SpdTower)
g.drawIm... | 7 |
public static boolean batch( WebSocketImpl ws, ByteChannel sockchannel ) throws IOException {
ByteBuffer buffer = ws.outQueue.peek();
WrappedByteChannel c = null;
if( buffer == null ) {
if( sockchannel instanceof WrappedByteChannel ) {
c = (WrappedByteChannel) sockchannel;
if( c.isNeedWrite() ) {
... | 8 |
public void paperRankInCluster(int iteratorNum, int cluster) {
String path = "";
if (cluster == k)
path = "";
else
path = "iteration" + iteratorNum + "//cluster" + cluster;
if (!FileUtil.isFileExist(path + "//" + FileUtil.FILE_PAPER)) {
HashMap<Integer, Double> rankMap = new HashMap<Integer, Double>();... | 9 |
public String getDayZone(){
int hour = this.validTime.get(Calendar.HOUR_OF_DAY)+2;
String result;
if(hour >= 5 && hour < 12){
result = "morning";
} else if(hour >= 12 && hour < 18){
result = "afternoon";
} else if(hour >= 18 && hour < 22){
result = "evning";
} else {
result = "night";
}
... | 6 |
public void adjustWeights(double[] vector, double koef)
{
// if ((Double.isInfinite(koef))||(Double.isNaN(koef))|| (koef > 1))
// System.out.println("WRONG");
double diffCoor = 0;
for (int i = 0; i < inN; i++){
double check = (vector[i] - weights[i]) * a * koef;
... | 6 |
private void addAllUniforms(String shaderText)
{
HashMap<String, ArrayList<GLSLStruct>> structs = findUniformStructs(shaderText);
final String UNIFORM_KEYWORD = "uniform";
int uniformStartLocation = shaderText.indexOf(UNIFORM_KEYWORD);
while(uniformStartLocation != -1)
{
if(!(uniformStartLocation != 0
... | 5 |
protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
int c;
int[] lookup = BYTE_TO_CHAR; // getfield bytecode optimization
int remaining = in.remaining();
while (remaining-- > 0) {
if (out.remaining() < 1)
return CoderResul... | 3 |
@Override
public void registerDeleted(IDomainObject domainObject) {
assert domainObject.getId() != null : "id not null";
if (newObjects.remove(domainObject)) {
return;
}
dirtyObjects.remove(domainObject);
if (!removedObjects.contains(domainObject)) {
removedObjects.add(domainObject);
... | 2 |
public static void STARTUP_FETCH_DEMO_CONTENT() {
{ Object OLD_$MODULE$_000 = Stella.$MODULE$.get();
Object OLD_$CONTEXT$_000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/STELLA/XML-OBJECTS/FETCH-CONTENT", Stella.$STARTUP_TIME_PHASE$ > 1));
... | 6 |
@Override
protected void dispatchMessage(ICallbackEnum message, IEvent object) {
// Iterate methods
for(Binding binding : this.callbackBindings.get(message))
{
try
{
// Dispatch
if(object == null)
binding.invoke(this);
else
{
// Set session
object.setSession(this);
... | 4 |
private void doUpdateTrafficMask() {
if (trafficControllingSessions.isEmpty())
return;
for (;;) {
SocketSessionImpl session = trafficControllingSessions.poll();
if (session == null)
break;
SelectionKey key = session.getSelectionKey();
... | 6 |
@Override
public boolean controls(ChessCoord coord) {
if (!super.controls(coord)) {
return false;
}
// Here we are sure we are not at the coordinate ourselves
final int currentRank = this.getCoord().getRank();
final int currentFile = this.getCoord().getFile();
... | 8 |
public void loadFavoriteServersList(List<Server> servers) {
favoritesMenu.removeAll();
if ( servers.size() > 0 ) {
for (final Server s : servers) {
JMenuItem item = new JMenuItem( s.get("title") );
item.addActionListener( new ActionListener() {
... | 2 |
protected Registration readName (Input input) {
int nameId = input.readInt(true);
if (nameIdToClass == null) nameIdToClass = new IntMap();
Class type = nameIdToClass.get(nameId);
if (type == null) {
// Only read the class name the first time encountered in object graph.
String className = input.readString... | 8 |
private void ParseAttack(Node parentElement) {
Node child = parentElement.getFirstChild();
while (child != null) {
if (! handleGeneralProperty(child)) {
String nodeName = child.getNodeName();
// Can contain conditions, a print, and actions
if (nodeName == "print") {
attackMessage = child.getFirs... | 5 |
@Override
public void setDefaultGraph(String graph) {
if(graph == null){
((SPARQLConnection) this.con).setDefaultGraphs(null);
}
LinkedList<String> graphs = new LinkedList<String>();
graphs.add(graph);
((SPARQLConnection) this.con).setDefaultGraphs(graphs);
} | 1 |
public char[] determineText(){
int sz = 0;
if(isUpper){
sz+= upperCase.length;
}
if(isLower){
sz+= lowerCase.length;
}
if(isNumbers) {
sz+= numbers.length;
}
char chars[] = new char[sz];
int offset = 0;
... | 6 |
public void update() {
Window window = device.getFullScreenWindow();
if (window != null) {
BufferStrategy strategy = window.getBufferStrategy();
if (!strategy.contentsLost()) {
strategy.show();
}
}
// Sync the display on some systems.
... | 2 |
public void loadState(Session s) throws Exception {
for (int n = s.loadInt() ; n-- > 0 ;) {
final Target t = s.loadTarget() ;
final List <Action> l = new List <Action> () ;
s.loadObjects(l) ;
actions.put(t, l) ;
//
// Safety checks for can't-happen events-
if (! t.inWorld(... | 5 |
protected Method findMethod(String name, Class<?> clazz, Class<?> returnType, Class<?>[] paramTypes) {
Method method = null;
try {
method = clazz.getMethod(name, paramTypes);
} catch (NoSuchMethodException e) {
throw new MethodNotFoundException(LocalMessages.get("error.property.method.notfound", name, clazz... | 8 |
private boolean jj_3R_38() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_23()) {
jj_scanpos = xsp;
if (jj_3_24()) {
jj_scanpos = xsp;
if (jj_3_25()) {
jj_scanpos = xsp;
if (jj_3_26()) {
jj_scanpos = xsp;
if (jj_3_27()) {
jj_scanpos = xsp;
if (jj_3_28()) {
jj_scanpos = x... | 8 |
public int hashCode() {
int code = super.hashCode() ^ toRead.hashCode() ^ toWrite.hashCode()
^ direction.hashCode();
return code;
} | 0 |
public void bajaDeLicencia(int numero) {
EntityManager manager = verificarConexion();
if (numero <= 0) {
System.out.println("Se introdulo una licencia nula, no se puedo ejecutar la peticion");
return;
}
if (manager.find(LicenciaConductor.class, numero) != null) {
... | 5 |
public void paint(Graphics2D g, Component component, int width, int height) {
MacWidgetsPainter<Component> painterToUse;
Window activeAncestor = null;
Window active = KeyboardFocusManager.getCurrentKeyboardFocusManager()
.getActiveWindow();
if (active != null) {
activeAncestor = SwingUtilities.getWindo... | 5 |
public static PermissionMethodParser fromFile(String fileName) throws IOException {
PermissionMethodParser pmp = new PermissionMethodParser();
pmp.readFile(fileName);
return pmp;
} | 0 |
public static String rowConverter(int row) {
switch (row) {
case 0:
return "A";
case 1:
return "B";
case 2:
return "C";
case 3:
return "D";
case 4:
return "E";
case 5:
return "F";
case 6:
return "G";
case 7:
return "H";
}
return "Failed";
} | 8 |
public static int findNumDays(String fileName)
{
int lineNumber = 0;
String line;
try {
BufferedReader br = new BufferedReader( new FileReader(fileName));
while( (line = br.readLine()) != null)
{
lineNumber++; ... | 3 |
public void save(){
List<TreeItem> items = getItems();
items.remove(0); //Remove the tree root ("Project")
for(TreeItem item : items){
DatabaseTreeItem dataItem = (DatabaseTreeItem) item;
if(dataItem.gameData != null){
File f... | 3 |
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Bookingclass other = (Bookingclass) obj;
if (clas == null) {
if (other.clas != null)
return false;
} else if (!clas.equals(other.clas))
return f... | 6 |
private void checkStaleHosts() {
long currTime = System.currentTimeMillis();
List<String> staleHostsToRemove = new ArrayList<String>();
for(TaskTrackerHB lastHB : lastHeartbeat.values()) {
if( currTime - lastHB.getSendTime() > 8*TaskTracker.JOB_TRACKER_HB_TIME) {
//This task tracker missed more than al... | 6 |
public String getURL()
{
String queryString = getQueryString();
return (queryString != null ? this.uri + "?" + queryString : this.uri);
} | 1 |
private static void panelProperties(Node node, StringBuilder code) {
GObject gObj = (GObject) node;
for (PanelProperty property : gObj.getPanelProperties()) {
String javaCode = property.getJavaCode();
if (!javaCode.isEmpty()) {
code.append(" ").append(javaC... | 4 |
public void deserializeFromStream(DataInputStream index) throws IOException {
int magic = index.readShort();
if (magic != MAGIC) {
throw new IOException("invalid magic at " + getPos());
}
nodeWeight = index.readInt();
int nodes = index.readShort();
if (nodes <... | 8 |
public String join(String separator) throws JSONException {
int len = length();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < len; i += 1) {
if (i > 0) {
sb.append(separator);
}
sb.append(JSONObject.valueToString(this.myArrayList.g... | 2 |
public static void saveImage(BufferedImage img, ImageViewer imViewer, ImageMapper imMapper, String path, int mode, boolean rle)
throws CantSaveException
{
String fn = generateCleanFileName(path);
StringBuffer output = new StringBuffer();
//print data on the buffer
printData(out... | 5 |
@Override
public int valueCount() {
return value == null? 0:value.length;
} | 1 |
public boolean step(){
// NETWORK: transmit any current data in the network, then signal the source UAV and queuing ground station if it finished
PointCloud finishedCloud = network.step(currentTime);
if(finishedCloud != null){
//System.out.println("UAV #" + finishedCloud.getSrc().get... | 9 |
void invalidAction(JSONObject action){
try {
JSONObject errorMessage
= new JSONObject().put("error", "Invalid action: " + action.get("type"));
sendMessage(errorMessage);
} catch (JSONException f){}
catch (IOException g){}
} | 2 |
public boolean canMove(int oldX, int oldY, int newX, int newY, boolean isNewSpotEmpty) {
int deltaX;
int deltaY;
deltaX = Math.abs(newX-oldX);
deltaY = Math.abs(newY-oldY);
if (deltaX == 0 && deltaY != 0){
return true;
} else if (deltaX != 0 && deltaY == 0) {
return true;
}
return false;... | 4 |
public ArrayList<String> listFilesFromSourceNotInTargets() throws IOException{
ArrayList<String> strings = new ArrayList<String>();
for(int i=0;i<targetDirs.size();i++){
strings.add(listFilesFromSourceNotInTarget(i));
}
return strings;
} | 1 |
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
switch (cmd) {
case "EnterButton":
// first the driver presses the enter button, this creates a ticket
// need to get the next available ticket number from the garage
int ticketNumber;
try {
tick... | 9 |
public void updatePathField(Path text, boolean colorReset) {
String replace = text == null ? "" : text.toString();
this.path.setText(replace);
this.path.setToolTipText(replace);
if (colorReset) {
this.path.setForeground(Color.BLACK);
}
} | 2 |
public int compareTo( Object obj ) {
if( obj == null ) {
return( -1 );
}
else if( obj instanceof GenKbGelExpansionBuff ) {
GenKbGelExpansionBuff rhs = (GenKbGelExpansionBuff)obj;
int retval = super.compareTo( rhs );
if( retval != 0 ) {
return( retval );
}
{
int cmp = getRequiredMacroName... | 9 |
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.