text stringlengths 14 410k | label int32 0 9 |
|---|---|
private int getMakeNextId() {
String text = ctx.widgets.component(WIDGET_INSTRUCTION, WIDGET_INSTRUCTION_CHILD).text();
if (text.equals("Helm")) {
return 20572 + options.ingotType.ordinal() - 1 + (20 * options.ingotGrade.ordinal());
} else if (text.equals("Boots")) {
return 20577 + options.ingotType.ordinal... | 4 |
public boolean getBoolean(int index) throws JSONException {
Object o = get(index);
if (o.equals(Boolean.FALSE) ||
(o instanceof String &&
((String)o).equalsIgnoreCase("false"))) {
return false;
} else if (o.equals(Boolean.TRUE) ||
(o in... | 6 |
protected static String processShortQuote(String text) {
StringBuilder output = new StringBuilder(400);
QuoteOrigin Origin = Processors.getOrigin(text);
text = RegEx.removeAll(text, SHORT_QUOTE_PATTERN);
String[] arr;
arr = text.split("\\|");
switch (Origin) {
... | 9 |
public Object nextEntity(char ampersand) throws JSONException {
StringBuffer sb = new StringBuffer();
for (;;) {
char c = next();
if (Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if (c == ';') {
... | 5 |
public void switchBlockColor(int type) {
if(this.type != -1){
this.type = -1;
} else{
this.type = type;
}
} | 1 |
public static Double[][] removeZeroCoefs(Double[][] a){
List<Double> coefs = new ArrayList<Double>();
List<Double> powers = new ArrayList<Double>();
for(int i = 0; i<a[0].length; i++){
if( a[0][i]!=null){
coefs.add(a[0][i]);
powers.add(a[1][i]==null?0... | 8 |
@Override
public boolean supportsDocumentAttributes() {return true;} | 0 |
public void renderButton(Graphics g, Rectangle r, String s)
{
if(r.contains(Main.mse))
{
g.drawImage(MenuRenderer.Button2, r.x, r.y, r.width, r.height, null);
}
else
{
g.drawImage(MenuRenderer.Button1, r.x, r.y, r.width, r.height, null);
}
g.setFont(new Font(Font.SANS_SERIF, 0, r.height/2));
g.dr... | 1 |
private void genIfZeroStmt(final IfZeroStmt stmt) {
int opcode;
stmt.expr().visit(this);
genPostponed(stmt);
final int cmp = stmt.comparison();
if (stmt.expr().type().isReference()) {
switch (cmp) {
case IfStmt.EQ:
opcode = Opcode.opcx_ifnull;
break;
case IfStmt.NE:
opcode = Opcode.op... | 9 |
public Type getComponent() {
if (this.clazz == null || !this.clazz.isArray())
return null;
CtClass component;
try {
component = this.clazz.getComponentType();
} catch (NotFoundException e) {
throw new RuntimeException(e);
}
Type type ... | 4 |
public void attack(int attDir, int damage){
Rect weaponCollision = null;
if(attDir == 0) weaponCollision = new Rect(x + 13, y - 16, 7, 16);
if(attDir == 1) weaponCollision = new Rect(x + 29, y + 18, 22, 7);
if(attDir == 2) weaponCollision = new Rect(x + 13, y + 32, 7, 24);
if(attDir == 3) weaponCollision =... | 5 |
public int interseca( GrupCaselles grupB )
{
int contador = 0;
ArrayList<Casella> CasellesB = grupB.getGrup();
for ( int i = 0; i < grup.size(); i++ )
{
if ( tauler.getEstatCasella( grup.get( i ) ) == EstatCasella.BUIDA )
{
for ( int j = 0; j < CasellesB.size(); j++ )
{
if ( grup.get( i ).eq... | 4 |
public static void merge(int[] array,int start,int mid,int end){
int[] left = new int[mid-start+1]; //need to add 1 ex: index is form 0 to 3 there are 4 elements;
int[] right = new int[end - mid];
for(int i=0; i<left.length;i++){
left[i] = array[start+i];
}
for(int i=0; i<right.length;i++){
right[i] ... | 6 |
@SuppressWarnings("unchecked")
public QuizServer decodeData() throws RemoteException {
QuizServer serverState = null;
XMLDecoder decode = null;
if (!getSerializationFile().exists() || getSerializationFile().length() == 0) {
return new QuizServer();
}
try {
... | 4 |
@Override
public void tick(int time) {
boolean inputChanged = false;
for (int i = 0; i < input.length; i++) {
if (events[i].isEmpty()) break;
while(events[i].peek().time < time) events[i].poll();
Event e = events[i].peek();
if (e.time == time) {
... | 9 |
private void getParameters(String inputFileName){
new GetComments();
//first the number of rows and columns is retrieved
String rowsN=TextIO.getWord();
//if(!rowsN.equals("Rows:")){
//throw new RuntimeException("The file format is not correct. Rows: keyword is absent");
//}
//System.out.pr... | 4 |
double[][] compf(double[][] D, int m) {
int s = D.length, r = 0;
if (s == 0) {
return null;
} else {
r = D[0].length;
}
double F[][] = new double[s][];
for (int i = 0; i < s; i++) {
F[i] = compob(D[i]);
}
return F;
} | 2 |
private void drawTooltip()
{
if(menuActionRow < 2 && itemSelected == 0 && spellSelected == 0)
return;
String s;
if(itemSelected == 1 && menuActionRow < 2)
s = "Use " + selectedItemName + " with...";
else
if(spellSelected == 1 && menuActionRow < 2)
s = spellTooltip + "...";
else
s = menuActionNa... | 8 |
public void generateMaps() throws MaltChainedException {
for (String groupname : optionGroups.keySet()) {
OptionGroup og = optionGroups.get(groupname);
Collection<Option> options = og.getOptionList();
for (Option option : options) {
if (ambiguous.contains(option.ge... | 7 |
private void initNameListFontMenu(Color bg) {
this.nametextListPanel = new JPanel();
this.nametextListPanel.setBackground(bg);
this.nametextListPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
String initFontTmp = this.skin.getNametextFont();
int initFontSizeTmp = th... | 7 |
@Override public void finishPopulate()
{
} | 0 |
public static String getServidor() {
return servidor;
} | 0 |
public void add(String name, Object prototype) {
prototypes.put(name, prototype);
} | 0 |
private MapperEstimatedJvmCost estimateBasedOnRules(JvmModel fMapPhaseMax, float fix, float eTempObj, boolean splitChanged) {
// estimate the Perm Generation
float ePermUsed = fMapPhaseMax.getPermUsed();
float ismb = newConf.getIo_sort_mb();
float eOU;
float eNGU;
float eHeapU = 0;
String reason;... | 9 |
@Override
public void action() {
TreeMap<Integer, Integer> answer = notWantedColor(100, couleurNonVoulue);
String data = CentralIntelligenceAgency.treeToString(answer);
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.setContent(data);
msg.addReceiver( new AID( arbitre, AID.ISLOCALNAME) );
... | 6 |
public static void main(String[] args){
int a = 0;
int b = 0;
int c = 0;
// range, die durchlaufen wird
int range = 10;
// durch die verschachtelte Schleifen werden alle
// Wertkombination in range
// durchlaufen und jeweils das maximum errechnet
while(a < range){
while(b < range){
while(... | 6 |
public static List<Offrir> selectOneByRapNum(EntityManager em, int rap_num) throws PersistenceException {
List<Offrir> desOffrirs=null;
Query query = em.createQuery("select v from Offrir v where v.rap_num = :rap_num ");
query.setParameter("rap_num", rap_num);
desOffrirs=query.getResultLi... | 0 |
public void setDataEvasione(Date dataEvasione) {
this.dataEvasione = dataEvasione;
} | 0 |
public void setFunUsuario(String funUsuario) {
this.funUsuario = funUsuario;
} | 0 |
protected void genArmorCode(MOB mob, CharClass E, int showNumber, int showFlag, String FieldDisp, String Field)
throws IOException
{
if((showFlag>0)&&(showFlag!=showNumber))
return;
mob.tell(showNumber+". "+FieldDisp+": '"+CharClass.ARMOR_LONGDESC[CMath.s_int(E.getStat(Field))]+"'.");
if((showFlag!=showNumb... | 7 |
private boolean buildFriendsListMenu(Interface component) {
int i = component.contentType;
if (i >= 1 && i <= 200 || i >= 701 && i <= 900) {
if (i >= 801) {
i -= 701;
} else if (i >= 701) {
i -= 601;
} else if (i >= 101) {
... | 9 |
public String toString() {
MyStack<E> temp = new ArrayStack<E>();
StringBuffer sb = new StringBuffer();
sb.append("front [ ");
/*print elements of out */
while(!out.isEmpty()){
sb.append(out.peek() + " ");
temp.push(out.pop());
}
sb.append("| ");
while(!temp.isEmpty()){
out.push(temp.... | 4 |
private void sendSharesToOthers(ShamirShare shamir) throws IOException {
try {
otherServerIP = getOtherServerIP();
} catch (UnknownHostException e) {
System.out.println("Cannot get other server's IP.");
e.printStackTrace();
}
ArrayList<SendingThread> sendingThreads = new ArrayList<SendingThread>();
... | 5 |
public static void main(String[] args) {
// print all permutations method 1
generatePermutations(new int[3], 2);
// print all permutations method 2
int[] p = {0, 1, 2, 4};
int cnt = 0;
do {
System.out.println(Arrays.toString(p));
if (!Arrays.equal... | 3 |
public Map<String, String> check() throws IOException {
IDGrabber grabber = new IDGrabber(link);
grabber.grab();
Map<String, String> updates = grabber.writeToFile();
if (updates.isEmpty()) {
System.out.println("Scanning......");
} else {
System.out.print... | 1 |
@Test
public void testMonsterDiff(){
charTest.setPlayerLvl(2);
testMons.genMonster(charTest.getPlayerLvl());
if (testMons.getName().equalsIgnoreCase("Valefor")){
assertEquals(350, testMons.getHealth());
assertEquals(20, testMons.getDamage());
}
else if... | 4 |
private void lookForVariableAccess(OptFunctionNode fn, Node n)
{
switch (n.getType()) {
case Token.DEC :
case Token.INC :
{
Node child = n.getFirstChild();
if (child.getType() == Token.GETVAR) {
int varIn... | 8 |
private void stressDistribution(Node from, Node to, Dijkstra dijkstra)
{
for(Node n : graph.getNodes())
{
if( n.getId() == from.getId() || n.getId() == to.getId())
continue;
ArrayList<Integer> al = dijkstra.getPathTo(to);
if(al.contains(n.getId()))
{
Integer count = stressDistribution.get(... | 5 |
@Override
public void run() {
Loader loader = new Loader();
try {
loader.setUrl(url);
loader.load();
System.out.println(i);
} catch (Exception e) {
e.printStackTrace();
}
} | 1 |
public boolean equals(HPDAddressModel address) {
if (address == null) {
return false;
}
return StringUtils.equalsIgnoreCase(this.getAddressTypeId(), address.getAddressTypeId())
&& StringUtils.equalsIgnoreCase(this.getAddressLine1(), address.getAddressLine1())
... | 9 |
public void testIsAfter_TOD() {
TimeOfDay test1 = new TimeOfDay(10, 20, 30, 40);
TimeOfDay test1a = new TimeOfDay(10, 20, 30, 40);
assertEquals(false, test1.isAfter(test1a));
assertEquals(false, test1a.isAfter(test1));
assertEquals(false, test1.isAfter(test1));
assertEqua... | 1 |
private void exit() {
switch (Server.getStatus()) {
case Server.PLAYERS_CONNECTED:
if (JOptionPane.showConfirmDialog(Main.this,
"The server is running and the game is in progress.\n"
+ "Do you want to exit anyway?", Main.TITLE_SHORT,
... | 4 |
private void updateMouse() {
double mouseXBefore = getMouseX();
double mouseYBefore = getMouseY();
glfwGetCursorPos(inputSource, mouseX, mouseY);
if (hasBeenUpdated) {
mouseDeltaX = getMouseX() - mouseXBefore;
mouseDeltaY = getMouseY() - mouseYBefore;
}
hasBeenUpdated = true;
} | 1 |
@Override
public String getColumnName(int column) {
String reply = "";
switch (column) {
case 0:
reply = "ID";
break;
case 1:
reply = "Name";
break;
case 2:
reply = "Demand";
break;
case 3:
reply = "Supply";
break;
case 4:
reply = "Max. Buy Price/Unit";
bre... | 8 |
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
boolean done = false;
StringBuilder buffer = null;
DataForm dataForm = new DataForm(parser.getAttributeValue("", "type"));
while (!done) {
int eventType = parser.next();
if (eventType =... | 9 |
void showColorForPixel(int x, int y) {
if (x >= 0 && x < imageData.width && y >= 0 && y < imageData.height) {
int pixel = imageData.getPixel(x, y);
RGB rgb = imageData.palette.getRGB(pixel);
boolean hasAlpha = false;
int alphaValue = 0;
if (imageData.alphaData != null && imageData.alphaData.length > 0)... | 8 |
public static ArrayList<Achievement> updateAchievement(User user) {
ArrayList<Achievement> records = AchievementRecord.getAchievementsByUserID(user.userID, QUIZ_CREATED_TYPE);
ArrayList<Achievement> newAchievements = new ArrayList<Achievement>();
int totalCreatedQuiz = QuizCreatedRecord.getCreatedQuizByUserID(use... | 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 |
@Override
public void triggered( CapabilityName<?>... allowHandlersFor ) {
if( triggeredSite == null ){
triggeredSite = this;
for(CapabilityName<?> allowHandlerFor : allowHandlersFor ){
handlersAllowed.add( allowHandlerFor );
}
updateAllEnabled();
}
} | 4 |
protected boolean isSplitable(JobContext context, Path file)
{
CompressionCodec codec = new CompressionCodecFactory(context.getConfiguration()).getCodec(file);
if (null == codec) {
return true;
}
return codec instanceof SplittableCompressionCodec;
} | 1 |
protected void done() {
double max = Double.NaN;
try {
max = Double.parseDouble( maxXField.getText());
}
catch (NumberFormatException nfe) {
}
double min = Double.NaN;
try {
min = Double.parseDouble( minXField.getText());
}
catch (NumberFormatException nfe) {
}
double tickSpaci... | 7 |
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
... | 4 |
public void autoFit()
{
// KSC: make more betta :)
double w = 0;
CellHandle[] cxt = getCells();
for( CellHandle aCxt : cxt )
{
String s = aCxt.getFormattedStringVal(); //StringVal();
FormatHandle fh = aCxt.getFormatHandle();
Font ef = fh.getFont();
int style = java.awt.Font.PLAIN;
if( ef.ge... | 5 |
public void addDiffFeature(){
HashMap<String, Double> difference = new HashMap<String, Double>();
for(Business b: businesses){
double truescore = b.stars;
//difference.put(b.id, b.stars);
for(Review r:reviews){
if(r.b_id.equals(b.id)){
difference.put(b.id, r.stars-truescore);
... | 4 |
@Override
public int hashCode() {
int result = sessionId != null ? sessionId.hashCode() : 0;
result = 31 * result + (ipAddress != null ? ipAddress.hashCode() : 0);
result = 31 * result + (userAgent != null ? userAgent.hashCode() : 0);
result = 31 * result + lastActivity;
resu... | 4 |
public static boolean isMurder(int s) {
if(s==32961)
return true;
return false;
} | 1 |
private void add() {
Integer option;
String s;
UI.printHeader();
System.out.println("Selecciona un agente a continuación:");
System.out.println("1) Snmp");
System.out.println("");
System.out.println("0) Atrás");
System.out.println("");
System.out.print("Introduce una opción: ");
try {
BufferedR... | 4 |
public static void ZipPutLongIntoBuf(ByteBuffer _buff, long _num)
{
if(_num > Byte.MIN_VALUE && _num < Byte.MAX_VALUE)
{
//put the length
_buff.put((byte)1);
//put the value
_buff.put((byte)_num);
return ;
}
else if(_num > S... | 6 |
public Map.Entry<Long, E> getClosestEqual(Long timestamp) {
Map.Entry<Long, E> lower = getFrameEqualLower(timestamp);
Map.Entry<Long, E> higher = getFrameEqualHigher(timestamp);
if(lower == null && higher == null) {
return null;
} else if(lower == null) {
return higher;
} else if(higher == null) {
... | 5 |
@Override
public Iterable<? extends Position<T>> children(Position<T> pos) {
return castPositionToNode(pos).getDirectChilren();
} | 1 |
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 addSearchedSites(String url){
/*
List<SqlParameter> sqlParamList = new LinkedList<SqlParameter>();
sqlParamList.add(new SqlParameter(Types.VARCHAR, url));
sqlParamList.add(new SqlParameter(Types.TIMESTAMP, new java.sql.Timestamp(new Date().getTime())));
final StringBuilder sql = new StringBuilder(... | 0 |
@Override
public void run() {
String [] hosts = execHosts.split(",");
int numHosts = hosts.length;
int currentHost = 0;
sgeExecHostsExampleScrollPane.setVisible(false);
validatingHostsLabel.setVisible(true);
sif.setNextEnabled(false);
sif.setBack... | 6 |
@Override
public List<ExpertiseDefinition> myListableExpertises(MOB mob)
{
ExpertiseDefinition D=null;
final List<ExpertiseDefinition> V=new Vector<ExpertiseDefinition>();
for(final Enumeration<ExpertiseDefinition> e=definitions();e.hasMoreElements();)
{
D=e.nextElement();
if((D.compiledListMask()==null... | 8 |
private void substitute() {
ArrayList< Substitution> textAcc = new ArrayList<>();
text.add(new Substitution(original, original));
for (SubstitutionRule rule : rules) {
for (Substitution s : text) {
// there should be no substitutions in text already with subc... | 6 |
public boolean login(String user, String pass) {
if (!player.isRegistered()) {
response = "login.error.registered";
return false;
} else if (player.isAuthenticated()) {
response = "login.error.authenticated";
return false;
} else if (!plugin.getPwdHndlr().checkPassword(player.getAccountId(), pass)) {
... | 5 |
protected synchronized GeneralPath getOutlineFromCMaps (char val,
float width) {
// find the cmaps
CmapTable cmap = (CmapTable) font.getTable ("cmap");
if (cmap == null) {
return null;
}
// try maps in requ... | 3 |
@Override public Iterator<Feature> iterator()
{
return features.iterator();
} | 0 |
private final synchronized Properties loadPropertyFile(final String file) {
// TODO optimize exception handling
File propertyFile = new File(file);
if(!propertyFile.exists()) {
URL fileURL = this.getClass().getResource(file);
if(fileURL != null) {
propertyFile = loadFileFromURL(fileURL);
}
}
... | 6 |
public void infoDisplay(final LocalExpr expr) {
final UseInformation UI = (UseInformation) useInfoMap.get(expr);
final DefInformation DI = (DefInformation) defInfoMap.get(expr);
System.err.println(expr.toString());
System.err.println(expr.parent().toString() + "-"
+ expr.parent().parent().toString());
i... | 7 |
public void run() {
_debug.fine(
"UpdateRunnable wird gestartet für " + _responseAspect + " " + _responseAtg
+ " Nachrichtentyp: DynamischeMengeAktualisierung/ObjektAktualisierung"
);
while(true) {
try {
Data data = _unboundedQueue.take();
if(data == null) {
_debug.fine("UpdateRun... | 8 |
private boolean getsToLive(Cell cell) {
int x = cell.getX();
int y = cell.getY();
int liveNeighbours = 0;
liveNeighbours += isAlive(x - 1, y - 1);
liveNeighbours += isAlive(x - 1, y);
liveNeighbours += isAlive(x - 1, y + 1);
liveNeighbours += isAlive(x, y - 1);
... | 9 |
private boolean initKeyExchange() {
if (type == CLIENT) {
try {
// get p
p = readBytes();
// ack p
sendBytes(p);
// get g
g = readBytes();
// ack g
sendBytes(g);
// calc A
crypto = new UMSM_Main_Crypto(p);
BigInteger A = crypto.calcA(g);
... | 8 |
public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb = new StringBuffer();
for (String ln; !(ln = in.readLine().trim()).equals("0");) {
StringTokenizer st = new StringTokenizer(ln);
TreeSet<Integer> arbol = new Tre... | 8 |
@Override
public void execute(VGDLSprite sprite1, VGDLSprite sprite2, Game game)
{
// Stop just in front of the wall, removing that velocity component, but possibly sliding along it.
//Keep in the list, for the current cycle, the sprites that have triggered this event.
int currentGameTi... | 3 |
@Override
public boolean removeAll(Collection<?> c) {
// TODO Auto-generated method stub
return false;
} | 1 |
public void delete(int data){
//to delete first node
if(head.getData() == data){
head = head.getNext();
}
else{
Node ptr = head.getNext();
Node preptr = head;
while(ptr.getNext() != null){
if(ptr.ge... | 7 |
@Override
protected void bindToModelModifications() {
dicSystemModel.addPropertyChangeListener(
dicSystemModel.getPropertyName(), new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (!lock)
paramsDicos.loadDicos((TagAndURISubModel[]) evt
... | 5 |
public void init(int startHappinessLevel)
{
currentHappinessLevel = startHappinessLevel;
yPos = -32 + GamePanel.HEIGHT/2;
xPos = GamePanel.WIDTH/4;
yVel = 0;
try
{
heartset = ImageIO.read(getClass().getResourceAsStream("/Heart/HeartSheet.png"));
for (int i = 0; i < numberHeartFrames; i++)
{
... | 3 |
public void removeServerFromLinkedList(Server server) {
logMessage(LOGLEVEL_DEBUG, "Removing server from linked list.");
if (servers == null || servers.isEmpty())
return;
ListIterator<Server> it = servers.listIterator();
while (it.hasNext()) {
// Check if they refer to the exact same object via reference,... | 4 |
private JToolBar createUpperToolBar() {
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
final JButton start = new JButton("Inizio");
start.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
started = !started;
if (started) {
... | 9 |
private boolean isIndirectlyPowered(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
return var5 == 5 && par1World.isBlockIndirectlyProvidingPowerTo(par2, par3 - 1, par4, 0) ? true : (var5 == 3 && par1World.isBlockIndirectlyProvidingPowerTo(pa... | 9 |
private boolean workAll(boolean undo) {
boolean result = true;
for (String taskId : taskIds) {
result = result && workOne(taskId, undo);
}
return result;
} | 2 |
public Map(){
if (Empous.Gov.getStat("census")<=50000)
mapimg = Empous.LoadImage("/main/resources/images/map1.png");
else if (Empous.Gov.getStat("census")<=1000000)
mapimg = Empous.LoadImage("/main/resources/images/map2.png");
else if (Empous.Gov.getStat("census")<=300000000)
mapimg = Empous.LoadImage("/... | 5 |
@Override
public void move(Excel start, Excel finish) {
for(int i=0;i<allex.size();i++)
{
if (start.getX() == allex.get(i).getX() && start.getY() == allex.get(i).getY())
{
allex.remove(i);
allex.add(i, finish);
setColoredExes();
break;
}
}
for(Excel ex: coloredEx)
{
if (ex.equ... | 5 |
public synchronized void shutdown(){
if(!shutdown)
shutdown = true;
//Poll the queue and release all objects left in the queue.
while(true){
Reference<?> ref = queue.poll();
if(ref != null){
Resource res = refs.get(ref);//Get the resource by the reference.
refs.remove(ref);//Remove the object ... | 4 |
public void testGet_DateTimeFieldType() {
LocalTime test = new LocalTime(10, 20, 30, 40);
assertEquals(10, test.get(DateTimeFieldType.hourOfDay()));
assertEquals(20, test.get(DateTimeFieldType.minuteOfHour()));
assertEquals(30, test.get(DateTimeFieldType.secondOfMinute()));
asser... | 2 |
public ParseNode getParseNode()
{
if (null == parseNode)
{
Item lParentItem = getParent();
ParseNode lParentParseNode = null;
if (null == lParentItem)
{
lParentParseNode = Processor.get().getPTree().getDocRoot();
}
... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Option other = (Option) obj;
if (optionNr != other.optionNr)
return false;
if (value == null) {
if (other.value != null)
return false... | 7 |
private Point chooseRandomLocation() {
Point randomLocation;
ArrayList<Point> listOfEmptyLocations = new ArrayList<>();
Player[][] locations = this.board.getBoardLocations();
for (int row = 0; row < locations.length; row++) {
Player[] rowLocations = locations[row];... | 5 |
public int[] searchRange(int[] A, int target) {
int l = A == null ? 0 : A.length;
int[] bound = new int[2];
//search left half
int start = 0, end = l - 1;
while (start + 1 < end) {
int mid = start + (end - start) / 2;
if (A[mid] < target) {
... | 9 |
public void enqueue(Object value, int priority) {
QueueElement current = new QueueElement(value, priority);
if (count == 0) {
head = current;
} else {
tail.connectNext(current);
}
tail = current;
count++;
} | 1 |
public void die() {
Item[] equipItems = player.getEquipment().getItems().getItems();
for (int slot = 0; slot < equipItems.length; slot++) {
if (equipItems[slot] != null && degradeCompletly(equipItems[slot]))
player.getEquipment().getItems().set(slot, null);
}
Item[] invItems = player.getInventory().getIt... | 6 |
public void init(final boolean flag) {
int i;
int a, b, c, d, e, f, g, h;
a = b = c = d = e = f = g = h = RATIO;
for (i = 0; i < 4; ++i) {
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
... | 5 |
public Boolean getSex() {
return this.sex;
} | 0 |
@Override
public void receive(Object obj) {
Helper.log("GSCONNECTIONTOCLIENT: RECEIVING");
Event event = (Event) obj;
Helper.log("RECEIVED EVENT:\n" + event);
event.player = player;
switch(event.type) {
case "key event":
Helper.log("GSCONNECTION: RECEIEVED KEY EVENT");
gameServer.engine.eventQ.add... | 7 |
public void show(T[] a, int[] perm) { // Print the array, on a
// single line.
for (int i = 0; i < a.length; i++)
System.out.print(a[perm[i]] + " ");
System.out.println();
} | 1 |
public boolean readVersion(InStream is) {
done = false;
if (verStrPos >= 12) return false;
verStr = new StringBuilder(13);
while (is.checkNoWait(1) && verStrPos < 12) {
verStr.insert(verStrPos++, (char)is.readU8());
}
if (verStrPos < 12) {
done = false;
return true;
}
... | 5 |
String normalizeForResourceLocation(String contextLocation){
boolean hasResource = contextLocation.startsWith("file")
|| contextLocation.startsWith("classpath")
|| contextLocation.startsWith("url");
if (!hasResource){
return String.format("%s:%s", DEFAULT_R... | 3 |
@After
public void tearDown() throws Exception
{
// File datei1 = new File("/var/www/uploads/3.txt");
// File datei2 = new File("/var/www/uploads/4.txt");
// File datei3 = new File("/var/www/uploads/5.txt");
// File datei4 = new File("/var/www/uploads/6.txt");
// File datei5 = new File("/var/www/uploads/7.t... | 0 |
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.