text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void addLongBranch(final Label label) {
if (ClassEditor.DEBUG || CodeArray.DEBUG) {
System.out.println(" " + codeLength + ": " + "long branch to "
+ label);
}
branchInsts.put(new Integer(codeLength), new Integer(lastInst));
longBranches.put(new Integer(codeLength), label);
addByte(0);
add... | 2 |
public static float findSumOfAction(float sum, int action, float dataValue){
if (action == 0){
sum = sum + dataValue;
}
if (action == 1){
sum = sum - dataValue;
}
if (action == 2 && sum != 0){
sum = sum * dataValue;
}
if (action... | 7 |
public Set<String> getRulesToDerive(Set<Literal> literals) {
Set<Literal> literalsChecked = new TreeSet<Literal>();
Set<Literal> literalsToCheck = new TreeSet<Literal>();
Set<Literal> literalsToAdd = new TreeSet<Literal>();
Set<String> rulesExtracted = new TreeSet<String>();
literalsToAdd.addAll(getLiteralsT... | 6 |
public void keyPressed(int k) {
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_UP) player.setUp(true);
if(k == KeyEvent.VK_DOWN) player.setDown(true);
if(k == KeyEvent.VK_Z) player.setPummeling();
} | 5 |
public void paint(Graphics g) {
for (Element<?> e : _lightElements) {
if (((Light)e.x).getColor() == LightColor.GREEN) {
g.setColor(Color.GREEN);
}
else if (((Light)e.x).getColor() == LightColor.YELLOW) {
g.setColor(Color.YELLOW);
}
else {
g.se... | 9 |
public V doit() {
PreparedStatement stmt = null;
V out = null;
con = null;
try {
con = connectionPool.getConnection();
stmt = con.prepareStatement(mSQL);
out = process(stmt);
} catch( SQLException e ) {
e.printStackTrace();
logger.warning(e.toString());
}
finally {
... | 3 |
private Factor parseFactor() {
//System.out.println("parseFactor");
Factor factor = null;
switch (showNext().getKind()){
case "ident":
factor = new IdentSelector();
((IdentSelector) factor).setIdent(new Identifier(acceptIt()));
((IdentSelector) factor).setSelector(parseSelector());
break;
case "in... | 4 |
@Override
public void handleOutputCommand(SoarBeanOutputContext context, DriveCommand driveCommand) {
if (shuttingDown) {
return;
}
short velocity = (short) driveCommand.velocity;
short radius = (short) driveCommand.radius;
context.setS... | 2 |
@Override
public boolean equals(Object other) {//@formatter:off
return (other == this) ? true
: (other == null) ? false
: (other instanceof Cell) ? equal(((Cell) other).x, x) && equal(((Cell) other).y, y)
: false;
}//@formatter:on | 4 |
private void sortEntities(){
int square;
//Go through every row and sorts the entityRows list
for(int i = 0; i < Constants.TILE_AMOUNT_Y; i++){
square = (i)*32;
for(Entity e: entities){
if(e.getY() >= square && e.getY() < square+32){
entityRows.get(i).add(e);
}
}
}
... | 6 |
public void testConstructor_ObjectStringEx4() throws Throwable {
try {
new MonthDay("10:20:30.040+14:00");
fail();
} catch (IllegalArgumentException ex) {
// expected
}
} | 1 |
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
if((msg.amITarget(littlePlantsI))
&&(!processing)
&&((msg.targetMinor()==CMMsg.TYP_GET)||(msg.targetMinor()==CMMsg.TYP_PUSH)||(msg.targetMinor()==CMMsg.TYP_PULL)))
{
processing=true;
final Ability A=littlePlantsI.fetchEffect... | 7 |
public int dxLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
if( optInTimePeriod > 1 )
return optInTimePeriod + (this.unstablePe... | 4 |
public void setRequestMethod(Method requestMethod) {
this.requestMethod = requestMethod;
} | 0 |
void mapInVal(Object val, Object to, String to_in) {
if (val == null) {
throw new ComponentException("Null value for " + name(to, to_in));
}
if (to == ca.getComponent()) {
throw new ComponentException(
"field and component ar ethe same for mapping :" + to_in);
}
ComponentAccess ca_to = lookup(to);
... | 3 |
@Override
public void paint(Graphics g) {
super.paint(g);
this.setBackground(Color.BLACK);
this.setDoubleBuffered(true);
g.setColor(gameOverColor);
drawLists(g);
drawHints(g);
drawScore(g);
if (isTeleport) {
teleport.draw(g);
}
... | 2 |
public void receiveMessage(String msg)
{
mailbox.add(msg);
if (myWindow != null)
{
while (hasMessages()) {
myWindow.showMessage(mailbox.remove());
}
}
} | 2 |
public static void main(String[] args) {
List<List<Scheduler>> all_schedulers = new LinkedList<List<Scheduler>>();
int as_time=4, as_period=10;
System.out.println("Aperiodic Server (c="+as_time+",p="+as_period+")\t\t\t\t i=Number of aperiodic tasks where start=0, c=2");
System.out.println("i\tFinish Time\t\t\... | 8 |
public DiskMgrException(Exception e, String name)
{
super(e, name);
} | 0 |
public void createDecal(SimpleVector pos, SimpleVector normal) {
Decal decal=getFreeDecal();
if (decal!=null) {
Matrix m=normal.getRotationMatrix();
decal.place(pos);
decal.rotate(m);
}
} | 1 |
public void start()
{
try {
Display.setDisplayMode(new DisplayMode(800, 600));
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
System.exit(0);
}
//Init Open GL here
while (!Display.isCloseRequested())
{
//Render Open GL here
Display.update();
}
Display.des... | 2 |
public void addLegalValue(String value, String desc, String mapto) throws MaltChainedException {
if (value == null || value.equals("")) {
throw new OptionException("The legal value is missing for the option "+getName()+".");
} else if (legalValues.contains(value.toLowerCase())) {
throw new OptionException("Th... | 7 |
public Vector<Camera> getCamerasByTag(String Tag)
{
Vector<Camera> cams = new Vector<Camera>();
for(Camera camera : this.Cameras)
{
if(camera.getTag().equals(Tag))
{
cams.add(camera);
}
}
return cams;
} | 2 |
public ArrayList<ISuggestionWrapper> addCharacter() {
ArrayList<ISuggestionWrapper> suggestions = new ArrayList<ISuggestionWrapper>();
initiateFromExhaustedNodes();
Link nextLink = getNextLink();
currentNodeVisitations = 1;
while(neededSuggestions - suggestions.size() > 0 && next... | 8 |
public void initialize() {
textField.setColumns(10);
frame = new JFrame();
frame.getContentPane().setBackground(SystemColor.control);
frame.setTitle("MFB");
frame.setBounds(100, 100, 366, 564);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JButton btnStop... | 6 |
public void definePerBal(int sem) {
String grandTotal = Integer.toString(0);
DataBase.sem_SWPerBal_data[sem][DataBase.schoolGradeCount][DataBase.sem_SWPerBal_data[sem][0].length - 1] = Integer
.toString(0);
for (int colNum = 0; colNum < sem_SWPerBal_headers[sem].length; colNum++) {// Iterates
// through ev... | 8 |
public void registerCustomer(String cid, String cname, String cadd, String password, String cphone) throws Exception{
con = ConnectionService.getConnection();
try {
PreparedStatement ps = con.prepareStatement("INSERT INTO customer VALUES (?,?,?,?,?)");
if (cid.length() == 0)
{
cid = null... | 6 |
public double dameGananciaMedia(Nodo n) {
int ganancia = 0;
int num = 0;
for (Nodo ady : memoria.getAdjacents(n)) {
if (!ady.isEstimacion()) {
ganancia += ady.ganancia;
num++;
}
}
if (num != 0) {
return ganancia / num;
}
return 0;
} | 3 |
private Method findMethod(String beanName, Class type, String methodName, MethodParameter[] parameters) {
Method[] declaredMethods = type.getDeclaredMethods();
for (Method declaredMethod : declaredMethods) {
if (methodName.equals(declaredMethod.getName())) {
if (declaredMetho... | 4 |
public void tick() {
for (int i=0; i<this.chunkLoadPerTick; i++) {
if (this.requests.isEmpty()) break;
ChunkAddress req = this.requests.poll();
EntityChunk chunk = search(req);
if (chunk == null) {
chunk = loadChunk(req);
}
if (chunk != null)
OpenCraftServer.instance().getWorldManager().getW... | 7 |
public static boolean itemHasEnchantment(ItemStack item, String enchantmentName) {
ItemMeta meta = item.getItemMeta();
if (meta == null) return false;
if (!meta.hasLore()) return false;
for (String lore : meta.getLore()) {
if ((lore.contains(enchantmentName)) && (ENameParser.... | 5 |
private void CheckButtons(ActionEvent evt)
{
int num = bRowNum * bColNum;
if(isOdd)
num--;
//System.out.println(evt.getActionCommand());
for(int i = 0; i <num; i++)
{
if(objectButtons[i].getActionCommand().equals(evt.getActionCommand()))
{
drwpnl.SetTexture(i);
mainPanel.setFocusable(true);
... | 3 |
public void _send(DataLine rq, Object callback) {
rq.set("msgid", self._msgId);
rq.set("clientid", self.clientId);
rq.set("userid", self.userid);
rq.set("userauth", self.auth);
String msg = rq.toString();
if (debug) {
System.out.println("< " + rq.toString());
}
this.ws.send("~m~" + msg.length() + "~... | 2 |
public static void main(String[] args) {
// list of fibonnaci numbers calculated so far
ArrayList<BigInteger> fibs = new ArrayList<BigInteger>();
// want a one based array, first two values are one
fibs.add(BigInteger.ZERO);
fibs.add(BigInteger.ONE);
fibs.ad... | 3 |
public void updateUI() {
super.updateUI();
setFont(Font.decode("Dialog Plain 11"));
if (weekPanel != null) {
weekPanel.updateUI();
}
if (initialized) {
if ("Windows".equals(UIManager.getLookAndFeel().getID())) {
setDayBordersVisible(false)... | 3 |
public void copyDataTo(String playername) {
try {
if(!playername.equalsIgnoreCase(this.player)) {
Player to = Bukkit.getPlayerExact(playername);
Player from = Bukkit.getPlayerExact(this.player);
if(from != null) {
from.saveData();
}
Files.copy(this.file, new F... | 6 |
public void multiSpellEffect(int playerId, int damage) {
switch(c.MAGIC_SPELLS[c.oldSpellId][0]) {
case 13011:
case 13023:
if(System.currentTimeMillis() - Server.playerHandler.players[playerId].reduceStat > 35000) {
Server.playerHandler.players[playerId].reduceStat = System.currentTimeMillis();
... | 9 |
public static int getIntBE(final byte[] array, final int index, final int size) {
switch (size) {
case 0:
return 0;
case 1:
return Bytes.getInt1(array, index);
case 2:
return Bytes.getInt2BE(array, index);
case 3:
return Bytes.getInt3BE(array, index);
case 4:
return Bytes.getInt4BE(... | 5 |
private int getDistance(Vertex node, Vertex target) {
for (Edge edge : edges) {
if (edge.getSource().equals(node)
&& edge.getDestination().equals(target)) {
return edge.getWeight();
}
}
throw new RuntimeException("Should not happen");
} | 3 |
public void writeCompleteConstant(CycConstant cycConstant)
throws IOException {
if (trace == API_TRACE_DETAILED) {
Log.current.println("writeCompleteConstant = " + cycConstant.toString());
}
write(CFASL_EXTERNALIZATION);
write(CFASL_COMPLETE_CONSTANT);
writeGuid(cycConsta... | 1 |
public Activity[] list () {
Connection con = null;
PreparedStatement statement = null;
ResultSet rs = null;
List<Activity> activities = new ArrayList<Activity>();
try {
con = ConnectionManager.getConnection();
String searchQuery = "SELECT * FROM activities";
statement = con.prepareS... | 8 |
public void setupVaultPermissions() {
if (!hasVaultPlugin() || !manager.isPluginEnabled("Vault") || permHook != null) {
return;
}
RegisteredServiceProvider<Permission> rsp = plugin.getServer().getServicesManager().getRegistration(Permission.class);
if (rsp != null) {
permHook = rsp.getProvider();
plugi... | 4 |
private IPlanTicketFilter[] createFilters() throws Exception
{
ServiceContainer site = new ServiceContainer();
site.initializeServices(this.getSite(), new Object[]{this});
IPlanTicketFilter[] rs = new IPlanTicketFilter[_filterTypes.length];
for(int i = 0; i < _filterTypes.length; i ++)
{
rs... | 2 |
public void add(Node n) {
// Valeur à ajouter
LinkSimpleNode newValue = new LinkSimpleNode();
newValue.setNode(n);
newValue.setNext(null);
if (linkSimple == null) {
linkSimple = newValue;
} else {
LinkSimpleNode actual = linkSimple;
while (actual.getNext() != null) {
actual = (LinkSimple... | 2 |
private void gameRender() {
// clear back buffer...
g2d = bi.createGraphics();
g2d.setColor( background );
g2d.fillRect( 0, 0, WIDTH - 1, HEIGHT - 1 );
/*==================================================================
* GAME RENDERING METHODS
*======================================================... | 1 |
public static Method getStaticMethod(Class<?> clazz, String methodName,
Class<?>... args) {
Assert.notNull(clazz, "Class must not be null");
Assert.notNull(methodName, "Method name must not be null");
try {
Method method = clazz.getMethod(methodName, args);
return Modifier.isStatic(method.getModifiers())... | 4 |
@SuppressWarnings("unused")
public String execute() {
String returnVal = SUCCESS;
if (getSubmit() != null && SUBMIT.equals(getSubmit())) {
validate();
LibraryManagementFacade libraryManagementFacade = new LibraryManagementFacade();
try {
UserVO validUserVO = libraryManagementFacade
.authenticate... | 6 |
private void tressMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tressMouseClicked
// TODO add your handling code here:
try {
if (conexion == true && enviando == 0) {
enviando = 1;
int opciones;
if (esinicio != 0 && 3 <= esini... | 9 |
public static void insertEvents (EventsBean event){
PreparedStatement pst = null;
Connection conn=null;
boolean result = false;
try {
conn=ConnectionPool.getConnectionFromPool();
pst = conn
.prepareStatement("INSERT INTO EVENTS (NAME, DESCRIPTION, EVENT_DATE, VENUE, TOTAL_SEATS, BOOKED_SEATS, T... | 4 |
public static String find(String line) {
line = StringUtility.removeNewLine(line);
if (line.contains("דרך תצורה=|נטיות=}")) {
return "";
}
if (line.contains("דרך תצורה=")) {
String[] arr = line.split("\\|נטיות=");
if (arr.length > 1) {
... | 6 |
public String getNum() {
return num;
} | 0 |
public static String StringtoDate(String timestamp){
try {
SimpleDateFormat sdfToDate = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss.SSS");
Date date = sdfToDate.parse(timestamp);
SimpleDateFormat sdfTranslated = new SimpleDateFormat(
... | 1 |
public int compareTo(Object o){
if(!(o instanceof ByteArray)) return this.toString().compareTo(o.toString());
int thisbound=bytes.length;
ByteArray cmp=(ByteArray)o;
int obound=cmp.bytes.length;
int bound=thisbound>obound?obound:thisbound;
for(int i=0;i<bound;i++){
if(bytes[i]==cmp.bytes[i... | 4 |
@Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just crashed a bunch of magic at the enemy, Yo!");
return random.nextInt((int) agility) * 3;
}
return 0;
} | 1 |
private boolean read() {
try {
final URLConnection conn = this.url.openConnection();
conn.setConnectTimeout(5000);
if (this.apiKey != null) {
conn.addRequestProperty("X-API-Key", this.apiKey);
}
conn.addRequestProperty("User-Agent", Up... | 4 |
private static void keyCreation() {
boolean kc_loop = true; // makes sure key creation loops
do {
System.out.println("\n\n\n+==+ KEY CREATION +==+ \n\n"+
"-- 1 - Create public & private keys -- \n"+
"-- 2 - Change prime numbers' bit length (current: "+length+" bits) -- \n"+
"-- 3 - Go back ... | 6 |
public String toXMLString() {
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Implement this method. Hint: You will need to do a
// combination of pre-Order and post-Order. That is, at each
// level you will need to call the label's "preString()"
// method before any recursive calls and then c... | 5 |
public BehaviourType decideBehaviourType(Stats s) {
return BehaviourType.CARNIVORE;
} | 0 |
private void reheapify() {
E root = array.get(1);
int lastIndex = array.size() - 1;
int index = 1;
boolean more = true;
while (more) {
int childIndex = getLeftChildIndex(index);
if (childIndex <= lastIndex) {
E child = getLeftChild(index);
// Use right child instead if it is smaller.
if (... | 5 |
@Bean
public DataSource dataSource() {
BasicDataSource ds = new org.apache.commons.dbcp.BasicDataSource();
ds.setDriverClassName("org.apache.derby.jdbc.ClientDriver");
ds.setUrl("jdbc:derby://localhost:1527/sample");
ds.setUsername("app");
ds.setPassword("app");
retur... | 0 |
public void click(int column, int row) {
if (!selected) {
if (pieces[column][row] != null && pieces[column][row].getColor() == activePlayer) {
selected = true;
selectedColumn = column;
selectedRow = row;
possibleMoves.addAll(pieces[colu... | 6 |
public Boundsheet getFirstSheet()
{
if( parent_rec != null )
{
WorkBook wb = parent_rec.getWorkBook();
if( sheetname != null )
{
try
{
return wb.getWorkSheetByName( sheetname );
}
catch( WorkSheetNotFoundException e )
{
; // fall thru -- see sheet copy operations -- appear... | 6 |
protected TableModel createModel(Transition transition) {
final TMTransition t = (TMTransition) transition;
return new AbstractTableModel() {
public Object getValueAt(int row, int column) {
return s[row][column];
}
public void setValueAt(Object o, int r, int c) {
s[r][c] = (String) o;
}
pub... | 3 |
@Override
public DataTable generateDataTable (Query query, HttpServletRequest request) throws DataSourceException
{
DataTable dataTable = null;
try (final Reader reader = new FilterCsv (new BufferedReader (new InputStreamReader (new URL (this.urlYahoo).openStream()))))
{
TableRow row = new TableRow ();
... | 5 |
private void setFieldsForEditing() {
subjectTextField.setText(this.proposal.getSubject());
descriptionTextField.setText(this.proposal.getDescription());
String options = "";
for (Iterator<String> it = this.proposal.getOptions().iterator(); it.hasNext();) {
String o = it.next(... | 3 |
public static boolean isRightButton(MouseEvent e, Boolean ctrlDown, Boolean shiftDown, Boolean altDown)
{
return (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == 0 &&
(e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == 0 &&
(e.getModifiersEx() & MouseEvent.BUTTON3_DO... | 8 |
public int mfiLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod + (this.unstablePeriod[FuncUnstId.Mfi.ordinal()]) ;
... | 3 |
private void split(DoublyLinkedNode curr, int red, int green, int blue,
int previousRunLength, int nextRunLength) {
DoublyLinkedNode previousRun, nextRun;
previousRun = previousRunLength <= 0 ? curr.getPrevious() : new DoublyLinkedNode(new Run((int) curr.getValue().getRed(), (int) curr.getValue().getGreen(), (in... | 8 |
public void checkRutor()
{
for(int i = 0;i < rutor.length && rutor[i] != null;i++)
{
if(rutor[i].inside(BoJMouseListener.getX(),BoJMouseListener.getY()))
{
rutor[i].increaseAntalTryck();
}
}
if(BoJMouseListener.getX() != BoJMouseLis... | 5 |
@Override
public boolean execute(CommandSender par1Sender, Command par2Command,
String par3Args, String[] par4Args) {
int page;
try {
page = Integer.parseInt(par4Args.length > 0 ? par4Args[0] : "0") * 10;
} catch (NumberFormatException e) {
page = 0;
}
ArgsParser ap = new ArgsParser();
ParseComman... | 7 |
public int getMinimum() {return bar.getMinimum();} | 0 |
public void keyPressed(KeyEvent e)
{
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT)
{
Magnus.moveDirection = 2;
Magnus.dx = -1;
System.out.println("Left key pressed");
}
if (key == KeyEvent.VK_RIGHT)
{
... | 5 |
private void initButtonBar(){
menuBarWithButtons = new JToolBar();
menuBarWithButtons.setSize(this.getWidth(), MENU_BAR_WITH_BUTTONS_HEIGHT);
menuBarWithButtons.setBorderPainted(true);
menuBarWithButtons.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
JToggleButton ... | 0 |
private String readString() throws JSONException {
Kim kim;
int from = 0;
int thru = 0;
int previousFrom = none;
int previousThru = 0;
if (bit()) {
return getAndTick(this.stringkeep, this.bitreader).toString();
}
byte[] bytes = new byte[65536];... | 9 |
public static boolean[] nextPosition(boolean switches[], int numTrue){
String value = "";
boolean retSwitches[] = new boolean [switches.length];
for(int i = 0; i < switches.length; i++){
value += switches[i] == true ? 1 : 0;
}
value = value.replaceAll( "[^\\d]", "" );
int currentValue = Integer.pars... | 7 |
public ZipUnpacker(String inputZip)
{
this.inputZip=inputZip;
outputFolder="temp";
} | 0 |
public void exploreDirectory(File f,String path, int linesNumber) {
//one file object is created with the directory path
File directory =new File(path);
BufferedWriter bw = null;
//Check if the path exists
if (!directory.exists()) {
System.out.println("The path " + directory.getAbsolutePath() + " does n... | 7 |
public String readBinary(Key key, String valueName) throws RegistryErrorException
{
if(key == null)
throw new NullPointerException("Registry key cannot be null");
if(valueName == null)
throw new NullPointerException("Valuename cannot be null, because the default value is always a STRING! If you wa... | 4 |
private String[] getCustomFilterNodeValue(final Document doc) {
List<String> values = new ArrayList<>();
Node filterNode = this.getFirstLevelNodeByTag(doc, FILTER_TAG);
if (filterNode == null) {
return null;
}
Node customFilterNode = this.getNodeByTagInNode(filterNode, CUSTOM_TAG);
if (customFilterNode =... | 5 |
private void Drink()
{
thirst = ps.getThirst();
waterAmount = ps.getWaterCollected();
waterLimit = ps.getWaterLimit();
hasSolarUpgrade = ps.getHasSolarUpgrade();
if (!hasSolar)
{
Dialog.message("I don't have a source of water to consume!"... | 6 |
public static void showCannotOpenMsg(Component comp, String name, Throwable throwable) {
if (throwable instanceof NewerDataFileVersionException) {
WindowUtils.showError(comp, MessageFormat.format(UNABLE_TO_OPEN_WITH_EXCEPTION, name, throwable.getMessage()));
} else {
if (throwable != null) {
Log.error(thr... | 2 |
@Override
public boolean perform(final Context context) {
// Example: /<command> timezone[ get][ <Player>]
int position = 2;
if (context.arguments.size() >= 2 && !context.arguments.get(1).equalsIgnoreCase(this.name)) position = 1;
OfflinePlayer target = Parser.parsePlayer(context, po... | 7 |
private HashMap<ArrayList<Integer>, Integer> parseInputFile(String inputFile) {
try {
HashMap<ArrayList<Integer>, Integer> data = new HashMap<ArrayList<Integer>, Integer>();
// read file input
BufferedReader in = new BufferedReader (new FileReader(inputFile));
// read the first line to initialize ... | 8 |
public void handleLogin(){
User u = loginView.getModel();
// Check if username is empty, if so then show a message.
if (u.getUsername().isEmpty()) {
JOptionPane
.showMessageDialog(
null,
"U moet een gebruikersnaam invoeren om in te kunnen loggen.",
"Fout!", JOptionPane.ERROR_MESSAGE);... | 9 |
public ClientThread(int id, CyclicBarrier barrier) {
this.id = id;
// determine where to push/pull info:
if(id == 0) {
req = new int[1];
req[0] = 1;
res = new int[1];
res[0] = 0;
} else if(id == 1) {
... | 3 |
public Node getPayloadNode() throws Exception {
Node result = null;
Node payloadNode = Utilities.selectSingleNode(this.getDocument(), "/dc:DCTransaction/*/dc:Payload", XMLLabels.STANDARD_NAMESPACES);
if(payloadNode != null) {
Node first = payloadNode.getFirstChild();
if(first != null) {
switch(first.... | 5 |
private void renderEntities()
{
for(Entity ent: entities)
{
if(ent==null)
continue;
ent.render();
int[] pix = ent.getPixels();
for(int x = 0; x < ent.getImageWidth(); x++)
{
for(int y = 0; y < ent.getImageHeight(); y++)
{
int yy = (((y + ent.getLocation().getY()) - yOffset) - ((ent.... | 7 |
@Override
public void run() {
Player[] players = plugin.getServer().getOnlinePlayers();
Player player;
long MarkerTime = System.currentTimeMillis() - (plugin.getConfig().getInt("AFK_TIMER") * 60 * 1000);
for (int i = 0; (players.length - 1) >= i; i++) {
long afkTime = 0;
player = players[i];
UserTable... | 3 |
void writeData(short fid, short file_offset, byte[] data,
short data_offset, short length) {
byte[] file = getFile(fid);
short fileSize = getFileSize(fid);
if (file == null) {
ISOException.throwIt(ISO7816.SW_FILE_NOT_FOUND);
}
if (fileSize < (short) (fil... | 7 |
public String getMusic(String scene) {
if(scene.equalsIgnoreCase("main menu")) {
return "assets/audio/testi.wav";
}
if(scene.equalsIgnoreCase("gameplay")) {
return "assets/audio/background.wav";
}
return null;
} | 2 |
public boolean keyDown(Event e, int key)
{
if (key == Event.LEFT)
{
player.setDirection(Player.LEFT);
player.setFacing(Player.LEFT);
}
if (key == Event.RIGHT)
{
player.setDirection(Player.RIGHT);
player.setFacing(Player.RIGHT);
}
if (key == Event.UP)
{
player.setDirection(Player.UP);... | 9 |
@Override
public SecurityChallenge getUserSecurityChallenge(String username) {
for(LdapServer server : ldapServers) {
try {
SecurityChallenge challenge = server.getUserSecurityChallenge(username);
if(logger.isDebugEnabled()) {
if(challenge != null) {
logger.debug("Successfully got security c... | 5 |
public String toString() {
return "waiting for items to be chosen";
} | 0 |
public static String find(File file) {
RandomAccessFile fileHandler = null;
try {
fileHandler = new RandomAccessFile(file, "r");
long fileLength = fileHandler.length() - 1;
StringBuilder sb = new StringBuilder();
for (long filePointer = fileLength; filePoi... | 9 |
@Override
public void execute() {
boolean partyFull = curGb.readMemory(curGb.pokemon.numPartyMonAddress) >= 6;
seq(new EflSkipTextsSegment(1)); // wild mon
seq(new EflBallSuccessSegment());
seq(new EflSkipTextsSegment(4)); // cought, new dex data
seqEflButton(Move.A); // skip dex
seqEflButton(Move.B... | 7 |
@Override
public boolean removeAll(Collection<?> c) {
if (c == null || c.isEmpty()) {
return false;
}
boolean removedAll = true;
for (Object element : c) {
if (element == null) {
removedAll = false;
}
}
return remove... | 6 |
private int searchIndex(int numero, boolean activa){
int index = -1;
if(activa){
for (int i = 0; i<cuentas.length; i++) {
if(cuentas[i] != null && cuentas[i].validarCuenta(numero) && cuentas[i].isActiva()){
index=i;
break;
... | 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 fe... | 6 |
private static boolean isSimpleReturnType(Method method, Object object) {
Class<?> returnType = getActualReturnType(method, object);
return returnType.equals(Integer.TYPE) || returnType.equals(Integer.class) || returnType.equals(Double.TYPE)
|| returnType.equals(Double.class)
... | 7 |
public void setValueAt(Object o, int row, int col) {
if (row != newRow) {
if (col == 1 || o.toString().length() > 0) {
int rowInModel = row < newRow ? row : row - 1;
nodeAttributeModel.setValueAt(o, rowInModel, col);
}
return;
} else {
... | 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.