text stringlengths 14 410k | label int32 0 9 |
|---|---|
public int maximalRectangleII(char[][] matrix) {
if (matrix == null || matrix.length == 0)
return 0;
int n = matrix[0].length;
int[] L = new int[n];
int[] R = new int[n];
int[] H = new int[n];
int area = 0;
for (int i = 0; i < n; i++)
R[i]... | 8 |
public Direction getDirectionToTarget(Entity target){
if(getX() < target.getX()){
return Direction.EAST;
}else if(getX() > target.getX()){
return Direction.WEST;
}else if(getY() < target.getY()){
return Direction.NORTH;
}else if(getY() < target.getY()){
return Direction.SOUTH;
}
re... | 4 |
@Override
public boolean init() {
if (game.getGameState() == GameState.LOGIN) {
if (getContext().getAccount() == null || getContext().getAccount().getUsername().equals("null")
|| getContext().getAccount().getPassword().equals("null")) {
log("You must have an acco... | 4 |
private void logicalNot(LogicalNot lnp) {
Predicate p = lnp.getPredicates().get(0);
if(p instanceof BinaryContains) {
// ignore them for the time being
} else if(p instanceof Contains) {
this.addToCount(((Contains) p).getA().getName(),
0);
} else if(p instanceof Exactly) {
if(((Exactly) p).getNum(... | 6 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> alread... | 8 |
public void run(){
File file = new File("./VanillaSwarm.txt");
try{
file.createNewFile();
}catch(IOException ex){
ex.printStackTrace();
}
this.generateHaltingCriteria();
this.generateNeighbourhoods();
this.generateVeloctiyUpdate();
this.generateFunction();
this.testSwarm(file);
} | 1 |
public void readPPM(String fileName)
// read a data from a PPM file
{
FileInputStream fis = null;
DataInputStream dis = null;
try{
fis = new FileInputStream(fileName);
dis = new DataInputStream(fis);
System.out.println("Reading "+fileName+"...");
// read Identifier
if(!dis.readLine().equals("P6"))
... | 5 |
public boolean pickAndExecuteAnAction() {
synchronized(orders){
for (CookOrder order: orders){
if(order.s==OrderState.cooked){
ServeOrder(order);
return true;
}
if(order.s==OrderState.pending){
TryToCookOrder(order);
return true;
}
}
}
synchronized(marketOrders){
for (MarketOrder... | 8 |
@Override
public List<TravelLog> sortDate() {
List<Journal> j = db.getAllJournals();
List<TravelLog> toReturn = new ArrayList<TravelLog>();
for(Journal journal : j)
{
List<TravelLog> tmp = journal.sort("Date");
if(toReturn.size() == 0)
toReturn.addAll(tmp);
else
{
for(TravelLog t : tmp)
... | 5 |
public long bindMortal(MortalMessage mortal)
{
if (proc != null)
{
try
{
messenger.readReadyMessage();
}
catch (ProcessCommunicationException ex)
{
// Fail. Project probably just doesn't support being reused for scoring. TODO: Statistics on how often this happens.
close();
}
}
if... | 6 |
public static void main(String[] args) {
RNASequence sequence;
if(args.length == 1 && args[0].equalsIgnoreCase("random")) {
int len = (int)(Math.random()*30+20);
StringBuilder sb = new StringBuilder();
RNABasePair[] pairs = RNABasePair.values();
for(int i = 0; i < len; i++) {
sb.append(pairs[(int)(M... | 4 |
@Override
public void dataModificationStateChanged(Object obj, boolean modified) {
String title = getFullTitle();
if (!title.equals(mTitle.getText())) {
mTitle.setText(title);
mTitle.revalidate();
}
} | 1 |
private boolean doCollisionCheck(boolean clatter) {
Debug.println("PhysicsEngine.doCollisionCheck()");
Vector3f here;
Vector3f there;
for (int i = 0; i < moving.length; i++) {
if (moving[i]) {
MovableObject[] pins = model.getPins();
here = pins[i].getPosition();
for (int j = 1; j < pins.length; j... | 8 |
private int readConfigTable
(ResTable_Config config,
byte[] data,
int offset) throws IOException {
config.size = readUInt32(data, offset);
offset += 4;
config.mmc = readUInt16(data, offset);
offset += 2;
config.mnc = readUInt16(data, offset);
offset += 2;
config.language[0] = (char) data[o... | 2 |
private void load(){
for(int yy = 0; yy < SIZE; yy++){
for(int xx = 0; xx < SIZE; xx++){
pixels[xx + yy * SIZE] = sheet.pixels[(x + xx) + (y + yy) * sheet.SIZE];
}
}
} | 2 |
public static Buffer load(String path) {
Buffer buffer = new Buffer(path);
if(path.endsWith(WAV_EXTENSION))
buffer = loadWAV(buffer);
else if(path.endsWith(OGG_EXTENSION))
buffer = loadOGG(buffer);
else
throw new RuntimeException("Unrecognized File for... | 2 |
@Basic
@Column(name = "CSA_VALOR_TOTAL")
public Double getCsaValorTotal() {
return csaValorTotal;
} | 0 |
public static String tanksString(ArrayList<Tank> tanks){
String tanksString = "";
for(Tank t:tanks){
String buf = tankString(t);
tanksString = tanksString + buf + ":";
}
return tanksString;
} | 1 |
static private boolean jj_3R_42() {
if (jj_3R_16()) return true;
if (jj_scan_token(DOT)) return true;
if (jj_scan_token(44)) return true;
if (jj_scan_token(LPAREN)) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3R_43()) jj_scanpos = xsp;
if (jj_scan_token(RPAREN)) return true;
ret... | 6 |
private boolean isMarketCommand(CommandName input) {
return input == CommandName.newTrader
|| input == CommandName.deleteTrader
|| input == CommandName.buy || input == CommandName.sell
|| input == CommandName.displayItems
|| input == CommandName.wish;
} | 5 |
public void init(IPacketProcessor packetProcessor, int port) {
this.port = port;
try {
datagramSocket = new MulticastSocket();
datagramSocket.setBroadcast(true);
System.out.println("datagramSocket: " + datagramSocket.getInetAddress());
} catch (SocketException e) {
packetProcessor.... | 2 |
public static int[] profit(int[] prices) {
int newMin = -1;
int newMinPosition = -1;
int[] result = new int[prices.length+1];
result[0] = 0;
int max = prices[0];
int maxPosition = 0;
int min = prices[0];
int minPosition = 0;
result[1] = 0;
int lastPoint = prices[0];
for(int i = 1; i < prices.le... | 7 |
public int getAdjustedNetProductionOf(GoodsType goodsType) {
int result = productionCache.getNetProductionOf(goodsType);
for (BuildQueue<?> queue : new BuildQueue<?>[] { buildQueue,
populationQueue }) {
ProductionInfo info = production... | 6 |
protected HantoMoveRecord findRandomMove(){
HantoMoveRecord aMove = null;
List<HantoCell> possCells = new ArrayList<HantoCell>();
possCells.addAll(gameManager.getCellManager().generatePossibleMoves());
List<HantoMoveRecord> possMoves = getPossMoves(possCells);
if (gameManager.getTurnCount() == 1){
aMove... | 6 |
private void dctLinePoint() {
if (trackingLines.isEmpty() || trackingPoints.isEmpty()) {
return;
}
// go through all lines
for (int i = 0; i < trackingLines.size(); i++) {
TrackingLine line = trackingLines.get(i);
// compare with all points
... | 9 |
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
try {
req.setAttribute("errors", new HashMap<String, String>());
if(ServletFileUpload.isMultipartContent(req)) {
req = new MultipartWrapper(req);
}
DaoUtil.diDao(this);
Stri... | 9 |
/* */ @EventHandler
/* */ public void onPlayerRegen(EntityRegainHealthEvent event)
/* */ {
/* 405 */ if ((event.getEntity() instanceof Player))
/* */ {
/* 407 */ Player p = (Player)event.getEntity();
/* */
/* 409 */ if (Main.getAPI().isSpectating(p))
/* */ {
/* 4... | 2 |
public boolean method195(int j) {
int k = maleEquip1;
int l = maleEquip2;
int i1 = anInt185;
if(j == 1) {
k = femaleEquip1;
l = femaleEquip2;
i1 = anInt162;
}
if(k == -1)
return true;
boolean flag = true;
if(!Model.method463(k))
flag = false;
if(l != -1 && !Model.method463(l))
flag =... | 7 |
private void playGame() {
IOGeneric.printTitle("Here they come! Try to bring down the plane!", "-");
while (true) {
try {
playRound();
} catch (AntiAircraftGun.BadCoordinate e) {
System.out.println("That shot missed the entire 10x... | 4 |
private Mob spawn(float x, float y){
Mob e = null;
short lyr = Vars.BIT_LAYER1;
if(Math.random()>.5) lyr = Vars.BIT_LAYER3;
switch(spawnType){
case CIVILIAN:
int type = (int) (Math.random()*3) + 1;
// int type = 1;
e = new Mob("Civilian", "civilian" + type, -1, x, y, lyr);
if(path!=null) e.moveT... | 6 |
private String getMethodName( CtClass clazz, CtMethod method ) throws NotFoundException
{
final CtClass[] types = method.getParameterTypes();
final StringBuilder sb = new StringBuilder();
sb.append( method.getName() ).append( '(' );
for (int k = 0; k < types.length; k++)
{
if... | 2 |
public void printBoard()
{
System.out.println("-------------------------------------------------------------------------");
System.out.println("\ta\tb\tc\td\te\tf\tg\th");
for(int i=0; i<8; i++)
{
System.out.print(i + "\t");
for(int j=0; j<8; j++)
{
if(this.checker[i][j] != null) //prevent null po... | 7 |
private boolean moveCheck(){
if (parent.getPosition().getX() < pos.getX() + bound) return true;
if (parent.getPosition().getX() + parent.getScale().getX() > pos.getX() + Window.getWidth() - bound) return true;
if (parent.getPosition().getY() < pos.getY() + bound) return true;
if (parent... | 4 |
public void takeOrder(List<MenuItem> orderList) throws RuntimeException {
try {
db.openConnection(ADMIN, sql, sql, sql);
List keys = new ArrayList();
List values = new ArrayList();
for (MenuItem item : orderList) {
keys.add("menu_id");
... | 5 |
public void testFactoryFieldDifference5() throws Throwable {
DateTimeFieldType[] types = new DateTimeFieldType[] {
DateTimeFieldType.year(),
DateTimeFieldType.dayOfMonth(),
DateTimeFieldType.dayOfWeek(),
};
Partial start = new Partial(types, new int[] {1, 2, 3... | 1 |
@Override
public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception {
splitted[0] = splitted[0].toLowerCase();
if (splitted[0].equalsIgnoreCase("ninjaglare")) {
NPCScriptManager.getInstance().start(c, 1103005);
} else if (splitted[0].equalsIgnoreC... | 5 |
public void putAll( Map<? extends Byte, ? extends Short> map ) {
Iterator<? extends Entry<? extends Byte,? extends Short>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Byte,? extends Short> e = it.next();
this.put( e.getKey(),... | 8 |
@Override
public void setBounds(int x, int y, int width, int height) {
super.setBounds(x, y, width, height);
if ((null == canvas) || (null == canvas.getOffScreenBuffer()) ||
(JCanvas3D.RESIZE_IMMEDIATELY == getResizeMode())) //whatever the resize mode, i create on first setbounds().... | 8 |
public int getMaxAddress() { return addressMax; } // Returns the highest address reached in the program | 0 |
public boolean isValidEndTurn(){
//The player must have a turn to be ending, must have already acted, and can't have other critical dialogs open at the time
if (gameOngoing){
if(playerTurn && hasActed && !accusationDialogOpen && !suggestionDialogOpen) {
return true;
} else {
String message = null;
... | 9 |
boolean removeAlignments() {
// passe 1 : marquer tous les alignements
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
if (grid[i][j].getColor() != 0 && horizontalAligned(i, j)) {
marked[i][j] = marked[i + 1][j] = marked[i + 2][j] = true;
}
if (grid[i][j].getColor() != 0 && verticalA... | 9 |
@Override
public float eval(IRList l) {
if (l == null || l.getQuery() == null || l.getPertinence() == null)
return -1;
ArrayList<Integer> relevants = l.getQuery().relevants;
ArrayList<Integer> pertinence = l.getPertinence();
int nRelevant = relevants.size(), nPertinence ... | 8 |
public double getSubStackWidth(int index1, int index2) {
double width = 0;
for (int i = index1; i <= index2; i++) {
width += intervals.get(i).getWidth();
}
return width;
} | 1 |
public static void printConstructors(Class<?> c){
display2.append("コンストラクタ\r\n");
Constructor[] declaredconstructors = c.getDeclaredConstructors();
Constructor[] constructors = c.getConstructors();
ArrayList<Constructor> constructorList = new ArrayList<Constructor>(constructors.length);
for(int i = 0; i < co... | 5 |
public String baseNumberCds2Codon(int cdsBaseNumber) {
int codonNum = cdsBaseNumber / CodonChange.CODON_SIZE;
int min = codonNum * CodonChange.CODON_SIZE;
int max = codonNum * CodonChange.CODON_SIZE + CodonChange.CODON_SIZE;
if ((min >= 0) && (max <= cds().length())) return cds().substring(min, max).toUpperCase... | 2 |
public static double[] mean(final SampleSet set) {
if (set.size() == 0) return null;
//
final int inputsize = set.get(0).getInputSize();
final double[] result = new double[inputsize];
long ctr = 0;
//
// add all features values.
//
for (Sample s... | 5 |
public void run(DebuggerVirtualMachine dvm) {
enterMessage();
needToDisplayFunction = true;
while (dvm.continueUntilFinished()) {
if (!dvm.getReasonForStopping().isEmpty()) {
UserInterface.println(dvm.getReasonForStopping());
UserInterface.println("");... | 4 |
@Override
public void run() {
while(true){
seatNr = -1;
try {
for(int runs=0;runs<5;runs++){
// Versuch einen Sitzplatz zu ergattern
if(blocked){
blocked = false;
Thread.sl... | 7 |
public Matrix getQ () {
Matrix X = new Matrix(m,n);
double[][] Q = X.getArray();
for (int k = n-1; k >= 0; k--) {
for (int i = 0; i < m; i++) {
Q[i][k] = 0.0;
}
Q[k][k] = 1.0;
for (int j = k; j < n; j++) {
if (QR[k][k] != 0) {
... | 6 |
public void addRedMarker(int markerNum) {
// Change markersRed[markerNum] to true
this.markersRed[markerNum] = true;
} | 0 |
private void pushPixels(int height, int dest[], byte src[], int destStep, int destOff, int width, int srcOff, int palette[],
int srcStep) {
int quarterX = -(width >> 2);
width = -(width & 3);
for (int i = -height; i < 0; i++) {
for (int j = quarterX; j < 0; j++) {
byte color = src[srcOff++];
if (colo... | 8 |
public static void main(String[] args){
programa = new ArrayList<Linea>();
File asm = new File("P1ASM.txt");
FileReader fr;
BufferedReader br;
Separador s = new Separador();
try {
fr = new FileReader(asm);
br = new BufferedReader(fr);
String linea = br.readLine();
while(linea != null){
... | 8 |
public void setHeight(int height)
{
marker[markers-1].setHeight(height);
} | 0 |
public void escanearDirectorio(String path){
File f = new File(path);
File[] files = f.listFiles();
if (files != null) {
for (File child : files) {
Date d = new Date(child.lastModified());
((DefaultTableModel)backupT.getModel()).addRow(new Obj... | 2 |
public Ball getBallAt(int index) {
return balls.get(index);
} | 0 |
private void loadContent() {
try {
avatar_image = ImageIO.read(this.getClass().getClassLoader().getResource("img/avatar_S.png"));
avatar_image_L = ImageIO.read(this.getClass().getClassLoader().getResource("img/avatar_S_L.png"));
avatar_image_J_R = ImageIO.read(this.getClass().getClassLoader().getResource("im... | 1 |
private static final void packObjectSpawns() {
Logger.log("ObjectSpawns", "Packing object spawns...");
if (!new File("data/map/packedSpawns").mkdir())
throw new RuntimeException(
"Couldn't create packedSpawns directory.");
try {
BufferedReader in = new BufferedReader(new FileReader(
"data/map/unpa... | 8 |
public void serializeObject()
{
try
{
int i;
Class<?> c1 = null;
Object obj;
File file = new File(path);
if (!file.exists())
file.createNewFile();
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
for(i=0; i<((p.objects).size()); i++)
... | 7 |
public void setSatisfied(boolean satisfied) {
Satisfied = satisfied;
} | 0 |
@Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
worldX = buf.readShort();
if (worldX < -255 || worldX > 255)
throw new RuntimeException("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || worldX > 255"... | 4 |
public void updateNextID()
{
for(Track track : this)
if (Integer.parseInt(track.get("id")) > nextID)
nextID = Integer.parseInt(track.get("id"));
nextID++;
//nextID = Integer.parseInt( this.get(new Integer(this.size()).toString()) . get("id") );
} | 2 |
private void initUserlistImageframeMenu(Color bg) {
this.userlistImageframeMenu = new JPanel();
this.userlistImageframeMenu.setBackground(bg);
this.userlistImageframeMenu.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
// image
{
Path initialValue = this.skin.... | 5 |
public Firewall(int id, Environment environment) {
this.id = id;
this.environment = environment;
} | 0 |
public void update() {
int xa = 0, ya = 0;
if (anim < 7500)
anim++;
else
anim = 0;
if (input.up)
ya--;
if (input.down)
ya++;
if (input.left)
xa--;
if (input.right)
xa++;
if (xa != 0 || ya != 0) {
move(xa, ya);
walking = true;
} else {
walking = false;
}
} | 7 |
public static void install() {
File root=new File(Main.path);
root.mkdir();
double version=0.0;
//Iz internetnega naslova prenese številko trenutne verzije posodoljevalnika
try {
URL url=new URL("http://"+Main.ip+"/d0941e68da8f38151ff86a61fc59f7c5cf9fcaa2/computer/... | 7 |
public Sprite getCurrentSprite() {
return sprites[currentFrame];
} | 0 |
public static void assignPropositionWeight(Proposition self, double weight) {
{ TruthValue tv = ((TruthValue)(Stella_Object.accessInContext(self.truthValue, self.homeContext, false)));
if (weight == 1.0) {
Proposition.assignTruthValue(self, Stella.TRUE_WRAPPER);
}
else if (weight == 0.0) ... | 7 |
@Override
public void actionPerformed(ActionEvent e) {
if((e).getSource() == view.getButtons()[ATTACKONCE]){
view.logUpdate(model.getBattle().fight());
}
if((e).getSource() == view.getButtons()[AUTOATTACK]){
while(model.getBattle().getFirstTerritory().getNbrOfUnits() > 1 && (model.getBattle().getSecondTerr... | 6 |
public ConnectionStringMap(ScriptFile file)
{
for (String line : file.getLines())
{
String elementName = null;
if (line.matches(".+=.+"))
{
elementName = line.substring(0, line.indexOf('=')).trim();
line = line.substring(line.inde... | 4 |
public static void main(String[] args)
{
long startTime = System.currentTimeMillis();
if(args.length == 0){
System.out.println("Please provide the location of the workload file!");
System.exit(1);
}
try {
String fileName = args[0];
... | 3 |
public void handleProcess() {
if (c.ssDelay > 0)
c.ssDelay--;
if (c.ssDelay == 0) {
soulSplitEffect(c.soulSplitDamage);
}
if (c.leechDelay > 0)
c.leechDelay--;
if (c.leechDelay == 5) {
if (c.oldPlayerIndex > 0)
appendRandomLeech(c.oldPlayerIndex, Misc.random(6));
else if (c.oldNpcIndex > 0... | 9 |
@Override
public void run() {
Socket connectionSocket = null;
try {
// block until connection is made
connectionSocket = masterSocket.accept();
// start game
window.RemotePlayer = "MASTER " + Pong.address.getHostAddress();
InputStream in =... | 5 |
private void buildFollow() {
follow = new ShareableHashMap<NonTerminal, SymbolSet>();
for (NonTerminal n : nonTerminals.values()) {
follow.put(n, newSymbolSet());
}
follow.get(startSymbol).add(endmarker);
int oldSize = 0;
int newSize = 0;
do {
oldSize = newSize;
newSize = 0;
fo... | 8 |
public void addlist(Object... args) {
for(Object o : args) {
if(o instanceof Integer) {
adduint8(T_INT);
addint32(((Integer)o).intValue());
} else if(o instanceof String) {
adduint8(T_STR);
addstring((String)o);
} else if(o instanceof Coord) {
adduint8(T_COORD);
addcoord((Coord)o);
}
}... | 4 |
@Override
public boolean equals(Object o) {
if (o == null) {
return false;
}
Event dest = (Event) o;
if (CompareUtil.isDifferent(_getEventName(), dest._getEventName())) {
return false;
}
if (_getEventData() != null && dest._getEventData() != null) {
if (_getEventData().length != dest._getEventDat... | 9 |
public String getName() {
return Name;
} | 0 |
private void drawObjectRadius(GOut g) {
String name;
g.chcolor(0, 255, 0, 32);
synchronized (glob.oc) {
for (Gob tg : glob.oc) {
name = tg.resname();
if (radiuses.containsKey(name) && (tg.sc != null)) {
drawradius(g, tg.sc, radiuses.get(name));
}
}
}
g.chcolor();
} | 3 |
public void charger(Element tour,Partie partie)
{
switch(tour.getChildText("couleurJoueur")){
case "BLANC":couleurJoueur = CouleurCase.BLANC;break;
case "NOIR":couleurJoueur = CouleurCase.NOIR;break;
case "VIDE":couleurJoueur = CouleurCase.VIDE;
}
List<Element> listdeSixFaces = tour.getChild("deSixFa... | 5 |
@Override
public Figur waehleFigur(String[][] spielfeld) {
Figur[] figurenArray = getFigurenArray();
Figur letzteFigur = null;
Figur vorletzteFigur = null;
double laengsterAbstand = 0;
for (Figur figur : figurenArray) {
boolean figurIstImZiel = false;
int[] aktuellePos = figur.getPosition();
for (... | 7 |
public List<Book> getBooksByAuthors(int branch_id, int [] author_id) {
List<Book> list = new ArrayList<>();
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = Drive... | 6 |
@Override
public void hoistDepthChanged(OutlinerDocumentEvent e) {} | 0 |
public String calculate() {
StringBuilder numV = new StringBuilder();
int i = 0;
while (cs[i] != '#' || op.peek().getOp() != '#') {
char c = cs[i];
if (Operator.isOp(c)) {
if (numV.length() != 0) {
num.push(numV.toString());
numV.delete(0, numV.length());
}
Operator op2 = new Operator(... | 8 |
public boolean hasArtist(String name) {
boolean result = false;
for (int i = 0; i < artist.size(); i++)
if (name.equals(artist.get(i).getName()))
result = true;
return result;
} | 2 |
@Override
public void setCountry(String c) {
super.setCountry(c);
} | 0 |
public AFN transformarEmAFN(Nodo nodo) throws Exception {
List<AFN> afnsNodos = this.getAFNsNodos(nodo);
List<AFN> afnsChars = this.getAFNsChars(nodo);
List<AFN> afns = this.getAFNs(nodo, afnsNodos, afnsChars);
AFN afn1 = null;
AFN afn2 = null;
AFN afn = null;
in... | 9 |
public CheckResultMessage check33(int day) {
return checkReport.check33(day);
} | 0 |
@Override
public double[] maxminWRT(String op, NodeVariable x, HashMap<NodeVariable, MessageQ> modifierTable) throws ParameterNotFoundException {
double[] maxes = new double[x.size()];
for (int i = 0; i < maxes.length; i++) {
maxes[i] = this.otherValue;
}
int xIndex = thi... | 7 |
public synchronized void createUnit(String name, float x, float y) {
NetworkedObject unit;
switch(name) {
case "Asteroid":
unit = new NS_Asteroid();
break;
case "Drone":
unit = new NS_Drone();
break;
case "Fighter":
unit = new NS_Fighter();
break;
case "Boss":... | 7 |
private String getPANIpAddress() {
// returns IP address in bluetooth and USB network
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface
.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces
.nextElemen... | 6 |
public void mouseReleased(MouseEvent e) {
if (debug == true)System.out.println("NodeGraphic.mouseReleased");
if (e.getButton() == MouseEvent.BUTTON1
&& MapPanel.selectedObject == MapPanel.EObjectTools.CURSOR
&& MapPanel.isDragging() == true)
{
move_vehicule_if_on();
if (debug == true) System.o... | 7 |
public Pion(final Couleur couleur, final int position) {
super(position);
this.couleur = couleur;
setOpaque(false);
switch (couleur) {
case BLANC :
setForeground(Color.WHITE);
setBackground(new Color(220, 220, 220));
break;
case NOIR :
setForeground(new Color(70, 70, 70));
setBackgroun... | 2 |
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Credentials)) {
return false;
}
Credentials that = (Credentials) o;
if (this.auth == null || this.key == null) {
return false;
... | 6 |
public Speaker getSpeaker() {
return speaker;
} | 0 |
public void deposit (int amount) {
if (amount < 0) {
System.out.println ("Cannot deposit negative amount.");
} else {
this.myBalance = this.myBalance + amount;
}
} | 1 |
public static String getStaticCreeperhostLinkOrBackup (String file, String backupLink) {
String resolved = (downloadServers.containsKey(Settings.getSettings().getDownloadServer())) ? "http://" + downloadServers.get(Settings.getSettings().getDownloadServer())
: Locations.masterRepo;
resol... | 5 |
public void clear() {
// haltScriptExecution();
// if we halt scripts, then the scripts that may call this method will not be able to run
initializationScript = null;
clearMouseScripts();
clearKeyScripts();
tot = 0;
kin = 0;
pot = 0;
lastCheckedTot = 0;
lastCheckedKin = 0;
setModelTime(0);
enabl... | 8 |
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 sheepDied(Sheep sheep) {
SheepFeed.debug("Sheep ("+ sheep.getEntityId() +") died, removing from list (and schedule)");
if ( this.isWoolGrowingSheep(sheep) ) {
// cancel task
this.scheduler.cancelTask(this.woolGrowingSheep.get(sheep));
// then remove the sheep
this.removeWoolGrowingSheep(shee... | 1 |
private String readUTF(int index, final int utfLen, final char[] buf) {
int endIndex = index + utfLen;
byte[] b = this.b;
int strLen = 0;
int c;
int st = 0;
char cc = 0;
while (index < endIndex) {
c = b[index++];
switch (st) {
case 0:
c = c & 0xFF;
if (c < 0x80) { // 0xxxxxxx
buf[str... | 7 |
private String convertValidateRTypes(String type) {
if (type.equals("double")) {
type = "numeric";
} else if (type.equals("i64") || type.equals("i32")) {
type = "integer";
} else if (type.equals("bool")) {
type = "logical";
} else if (type.equals("stri... | 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.