text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void remove() {
for (ForceFieldConnection forceFieldConnection : forceFieldConnections) {
for (ForceField forcefield : forceFieldConnection.getForceFieldsInConnection())
getGrid().removeElement(forcefield);
for (ForceFieldGenerator forceFieldGenerator : forceFieldConnection.getForceFie... | 3 |
public void handle(final Callback[] callbacks) throws UnsupportedCallbackException {
if (callbacks == null || callbacks.length == 0) {
return;
}
for (Callback cb : callbacks) {
if (cb instanceof NameCallback) {
NameCallback ncb = ... | 5 |
@Override
public void endElement(String namespaceURI, String localName, String qName) {
super.endElement(namespaceURI, localName, qName);
} | 0 |
public static int getTreePointsSpent(String prestige){
for(ClassTree ct : takenPrestigeTrees){
if(ct.getPrestige().equalsIgnoreCase(prestige))
return ct.spentAp();
}
if(prestige.equalsIgnoreCase(characterRace))
return racialTree.spentAp();
return 0;//default
} | 3 |
private void loadAvaliblePlattformar() {
DefaultComboBoxModel<Plattform> dcbm = (DefaultComboBoxModel<Plattform>) cbAvaliblePlattformar.getModel();
ArrayList<String> tempal = new ArrayList<>();
ArrayList<Plattform> al = new ArrayList<>();
try {
String query = "select pid fr... | 3 |
public ArrayList<Integer> getLocalFolders()
{
_read.lock();
try
{
return _localFolders;
}
finally
{
_read.unlock();
}
} | 0 |
public long getUserCommentsCount(String userId) {
long result = 0L;
DBCursor cursor = database.getCollection(ACTIVITY_COLLECTION).find(new BasicDBObject("_id", Pattern.compile("^" + userId)), new BasicDBObject("comment", 1));
try {
while (cursor.hasNext()) {
DBObject ... | 2 |
private void retrievePublicKeys(List<String> list) {
String line;
boolean bNewKey = false;
String keyID = null;
for (String list1 : list) {
line = list1;
if (line.startsWith("pub")) {
Pattern p = Pattern.compile("^.*/([^\\s]+).*");
... | 6 |
public static void println(Object s) {
System.out.println(s);
} | 0 |
public PosFuncEstado getPosFuncEstado(int idPos, long cedula){
Object o[] = {idPos, cedula};
List<PosFuncEstado> list = getHibernateTemplate().find(
"from PosFuncEstado where fesIdPos = ? and fesCedula = ?",
o
);
if (list.size()>0){
return list... | 1 |
private AnimFrame getFrame(int i) {
return (AnimFrame)frames.get(i);
} | 0 |
@Override
public void setEnabled( boolean enabled ) {
if( !enabled ){
closeMenu();
}
} | 1 |
public void submit() {
// Get RMI data
RmiData socketData = new RmiData();
// Get list of problems
ArrayList<Problem> problems = socketData.getProblems();
ArrayList<Language> languages = socketData.getLanguages();
// Get selected problem and language
Problem problem = problems.get(problemComboBox.getSel... | 1 |
@Override
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
if (!(sender instanceof Player)) {
Main.courier.send(sender, "messages.requiresPlayer", label);
return false;
}
final Player player = (Pla... | 3 |
public void setDestinationStop(int value) {
this._destinationStop = value;
} | 0 |
@Override
public void deserialize(Buffer buf) {
dungeonId = buf.readShort();
if (dungeonId < 0)
throw new RuntimeException("Forbidden value on dungeonId = " + dungeonId + ", it doesn't respect the following condition : dungeonId < 0");
int limit = buf.readUShort();
addedP... | 3 |
@Override
protected byte[] load_from_current_position(String frameId, int dataLen,
RandomAccessFile openFile) throws IOException {
byte[] frameData=new byte[dataLen];
MediaFileUtil.read_sure(openFile,frameData);
int offs=0;
int pictureTypeId = (int)MediaFileUtil.convert32bitsToUnsignedInt(frameData);
o... | 4 |
@Override
public Value applyOperator(FunctionOperator op, List<Value> otherValues)
{
Value first = otherValues.get(0);
switch (op.toString()) // the two current operators aren't actually supported/ever used
{
case ".[]":
if (first instanceof IntValue)
{
int index = (int) ((IntValue) first).getVa... | 8 |
@Override
public PrintWriter getLogWriter() throws SQLException {
return null;
} | 0 |
public ArrayList<Move> getRegularMoves(Board currentBoard, boolean onlyChainable, Checker checker) {
//List of possible moves.
ArrayList<Move> moves = new ArrayList<Move>();
//Add all regular moves to the list.
moves.add(new ForwardLeft(currentBoard, checker));
moves.add(new ForwardRight(currentBoard, chec... | 4 |
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// 输入n
int n = Integer.parseInt(sc.nextLine());
// 创建ArrayList用于存放每一个十六进制字符串。将其容量设置为n,避免空间增长的时间消耗
ArrayList<char[]> list = new ArrayList<>(n);
// 将每个字符串的字母转换为大写后,将字符串转换成char数组并添加到ArrayList中
for (int i = 0; i < n; i++) {
Strin... | 7 |
@SuppressWarnings("unchecked")
public static ViewMapper getView() {
// 根据请求地址映射到具体的视图控制器
HttpServletRequest req = WebContext.getRequest();
String uri = req.getServletPath().split("\\.")[0];
ViewMapper viewMapper = ContextConfig.getMapperCtrl().get(uri);
List<Object> params = new ArrayList<Object>();
// 如果视... | 5 |
private E getResult(boolean findMax) {
int index = 0;
Entry<Integer, Double> result = null;
if (findMax == true) {
Iterator<Entry<Integer, Double>> s = fitScores.entrySet().iterator();
for (; s.hasNext(); )
{
Entry<Int... | 7 |
public Pair<Integer, TilesetRef> mapGidToFirstGidTilesetPair(int gid) {
if (gid == 0) {
return new Pair<Integer, TilesetRef>(0, null);
} else if (tilesets.containsKey(gid)) {
return new Pair<Integer, TilesetRef>(gid, tilesets.get(gid));
} else {
int last_key_gid = 0;
for(int current_key_gid : tilesets... | 6 |
public boolean isOn() {
boolean hasStock = false;
outer:for (int i = 0; i < this.dispensers.size(); i++) {
if (!this.dispensers.get(i).getDispenserContents().isEmpty()) {
hasStock = true;
break outer;
}
}
if (!hasStock || !this.on) {
on = false;
return false;
}
Date temp = new Date();
... | 6 |
@Override
public Course unassignRoleSchoolFromCourse(long roleId, long courseId) {
// for(Person person : persons){
// List<RoleSchool> roles = (ArrayList<RoleSchool>)person.getRoles();
// for(RoleSchool role : roles){
// if(role.getId() == roleId){
// ... | 2 |
public final void method44(int i, AbstractToolkit var_ha) {
anInt9986++;
Object object = null;
r var_r;
if (aR9976 != null || !aBoolean9988) {
var_r = aR9976;
aR9976 = null;
} else {
Class2 class2 = method2401(var_ha, 262144, true, 22);
var_r = class2 == null ? null : ((Class2) class2).aR118;
... | 5 |
private void parse(String query) {
try {
// StringTokenizer is faster than split. http://www.javamex.com/tutorials/regular_expressions/splitting_tokenisation_performance.shtml
StringTokenizer st = new StringTokenizer(query, "&");
while (st.hasMoreTokens()) {
S... | 4 |
public void uimsg(int id, String msg, Object... args) {
Widget w = widgets.get(id);
synchronized(robots) {
for(Robot r : robots)
r.uimsg(id, w, msg, args);
}
super.uimsg(id, msg, args);
} | 1 |
public static void vendingMachine(char a, int n){
int price = 0;
if(a == 'w' || a == 'W') {
price = 10;
checkPayment(price, n, a);
} else if (a == 'j' || a == 'J') {
price = 15;
checkPayment(price, n, a);
} else if ( a == 'c' || a == 'C') {
price = 12;
checkPayment(price, n, a);
... | 6 |
@Override
public void addTextBack() {
Element textBack = text.getOwnerDocument().createElement("path");
String d = "M";
for (Coordinate c : geometry.getCoordinates()) {
if(d.length()>1){
d=d+" L";
}
d = d + " " + c.x + "," + c.y;
}
textBack.setAttribute("d", d);
textBack.setAttribute("style", ... | 2 |
public void mousePressed(MouseEvent e) {
if (!b.isEnabled()) return;
if (b instanceof javax.swing.JToggleButton) {
b.setBorder((b.isSelected() ? inactive : lowered));
b.setBorderPainted((b.isSelected() ? false : true));
} else {
b.setBorder(lowered);
b.setBorderPainted(... | 4 |
protected boolean controlThicknessInput(JTextField textfield, int maxLength, boolean negativeAllowed) {
boolean ret = true;
String tmp = textfield.getText();
if (negativeAllowed && tmp.matches("-")) {
ret = false;
} else if ((!negativeAllowed && !tmp.matches("[0-9]++")) || ... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ArrayID other = (ArrayID) obj;
if (arrayId != other.arrayId)
return false;
return true;
} | 4 |
public void login()
{
if (!ValidationHelper.isNullOrEmpty(getLogin(),getPassword()))
{
setPassword(DigestUtils.md5Hex(getPassword()));
setUser(IndexedEntityService.em
.createNamedQuery("User.findByLogin", User.class)
.setParameter("logi... | 3 |
private boolean runSingleCycleAndContinue() {
if (checkReturnCode("Do you want to create a new Cell(Y/N)?"))
addLivingCellAndPrint();
if (checkReturnCode("Do you want to apply a tick (Y/N)?"))
applyTickAndPrint();
if (checkReturnCode("Do you want to quit (Y/N)?"))
... | 3 |
final void method3049(ByteBuffer class348_sub49, int i, int i_0_) {
if (i_0_ != 31015)
method3049(null, 44, 80);
int i_1_ = i;
while_200_:
do {
while_199_:
do {
do {
if ((i_1_ ^ 0xffffffff) != -1) {
if (i_1_ != 1) {
if (i_1_ != 2) {
if ((i_1_ ^ 0xffffffff) != -4)
break wh... | 8 |
public void paint(Graphics g_) {
super.paint(g_);
Graphics2D g = (Graphics2D) g_;
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(Color.LIGHT_GRAY);
g.fillRect(0, 0, getWidth(), getHeight());
if (socket.getGate() == null... | 7 |
public MySQLDataStorageImplementation(Decapitation decapitation, String url, String username, String password) throws SQLException {
plugin = decapitation;
connection = DriverManager.getConnection(url, username, password);
final ResultSet bansExists = connection.getMetaData().getTables(null, nu... | 3 |
public static List<String> getResult() {
for (Thread t : threads) {
try {
if (!t.isInterrupted()) {
t.join();
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return result;
} | 3 |
public void stop() {
if(player != null) {
if(fadeTime == 0.0f || this != gamePlayList.getCurrentSong() || gamePlayList.getStopping()) {
stopFadeIn();
stopFadeOut();
// setVolume(getMinGain());
// if(playerThread != null) {
// ... | 4 |
public boolean hasPartName(String xpathExpression){
if (xpathExpression.contains("/")){
String varPart = xpathExpression.substring(0, xpathExpression.indexOf("/"));
return varPart.contains(".");
}else{
return xpathExpression.contains(".");
}
} | 1 |
private void handleDevices(AjaxRequest vars, HttpServletRequest request, HttpServletResponse response) {
EntityManager em = getEntityManager();
CommunicationDeviceDao dbDevice = new CommunicationDeviceDao(em);
CommunicationDeviceTypeDao dbType = new CommunicationDeviceTypeDao(em);
if (... | 6 |
public Block getBlock(int x, int y, int z) {
if(x < 0 || x >= w_width || y < 0 || y >= w_height || z < 0 || z >= w_depth) return Block.air;
return Block.blocks[blocks[x][y][z]];
} | 6 |
public CuttingResult getReward(Tilia x){
ArrayList<Integer> pieces = new ArrayList<Integer>();
pieces.add(x.getSide());
// First two variables in CuttingResult are not used
CuttingResult best = new CuttingResult(0, 0, x.getReward(), pieces);
// Try possible cuts
for (int i =1 ; i ... | 4 |
public void exception(){
long result = a.getTimeLeftInMillis();
if(result <= 0){
System.out.println("The bid for " + a.getName() + " has expired.");
}
} | 1 |
public static void addAllCombos(String previous, int len) {
if (len == 0) {
if (checkHash(previous)) Solutions.add(previous);
// System.out.println(previous);
}else {
for (int i = 0; i < CHARS.length; i++) {
String next = previous + CHARS[i];
addAllCombos(next, len - 1);
}
}
} | 3 |
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2=(Graphics2D)g;
if (cb_antialias.isSelected()) {
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_... | 9 |
private void solve (int col, int row) throws Exception {
runCount++;
if (runCount>40000) {
System.out.println("Solution not found");
throw fail;
}
if (row>8) {
System.out.println("Solved");
throw new Exception("Solution succesful");
}
if (solutionArray[col][row] != 0) {
next(col,row);
} els... | 7 |
private void update() {
long now = System.currentTimeMillis();
if (now - lastLine > lineDelay) {
if (!view.getGrid().newLine()) {
timer.cancel();
if (view.newGame()) {
init();
return;
} else {
... | 3 |
public static void main(String[] args) {
// TODO code application logic here
int i = 1;
int count = 0;
boolean s = true;
while (s) {
i++;
if (Prime(i)) {
count++;
}
if (count == 10001) {
s = false;
... | 3 |
@Override
public void run() {
while (true) {
try {
// Wait for an event one of the registered channels
this.selector.select();
// Iterate over the set of keys for which events are available
Iterator<?> selectedKeys = this.selector.... | 8 |
@Override
public String toString() {
return "CallType is " + remoteCallObjectType + "\n" +
"Command is " + execCommand;
} | 0 |
private String getFieldName(ExtendedField field) {
try {
if (field.hasDBMapping()) {
return field.getDBColumnNameWithoutEscape();
}
if (field.hasEntityMapping()
&& MappingType.MANY_TO_ONE.equals(field.getEntityMapping())) {
return field.getTableName() + "_UUID";
}
if (field.hasEntityMappi... | 6 |
public String getShortDateUS(){
this.shortDateUS = (new Integer(this.getMonthAsInteger())).toString();
if(this.shortDateUS.length()<2)this.shortDateUS = "0" + this.shortDateUS;
int dayI = this.getDayOfTheMonth();
if(dayI<10){
this.shortDateUS += "/0" + dayI;
}
... | 2 |
private void handleMousePressed(int x, int y) {
x -= 50;
y -= 50;
x /= 16;
y /= 16;
if ((x < 0) || (y < 0) || (x >= map.getWidthInTiles()) || (y >= map.getHeightInTiles())) {
return;
}
if (map.getUnit(x, y) != 0) {
selectedx = x;
selectedy = y;
lastFindX = -1;
} else {
if (selectedx != ... | 7 |
public int flags(int x, int y) // get the number of surrounding flags
{
int surFlags = 0;
for (int q = x - 1; q <= x + 1; q++) {
for (int w = y - 1; w <= y + 1; w++) {
while (true) {
if (q < 0 || w < 0 || q >= row || w >= col) // makes sure
// that it wont
// have an err... | 8 |
@Override
protected void generateLevel()
{
// Grass = 0xFF00;
// Flower = 0xFFFF00;
// Rock = 0x7F7F00;
for (int i = 0; i < levelpixels.length; i++) {
if (levelpixels[i] == 0xff00) {
tiles[i] = Tile.grass;
}
if (levelpixels[i] == 0xffff00) {
tiles[i] = Tile.flower1;
}
if (levelpixels[i... | 4 |
@Override
public void quickPlay( boolean priority, boolean toStream, boolean toLoop,
String sourcename, FilenameURL filenameURL, float x,
float y, float z, int attModel, float distOrRoll,
boolean temporary )
{
IntBuffer myB... | 8 |
private void dealDamage(GridSpace target, Weapon weapon, Point targetLocation) {
ArrayList<LivingThing> livingThings = target.returnLivingThings();
Character c = (grid.get(getCharacterLocation())).returnCharacter();
if (livingThings == null || livingThings.size() == 0) {
return;
} else {
for (LivingThing ... | 6 |
public void chercher() {
String nom = (String) this.vue.getjComboBoxSearch().getSelectedItem();
String[] libelle = nom.split(" ", 0);
System.out.println(libelle[0] + " " + libelle[1]);
Praticien unPraticien = DaoPraticienJPA.selectOneByNomPrenom(em, libelle[0], libelle[1]);
affic... | 0 |
public static void quickSort(int[] array, int lowIndex, int highIndex) {
// this.printArray();
// System.out.println("low:high="+lowIndex+":"+highIndex);
if (lowIndex >= highIndex)
return;
count2 += (highIndex - lowIndex);
int i = lowIndex + 1;
int pivot = choosePivot(array, lowIndex, highIndex);
in... | 4 |
private static final List<Integer[]> drawCircle(Graphics graphics,
int xc, int yc, int radius) {
/*
* Declare and initialise local variables.
* The origin is base on positive y-axis at (0,r)
*
* int x and y - Circle coordinates use
* to d... | 4 |
@Override
public boolean retiro(int codigo, double m) {
try{
boolean seRetiro = false;
double saldo = 0;
if( buscarCuenta(codigo) ){
TipoCuenta tc = TipoCuenta.valueOf(rCuentas.readUTF());
rCuentas.readUTF();
sa... | 5 |
Point3f getFaceCenter(byte face) {
if (faceCenter == null)
faceCenter = new Point3f();
switch (face) {
case TOP:
switch (axis) {
case 'x':
faceCenter.set(center.x + 0.5f * height, center.y, center.z);
break;
case 'y':
faceCenter.set(center.x, center.y + 0.5f * height, center.z);
break;... | 9 |
private void setStatus(int status)
{
if ((status & 128) == 128)
FIN = true;
if ((status & 64) == 64)
RSV1 = true;
if ((status & 32) == 32)
RSV2 = true;
if ((status & 16) == 16)
RSV3 = true;
// if the opcode is 8, then w... | 9 |
public int execute() {
// The LOGLEVEL command is described as follows:
// LOGLEVEL [<level>]
if( this.getParamCount() == 0 ) {
// this.getFactory().getServer().performLogLevel( null );
this.getFactory().getServer().getLogger().log( Level.INFO,
"Current log level is: " + this.getFactory().ge... | 3 |
public static int howManySundays0(){
int sundays = 0;
//first pass
int day = 1;
int year = 1900;
for(; year < 1901; year++)
for(int month = 1; month <= 12; month++)
for(int date = 1; date <= daysInMonth(month, year); date++, day++){
if(day % 7 == 0)day = 0;
}
for(; year <= 2000; year++){
... | 9 |
public static ArrayList<Entity> getEntitiesWithinRange(Point location, double maxRange, Team entityTeam) {
ArrayList<Entity> entitiesWithinRange = new ArrayList<Entity>();
if (entityTeam == Team.EVIL) {
for (Enemy enemy : enemies) {
if (enemy.isLocationWithinDistance(location, maxRange)) {
entitiesWithi... | 5 |
public SecureChannel (byte[] secret, String algs)
throws NoSuchAlgorithmException
{
// reset counters
countIn = countOut = 0;
String digAlg = null;
String encAlg = null;
pending = null;
// parse definition string
int pos = algs.indexOf ('/');
if (pos < 0) {
// we have only one algorithm: fin... | 7 |
public static String convertId(Object value){
if(value != null && String.class.isAssignableFrom(value.getClass())){
return value.toString();
}
else if (value != null && Double.class.isAssignableFrom(value.getClass())) {
StringBuilder sb = new StringBuilder();
... | 6 |
public List<Action> selectActions(boolean units, boolean buildings, boolean research, boolean upgrades) {
List<Action> actions = new ArrayList<Action>();
for(Action action : this.actions){
if (action.type == Type.Building && buildings)
actions.add(action);
if (action.type == Type.Unit && units)
actions.add... | 9 |
public TypeBinding postConversionType(Scope scope) {
TypeBinding convertedType = this.resolvedType;
// if (this.genericCast != null)
// convertedType = this.genericCast;
int runtimeType = (this.implicitConversion & IMPLICIT_CONVERSION_MASK) >> 4;
switch (runtimeType) {
case T_boolean :
convertedType = T... | 8 |
@Override
public double getArea() {
return _width * _height;
} | 0 |
public void run() {
try {
boolean work = true;
while (work) {
String str = in.readLine().replace(";;", "\n");
GUI.memo.append( "Server recived message:" );
GUI.println( str );
if (str == "END") {
socket.close();
UserList.user_list.remove(port);
work = false;
break;
} else... | 5 |
public String toCSV() {
return super.toCSV();
} | 0 |
public void act() {
move();
Vector players = find("players");
if (players.size() > 0) {
for (int p = 0; p < players.size(); p++) {
Agent other = (Agent) players.elementAt(p);
//The agents only play when *both* have moved.
if (other.hasM... | 3 |
@Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... | 6 |
static CursorContext getNepticalContext(NepticalContext nepticalContext) {
if (nepticalContext.getContextKey() == null) {
ContextKey contextKey = CONTEXT_KEY_FACTORY.createContextPartitionKey("UNSAFE".hashCode(),
nepticalContext.getIdentity().toString(), Location.class);
nepticalContext.setContextKey(conte... | 1 |
public static void main(String[] args) throws IOException,
ParserConfigurationException, SAXException {
String path = "BIGxml.xml";
boolean error = false;
try {
if (args.length > 0) {
if (isValidXML(args[0])) {
path = args[0];
}
else {
System.out
.println("Invalid file path. P... | 4 |
public void updateCustomer(boolean equal) {
Database db = dbconnect();
try {
StringBuilder query = new StringBuilder ();
query.append("UPDATE customer SET firstname = ?, "
+ "lastname = ?, username = ?");
... | 2 |
public static void giveFlag(Cuboid c, String player, Flag flag) {
if (c == null || player == null || flag == null) return;
if (c.getFlags().get(flag).contains(player)) return;
c.getFlags().get(flag).add(player);
} | 4 |
public static List<Trends> constructTrendsList(Response res)
throws WeiboException {
JSONObject json = res.asJSONObject();
List<Trends> trends;
try {
Date asOf = parseDate(json.getString("as_of"));
JSONObject trendsJson = json.getJSONObject("trends");
trends = new ArrayList<Trends>(trendsJson.length()... | 5 |
private static void findAllMaps(List<String> allMaps) {
try {
File[] folderFiles = MAP_FOLDER.listFiles();
assert folderFiles != null;
for (File fileEntry : folderFiles) {
if (fileEntry.isDirectory()) {
findAllMaps(allMaps);
} else {
String name = fileEntry.getName();
if (nam... | 4 |
@Override
public void update() {
Background background = null;
for (int i = 0; i < backgrounds.size(); i++) {
background = backgrounds.get(i);
background.update();
}
super.update();
} | 1 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
// when this spell is on a MOBs Affected list,
// it should consistantly prevent the mob
// from trying to do ANYTHING except sleep
if(msg.amISour... | 7 |
public void InsertarVideo(ArrayList datos)
{
// Cambiamos todos los datos, que se puedan cambiar, a minúsculas
for(int i = 0 ; i < datos.size() ; i++)
{
try{datos.set(i, datos.get(i).toString().toLowerCase());}
catch(Exception e){}
}
biblioteca.inserta... | 2 |
static public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextCol... | 6 |
public int getCoverage() {
int coverage = 0;
if (evalFalse > 0)
coverage += 50;
if (evalTrue > 0)
coverage += 50;
return coverage;
} | 2 |
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
// g.drawImage(skybg, 0, 0);
g.setBackground(new Color(61, 52, 73, 1));
level.map.render(0,0);
if(player.alive)
g.drawAnimation(player.animation , player.x, player.y);
g.drawImage(levelText[0], 370, 10);
g.draw... | 6 |
@Override
public Vector2f getHitSideVector(Entity entity) {
Shape[] skeleton = getSkeleton();
Vector2f vector = new Vector2f();
float ex = entity.getBBCentre().getX();
float ey = entity.getBBCentre().getY();
float cx = getBBCentre().getX();
float cy = getBBCentre().ge... | 8 |
private MapPortal getMapPortal(Point location){
for (MapPortal portal : getPortals()){
if (portal.getLocation().equals(location)){
return portal;
}
}
return null;
} | 2 |
@Override
public Stream resolveStreamUrl(final String url, boolean skipLogging) throws IOException {
HttpResponse resp = head(Request.to(url));
if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) {
Header location = resp.getFirstHeader("Location");
if... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Room other = (Room) obj;
if (uid != other.uid)
return false;
return true;
} | 4 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected!=null)&&(affected instanceof MOB)&&(tickID==Tickable.TICKID_MOB))
{
final MOB mob=(MOB)affected;
if((buildingI==null)
||((fireRequired)&&(getRequiredFire(mob,0)==null))
||(theSpell==null))
{
aborted=true;
unInvoke();... | 9 |
public Graph createGraph(final String name) {
if (name == null) {
throw new IllegalArgumentException("Graph name cannot be null");
}
// Construct the graph object
final Graph graph = new Graph(name);
// Now we can add our graph
graphs.add(graph);
//... | 1 |
public final String method1(int i, int j, int ai[], long l) {
if (j != -8945) {
method1(-60, -74, null, -72L);
}
if (i == 0) {
Class142_Sub27_Sub14 class142_sub27_sub14 = Animation.method962(ai[0], -2882);
return class142_sub27_sub14.method1887((int) l, (byte)... | 7 |
private String getRightStringResult(String step, int pos, char value) {
String result = "";
pos++; // the initial position is already taken care of
int max = step.length();
for (; pos < max; pos++) {
if (step.charAt(pos) != '0' && step.charAt(pos) != '1') {
break;
}
result += value;
}
return re... | 3 |
public SQLite_helper() throws Throwable {
// load driver; connect to DB
Class.forName("org.sqlite.JDBC");
con = DriverManager.getConnection(urlToDb);
// test if Tables have already been set up; initialize if not
try {
pst = con.prepareStatement("SELECT * FROM users;");
rs = pst.executeQuery();
... | 2 |
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj instanceof ActorModel)
{
ActorModel currentActor = (ActorModel) obj;
if (currentActor.id == this.id)
{
return true;
}
}
return false;
} | 3 |
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.