text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void setExpiryDate(XMLGregorianCalendar value) {
this.expiryDate = value;
} | 0 |
public void applyCareer(Human actor) {
subject = actor ;
applyBackgrounds(actor) ;
//
// We top up basic attributes to match.
actor.traits.initDNA(0) ;
actor.health.setupHealth(
Visit.clamp(Rand.avgNums(2), 0.26f, 0.94f),
1, 0
) ;
//
// For now, we apply gender at rando... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
BasicResourceDefinition other = (BasicResourceDefinition) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!... | 6 |
@Override
public void actionPerformed(ActionEvent src) {
Object source = src.getSource();
if (source == btnReset) {
resetAllTrain();
} else if (source == btnAddLocomotive) {
getLocomotiveInfo();
} else if (source == btnAddPassengerCar) {
getPassengerCarInfo();
} else if (source == btnAddFreightC... | 6 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Email)) {
return false;
}
Email other = (Email) object;
if ((this.idEmail == null && other.idEmail != null) || ... | 5 |
private void gameUpdate(long delta) {
hero.tick(delta);
myControle.tick(delta);
for(int i = 0; i < bullets.size(); i++) {
bullets.get(i).tick(delta);
}
} | 1 |
public GetUserInfoResult genLoad() {
EntityUser user = EntityUser.load(userId);
EntityUser delegate = null;
List<EntityUser> userVotes = null;
if (showVotes) {
userVotes = getVotes(user);
HashoutUserToDelegate hashoutUserToDelegate = new HashoutUserToDelegate();
List<EntityUserAndVote... | 3 |
public void printList() {
for (int i=0; i<size(); i++) {
System.out.println(this.get(i).getX() + " " + this.get(i).getY());
}
} | 1 |
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int aleatorio, intentos;
int numero, continua;
boolean continuar=true;
while(continuar){
intentos = 0;
aleatorio = (int)(Math.random()*1000 + 1);
do{
System.out.println("Adivine un numero entre 1 y 1000: ");
... | 9 |
private void placePitsAndSlime(){
Random rand = new Random();
int pitCount = rand.nextInt(3) + 3;
int x, y;
//Assign Pits
for(int i = 0; i < pitCount; i++){
x = rand.nextInt(10);
y = rand.nextInt(10);
if(grid[x][y] != RoomState.EMPTY)
i--;
else
grid[x][y] = RoomState.PIT;
}
... | 5 |
public Skill getEnum() {
switch (skill) {
case 0:
return Skill.ATTACK;
case 1:
return Skill.DEFENCE;
case 2:
return Skill.STRENGTH;
case 3:
return Skill.CONSTITUTION;
case 4:
return Skill.RANGED; // guess
case 5:
return Skill.PRAYER;
case 6:
return Skill.MAGIC;
case... | 9 |
public int addFuelToCar(int litresAdded) {
if(isCarRented() == false || getFuelInCar() == getFuelCapacity()){
return 0;
} else {
int fuelTotal = fuelInCar + litresAdded;
int fuel = Math.min(fuelTotal, fuelCapacity);
fuelInCar = fuel;
if (litresAdded >= (fuelCapacity - fuelInCar)){
... | 3 |
@Override
public void destroy() {
node = null;
} | 0 |
public ArrayList<Position> possibleMoves(){
ArrayList<Position> d = new ArrayList<Position>();
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
Position position = new Position(super.position().x() + i, super.position().y() + j);
if (position().x... | 9 |
private int findWordLimit(int index, BreakIterator words, boolean direction, String s)
{
// Fix for 4256660 and 4256661.
// Words iterator is different from character and
// sentence iterators
// in that end of one word is not necessarily start of
// another word.
// Please see java.text.Brea... | 6 |
private int getAngleNearEnemy(){
int vzdalenost = 2000;
int angle, min_x = 0,min_y = 0;
/**
* Zjištění nejližšího nepřítele
*/
for (int i=0;i<enemies.size();i++)
{
// Výpočet vzdalenost X,Y souradnice
int pomx = Math.abs(x - enemies.... | 8 |
@Override
public void componentActivated(AbstractComponent source) {
//Handles the Mouse Interactions
//TODO: Add logic to check for overlays
if(gameTypeBox.isActivated()){
if(source == gameTypeBox.pvaiButton){
Globals.playerTwoAI = true;
Globals.GAME.enterState(Globals.GAME.GAMESCREENSTATE, new Fa... | 9 |
public void setIntelligentY(int intelligentY) {
this.intelligentY = intelligentY;
} | 0 |
private String IaddResourceNode(String resource_id)
{
String node_id = null;
OrientGraph graph = null;
try
{
node_id = getResourceNodeId(resource_id);
if(node_id != null)
{
//System.out.println("Node already Exist: region=" + regio... | 5 |
@Override
public void keyPressed(KeyEvent keyEvent) {
if(keyEvent.getKeyCode() == KeyEvent.VK_LEFT) {
iDireccion = 1;
}
if(keyEvent.getKeyCode() == KeyEvent.VK_RIGHT) {
iDireccion = 2;
}
if (iDireccionProyectil == 0 &&
keyEvent.getKeyCode(... | 4 |
public void setAddress1(String address1) {
this.address1 = address1;
} | 0 |
static public String[] findCoauthor(HashMap<String, String[]> coauthorResult, String personName){
String coauthorArray[] = coauthorResult.get(personName);
String temp[] = null;
String tempString = null;
String ResultArray[] = new String[coauthorArray.length];
ResultArray[0] = coauthorArray[0];
for(int i = 1... | 1 |
private static float maximum(float a, float b, float c, float d) {
if (a > b) {
if (a > c) {
return a > d ? a : d;
} else {
return c > d ? c : d;
}
} else if (b > c) {
return b > d ? b : d;
} else {
return c > d ? c : d;
}
} | 7 |
@GET
@Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8")
public List<SocialCommunity<?>> getCommunities(
@QueryParam("query") String query,
@QueryParam("communitiesTypes") CommunityType[] communitiesTypes,
@QueryParam("page") Integer page) {
EnumSet<CommunityType> communitiesTypesSet = EnumSet
.n... | 4 |
public static final void exampleSynchronousQueries() {
System.out.println("Starting Cyc synchronous query examples.");
try {
ELMt inferencePSC = access.makeELMt("InferencePSC");
CycFormulaSentence query = CycLParserUtil.parseCycLSentence("(isa ?X Dog)", true, access);
InferenceWorkerSynch work... | 1 |
private void updateShop(final ShopCharacter shop, final PlayerCharacter player){
for(final Item item : shop.getInventory()){
// create item panel
JPanel shopItem = new JPanel();
shopItem.setPreferredSize(new Dimension(250, 70));
shopItem.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
shopItem.se... | 4 |
public void installListeners() {
keyListener = new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
JediWindowModel model = window.model;
if (e.getKeyCode() ==... | 8 |
private JPanel createSavedSettingsPanel() {
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createTitledBorder("Gespeicherte Einstellungen"));
panel.setLayout(new BorderLayout());
_savedSettingsTable.setRowSelectionAllowed(true);
_savedSettingsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INT... | 7 |
public void addUso(String cod, double area) {
if (usos == null)
usos = new HashMap<String, Double>();
if (usos.get(cod) == null)
usos.put(cod, area);
else {
double a = usos.get(cod);
a += area;
usos.put(cod, a);
}
} | 2 |
public AnnotationVisitor visitAnnotationDefault() {
AnnotationVisitor av = mv.visitAnnotationDefault();
return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
} | 1 |
public TurnHandler(boolean clockwise) {
this.clockwise = clockwise;
} | 0 |
public static void moviesToFile(String infilename, String outfilename) {
File file = new File(outfilename);
List<UserMovie> list = readData(infilename);
Collections.sort(list);
FileWriter fw = null;
try {
fw = new FileWriter(file);
for(int i=0; i<list.size(); i++){
fw.append(list.get(i)+"\n");
}
... | 4 |
public Strat getrand(int r) {
if (r == 0) {
return tStrats.get((int) new Random().nextInt(tStrats.size()));
} else if (r == 1) {
return zStrats.get((int) new Random().nextInt(zStrats.size()));
} else if (r == 2) {
return pStrats.get((int) new Random().nextInt(pStrats.size()));
} else if (r == 3) {
r... | 4 |
private Collection<Object[]> getParameterArrays() throws Exception {
Method testClassMethod = getDeclaredMethod(this.getClass(),
"getTestClass");
Class<?> returnType = testClassMethod.getReturnType();
if (returnType == Class.class) {
return getParameterArrays4_3();
... | 2 |
@Override
public void run() {
if (players[0].getPlayerType() == Const.LAN) {
try {
String name = in.readUTF();
this.setPlayer1Name(name);
out.writeUTF(players[1].getName());
} catch (Exception ex) {
System.out.pri... | 8 |
public void showTip(String tipText, Point pt)
{
if (getRootPane() == null)
return;
// draw in glass pane to appear on top of other components
if (glassPane == null)
{
getRootPane().setGlassPane(glassPane = new JPanel());
glassPane.setOpaque(false);... | 3 |
@SuppressWarnings({ "rawtypes", "unchecked" })
public void lock(TransactionId tid, Permissions permission) throws TransactionAbortedException
{
if (permission == Permissions.READ_ONLY)
{
if (lock.getReadHoldCount() == 0)
{
try
{
while(!lock.readLock().tryLock())
{
wait();
}
... | 9 |
public static void export(String filename) throws Exception {
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(
filename)));
manager = new MovieManager("imdblist", "movies");
set = manager.getCompleteResultSet();
writer.write("<html><body><table width=80%>\n");
while (set... | 8 |
public static void clearList(){
listAllWords.clearList();
} | 0 |
@Override
public boolean isCellEditable(int row, int col)
{
switch (col)
{
case 0:
case 2:
case 3:
return true;
}
return false;
} | 3 |
private int[] getSurroundings(int xCoord, int yCoord) {
int[] surroundings = new int[3];
//System.out.println("origin = " + xCoord + ", " + yCoord);
for(int y = yCoord - 1; y <= yCoord + 1; y++) {
for(int x = xCoord - 1; x <= xCoord + 1; x++) {
if(!((validateX(x) == xCoord) && (validateY... | 6 |
public Result recognizeFromResult(Result r)
{
//get phonemes
ArrayList<PhonemeContainer> phonemesSpeech = pc.getPhonemes(r);
//get best result
String[] phonemes = phonemesSpeech.get(0).getPhonemes();
//ad to phone frontend
pfe.addPhonemes(phonemes);
//start postprocessing
r = null;
e... | 9 |
public static void closeSession() throws HibernateException {
Session session = (Session) threadLocal.get();
threadLocal.set(null);
if (session != null) {
session.close();
}
} | 1 |
public void updatePlayer(PlayerUpdate newdata){
x = newdata.x;
y = newdata.y;
} | 0 |
@Override
public boolean colides(SchlangenKopf head) {
if (super.colides(head) ? true : (nextGlied == null ? false : nextGlied.colides(head))) {
head.die();
return true;
}
return false;
} | 3 |
public void buttonClick(int position){
if(turn <10){
btnEmptyClicked = true;
if(isMyTurn)
{
btnEmpty[position].setText("X");
btnEmpty[position].setFont(new Font("sansserif",Font.BOLD,32));
isMyTurn = false;
}
else
{
btnEmpty[position].setFont(new Font("sansserif",Font.BOLD,32));
btnEmpty... | 3 |
private boolean isAttackPlaceLeftNotHarming(int position, char[] boardElements, int dimension) {
if (isPossibleToPlaceLeft(position, dimension)) {
if (isPossibleToPlaceOnNextLine(boardElements, position + dimension)
&& isBoardElementAnotherFigure(boardElements[positionLeftBelow(p... | 5 |
public boolean PointInLineRect(Vector2 point)
{
return (((point.X >= mPoint1.X && point.X <= mPoint2.X)
|| (point.X <= mPoint1.X && point.X >= mPoint2.X))
&& ((point.Y >= mPoint1.Y && point.Y <= mPoint2.Y)
|| (point.Y <= mPoint1.Y && point.Y >= mPoint2.Y)));
} | 7 |
@Basic
@Column(name = "employee_id")
public int getEmployeeId() {
return employeeId;
} | 0 |
public static void main(String[] args) {
try {
new CounterSwipeServer().startServer();
} catch (Exception e) {
System.out.println("I/O failure: " + e.getMessage());
e.printStackTrace();
}
} | 1 |
public boolean removeWord(String word) {
if(word.length() == 0) return true;
char the_char = word.charAt(0);
int childPos = getChildPos(the_char);
if(this.children[childPos] == null)
return false;
if(word.length() == 1 ){
if(this.children[childPos].is_word){
if(this.children[childPos].is_leaf){
... | 9 |
private static void tr(final String s) {
if (BloatBenchmark.TRACE) {
System.out.println(s);
}
} | 1 |
public double sin(int a){
//normalizing
if(a>360){
a %= 360;
}else if(a<0){
a %= 360;
a += 360;
}
//return
if(a <= 90){
return sin[a];
}else if(a <= 180){
return sin[180 - a];
}else if(a <= 270){
return -sin[a - 180];
}else{
return -sin[360 - a];
}
} | 5 |
public HacklabSignDriver(String serialPortName) {
this.portName = serialPortName;
if(numBoards < 1 || numBoards > 12) {
throw new IllegalArgumentException("numBoards is out of range: " + numBoards);
}
// open the serial port
CommPortIdentifier portIdentifier;
try {
portIdentifier = CommPortI... | 9 |
public ClassInfo getClassInfo() {
if (clazz != null)
return clazz;
else if (ifaces.length > 0)
return ifaces[0];
else
return ClassInfo.javaLangObject;
} | 2 |
private void killAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_killAllButtonActionPerformed
try {
logger.log(Level.INFO, "Killing all processes on device: " + deviceManager.getSelectedAndroidDevice().toString());
logger.log(Level.INFO, "ADB Output: " + adbCo... | 1 |
public static <E> Map<E,int[]> intArrayMapCopy(Map<E,int[]> map) {
Map<E,int[]> copy = null;
if (map instanceof HashMap<?,?>) {
copy = new HashMap<E,int[]>();
} else if (map instanceof TreeMap<?,?>) {
copy = new TreeMap<E,int[]>();
}
for (E e : map.keySet(... | 7 |
public boolean parseField(String name, String value) {
if (name != null && value != null) {
DeviceField filed = EnumUtils.lookup(DeviceField.class, name);
if (filed != null){
return filed.handle(getDevice(), value);
} else{
return false;
}
}
return false;
} | 3 |
@Override
public void moveCursor(int x, int y)
{
if(x < 0)
x = 0;
if(x >= size().getColumns())
x = size().getColumns() - 1;
if(y < 0)
y = 0;
if(y >= size().getRows())
y = size().getRows() - 1;
textPosition.setColumn(x);
... | 4 |
public BinSmotif(Smotifs binMe) {
try {
String bin = binMe.getBin();
String path = bin.substring(0,1) + "/" + bin.substring(1,2) + "/" +
bin.substring(2,3) + "/" + bin.substring(3,4) + "/" + bin.substring(4,5);
String totalPath = "C:/emacs/Bioinformatics-Project/Bins" + path + "/" +
bin + "output.... | 2 |
@Test
public void resolve() {
int sqrt = ((int) Math.sqrt(N)) + 1;
Primes.isPrime(sqrt);
print(largest(N));
} | 0 |
public String mkString(Class clazz) throws IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException {
List<String> list = new ArrayList<String>();
String result = clazz.getSimpleName() + " ";
if (!Modifier.isAbstract(clazz.getModifiers())){
o... | 9 |
private String read() throws IOException {
String line = br.readLine();
if(line == null)
return "";
return line;
} | 1 |
public synchronized void moveDown(boolean pressed) {
downPressed = pressed;
if (pressed) {
if (timeToNextDownMove <= 0) {
tetromino.tryMove(this, Direction.DOWN);
timeToNextDownMove = AUTO_REPEAT_TICKS;
}
else timeToNextDownMove--;
... | 2 |
private void render() {
// System.out.println("rendering...");
if (first) {
c = new Chat();
first = false;
}
BufferStrategy bs = this.getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
}
Graphics ... | 6 |
public final double grad(int var1, double var2, double var4, double var6) {
int var8 = var1 & 15;
double var9 = var8 < 8?var2:var4;
double var11 = var8 < 4?var4:(var8 != 12 && var8 != 14?var6:var2);
return ((var8 & 1) == 0?var9:-var9) + ((var8 & 2) == 0?var11:-var11);
} | 6 |
private void fixBounds() {
if (x < xmin)
x = xmin;
if (y < ymin)
y = ymin;
if (x > xmax)
x = xmax;
if (y > ymax)
y = ymax;
} | 4 |
private static void splitRange(
final Object builder, final int valSize,
final int precisionStep, long minBound, long maxBound
) {
if (precisionStep < 1)
throw new IllegalArgumentException("precisionStep must be >=1");
if (minBound > maxBound) return;
for (int shift=0; ; shift += precisionSt... | 9 |
public PrintWriter getWriter()
throws java.io.IOException
{
if (_outputState==DISABLED)
return __nullServletWriter;
if (_outputState!=NO_OUT && _outputState!=WRITER_OUT)
throw new IllegalStateException();
// If we are swit... | 8 |
public void act()
{
//Initial. Stores the locations which can be reached in the first location.
//Push it into the stack
if(init==0)
{
last=this.getLocation();
next = last;
crossLocation.push(getValid(last));
init=1;
}
if (isEnd == true)
{
//to show step count when reach the goal ... | 9 |
private void menu_closeConnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menu_closeConnActionPerformed
Globals.global_connection.close_connection();
this.setTitle("Kurs project,3105,Ratnikov,Chuglov. Connection state = " + Globals.global_connection.get_connection_state());
... | 0 |
@Override
public void run() {
initialize();
newGeneration = new Chromosome[popsize];
for (int k = 0; k < nGenerations; k++) {
evaluate(population);
Arrays.sort(population);
System.out.println(
"Iter: " + k + " Dur: " + population[0].getActualDuration()
);
// Elitism
for (int... | 4 |
public static void main(String[] args)
{
int numOfGuesses = 0;
GameHelper helper = new GameHelper();
SimpleDotCom theDotCom = new SimpleDotCom();
int randomNum = (int) (Math.random() * 5);
int[] locations = {randomNum, randomNum+1, randomNum+2};
theD... | 2 |
public static void sendData(String message, String IP, int PORT){
String multicast = IP;
int port = PORT;
Logger logger = LoggerFactory.getLogger(DaemonStorageProcess.class);
InetAddress group = null;
try {
group = InetAddress.getByName(multicast);
} catch (... | 6 |
public List<ReceptDTO> getReceptList() throws DALException {
List<ReceptDTO> list = new ArrayList<ReceptDTO>();
ResultSet rs = Connector.doQuery("SELECT * FROM recept");
try
{
while (rs.next())
{
list.add(new ReceptDTO(rs.getInt(1), rs.getString(2)));
}
}
catch (SQLException e) { throw new DAL... | 2 |
@Before(value = "")
public void before() throws Throwable {
log.info("Beginning method: ");
} | 0 |
public Logging() {
String time = getFilenameDateTime();
logfilename = "log/log" + time + ".xml";
msgfilename = "log/.msg" + time;
start = "\t<start date=\"" + getLogDate() + "\" time=\"" + getLogTime() + "\" />\n";
try {
File file = new File("log/");
if (!file.exists())
file.mkdir();
else
i... | 4 |
public Row getByKey(String tableName, String key) throws DBUnavailabilityException,
DataBaseRequestException, DataBaseTableException {
if (key == null) {
throw new DataBaseRequestException("key shouldn't be null");
}
String firstCharAtName = key.substring(0, 1);
... | 1 |
public static Dir getDir(int id)
{//Great for iterating over all Dirs in a for loop
// ex: for(int d=0;d<4;d++)
// square.transform(Dir.getDir(d));
switch (id)
{
case 0:
return Dir.North;
case 1:
return Dir.East;... | 5 |
public void busRemoved (Bus bus)
throws IOException
{
if (model == null)
return;
synchronized (busses) {
Bus newBusses [] = new Bus [busses.length - 1];
HubNode newHubs [] = new HubNode [newBusses.length];
int index, nodeIndex = -1;
HubNode node = null;
// which one went?
for (int i = in... | 4 |
@Override
void write(DataOutput dataoutput) {
try {
if (!this.list.isEmpty()) {
this.type = ((NBTBase) this.list.get(0)).getTypeId();
} else {
this.type = 0;
}
dataoutput.writeByte(this.type);
dataoutput.writeInt(th... | 3 |
public void setDescription(String description) {
this.description = description;
} | 0 |
public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... | 7 |
@SuppressWarnings({ "unchecked", "rawtypes" })
public void run() {
//References the instance of the plugin and config for easier accessing
ms = MojangStatus.getInstance();
config = ms.getConfig();
try {
//Retrieve status info
URL url = new URL("http://status.mojang.com/check");
Scanner s = new ... | 5 |
public void generate_cffile(int operations_count, int file_minindex,
int file_maxindex) {
System.out.println("inside generating config file");
int remaining_ops = operations_count;
int line_index = 1;
int read_ops = (int) Math.floor(0.7 * operations_count);
int write_ops = (int) Math.ceil(0.3* operations_c... | 6 |
public void nextModel(LineageState state) {
state.setCurrentTime(getNextEventTime());
double time = getNextEventTime();
if (time == Long.MAX_VALUE) {
// assert false:state.getLinagesActive();
throw new RuntimeException("Model does not permit full coalescent of linages.\n Check for zero migration rates... | 8 |
public static final ISkill getSkill(final int id) {
if (skills.size() != 0) {
return skills.get(Integer.valueOf(id));
}
System.out.println("Loading SkillFactory :::");
final MapleDataProvider datasource = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("net.sf.odinms.wzpath") + "/Skill.wz"... | 8 |
public void settingsKey(int k, Character c) {
HUD hud = null;
for (int i = (huds.size() - 1); i >= 0; i--) {
hud = huds.get(i);
if (hud.getName().equals("ScreenKeys")) {
hud.settingsKey(k, c);
}
}
} | 2 |
public static void main(String[] args) {
GameData g = new GameData(6);
String[] tribes = new String[] { "banana", "apple" };
g.setTribeNames(tribes[0], tribes[1]);
Contestant c1 = null, c2 = null;
try {
c1 = new Contestant("a2", "Al", "Sd", tribes[1]);
c2 = new Contestant("as", "John", "Silver", trib... | 4 |
*/
public void deselectAll () {
checkWidget ();
CTableItem[] oldSelection = selectedItems;
selectedItems = new CTableItem [0];
if (isFocusControl () || (getStyle () & SWT.HIDE_SELECTION) == 0) {
for (int i = 0; i < oldSelection.length; i++) {
redrawItem (oldSelection [i].index, true);
}
}
for (int i = 0; i... | 5 |
public void showEndScreen() {
main.textFont(font, 130);
main.text("Game Over!", 30, 150);
main.textFont(font, 30);
main.text("[R]etry", 680, 480);
if (main.rightBar.score == 10 && main.opponent != null) {
main.textFont(font, 50);
main.text("Get some practice an come back.", 30, 350);
return;
}
ma... | 6 |
public void move(int xa, int ya) {
if(xa != 0 && ya != 0){
if(diagonal<4){
move(xa, 0);
move(0, ya);
diagonal++;
}else{
diagonal = 0;
}
return;
}
if (xa > 0)
dir = 1;
if (xa < 0)
dir = 3;
if (ya > 0)
dir = 2;
if (ya < 0)
dir = 0;
if (!collision(xa, ya)) {
x ... | 8 |
public void saveOrder() throws Exception{
orderSQL="INSERT INTO ORDERS(USERNAME,";
orderSQL += " SHIPPING_ADDRESS, SHIPPING_ZIPCODE, SHIPPING_CITY)";
orderSQL += " VALUES(?,?,?,?)";
try{
// load the driver and get a connection
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnectio... | 7 |
public void start() {
Timer time = new Timer();
TimerTask task = new TimerTask() {
/**
* Actions to do
*/
@Override
public void run() {
localNet.progress();
localNet.showNet();
if (!localNet.ha... | 1 |
public void forward_packet(Node sender, Packet packet)
{
try
{ //latência do canal de transferência
sleep((long) this.latency);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
//identifica qual das extremidades está enviando
Node receiver = null;
if (sender.equals(this.point_A... | 4 |
@Override
public AbstractActionPanel getAction() {
if ( owner.getSelected() ) {
return new ActionPanelBlank();
} else {
return new ActionPanelBlank();
}
} | 1 |
public void run() {
long beforeTime, afterTime, timeDiff, sleepTime;
long overSleepTime = 0L;
int noDelays = 0;
long excess = 0L;
gameStartTime = System.nanoTime();
prevStatsTime = gameStartTime;
beforeTime = gameStartTime;
running = true;
while(running) {
theModel.update();... | 6 |
@Override
public Class<?> getColumnClass(int columnIndex) {
if (columnIndex == 2)
return Boolean.class;
else if(columnIndex == 3)
return Boolean.class;
return super.getColumnClass(columnIndex);
} | 3 |
public void pedirPath(File[] dir) {
ArrayList<String> ficheros = new ArrayList();
if(getPath().equals("")){
Interfaz.dirAct.setText(("Carpeta: \"\\\""));
}else{
Interfaz.dirAct.setText("Carpeta: \"" + getPath() + "\"");
}
int i=0;
... | 3 |
private static void printHeroList()
{
for(HeroSlot heroslot : heroSlots){
System.out.println(heroslot.toString());
}
} | 1 |
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.