text stringlengths 14 410k | label int32 0 9 |
|---|---|
public SpringAttachable findAttachableElement(double x) {
for (PhysicsElement e: elements)
if (e instanceof SpringAttachable)
if (e.contains(x,0)) return (SpringAttachable)e;
return null;
} | 3 |
public void animation() {
animationt--;
if (animationt >= 45) {
setImage(swordfish1);
}
else if (animationt < 45 && animationt >= 30) {
setImage(swordfish2);
}
else if (animationt < 30 && animationt >= 15) {
setImage(swordfish1);
... | 8 |
public static void main(String[] args) {
first : {
System.out.print("Hello, ");
here : System.out.println("World!");
}
} | 0 |
public static void main(String[] args) {
boolean[] isPrime = EulerMath.getSieve(N);
boolean found = false;
for(int c = 9; c < isPrime.length; c += 2)
if( !isPrime[c] ) {
found = false;
for(int p = 2; !found && p < c; p++) {
if( !isPrime[p] ) continue;
for(int s = 1; !found && p+2*s*s <= c;... | 9 |
static double incompleteBetaFraction1(double a, double b, double x) throws ArithmeticException {
double xk, pk, pkm1, pkm2, qk, qkm1, qkm2;
double k1, k2, k3, k4, k5, k6, k7, k8;
double r, t, ans, thresh;
int n;
k1 = a;
k2 = a + b;
k3 = a;
k4 = a + 1.0;
... | 7 |
public boolean matches(Identifier ident) {
String test = ident.getFullName();
if (firstStar == -1) {
if (wildcard.equals(test)) {
return true;
}
return false;
}
if (!test.startsWith(wildcard.substring(0, firstStar)))
return false;
test = test.substring(firstStar);
int lastWild = firstStar;
... | 6 |
public void setGrid(Grid grid) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: setGrid() BEGIN");
}
m_grid = grid;
repaint();
if (test || m_test) {
System.out.println("GameBoardGraphics :: setGrid() END");
}
} | 4 |
private void resetLater(final ExprInfo exprInfo, final Phi phi) {
phi.setLater(false);
final Iterator blocks = cfg.nodes().iterator();
while (blocks.hasNext()) {
final Block block = (Block) blocks.next();
final Phi other = exprInfo.exprPhiAtBlock(block);
if (other == null) {
continue;
}
fi... | 5 |
public boolean mousewheel(Coord c, int amount) {
int mod = ui.modflags();
if ((mod & 6) == 6) { //
mod = 7;
}
if (amount < 0)
wdgmsg("xfer", -1, mod);
if (amount > 0)
wdgmsg("xfer", 1, mod);
return (true);
} | 3 |
@Override
public void onPacketReceived(NetworkPacket pPacket) {
switch (pPacket.getHeader()) {
case REGISTER_RESULT_REP:
if (pPacket.getReqResult() == true) {
ScreenManager.getInstance().showLoginLayer();
} else {
final Base... | 8 |
public List<Organism> GAstep_crossover() throws Exception {
// TODO
/* crossover entre les species !!! */
/* crossover */
List<Organism> childList = new ArrayList<Organism>();
for (int i = 0; i < this.getSpeciesNumber(); i++) {
if (species.get(i).getNumberOrganisms()... | 3 |
@PUT()
@Path("trade/{playerId}/newteam/{teamId}")
@Produces("application/json")
@SportService(ServiceType.MLB)
public Player tradePlayer(@PathParam("playerId") int iPlayerId, @PathParam("teamId") int iTeamId)
{
Player p = new Player();
UserTransaction utx ... | 3 |
@Override
public void removeInheritence(String inher) {
do {
inheritence.remove(inher);
} while (inheritence.contains(inher));
} | 1 |
protected void resize( int width, int height ) {
if( width==fWidth && height==fHeight )
return;
fWidth = width;
fHeight= height;
MutableAttributeSet attr = new SimpleAttributeSet();
attr.addAttribute(HTML.Attribute.WIDTH ,Integer.toString(width));
attr.addAttribute(HTML.Attribute.HEIGHT,Integer.toStrin... | 2 |
private void setStateOfComboBox(JComboBox cb, int index) {
Action a = cb.getAction();
ActionListener[] al = cb.getActionListeners();
ItemListener[] il = cb.getItemListeners();
cb.setAction(null);
if (al != null) {
for (ActionListener i : al)
cb.removeActionListener(i);
}
if (il != null) {
for ... | 8 |
public double findMedianSortedArrays(int A[], int B[]) {
// Start typing your Java solution below
// DO NOT write main() function
int m = A.length;
int n = B.length;
if (m == 0 && n == 0) {
return 0;
}
int i = 0;
int j = 0;
int s = (m + n) / 2;
System.out.println(s);
int m1 = -1;
int m2 = -1;... | 7 |
public static boolean isOrdered(List<Partition> partitions) {
List<Long> lengths = new ArrayList<Long>();
for (Partition partition : partitions) {
lengths.add(partition.getLength());
}
// Ignore trailing 0 length blocks.
while (lengths.size() > 0 && lengths.get(lengt... | 5 |
public static int getMinimumLoadableVersionOfTag(Class<?> objClass) {
XmlTagMinimumVersion tagVersion = objClass.getAnnotation(XmlTagMinimumVersion.class);
return tagVersion != null ? tagVersion.value() : 0;
} | 2 |
public String getDescription() {
if(fullDescription == null) {
if(description == null || isExtensionListInDescription()) {
fullDescription = description==null ? "(" : description + " (";
// build the description from the extension list
Enumeration extensions = filters.keys();
if(extensions != null) {
... | 6 |
private static final Object get_impl( final NonBlockingHashMap topmap, final Object[] kvs, final Object key, final int fullhash ) {
final int len = len (kvs); // Count of key/value pairs, reads kvs.length
final CHM chm = chm (kvs); // The CHM, for a volatile read below; reads slot 0 of kvs
final i... | 8 |
public static <E extends Enum<?>> E caseInsensitiveValueOf(E[] enumValues,
String constant) {
for (E candidate : enumValues) {
if (candidate.toString().equalsIgnoreCase(constant)) {
return candidate;
}
}
throw new IllegalArgumentException(String.format(
"constant [%s] does not exist in enum type ... | 3 |
public void init(SmaliMethod method, int linesCount, boolean doMapParams) {
if(isInitialized)
return;
isInitialized = true;
this.linesCount = linesCount;
this.sliceLength = method.getRegisters();
this.timeline = new ArrayList<ArrayList<RegisterInfo>>(linesCount);
for(int i = 0; i < linesCount... | 7 |
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
PC = (PistolCaveGame) game;
//socket connecting to client
Socket s = null;
//connect to client
if(renderWait != 0 && connections.size() < 2){
try {
s = ss.... | 3 |
public String encodeUrl(String value) throws Exception
{
try
{
if (value != null)
{
return URLEncoder.encode(value.trim(), "UTF-8").replaceAll("\\+", "%20");
}
else
{
return null;
}
}
catch (Exception e)
{
throw e;
}
} | 2 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... | 7 |
@SuppressWarnings("unchecked")
public void tabulateTest(Test t) throws IOException{ //Takes a Test given by the user and shows all response results for the Test.
Test tes = t;
ArrayList<ArrayList<Response>> resp = new ArrayList<ArrayList<Response>>();
final File dir = new File("responses");
if (!dir.exists(... | 7 |
public void visitInsn(final int opcode) {
buf.setLength(0);
buf.append(tab2).append(OPCODES[opcode]).append('\n');
text.add(buf.toString());
if (mv != null) {
mv.visitInsn(opcode);
}
} | 1 |
public static void main(String[] args) {
Set set = new Set();
Speler[] spelers = new Speler[5];
for(int i = 0; i < spelers.length; i++){
spelers[i] = new Speler();
}
for(int i = 0; i <Vars.aantalTests; i++){
set.schud();
Kaart[] opTafel = new Kaart[5];
for(int j = 0; j < opTafel.length; j++... | 5 |
public int distSingle(int[] inds, int pos, int ch) {
int size = inds.length;
int[] inds2;
int d = 0, i;
if(ch >= 0) {
inds2 = rp2c[pos][ch];
for(i = 0; i < size; i++)
if(i != pos && (ch=inds[i]) != inds2[i])
d += ch >= 0 ? 2 : 1;
} else {
for(i = 0; i < size; i++)
if(i != pos && (ch=inds... | 9 |
public SimpleVector getDirection() {
return cam.getDirection();
} | 0 |
public boolean equals(Object other) {
if (other == this) return true;
if (other == null) return false;
if (other.getClass() != this.getClass()) return false;
Point2D that = (Point2D) other;
return this.x == that.x && this.y == that.y;
} | 4 |
public final void comment(final char[] ch, final int off, final int len)
throws SAXException
{
try {
closeElement();
writeIdent();
w.write("<!-- ");
w.write(ch, off, len);
w.write(" -->\n");
... | 1 |
@Override
public T poll() {
T result = null;
if (firstItem != null) {
result = (T) firstItem.value;
if (firstItem.getNextItem() != null) {
firstItem = firstItem.getNextItem();
}
}
length--;
return result;
} | 2 |
public static ScriptableObject initStandardObjects(Context cx,
ScriptableObject scope,
boolean sealed)
{
if (scope == null) {
scope = new NativeObject();
}
scope.associat... | 8 |
public boolean kickClient(int cientID, boolean onlyChannelKick, String kickReason)
{
resetLastError();
if (!isConnected())
{
saveLastError("kickClient(): Not connected to TS3 server!");
return false;
}
HashMap<String, String> hmIn;
try
{
String command = "clientkick clid=" + Integer.toStri... | 7 |
@Override
public void actionPerformed(ActionEvent event) {
if (event.getSource() == setBPMButton) {
try {
bpmTextField.commitEdit();
bpmSetEvent();
} catch (ParseException e) {
bpmTextField.setText((String) bpmTextField.getValue());
... | 4 |
public static double asin(double x) {
if (x != x) {
return Double.NaN;
}
if (x > 1.0 || x < -1.0) {
return Double.NaN;
}
if (x == 1.0) {
return Math.PI/2.0;
}
if (x == -1.0) {
return -Math.PI/2.0;
}
if (x == 0.0) { // Matc... | 6 |
private static HashMap<String, Integer> getCollectionFrequency(String dirName, Normalizer normalizer) throws IOException {
// Création de la table des mots
HashMap<String, Integer> hits = new HashMap<String, Integer>();
File dir = new File(dirName);
String wordLC;
if (dir.isDirectory()) {
// Liste des fich... | 4 |
public void startConsole() {
System.out.println("Welcome aboard! Type 'help' for more information");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (true) {
System.out.print("> ");
String line = null;
try {
line... | 2 |
@Override
@RequestMapping(value = "/beers", method = RequestMethod.PUT)
@ResponseBody
@Transactional
public BeerResponse create(@RequestBody BeerRequest beerRequest) {
Beer beer = new Beer();
beer = persistenceService.create(beer);
return update(beer.getId(), beerRequest);
} | 0 |
@Test
public void testSendStatus() throws Exception{
AccessControlServer server = new AccessControlServer(1926);
server.start();
SpotStub security = new SpotStub("Security",1926);
security.start();
String ans = "";
int x = 0;
while(x == 0){
... | 4 |
@Override
public void run() {
while(true) {
//random time sleeping
int timeToSleep = randInt(3, 10);
try {
TimeUnit.SECONDS.sleep(timeToSleep);
} catch (InterruptedException e) {
e.printStackTrace();
}
/... | 2 |
public JMenuBar createMenuBar() {
// Create the menu bar
final JMenuBar menuBar = new JMenuBar();
// Menu for all beans to demo
JMenu componentsMenu = new JMenu("Components");
componentsMenu.setMnemonic('C');
menuBar.add(componentsMenu);
for (int i = 0; i < bea... | 8 |
private void reply (String x)
{
try
{
Soutput.writeObject (x);
Soutput.flush ();
}
catch (Exception e)
{
}
} | 1 |
public synchronized Object getNext() {
Object obj = null;
if (getSize() > 0) {
obj = queue.firstElement();
queue.removeElementAt(0);
}
return obj;
} | 1 |
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Block)) return false;
Block block = (Block) obj;
if ((block.xPos == this.xPos) && (block.yPos == this.yPos) && (block.width == this.width) && (block.height == this.height)) {
return true;
}
return false;
} | 5 |
public String toString() {
StringBuffer result;
int i;
int n;
boolean found;
result = new StringBuffer();
// title
result.append(this.getClass().getName().replaceAll(".*\\.", "") + "\n");
result.append(this.getClass().getName().replaceAll(".*\\.", "").replaceAll(".", "=") ... | 7 |
byte[] buildBrush(byte[] brush, CPBrushInfo brushInfo) {
int intSize = (int) (brushInfo.curSize + .99f);
float center = intSize / 2.f;
float sqrRadius = (brushInfo.curSize / 2) * (brushInfo.curSize / 2);
float xFactor = 1f + brushInfo.curSqueeze * MAX_SQUEEZE;
float cosA = (float) Math.cos(brushInfo.curAngl... | 3 |
public void toXML( TreeNode treeRoot, Element node ) {
if ( treeRoot.ChildNodes == null ) {
return ;
}
for ( String SituName:treeRoot.ChildNodes.keySet() ) {
Element nextNode = node.addElement(treeRoot.AttributeName);
TreeNode childNode = treeRoot.ChildNodes.get(SituName);
nextNode.addAttribute("v... | 3 |
public Dimension resize(final Dimension newSize, final boolean isLoading) {
if (ancestor == null)
return newSize;
float[] objectBounds = getModel().getBoundsOfObjects();
if (objectBounds != null) {
float xmin = objectBounds[0];
float ymin = objectBounds[1];
float xmax = objectBounds[2];
float ymax ... | 7 |
@Scheduled(fixedRate = 60000)
public void scheduledPoll() {
Optional<Status> status = Optional.absent();
if (url != null) {
status = statusPoller.poll(url);
}
if (!status.isPresent()) {
System.out.println(String.format("not status found at url %s", url));
... | 5 |
public static Object setValue(String key,Object obj, Object newValue) {
String error = "";
if ( obj instanceof Map ) {
((Map)obj).put(key,newValue);
return newValue;
}
try {
BeanInfo binfo = Introspector.getBeanInfo(obj.getClass(), Object.class);
... | 6 |
public static int binarySearchUnknownLength(List<Integer> A, int k) {
// Find the possible range where k exists.
int p = 0;
while (true) {
try {
int val = A.get((1 << p) - 1);
if (val == k) {
return (1 << p) - 1;
} e... | 8 |
public void refresh()
{
myCases = myLemma.getDoneDescriptions();
/*
* Let the table know that data has changed.
*/
((AbstractTableModel)myTable.getModel()).fireTableDataChanged();
if(myCases.size() == 0)
{
myDone.setEnabled(false);
... | 1 |
public static int cmpDstMaj(final int[] buffer, final int first, final int second) {
//
if (buffer[first + IDX_DST] < buffer[second + IDX_DST]) return SMALLER;
if (buffer[first + IDX_DST] > buffer[second + IDX_DST]) return BIGGER;
if (buffer[first + IDX_SRC] < buffer[second + IDX_SRC]) r... | 4 |
@Override
public void mouseReleased(MouseEvent e)
{
super.mouseReleased(e);
Vertex chosenPoint = chooseVertex(e);
if (e.getButton() == MouseEvent.BUTTON1)
addPoint(draggedToX, draggedToY);
else if (e.getButton() == MouseEvent.BUTTON2)
toggleWallMode(chosen... | 3 |
public void windowDeiconified(WindowEvent e) {
isIdle=false;
} | 0 |
public int getMaxJaar()
{
int jaar = 0;
// Itereer de datasets
for (DataSet set: this.datasets)
{
for (Category cat: set.categories)
{
for (SubCategory scat: cat.subcategories)
{
SubCategory subcat = new SubCategory(scat.id, scat.naam, scat.datatype, scat.weight,... | 5 |
public void setData(InputStream data) {
this.data = data;
} | 0 |
@Override
public void update(Observable o, Object arg) {
Route route = (Route) arg;
if (route.to == null) {
VoieEnum ve = (VoieEnum) ((VoieExterne)route.from).getEnum();
voituresEnAttentes.get(ve).incrementAndGet();
voituresEntrees.get(ve).incrementAndGet();
}
else if (route.from instanceof VoieExtern... | 5 |
private char getChar(int i) {
if(i >= 0 && i < 10) {
return (char) ('0' + i);
}
switch (i) {
case 10: return 'A';
case 11: return 'B';
case 12: return 'C';
case 13: return 'D';
case 14: return 'E';
case 15: retur... | 8 |
private ObjectDefinition method457() {
int i = -1;
if (varbitFileId != -1) {
VarBit varBit = VarBit.cache[varbitFileId];
int configId = varBit.configId;
int shift = varBit.anInt649;
int amountBits = varBit.anInt650;
int j1 = Client.anIntArray1232[amountBits - shift];
i = client.configStates[config... | 5 |
@Override
public String buscarDocumentoPorEmpresa(String empresa) {
ArrayList<Compra> geResult= new ArrayList<Compra>();
ArrayList<Compra> dbCompras = tablaCompras();
String result="";
try{
for (int i = 0; i < dbCompras.size() ; i++){
if(dbCompras.get(i).... | 4 |
private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... | 5 |
@Override
protected void finalize()
{
if(m_resource.RemoveReference() && !m_fileName.isEmpty())
{
s_loadedShaders.remove(m_fileName);
}
} | 2 |
private void loadData() throws IOException, InvalidConfigurationException
{
File folder = getDataFolder();
if (!folder.exists())
{
folder.mkdir();
}
else
{
// Delete the old config file if it is there
File oldConfigFile = new File(folder.getPath() + File.separator + "config.yml");
if (oldConf... | 3 |
public <T> BeansContainer register(Class<? extends T> impl, Class<T> iface) {
registry.put(iface, impl);
return this;
} | 1 |
public Element toElement() {
cleanTableFrom();
DocumentFactory factory = DocumentFactory.getInstance();
Element root = factory.createElement(DbSchema.DBSELECT_FIELD);
root.addAttribute(DbSchema.OFFSET_ATTRIBUTE, Integer.toString(offset));
root.addAttribute(DbSchema.LIMIT_ATTRIBUTE, Integer.toString(limit));
... | 9 |
public final Texture getCoinTexture(final BlockType type) {
switch (type) {
case BLUE_FACE:
return coinBlue;
case RED_FACE:
return coinRed;
case GREEN_FACE:
return coinGreen;
case GREY_FACE:
return coinGrey;
case BROWN_FACE_BROKEN:
return coinPotion;
default:
return null;
}
} | 5 |
private void step3Recursiv(String usedEdge, int delta, String target) {
if (usedEdge != null && usedEdge.length() > 0 && delta > 0) {
int flowAtEdge = this.graph.getValE(usedEdge, this.attrEdgeFlow);
//Bin ich Source oder Target
String source = this.graph.getSource(usedEdge);
if (!source.equals(target... | 4 |
public static synchronized DataAccessLayer getInstance(){
if (null == instance)
{
instance = new DataAccessLayer();
}
return instance;
} | 1 |
@Override
protected void execute() {
Map<Integer, Set<String>> m = new TreeMap<Integer, Set<String>>();
seq(new WalkToSegment(19, 17));
seq(Segment.skip(1));
seqMove(new WriteMemory(0xd3b1, 0x00)); // set index to 0
qsave();
for (int map=MIN_MAP;map<=MAX_MAP;map++) {
if(excludedMaps.contains(map))
... | 6 |
@Test
public void testShowAllTrackedJobs() throws LuaScriptException {
String jid = addNewTestJob();
String jid2 = addJob(UUID.randomUUID().toString(), TEST_QUEUE);
// Track both jobs
performTrackingAction("track", jid);
performTrackingAction("track", jid2);
// Get tracked status
List<String> emptyKeys... | 3 |
public int[] getPitchShifts(String tuningscheme, double bendrange, int rootnote, int tuningnote, double tuningfreq) throws Exception, IndexOutOfBoundsException {
Double[] pitchratios = getRatios(tuningscheme);
int[] pitchshift = {0,0,0,0,0,0,0,0,0,0,0,0};
// midi specs use a numerical value from (0 to 16383... | 9 |
public void shellSort() {
int inc, i, j, s, s1, p1, p2, p3;
Integer[] seq = new Integer[myArray.length];
p1 = p2 = p3 = 1;
s1 = -1;
do {
if ( (++s1 % 2) != 0 ) {
seq[s1] = 8 * p1 - 6 * p2 + 1;
} else {
seq[s1] = 9 * p1 - 9 *... | 7 |
public TestEmbeddedServer( String host, int port ) {
this.host = host;
this.port = port;
this.community_url = host + ":" + port + "/community";
getKeys();
TrustManager[] osTrustManager = new TrustManager[] {
new LiberalTrustManager()
};
try {
sslcontext = SSLContext.getInstance("SSL");
... | 2 |
public void addDocument(File f) throws IOException
{
String document = "";
BufferedReader io = new BufferedReader(new FileReader(f));
String line;
boolean markUpFile = false, captureText = false;
while((line = io.readLine()) != null)
{
if(line.startsWith("... | 9 |
public final IServiceProvider getSite()
{
return privateSite;
} | 0 |
public ArrayList<Pallet> getPalletsWithBlockStatus(boolean status) {
ArrayList<Pallet> pallets = new ArrayList<Pallet>();
String sql =
"Select * from Pallets where isBLocked = ? ";
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(sql);
ps.setBoolean(1, status);
} catch (SQLException ... | 5 |
* @param colony The <code>Colony</code> to unload to,
* or null if unloading in Europe.
* @return True if the unload succeeded.
*/
private boolean unloadGoods(Goods goods, Unit carrier, Colony colony) {
if (colony == null && carrier.isInEurope()
&& carrier.getOwner()... | 7 |
protected void _allocate(int cap) {
initialCapacity=cap;
buf=new byte[cap];
index=0;
} | 0 |
public String toString(){
if(identifer != null)return this.identifer.getNewName(false);
else if(literal != null)return this.literal.getValue();
else return expression.toString();
} | 2 |
@SuppressWarnings("unchecked")
@Override
public void refreshView(Map<String, Map<String, Object>> state) {
// Extract the maps from the state
//
Map<String, Object> mapState = state.get("mapState"), dayState = state
.get("dayState");
LinkedList<Map<String, Object>> elementList = (LinkedList<Map<String, O... | 6 |
@Override
public void update(Observable o, Object arg1) {
if (o == model){
view.displayData(model.getData());
view.displayScore(model.getScore());
view.displayHint(model.getHint());
if(model.isSucceed()){
view.gameOver(true);
}
if(model.isStuck()){
view.gameOver(false);
}
}
i... | 7 |
public void printSudoku() {
for (int i = 1; i <= countRow; i++) {
for (int j = 1; j <= countRow; j++) {
if (selectCellCoord(i, j).openValues.size() == 1)
System.out.print(selectCellCoord(i, j).openValues + " ");
else System.out.print("[ ] ");
... | 3 |
@Override
public int read() throws IOException {
synchronized (this) {
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return -1;
} | 1 |
protected void processEntity(IXMLReader reader,
IXMLEntityResolver entityResolver)
throws Exception
{
if (! XMLUtil.checkLiteral(reader, "NTITY")) {
XMLUtil.skipTag(reader);
return;
}
XMLUtil.skipWhitespace(reader, null);
char c... | 9 |
public static void analytics() {
String uuid="";
try {
BufferedReader in=new BufferedReader(new InputStreamReader(new FileInputStream(Main.path+"uuid.txt"), "UTF-8"));
String ln; String out="";
while ((ln=in.readLine())!=null) out+=ln;
uuid=out;
... | 6 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(tickID!=Tickable.TICKID_MOB)
return false;
if((affecting()!=null)&&(affecting() instanceof MOB))
{
final MOB M=(MOB)affecting();
final Room room=M.location();
final MOB invoker=(invoke... | 8 |
@Override
public void run() {
byte[] receiveData = new byte[1024];
while(active) {
try {
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
serverSocket.receive(receivePacket);
String sentence = new String(receivePacket.getData(), 0, receive... | 5 |
public String getName() {
return name;
} | 0 |
private LinkedList<Node> getAllNodes(Node in) {
LinkedList<Node> list = new LinkedList<Node>();
list.add(in);
int i = 0;
while ( i < list.size() ) {
for ( Node n : list.get(i).getNeighbors() ) {
if ( n != null && !list.contains(n) ) list.addLast(n);
}
i++;
}
return list;
} | 4 |
@Basic
@Column(name = "password")
public String getPassword() {
return password;
} | 0 |
public String getPlace() {
return place;
} | 0 |
public String row(int i)
throws Exception
{
int h = this.contents.height();
// The top and bottom of the box
if ((i == 0) || (i == h + 1))
{
return "+" + TBUtils.dashes(this.contents.width()) + "+";
}
// Stuff within the box
else if ((i > 0) && (i <= h))
{
ret... | 4 |
@Override
public void render(GameContainer gc, Graphics g) {
_animation[facing].draw(position.getX(), position.getY());
if(GameInfo.SHOW_DEBUG_INFO) {
if(considered != null && isCurrentlyMoving) {
g.setColor(new Color(0, 255, 255, 64));
for(Node node : considered) {
Vector2 pos = node.getPosition()... | 6 |
public Map<Position, List<ElementInfo>> getElements() {
final Map<Position, List<ElementInfo>> elements = new HashMap<Position, List<ElementInfo>>();
for (Entry<Position, List<Element>> entry : getGrid().getElementsOnGridMap().entrySet())
elements.put(entry.getKey(), new ArrayList<ElementInfo>(entry.getValue()))... | 1 |
public double leiaDouble()
{
double numero = 0 ;
String linha ;
BufferedReader entra = new BufferedReader(new InputStreamReader(System.in)) ;
try
{
linha = entra.readLine() ;
numero = Double.valueOf(linha).doubleValue();
}
... | 1 |
public void startWorking(BufferedReader in, PrintWriter out) throws IOException {
new Thread(() -> {
try {
String input;
while ((input = in.readLine()) != null) {
lastInput = input;
event.run();
}
} c... | 5 |
@Override
public void executeTask() {
/* Redundant code here in the event Server and Client start diverting. */
try {
/* NULL indicates no node was registered. */
if (node != null) {
Node mNode = new Client();
switch(node.NODE) {
case CLIENT:
mNode = RoutingTable.getInsta... | 7 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.