text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Test
public void WhenComparingKeys_ExpectResults() {
Key key1 = new PGridKey("");
Key key2 = new PGridKey("");
Assert.assertTrue(key1.compareTo(key2) == 0);
key1 = new PGridKey("");
key2 = new PGridKey("00");
Assert.assertTrue(key1.compareTo(key2) == 1);
ke... | 1 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuilder sb = new StringBuilder();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | 9 |
public static void palette_change_color_16_static(int color, int red, int green, int blue) {
if (color == palette_transparent_color) {
int i;
palette_transparent_pen = shrinked_pens[rgbpenindex(red, green, blue)];
if (color == -1) {
return; /* by default, pa... | 8 |
public IrcCommandSender(AprilonIrc plugin, IrcClient client, IrcMessage message)
{
this.Plugin = plugin;
this.Client = client;
this.Message = message;
this.User = message.getUser();
} | 0 |
public static void removeConnectedClient(String btN)
{
for(int i = 0;i<=5;i++)
{
if(clientsTable.getModel().getValueAt(i, 0) != null)
{
if(clientsTable.getModel().getValueAt(i, 0).toString().equals(btN))
{
//Clear Device
clientsTable.getModel().setValueAt(null, i, 0);
clientsTable.getM... | 3 |
public int getBumoncode() {
return this.bumoncode;
} | 0 |
public void download( String source, String target )
{
try
{
String remote = convertPath( source );
String local = convertPath( target );
if ( isDirectory( local ) && !isDirectory( remote ) )
{
throw new IllegalStateException(
"Can not send a directory to a file!" );
}
File f = new Fil... | 6 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... | 7 |
public void setId(Integer id) {
this.id = id;
} | 0 |
private void getWavData() {
// Get the sample from the input thread
try {
// Add the data from the thread pipe to the circular buffer
circBuffer.addToCircBuffer(inPipeData.readInt());
// Process this data
processData();
// Update the progress bar
updateProgressBar();
// Check if the file ... | 8 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
newPersonDialog = new javax.swing.JDialog();
newNameField = new javax.swing.JTextField();
newAddressField = new javax.swing.JTextField... | 1 |
protected Target nextMoveTarget(Target dummy, Actor actor) {
float offs[] = null ; switch (drill) {
case (DRILL_MELEE ) : offs = MELEE_OFFS ; break ;
case (DRILL_RANGED ) : offs = RANGED_OFFS ; break ;
case (DRILL_ENDURANCE) : offs = ENDURE_OFFS ; break ;
case (DRILL_AID ) : offs ... | 7 |
private int partition(int[] array, int p, int r) {
int i = p;
int key = array[p];
for (int j = p + 1; j < r + 1; j++) {
if (array[j] < key) {
i++;
swap(array, i, j);
}
}
swap(array, p, i);
return i;
} | 2 |
public void Render(GameContainer gc, Graphics g) {
g.setColor(INVENTORY_BACKGROUND_COLOR);
g.fillRect(600, 100, 180, 400);
g.setLineWidth(5f);
g.setColor(INVENTORY_OUTLINE_COLOR);
g.drawRect(600, 100, 180, 400);
g.resetLineWidth();
Vector2 currentlyDrawing = new Vector2(603, 112);
Inventory inv = player... | 3 |
public static void wordFrequencyCount(String s) {
int count = StringDemo.wordCount(s);
String ar[] = new String[count];
int ocr = 0;
for (int i = 0; i < count; i++) {
if (i == (count - 1)) {
ar[i] = s.substring(0);
} else {
ar[i] = s.substring(0, s.indexOf(' '));
s = s.substring(s.indexOf(' ')... | 9 |
*/
protected Rectangle repaintSelectionInternal() {
Rectangle area = new Rectangle();
Insets insets = getInsets();
Rectangle bounds = new Rectangle(insets.left, insets.top, getWidth() - (insets.left + insets.right), getHeight() - (insets.top + insets.bottom));
int last = getLastRowToDisplay();
List<Column> c... | 5 |
@Override
public boolean activate() {
if(Tabs.getCurrent() != Tabs.INVENTORY && hasSpinTicket()) {
return false;
}
return hasSpinTicket();
} | 2 |
public List<Double> multiply(Business bus, double[] maxPerFeature){
double scoregiven = 0;
List<Double> sample = new ArrayList<Double>();
for(Review r:reviews){
if(r.b_id.equals(bus.id)){
scoregiven = r.stars;
break;
}
}
for(int i=0; i<features.size();i++){
sampl... | 3 |
public int loadALData() {
AL10.alGenBuffers(buffer);
if(AL10.alGetError() != AL10.AL_NO_ERROR) {
return AL10.AL_FALSE;
}
/*
WaveData waveFile = WaveData.create("testi.wav");
AL10.alBufferData(buffer.get(0), waveFile.format, waveFile.data, waveFile.samplerate);... | 3 |
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
try{
OAuth2Message requestMessage = OAuth2Servlet.getMessage(request, null);
OAuth2Client client = SampleOAuth2Provider.get... | 8 |
public void setSelected(boolean isSelected) {
if(this.isSelected && isSelected ) {
if ( isXSelected) {
isXSelected = false;
isYSelected = true;
}
else if (isYSelected) {
isYSelected = false;
isXSelected = false;
}
}
else if (!this.isSelected && isSelected) {
this.isSelected = true;... | 7 |
private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
//set a Princess Peach Theme!
world.setThemes("Peach");
this.repaint();
}//GEN-LAST:event_jMenuItem7ActionPerformed | 0 |
public STTPoint getNextPoint() {
long timeSinceLastPull = System.currentTimeMillis() - this.lastDataPullTime.getTime();
if (timeSinceLastPull > this.pointPollingTimeMS) {
ArrayList<STTPoint> newData = this.wrapperReference.getWrappedData();
this.mostRecentPoints = newData;
this.lastDataPullTime = new Ti... | 4 |
public int getBlockTextureFromSideAndMetadata(int par1, int par2)
{
int var3 = par2 & 7;
return var3 == 0 ? (par1 <= 1 ? 6 : 5) : (var3 == 1 ? (par1 == 0 ? 208 : (par1 == 1 ? 176 : 192)) : (var3 == 2 ? 4 : (var3 == 3 ? 16 : (var3 == 4 ? Block.brick.blockIndexInTexture : (var3 == 5 ? Block.stoneBrick... | 9 |
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... | 5 |
public int minDistance(String word1, String word2) {
int m = word1.length();
int n = word2.length();
int array[][]= new int[n+1][m+1];
//init
for(int i =0 ; i < n+1;i++)
array[i][0] = i;
for(int i = 0 ; i < m +1; i++)
array[0][i] = i;
for(... | 5 |
public Upgrade getUpgradeByName(String name){
for(Upgrade u : allUpgrades){
if(u.getName() == name){
return u;
}
}
return null;
} | 2 |
public PollItem getItem (int index)
{
if (index < 0 || index >= this.next)
return null;
return this.items[index];
} | 2 |
@Override
public boolean supportsAttributes() {return true;} | 0 |
public static void setMarketComparisonStatistics(StatInfo setTo, int iD,
float emin, float emax) {
ArrayList<Float> over = new ArrayList<Float>();
ArrayList<Float> under = new ArrayList<Float>();
for (Entry<Float, float[][]> ent : Database.DB_ARRAY.entrySet()) {
// change in market forward 1wk
if (!Dat... | 7 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Location other = (Location) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
... | 3 |
public void run() {
Plugin larvikGaming = Bukkit.getServer().getPluginManager().getPlugin("LarvikGaming");
int delay = larvikGaming.getConfig().getInt("RefreshGroupInMin", 10) * 60000;
long runTime = 0;
if (delay < 1) {
return;
}
try {
Thread.sleep(100);
}
catch (InterruptedExceptio... | 5 |
@Override
public boolean verifier() throws Exception {
super.verifier();
if(!expression.verifier())
GestionnaireSemantique.getInstance().add(new SemantiqueException("La declaration de la variable "+((Identificateur) expression).getNom()+" a la ligne "+/*line+*/" est manquante"));
... | 3 |
@Override
protected ModelAndView onSubmit(Object command, BindException errors) throws Exception {
ModelAndView modelAndView = null;
NewUserForm newUserForm = (NewUserForm)command;
if (usersManager.existingUserName(newUserForm.getUserName())){
modelAndView = new ModelAndView(getFormView(), "startUserSession",... | 1 |
void close() {
try {
Thread.sleep(100000);
} catch (InterruptedException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
try {
mySocket.close();
} catch (IOException e1) {
// TODO Auto-generated catch bl... | 3 |
@Override
public String toString() {
return "\nUser [id=" + getId() + ", " + firstName + " " + lastName + ", email: "
+ email + ", " + role + "]";
} | 0 |
private File ensureFolder( final File folder ) {
if( folder.exists() ) {
if( !folder.isDirectory() ) {
throw new IllegalArgumentException( "Given path " + folder.getAbsolutePath() + " is not a directory." );
}
if( !folder.canWrite() ) {
throw new IllegalArgumentException( "Can't write into directory ... | 4 |
private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String localVersion = this.plugin.getDescription().getVersion();
if (title.split(delimiter).length == 2) {
final String remoteVersion = title.split(delimiter)[1].split(" ")[... | 5 |
public void dumpInstruction(TabbedPrintWriter writer)
throws java.io.IOException {
writer.print("try");
writer.openBrace();
writer.tab();
subBlocks[0].dumpSource(writer);
writer.untab();
for (int i = 1; i < subBlocks.length; i++)
subBlocks[i].dumpSource(writer);
writer.closeBrace();
} | 1 |
protected StringBuilder appendIntValue(StringBuilder sb) {
if ("0".equals(number)) {
return sb.append(style.getNumbersText()[0]);
}
int length = number.length();
// 计算cell的个数
int size = length >> 2;
if (length % 4 != 0) {
size++;
}
// 循环截取4位数字字符串组装成cell,放入List中
List<Cell> cells = new ArrayList<C... | 9 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Spot spot = (Spot) o;
if (col != spot.col) return false;
if (row != spot.row) return false;
return true;
} | 5 |
protected void getEvidenceDetail(String title) {
if (title != null) {
for (int i = 0; i < evidenceResultList.size(); i++) {
if (evidenceResultList.get(i).getTitle().equals(title)) {
if (!(evidenceResultList.get(i).getDescription() == null
|| evidenceResultList.get(i).getDescription().equals("null"... | 8 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public void MI(HashMap<String, _stat> featureStat, int[] classMemberNo){
m_selectedFeatures.clear();
double[] PrCi = new double[classMemberNo.length];
double[] ItCi = new double[classMemberNo.length];
double N = Utils.sumOfArray(classMemberNo);
double Iavg = 0;
for (int i = 0; i < classMemberNo.length; i++... | 5 |
public int compute()
{
subSequence[0] = seq[0];
len = 1;
for (int i = 1; i < seq.length; i++) {
if (seq[i] > subSequence[len-1]) {
subSequence[len++] = seq[i];
} else if (seq[i] < subSequence[0]) {
subSequence[0] = seq[i];
}... | 3 |
private void handleLoginLogoutButtonPressed(ActionEvent e) {
if (loginLogoutButton.getText().equals("Log In")) {
String serverName = serverBox.getValue();
String version = versionBox.getValue();
String userName = userField.getText();
if (userName == null || userName.length() == 0) {
return;
}
... | 7 |
private void readAndDecompress() throws IOException {
// Read the length of the compressed block
int ch1 = in.read();
int ch2 = in.read();
int ch3 = in.read();
int ch4 = in.read();
if ((ch1 | ch2 | ch3 | ch4) < 0)
throw new EOFException();
inLength = (... | 9 |
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} | 6 |
@Override
public Line localOptimize()
{
for (int i = 0; i < conditions.size();)
{
conditions.set(i, conditions.get(i).localOptimize());
if (conditions.get(i) instanceof ExpressionLiteral)
{
Value conditionValue = ((ExpressionLiteral) conditions.get(i)).getValue();
if (conditionValue instanceof Bo... | 7 |
public synchronized static Integer getValue(Object layout, String key, int type)
{
Integer ret = null;
boolean cont = true;
for (int i = LAYOUTS.size() - 1; i >= 0; i--) {
Object l = LAYOUTS.get(i).get();
if (ret == null && l == layout) {
int[] rect = VALUES_TEMP.get(i).get(key);
if (cont && rect ... | 9 |
@Override
public Move makeAMove() {
// Send make a move request over network then wait
this.send("YOUR-TURN");
String result;
try {
result = this.inStream.readLine();
if (result == null) {
return null;
}
String[] cmdToke... | 3 |
public void runGroup(GroupSettings settings, boolean printResult, boolean printEmpty)
{
if(settings.warnOnly())
return;
EntityConcentrationMap map = new EntityConcentrationMap(settings, this);
for(World world : Bukkit.getWorlds())
{
if(allowWorldGlobal(world) && settings.allowWorld(world))
map.... | 4 |
public void setActivity(String activity) {
this.activity = activity;
} | 0 |
public static String encodeURIComponent(String s)
{
String result = null;
try
{
result = URLEncoder.encode(s, "UTF-8")
.replaceAll("\\+", "%20")
.replaceAll("\\%21", "!")
.replaceAll("\\%27", "'")
.r... | 1 |
public final synchronized BigDecimal readBigDecimal(){
this.inputType = true;
String word="";
BigDecimal big = null;
if(!this.testFullLineT) this.enterLine();
word = nextWord();
if(!eof)big = new BigDecimal(word.trim());
... | 2 |
public SignatureVisitor visitExceptionType() {
if (exceptions == null) {
exceptions = new StringBuffer();
} else {
exceptions.append(", ");
}
// startType();
return new TraceSignatureVisitor(exceptions);
} | 1 |
public static String Base64EncodedStringFromString(String string) {
byte[] data = string.getBytes();
int length = data.length;
byte[] input = data;
byte[] output = new byte[((length + 2) / 3) * 4];
for (int i = 0; i < length; i += 3) {
int value = 0;
for... | 5 |
private void printSimpleString(Graphics2D g2d, String s, int width, int XPos, int YPos){
int stringLen = (int)
g2d.getFontMetrics().getStringBounds(s, g2d).getWidth();
int start = width/2 - stringLen/2;
g2d.drawString(s, start + XPos, YPos);
} | 0 |
public int GetTimeDeliverd()
{
return timeDelivered;
} | 0 |
public static boolean isPlate(int itemID)
{
for (int i=0; i<platebody.length; i++)
if (platebody[i] == itemID)
return true;
return false;
} | 2 |
public void print()
{
System.out.println("#nodes:" + this.nodes.size() + " #edges:"+ this.edges.size());
for (Edge oneEdge : this.edges.values())
{
oneEdge.print();
System.out.println("");
}
} | 1 |
public static String encodeParameters(PostParameter[] httpParams) {
if (null == httpParams) {
return "";
}
StringBuffer buf = new StringBuffer();
for (int j = 0; j < httpParams.length; j++) {
if (httpParams[j].isFile()) {
throw new IllegalArgumentE... | 5 |
@Override
public double[] get2DData(int px, int pz, int sx, int sz)
{
double[] d = f.get2DData(px, pz, sx, sz);
int s = sx * sz;
for (int i = 0; i < s; i++)
{
double n = d[i];
if (n < min)
n = min;
if (n > max)
... | 3 |
public static final int getMaxHit(Player player, int weaponId,
int attackStyle, boolean ranging, boolean usingSpec,
double specMultiplier) {
if (!ranging) {
int strengthLvl = player.getSkills().getLevel(Skills.STRENGTH);
double xpStyle = CombatDefinitions
.getXpStyle(weaponId, attackStyle);
double... | 8 |
NewsSearchResponse(JSONObject jsonObject) {
super(jsonObject);
if (this.Count > 0) {
JSONArray results = (JSONArray) jsonObject.get("results");
@SuppressWarnings("unchecked") Iterator<JSONObject> iterator = results.iterator();
while (iterator.hasNext()) {
Results.add(new NewsResult(iterator.next()))... | 2 |
public static int getMF(String name) {
String s = (String) getCache(60 * 60 * 24 * 365).get("namelist");
if (s == null) {
WakeBackends wb = new WakeBackends();
wb.memSet();
s = (String) WikiUtil.getCache(60 * 60 * 24 * 365).get("namelist");
}
Pattern p_name = Pattern.compile("^.*?" + name.split("[ __]"... | 2 |
@Override
public void setAccounts(Accounts accounts) {
this.accounts = accounts;
boolean active = accounts != null;
if (accountTypes != null) {
for (AccountType type : accountTypes.getBusinessObjects()) {
JCheckBox checkBox = boxes.get(type);
check... | 3 |
private void writeDescriptor()
{
OutputStream resourceOut = null;
XMLStreamWriter xml = null;
String resourceName = PERSISTENCE_FILE;
try
{
final FileObject resource = filer.createResource(
StandardLocation.CLASS_OUTPUT, "", PERSISTENCE_FILE);
resourceName = resource.getName();
resourceOut = re... | 7 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficien... | 9 |
@Override
public boolean execute(CommandSender sender, String[] args)
{
if(sender instanceof ConsoleCommandSender == false)
{
return true;
}
if(args.length != 3)
{
// Ignore, its the console anyway
//sender.sendMessage(RED+"Incorrect sy... | 4 |
private void popTurtleStack() {
try {
Turtle lt = (Turtle) turtleStack.pop();
lt.updateBounds(currentTurtle);
currentTurtle = lt;
g.setColor(currentTurtle.getColor());
g.setStroke(currentTurtle.getStroke());
} catch (EmptyStackException e) {
// We just ignore it.
}
} | 1 |
void t2dGenes(VcfEntry ve) {
if ((ve.getId() == null) || ve.getId().isEmpty()) ve.addInfo(T2D_GENES);
} | 2 |
public List<File> buildFont( String internalName, FileGarbage garbage ) throws IOException {
File tempDir = File.createTempFile( "fonts", ".tmp" );
tempDir.delete();
tempDir.mkdirs();
garbage.addFile( tempDir, true );
File binDir = new File( "bin" );
File binFile = ... | 7 |
public static boolean checkMathAssign(Type p1, Type p2) {
if (p1 == null || p2 == null) {
return false;
}
return p1 == Type.Fixed && p2 == Type.Integer || p1 == Type.Fixed && p2 == Type.Fixed || p1 == Type.Integer && p2 == Type.Integer;
} | 7 |
public static HTTPResponse notFound()
{
return new HTTPResponse(404, "<h1>Not Found</h1>The requested URL was not found.");
} | 0 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Edge))
return false;
Edge other = (Edge) obj;
if (u == null) {
if (other.u != null)
return false;
} else if (!u.equals(other.u))
return false;
i... | 9 |
/* */ public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
/* */ {
/* 14 */ if (((sender instanceof Player)) && ((sender.hasPermission("ghost.noclip:")) || (sender.getName().equalsIgnoreCase("gateklaas"))))
/* */ {
/* 16 */ PlayerListener.toggleGhostMode((P... | 4 |
public void magnify(){
if(magnifyingLevel == 0.25){
setMagnifyingLevel(0.5);
}else if(magnifyingLevel == 0.5){
setMagnifyingLevel(1);
}else if(magnifyingLevel == 1){
setMagnifyingLevel(1.5);
}else if(magnifyingLevel == 1.5){
setMagnifyingLevel(2.5);
}
} | 4 |
public Integer getContestId() {
return this.contestId;
} | 0 |
private String getTagAsString(XMLTag tag) {
String tagStr = "";
if (tag instanceof PITag) {
PITag instruction = (PITag) tag;
if (instruction.getName().equals("easyxml")) {
tagStr += parseEasyXML(instruction.getValue());
}
} else {
... | 6 |
public void fall() {
if(this.getWorld() != null) {
while(canFall() && this.getWorld().liesWithinBoundaries(this)) {
this.setPosition(new Position(this.getPosition().getX(), this.getPosition().getY() - this.getRadius()*0.1)); // fall with a little bit
}
}
} | 3 |
private void editQuantity(Product product) {
String msg;
if (product instanceof WeighableProduct) {
msg = "Enter how many grams of " + product.getProductName()
+ " you want to remove";
} else {
msg = "Enter how many " + product.getProductName()
+ "s you want to remove";
}
String answer;
boo... | 4 |
final public Iterator<PropertyTree> getChildren() {
if(children==null)
return null;
return children.iterator();
} | 1 |
@Override
public float getWidth(char code, String name) {
// we don't have first and last chars, so therefore no width array
if (getFirstChar() == -1 || getLastChar() == -1) {
String key = chr2name[code & 0xff];
// use a name if one is provided
if (name != null) ... | 7 |
public void test_printParseShortNameWithLookup() {
Map<String, DateTimeZone> lookup = new LinkedHashMap<String, DateTimeZone>();
lookup.put("GMT", LONDON);
lookup.put("BST", LONDON);
DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder()
.appendPattern("yyyy-MM-dd HH:m... | 1 |
protected boolean isCallableMethod(Method m, Class<?> runClass) {
if (!runClass.equals(m.getDeclaringClass()))
return false;
if (!Modifier.isPublic(m.getModifiers()))
return false;
if (m.getParameterTypes().length != 0)
return false;
if (Modifier.isNative(m.getModifiers()))
return false;
if (Modif... | 7 |
public int Winner() {
Set<Integer> remainingPlayers = new TreeSet<Integer>();
for (Planet p : planets) {
remainingPlayers.add(p.Owner());
}
switch (remainingPlayers.size()) {
case 0:
return 0;
case 1:
return ((Integer) remainingPlayers.toArray()[0]).intValue();
default:
return -1;
}
} | 3 |
public String displayInfo() {
super.displayInfo();
//The getFood method is an example of encapsulation
return "Bears oh My!Bears are "+look+" fury and\neat a lot. Bears live in the "+location+" and\neats "+getFood();
} | 0 |
public User getUserByFacebookID(EntityManager em, long facebookID) {
User returnUser = null;
try {
TypedQuery<User> query = em.createQuery(
"from User u where u.facebookID = ?", User.class);
query.setParameter(1, facebookID);
List<User> result = query.getResultList();
if (result.isEmpty()) {
r... | 3 |
public Texture(String fileName)
{
this.m_fileName = fileName;
TextureResource oldResource = s_loadedTextures.get(fileName);
if(oldResource != null)
{
m_resource = oldResource;
m_resource.AddReference();
}
else
{
m_resource = LoadTexture(fileName);
s_loadedTextures.put(fileName, m_resource);
... | 1 |
public static void main(String[] args)
{
Item ourCounter = new Item("Team Counter", 150);
try
{
Vector<Thing> things = new Vector<Thing>();
for (int i = 1; i < 5; i++)
{
Thing t = new Thing();
t.setCode(String.valueOf(i));
t.setDescription("Description of " + i);
t.setValue(new BigDeci... | 7 |
public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
... | 4 |
public String getDataVisita(String abrev)
{
String aux="";
String SQL1 = "SELECT * FROM tuta_visitestutors WHERE abrev='"+abrev+"'";
try {
Statement st = client.getMysql().createStatement();
ResultSet rs1 = client.getMysql().getResultSet(SQL1);
w... | 9 |
private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
... | 8 |
public void putAll( Map<? extends Character, ? extends Float> map ) {
Iterator<? extends Entry<? extends Character,? extends Float>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Character,? extends Float> e = it.next();
this.p... | 8 |
@Override
public int hashCode() {
int result = item != null ? item.hashCode() : 0;
result = 31 * result + (item2 != null ? item2.hashCode() : 0);
result = 31 * result + (item3 != null ? item3.hashCode() : 0);
result = 31 * result + (item4 != null ? item4.hashCode() : 0);
retu... | 4 |
public PersonListItem(Person person) {
this.person = person;
givenName = person.getGivenName();
int bYear = person.getBirthYear();
int dYear = person.getDeathYear();
asString = givenName + " (" + ((bYear == 0) ? "?" : ""+bYear) + " - " +
((dYear == 0) ? "?" : ""+dYear) + ")";
} | 2 |
public DemoLayout(int num) {
num = num < 1 ? 1 : num;
setTitle("DemoLayout application");
setSize(640, 480);
setLocation(100, 50);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
cp = getContentPane();
CardLayout cpl = new CardLayout();
cpl.setHgap(10);
... | 6 |
@EventHandler (priority = EventPriority.NORMAL)
public void getInBed(final PlayerBedEnterEvent evt) {
// super accurate nanotime ?!
Long time = System.nanoTime();
String name = evt.getPlayer().getName();
if (Bukkit.getServer().getOnlinePlayers().length < 2) return;
if (slept.containsKey(name)) {
//check... | 5 |
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.