text stringlengths 14 410k | label int32 0 9 |
|---|---|
@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 Message)) {
return false;
}
Message other = (Message) object;
if ((this.messageId == null && other.messageId !=... | 5 |
public double getValue (double x, double y, double z)
{
// This method could be more efficient by caching the seed values. Fix
// later.
x *= frequency;
y *= frequency;
z *= frequency;
int xInt = (x > 0.0? (int)x: (int)x - 1);
int yInt = (y > 0.0? (int)y: (int)y - 1);
... | 8 |
public static void setNow(long timestamp) {
timeDiff = timestamp - new Date().getTime();
} | 0 |
public void setStatus(int status) {
this.status = status;
} | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
Physical target=mob;
if((auto)&&(givenTarget!=null))
target=givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",... | 7 |
private ArrayList<Desire> findDesires() {
ArrayList<Desire> returnDesires = new ArrayList<Desire>();
for (Agent a : level.agents) {
if (!getToBoxDesireCompleted(a)) {
for (Box b : level.boxes) {
//System.err.println("adding box goal with " + b.getId());
if (a.getColor() == b.getColor()
&& !... | 9 |
private static PrintStream getStream(String type) {
if (type == null) return null;
if (type.equals("stdout")) {
return System.out;
} else if (type.equals("stderr")) {
return System.err;
} else if (type.startsWith("file:")) {
String relativeDir = Settings.get(Settings.DEBUG_DIR);
try {
return ... | 5 |
public Hashtable getDictionary(Hashtable dictionaryEntries, String key) {
Object o = getObject(dictionaryEntries, key);
if (o instanceof Hashtable) {
return (Hashtable) o;
} else if (o instanceof Vector) {
Vector v = (Vector) o;
Hashtable h1 = new Hashtable();... | 4 |
protected Apply(Element apply, FieldMetaInfo.Optype opType, ArrayList<Attribute> fieldDefs,
TransformationDictionary transDict)
throws Exception {
super(opType, fieldDefs);
String functionName = apply.getAttribute("function");
if (functionName == null || functionName.length() == 0) {
/... | 9 |
private Map<String, Object> values(final int type,
final ValueVisitor defaultVisitor) {
Class<?> clazz = getClass();
final FieldDefinitionImpl thiz = this;
final Map<String, Object> map = new HashMap<String, Object>();
SpringReflectionUtils.doWithFields(clazz,
new SpringReflectionUtils.FieldCallback() {
... | 8 |
public void simulateGrowth() {
for (Planet p: planets){
if(p.Owner() == 0)
continue;
Planet newp = new Planet(p.PlanetID(), p.Owner(), p.NumShips()+p.GrowthRate() ,
p.GrowthRate(), p.X(), p.Y());
planets.set(p.PlanetID(), newp);
}
} | 2 |
@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 Comment)) {
return false;
}
Comment other = (Comment) object;
if ((this.commentID == null && other.commentID !=... | 5 |
public void tick(){
gsm.tick();
if (FallingBlocks.lives <= 0) {
Sound.playGameOverSound();
gameOverB();
}
if (SinglePlayerState.p1Score == 10) {
Sound.playGameOverSound();
gameOverS1();
}
if (SinglePlayerState.compScore == 10) {
Sound.playGameOverSound();... | 5 |
private void updateGraphics() {
if (isInit) {
setBorder(BorderFactory.createTitledBorder("init"));
} else {
setBorder(null);
}
switch (aspect) {
case POINT:
setBackground(Color.yellow);
setIcon(new ImageIcon("dot.jpg"));
break;
case VIDE:
setBackground(Color.white);
setIcon(null);
b... | 6 |
@Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
String parm = (commands.size() > 1) ? CMParms.combine(commands,1) : "";
if((!mob.isAttributeSet(MOB.Attrib.AUTODRAW) && (parm.length()==0))||(parm.equalsIgnoreCase("ON")))
{
mob.setAttribute(MOB.At... | 8 |
@Override
public BMPImage apply(BMPImage image) {
BMPImage filteredImage = new BMPImage(image);
int redGap = 256/redBits;
int greenGap = 256/greenBits;
int blueGap = 256/blueBits;
BMPImage.BMPColor[][] bitmap = image.getBitMap();
BMPImage.BMPColor[][] filteredBitmap =... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Vertex other = (Vertex) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!... | 6 |
private void moveCursorLeft(boolean shiftDown) {
if (shiftDown) {
int start = textField.getSelectionStart();
if (start > 0) {
textField.setSelectionStart(start - 1);
}
} else {
int pos = textField.getCaretPosition();
if (pos > 0)
textField.setCaretPosition(pos - 1);
}
} | 3 |
private void selectMove(int selected) {
IMove[] moves = battle.getPlayer().getPokemon().get_moves();
System.out.println(selectedMove + " - " + moves.length);
if(selected >= moves.length)
selectedMove = 0;
else if(selected < 0)
selectedMove = moves.length - 1;
else
selectedMove = selected;
System.ou... | 2 |
public void run()
{
short ret = MsgDumperCmnDef.MSG_DUMPER_SUCCESS;
MsgDumperCmnDef.WriteDebugFormatSyslog(__FILE__(), __LINE__(), "Thread[%s]=> The worker thread is running", worker_thread_name);
while (!exit.get())
{
synchronized(this)
{
// wait for input data
try
{
wait();
// Move th... | 9 |
@Test
public void isEmptyReturnsFalseAfterSingleEnqueue() {
q.enqueue(0);
assertFalse(q.isEmpty());
} | 0 |
public int longestValidParentheses(String s) {
if (s == null || s.length() == 0) {
return 0;
}
List<int[]> spans = new LinkedList<>();
Deque<Integer> deque = new LinkedList<>();
int maxSpan = 0;
for (int i = 0; i < s.length(); i++) {
char c = s.... | 8 |
private void copyRGBtoABGR(ByteBuffer buffer, byte[] curLine) {
if (transPixel != null) {
byte tr = transPixel[1];
byte tg = transPixel[3];
byte tb = transPixel[5];
for (int i = 1, n = curLine.length; i < n; i += 3) {
byte r = curLine[i];
... | 6 |
public Unit getUnitAt(Position p) {
if ( p.getRow() == 2 && p.getColumn() == 3 ||
p.getRow() == 3 && p.getColumn() == 2 ||
p.getRow() == 3 && p.getColumn() == 3 ) {
return new StubUnit(GameConstants.ARCHER, Player.RED);
}
if ( p.getRow() == 4 && p.getColumn() == 4 ) {
return new ... | 8 |
public void dispose(boolean cache) {
if (streamInput != null) {
if (!cache) {
try {
streamInput.dispose();
}
catch (IOException e) {
logger.log(Level.FINE, "Error disposing stream.", e);
}
... | 6 |
private void decodeLobbyLogin(InputStream buffer) {
int clientRev = buffer.readInt();
int rsaBlockSize = buffer.readShort(); // RSA block size
int rsaHeaderKey = buffer.readByte(); // RSA header key
System.out.println(" " + rsaBlockSize + " " + rsaHeaderKey + " "
+ clientRev);
int[] loginKeys = new int[... | 8 |
public OutputStream getOutputStream ()
{
if ("bulk" != getType () || isInput ())
throw new IllegalArgumentException ();
spi = getDevice ().getSPI ();
return new BulkOutputStream (spi, getEndpoint ());
} | 2 |
@EventHandler
public void onDamage(EntityDamageEvent event) {
if (event.getEntity() instanceof Player) {
if (MPlayer.getElement((Player) event.getEntity()).equals(Element.EARTH) && event.getCause().equals(DamageCause.FALL)) {
event.setCancelled(true);
} else if (MPlayer.getElement((Player) event.getEntity(... | 8 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(tickID==Tickable.TICKID_MOB)
{
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if(!mob.isInCombat())
if((mob.amFollowing()==null)
||(mob.location()==null)
||(mob.amDead())
||((invoker!=null)
&&((mob... | 9 |
@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 Tenant)) {
return false;
}
Tenant other = (Tenant) object;
if ((this.id == null && other.id != null) || (this.i... | 5 |
public static boolean isLich (Entity entity) {
if (entity instanceof Skeleton) {
Skeleton lich = (Skeleton) entity;
LeatherArmorMeta chestMeta;
ItemStack lichChest = new ItemStack(Material.LEATHER_CHESTPLATE, 1, (short) - 98789);
chestMeta = (LeatherArmorMeta) lic... | 2 |
private IpInfo jsoupParser(String Html) {
IpInfo ipLookup = new IpInfo();
int count = 0;
Document doc = Jsoup.parse(Html);
Elements e = doc.getElementsByTag("input");
for (int i = 0; i < e.size(); i++) {
if (i == 1) {
Element element = e.get(i);
... | 6 |
public static Gender buildGender(String genderStr) {
return genderStr.equals(MALE_DESC) ? MALE : FEMALE;
} | 1 |
@Override
public void notifySubscription(String file, int number) throws RemoteException {
System.out.println("Notification: "+file+" got downloaded "+number+" times!.");
try {
shell.writeLine("Notification: "+file+" got downloaded "+number+" times!.");
} catch (IOException e) {
// TODO Auto-generated catc... | 1 |
public void setRoadHaul(String roadHaul) {
this.roadHaul = roadHaul;
} | 0 |
private void writeJSON(Object value) throws JSONException {
if (JSONObject.NULL.equals(value)) {
write(zipNull, 3);
} else if (Boolean.FALSE.equals(value)) {
write(zipFalse, 3);
} else if (Boolean.TRUE.equals(value)) {
write(zipTrue, 3);
} else {
... | 8 |
private TokenString tokenizeCurrentLine() {
TokenString tokenString = new TokenString();
boolean finishedLine = false;
// Sorts through the list of TokenTypes, ordering them from longest to shortest.
TokenType[] types = TokenType.values();
Arrays.sort(types, Comparator.comparing... | 9 |
public boolean nextToCell(int x, int y, IMapCell cell) {
int xL = x - 1;
int xR = x + 1;
int yL = y - 1;
int yR = y + 1;
if (xL >= 0 && getCell(xL, y).equals(cell)) {
return true;
}
if (xR < getX() && getCell(xR, y).equals(cell)) {
return ... | 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... | 7 |
public static String getString() throws BadInput{
//return System.console().readLine();
try {
return br.readLine();
} catch(IOException e) {
throw new BadInput("Couln't get input. IO problem?");
}
} | 1 |
public boolean isMatch(String s, String p) {
if (s == null || p == null)
return false;
if ("".equals(p)) {
if ("".equals(s))
return true;
return false;
}
this.s = s;
this.p = p;
f = new Boolean[s.length() + 1][];
for (int i = 0; i <= s.length(); i++)
f[i] = new Boolean[p.length() + 1];
f... | 5 |
public static void makePlayerList() {
final int MAX_PLAYERS = 3, MIN_PLAYERS = 1;
int numPlayers;
String playerName;
System.out.print("How many people are playing (1-3)? ");
do {
try {
numPlayers = scan.nextInt();
}
catch(InputMismatchException e) {
numPlayers = -1;
}
scan.nextLin... | 7 |
@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 Transactions)) {
return false;
}
Transactions other = (Transactions) object;
if ((this.id == null && other.id !... | 5 |
public Level(String name) {
double checkRatioEnemyType = 0;
for(double e : ratioEnemyType)
checkRatioEnemyType += e;
if( checkRatioEnemyType != 1.0) {
System.out.println("La somme des ratios des types d'ennemies du level " + name + " est différente de 1. (" + checkRatioEnemyType + ")");
System.exi... | 3 |
public void toggleConnectionActions(boolean setVisible) {
if (setVisible) {
String name = InputHandler.getCurrentServerTab().getTabName();
disconnectFromServer.setText("Odpojit od " + name);
}
joinToChannel.setVisible(setVisible);
disconnectFromAll.setVisible(set... | 1 |
public static String findMLIA() {
String fmlmsg = "";
try {
HttpURLConnection con = (HttpURLConnection) new URL("http://mylifeisaverage.com/" + getPage()).openConnection();
StringBuilder sb = new StringBuilder();
con.connect();
InputStream input = con.get... | 7 |
@Override
public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {
g.setAntiAlias(true);
g.setColor(new Color(255, 255, 255));
if (!terrainMode) {
g.setColor(new Color(209, 217, 224));
}
g.fillRect(0, 0... | 6 |
public CellElement getPointerWithPolicy(int policy) {
if (m_pointers.size() == 0) {
return null;
}
CellElement retCell = null;
switch (policy) {
case POINTER_POLICY_ANY:
retCell = (CellElement) m_pointers.firstElement();
break;
... | 9 |
public void addToOutput(String message) {
try {
Element p = houtput.getParagraphElement(houtput.getLength());
houtput.insertAfterEnd(p, "<div align=left> "+message+" </div>");
} catch (NullPointerException e) {
e.printStackTrace();
} catch (BadLocationException e) {
e.printStackTrace();
} catch (IOE... | 4 |
public static long f( int h, int w ){
if(h>=0 && w < mem[h].length && mem[h][w]!=-1) return mem[h][w];
if( w == 1 && h == 0 ) return mem[h][w]=1;
if( h>=1 && w==0 ) return mem[h][w]=1;
if( w < 0 || h < 0 ) return 0;
else return mem[h][w]=f( h-1, w )+f( h+1, w-1 );
} | 9 |
@AfterClass
public static void tearDownClass() {
} | 0 |
@Override
public Object getWatchKey() {
return watchKey;
} | 0 |
public int[] getSucc(int i) throws ArrayIndexOutOfBoundsException{
if ((i<0) || (i>=nbVertices))
throw new ArrayIndexOutOfBoundsException();
int[] tab = new int[succ.get(i).size()];
for(int j=0;j<tab.length;j++){
tab[j] = succ.get(i).get(j);
}
return tab;
} | 3 |
public final void filter(final Object o) throws JSONException {
if (o instanceof Element) {
Element element = (Element) o;
String elemName = element.getName();
List children = element.getContent();
List attribute = element.getAttributes();
Iterator ita = attribute.iterator();
Iterator itc = children... | 5 |
@Override
public final void set( GraphSite site ) {
if( this.site != null ) {
for( GraphItem item : children ) {
this.site.removeItem( item );
}
removeFrom( this.site );
}
this.site = site;
if( site != null ) {
addTo( site );
for( GraphItem item : children ) {
site.addItem( item );
}
... | 4 |
private void simpleSetLocal(int index, Type type, Frame frame) {
frame.setLocal(index, type);
if (type.getSize() == 2)
frame.setLocal(index + 1, Type.TOP);
} | 1 |
public void mouseClicked(int x, int y, MouseHelper helper) {
if (helper == MouseHelper.LEFT_CLICK) {
if ((x >= theComponent.getX()) && ((x <= (theComponent.getX() + buttonWidth)))) {
if ((y >= theComponent.getY()) && (y <= (theComponent.getY() + buttonHeight))) {
... | 7 |
public boolean isUpgradeable(ItemStack is){
if(!(is.getType() == Material.WOOD_SWORD || is.getType() == Material.GOLD_SWORD || is.getType() == Material.IRON_SWORD || is.getType() == Material.DIAMOND_SWORD))return false;
if(is.hasItemMeta()){
ItemMeta im = is.getItemMeta();
if(im.hasLore()){
for(String ... | 8 |
private static int getShortLittleEndian(byte[] a, int offs) {
return (a[offs] & 0xff) | (a[offs + 1] & 0xff) << 8;
} | 0 |
public void addCollectable(int tileX, int tileY, int tileType)
{
Tile collectable = null;
if(tileType == TileTypes.DIAMOND)
{
collectable = new TileCollectableDiamond(tileX * Tile.TILE_SIZE, tileY * Tile.TILE_SIZE, true);
}
else if(tileType == TileTypes.GOLD)
{
collectable = new TileCollectableGol... | 2 |
private static PixImage array2PixImage(int[][] pixels) {
int width = pixels.length;
int height = pixels[0].length;
PixImage image = new PixImage(width, height);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
image.setPixel(x, y, (short) pixels[x][y],
(short) pixels[x][y], (sh... | 2 |
@Override
public void drawShape(Graphics graphics) {
int xn, yn, xm, ym;
int xa, ya, xb, yb, xc, yc, xd, yd;
// xn and yn is the first point the user clicked
// xm and ym is the second point the user clicked
xn = super.getXi();
yn = super.getYi();
xm = super.... | 5 |
public boolean checkCanMove(Block[][] boardMatrix, int firstBlockX, int firstBlockY, int secBlockX, int secBlockY, int thirdBlockX, int thirdBlockY,
int fourthBlockX, int fourthBlockY)
{
for (int i = 0; i < getBlocks().length; i++) {
Block tempBlock = getBlocks()[i];
int x = tempBlock.getX();
int y = tem... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
Subscription o = (Subscription) obj;
return (edition == null ? o.edition == null : edition.equals... | 6 |
private void listen( HttpServletRequest request, HttpServletResponse response ) {
RequestDispatcher dispatcher = null;
ChatClientHelper helper = null;
int action = 0;
try {
if( request.getParameter( "action" ) == null ){
logger.info( "No action parameter, redirecting to default action" );
a... | 6 |
private void submitSQL(ArrayList<VulnLocation> params, String url, String method) {
String sqlAttack = "' OR 1=1; --";
String response = "";
String normalResponse = "";
SubmitForm submitForm = new SubmitForm(url);
SubmitForm submitNormalForm = new SubmitForm(url);
try {
for(VulnLocation vuln:para... | 8 |
protected void calculateMean()
{
double sum = 0.0;
for (double a : data) {
sum += a;
}
mean = sum / size;
} | 1 |
@Override
public boolean isAllowedToBorrow(Loan loan, StockController stockController) {
if (stockController.numberOfLoans(this) < 1) {
if (loan.getQuantity() < 2) {
if (CalendarController.differenceDate(loan.getStart(),
loan.getEnd()) < 8) {
... | 4 |
public void addListener( Object listener )
{
Class<?> listenerClass = listener.getClass();
for (Class<?> listenerInterface : listenerClass.getInterfaces())
{
RemoteInterface ri = listenerInterface.getAnnotation( RemoteInterface.class );
if (ri != null)
{... | 6 |
public static int majorityElement(int[] arr) {
if(arr.length == 0 || arr.length == 1) {
System.out.println("Error: Input array's length is less than 2.");
System.exit(0);
}
Integer count;
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for(int i = 0; i < arr.length; i++) {
if((count = ma... | 6 |
private void doCommand(String cmd) {
if (cmd.startsWith("S")) {
doSleep(Integer.parseInt(cmd.substring(1)));
} else if (cmd.startsWith("X")) {
doShutdown();
} else if (cmd.startsWith("R")){
doRecovery();
} else if (cmd.equals("help")) {
doH... | 5 |
public ArrayList<Activity> orderActivitiesByTime(ArrayList<Activity> activities, LinkedHashSet<Integer> activityIds) {
ArrayList<Activity> reorderedActivities = new ArrayList<>();
// if (activityIds != null) {
for (int i : activityIds) {
for (Activity a : activities) {
if (i == a.getIdActivity()) {
... | 5 |
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 |
private void compute_pcm_samples11(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
final float[] dp = d16[i];
float pcm_sample;
pcm_sample = (float)(((vp[11 ... | 1 |
public int reverse(int x) { // 无需处理符号位
int y = 0;
while(x !=0){
y = y*10 + x % 10;
x = x/10;
}
return y;
} | 1 |
public void input() {
if (Input.getKeyDown(Keyboard.KEY_UP)) {
System.out.println("We've just pressed up!");
}
if (Input.getKeyUp(Keyboard.KEY_UP)) {
System.out.println("We've just released up!");
}
if (Input.getMouseDown(1)) {
System.out.println("We've just pressed RMB @" + Input.getMousePosition(... | 4 |
public ArrayList<Double> FDWT(ArrayList<Double> _pic) {
ArrayList<Double> _temp = new ArrayList<Double>(_pic.size());
//Initialize _temp
_temp = (ArrayList<Double>) _pic.clone();
for (int j = _pic.size(); j >= 2; j = j / 2) {
for (int i = 0; i < j / 2; i += 1) {
... | 2 |
public static void NewGame(GameType type, GameModes mode, InetAddress addr, int nPlayers, int nPlanets, int nRows, int nCols)
{
if(type == null || mode == null) {
System.err.println("Must select a type and mode!");
return;
}
Instance.gameType = type;
Instance.gameMode = mode;
if(debug) System.out.print... | 5 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
{
if (commandLabel.equalsIgnoreCase("censor"))
{
if (sender instanceof Player)
{
Player p = (Player) sender;
if (p.hasPermission("cens... | 6 |
@Override
public void draw(Graphics g) {
if (state) {
if (color == 1)
g.drawImage(imgred, pos_x, pos_y, width, height, null);
else if (color == 2)
g.drawImage(imgblue, pos_x, pos_y, width, height, null);
else if (color == 3)
g.drawImage(imgwhite, pos_x, pos_y, width, height, null);
else if ... | 9 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
if((affected!=null)&&(affected instanceof Room))
{
final Room R=(Room)affected;
if(isRaining(R))
for(int i=0;i<R.numInhabitants();i++)
{
final MOB M=R.fetchInhabitant(i);
if(M!=nul... | 8 |
@Test
public void TestRemoveStudent() throws InstanceNotFoundException {
try {
familyService.removeStudent(1);
} catch (InstanceNotFoundException e) {
e.printStackTrace();
}
assertEquals(familyService.getStudents().size(), 3);
} | 1 |
public void loadSchema(String catalogFile) {
String line = "";
try {
BufferedReader br = new BufferedReader(new FileReader(new File(catalogFile)));
while ((line = br.readLine()) != null) {
//assume line is of the format name (field type, field type, ...)
... | 8 |
public int hashCode() {
int hc = 13 * sort;
if (sort == OBJECT || sort == ARRAY) {
for (int i = off, end = i + len; i < end; i++) {
hc = 17 * (hc + buf[i]);
}
}
return hc;
} | 3 |
static int checkStyleBit(Shell parent, int style) {
int mask = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
if ((style & SWT.SHEET) != 0) {
style &= ~SWT.SHEET;
if ((style & mask) == 0) {
style |= parent == null ? SWT.APPLICATION_MODAL
: SWT.PRIMARY_MODAL;
}
}
if ((style & ma... | 8 |
private void createTablesIfNotExist(Connection cnn) {
if (tableExists("cb_users", cnn)) {
logger.info("table cb_users already exists");
} else {
logger.info("create table cb_users");
String sql =
"CREATE TABLE `cb_users` ( \n" +
... | 2 |
public CycList allIndicesOf(Object elem) {
CycList result = new CycList();
if (elem == null) {
for (int i = 0; i < size(); i++) {
if (get(i) == null) {
result.add(i);
}
}
} else {
for (int i = 0; i < size(); i++) {
if (elem.equals(get(i))) {
resu... | 5 |
private void go() throws IOException {
// Create a new selector
Selector selector = Selector.open();
// Open a listener on each port, and register each one
// with the selector
for (int i=0; i<ports.length; ++i) {
ServerSocketChannel ssc = ServerSocketChannel.open();... | 8 |
public ArrayList<FeatureResult> extractFeaturesFrom(MouseLogParser parser) {
ArrayList<FeatureResult> fr=new ArrayList<FeatureResult>();
fr.addAll(parser.getUserProfile().extract());
try {
// want to dynamically 'load' feature set
//so we can add features without having to modify this code.
//All feature... | 7 |
public int getImgWidth() {
return imgWidth;
} | 0 |
private static void registerGeneral(String field, Class<? extends FrameNode> type, Property prop) {
generalFields.add(new GeneralNameValueConfig(field,type,prop));
} | 1 |
private static Set<Trace> checkArgs(String[] args) {
boolean error = false;
if (args.length != 2) {
error = true;
} else {
if (args[0].equals("d")) {
switch (args[1]) {
case "L1":
return Utils.demoL1eventLog();
... | 9 |
public static void main(String[] args) throws FileNotFoundException, InvalidCantidadDeTokensDeLookaheadException, BufferDeTokensVacioException, IOException, ElementoFueraDeIndiceEnBufferException {
// Menú de prueba para probar el Lexer, Parser y Traducción.
int i = 1;
Buffered... | 4 |
@Override
public void Throttle(double value) {
double forward = 2.1;
double center = 1.50;
double reverse = 1.00;
double ms;
value = (value > 1) ? 1 : value;
value = (value < -1) ? -1 : value;
switch (direction){
case Posi... | 8 |
public void testConstructor_ObjectStringEx3() throws Throwable {
try {
new YearMonth("10:20:30.040");
fail();
} catch (IllegalArgumentException ex) {
// expected
}
} | 1 |
public Node<K> getLeft() {
return left;
} | 0 |
public boolean isInUserAgentString(String agentString)
{
for (String alias : aliases)
{
if (agentString != null && agentString.toLowerCase().indexOf(alias.toLowerCase()) != -1)
return true;
}
return false;
} | 3 |
public Image getCurrentImage()
{
DefaultFont font = DefaultFont.getDefaultFont();
Image[] charecters = font.getStringImage(currentInput);
Image currentImage = (isSelected) ? selectedImage : unSelectedImage;
int[] pixels = currentImage.getPixels();
int IWidth = currentImage.getWidth();
int IHeight = current... | 8 |
public static OOXMLElement parseOOXML( XmlPullParser xpp, Stack<String> lastTag, WorkBookHandle bk )
{
BodyPr b = null;
P para = null;
try
{ // need: endParaRPr?
int eventType = xpp.getEventType();
while( eventType != XmlPullParser.END_DOCUMENT )
{
if( eventType == XmlPullParser.START_TAG )... | 7 |
private void doParse(String contents) {
try {
InputSource xmlParserSource = new InputSource(new StringReader(contents));
reader.parse(xmlParserSource);
} catch (IOException ioe) {
System.out.println("IOException when running parser.");
ioe.printStackTrace();
System.out.println("IOException when runni... | 2 |
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.