text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static Cliente convertToCliente(ClienteDTO clienteDTO) {
if (clienteDTO == null) {
return new Cliente();
}
return new Cliente(clienteDTO.getId(), clienteDTO.getNome(), clienteDTO.getSobrenome(),
clienteDTO.getEndereco(), clienteDTO.getCep(),
clienteDTO.getDtNascimento(), clienteDTO.getTelefone()... | 1 |
public static long getCRC32(String filename)
{
// Attempt to read the file from disk
try
{
RandomAccessFile file = new RandomAccessFile(filename, "r");
// Convert the file to a buffer
byte[] buffer = new byte[(int)file.length()];
file.read(buffer);
// Generate the CRC from the buffer
CR... | 1 |
protected void revertButtonActionPerformed(@SuppressWarnings("unused") final ActionEvent arg0) {
for (int i = 0; i < this.fileStateTable.getSelectedRows().length; i++) {
final int rowIndex = this.fileStateTable.getSelectedRows()[i];
// We have to know the absolute path of the selected file
// Indexes of file... | 3 |
public HashSet<String> getIgnores(String player){
HashSet<String> ignorelist = new HashSet<String>();
sql.initialise();
ResultSet res = null;
try {
res = sql.sqlQuery("SELECT Ignoring FROM BungeeIgnores WHERE PlayerName = '"+player+"'");
} catch (SQLException e) {
e.printStackTrace();
}
try {
wh... | 3 |
@Override
public void speak()
{
System.out.println("The Rottweiler says (in a very deep voice) \"WOOF!\"");
} | 0 |
public void run()
{
sendRulesToPlayers();
Connection activePlayer = players.get(0);
while(true)
{
row = null;
column = null;
row = activePlayer.received.pollLast();
System.out.println("%%%%%"+row);
column = activePlayer.received.pollLast();
System.out.println("%%%%%"+column);
active... | 9 |
public ReleaseType getLatestType() {
this.waitForThread();
if (this.versionType != null) {
for (ReleaseType type : ReleaseType.values()) {
if (this.versionType.equals(type.name().toLowerCase())) {
return type;
}
}
}
return null;
} | 3 |
public boolean contains(AABB other) {
return minX <= other.minX && other.maxX <= maxX && minY <= other.minY
&& other.maxY <= maxY && minZ <= other.minZ
&& other.maxZ <= maxZ;
} | 5 |
public static int poisson(double lambda) {
if (!(lambda > 0.0))
throw new IllegalArgumentException("Parameter lambda must be positive");
if (Double.isInfinite(lambda))
throw new IllegalArgumentException("Parameter lambda must not be infinite");
// using algorithm given by... | 3 |
public CheckResultMessage checkF01(int day) {
return checkReport.checkF01(day);
} | 0 |
public static String sign(byte[] data, String privateKey) throws Exception {
// 解密由base64编码的私钥
byte[] keyBytes = SecurityCoder.base64Decoder(privateKey);
// 构造PKCS8EncodedKeySpec对象
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
// KEY_ALGORITHM 指定的加密算法
KeyFactory keyFactory = KeyFac... | 0 |
@BeforeTest
@Test(groups = { "Random BST", "Insertion" })
public void testRandomBSTInsertion() throws DuplicateKeyException {
Integer count = 0;
Reporter.log("[ ** Random BST Insertion ** ]\n");
try {
timeKeeper = System.currentTimeMillis();
for (int i = 0; i < seed; i++) {
randomBST.put(i, randomCha... | 5 |
*/
protected void getResponseBipolarDetail(String title) {
if (title != null) {
for (int i = 0; i < bipolarQuestionList.size(); i++) {
if (bipolarQuestionList.get(i).getTitle().equals(title)) {
if (!(bipolarQuestionList.get(i).getDescription() == null
|| bipolarQuestionList.get(i).getDescription(... | 9 |
public Entry search_level(int slevel, String myid) {
if (slevel > level) {
return null;
}
if (slevel < 0) { // be defensive
System.err.println("oops slevel<0 " + slevel);
System.exit(1);
}
// go directly to right block:
ArrayList<Entry> block = st.elementAt(level... | 4 |
private void start() {
try {
Connection connection;
int i;
int option;
UI.printHeader();
System.out.println(connections.size() + " conexiones activas:");
System.out.println("");
for (i = 0; i < connections.size(); i++) {
connection = connections.get(i);
System.out.println((i + 1) + ") C... | 3 |
private Connection initDBConnection() throws SQLException {
try {
Class.forName(CLASSNAME);
con = DriverManager.getConnection(CONNECTIONSTRING);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return con;
} | 1 |
public LinkedNode nthToLastElement(LinkedNode head, int elementToRemove){
//Can't remove negative element
if(elementToRemove<0){
return head;
}
LinkedNode current = head;
int size = 1;
while(current.getNext()!=null){
current=current.getNext();
... | 5 |
public static String addressFichier(String addresse, String str)
{
StringBuffer res = new StringBuffer();
for (int i = 0; i < addresse.length() - str.length(); i++) {
res.append(addresse.charAt(i));
}
return res.toString();
} | 1 |
@RequestMapping(value = "/speaker-room-event-list/{speakerId}", method = RequestMethod.GET)
@ResponseBody
public RoomEventListResponse speakerRoomEventList(
@PathVariable(value = "speakerId") final String speakerIdStr
) {
Boolean success = true;
String errorMessage = null;
... | 1 |
public BeanLens(String fieldName, Class<A> theType) {
for (Method m : theType.getMethods()) {
if (m.getName().toLowerCase()
.equals("get" + fieldName.toLowerCase())) {
this.getMethod = m;
}
if (m.getName().toLowerCase()
.equals("set" + fieldName.toLowerCase())) {
this.setMethod = m;
}
... | 3 |
public static void main(String[] args) {
InterfaceControlador ic;
System.out.println("Controller object created");
try
{
ic = new Controller();
System.out.println("Binding controller " + ic);
Naming.rebind("rmi://localhost/Controller", ic);
... | 1 |
public synchronized void publishLastSale(String product, Price p, int v) throws Exception {
String thisClass = "publishers.LastSalePublisher#publishLastSale.";
if (ExceptionHandler.checkString(product, thisClass) && ExceptionHandler.checkIntNegative(v, thisClass)
&& ExceptionHandler.chec... | 8 |
@Override
public void update(GameContainer container, int delta) throws SlickException {
if (winner == null) {
itemEffectHandler.processDelta(delta);
players.forEach(p -> p.update(delta));
itemSpawnTimer += delta;
if (itemSpawnTimer > TPBJGConfig.ITEM_SPAWN_TIME) {
itemSpawnTimer ... | 4 |
public void setAlgorythmType(String type){
algorythmType = type;
} | 0 |
public int getIndex(Weapon w) {
for(int i = 0; i < this.getWeapons().length; i++) {
if(this.getWeapons()[i] == w) {
return i;
}
}
return -1;
} | 2 |
public PermutationIterator(List<T> list, int size){
outSize = size;
totalSize = list.size();
index = new ArrayList<T>(totalSize);
current = new ArrayList<Integer>(outSize);
for(int i = 0; i < outSize; i++){
current.add(0);
}
map = new TreeMap<Integer, Integer>();
int i = 0;
for(... | 6 |
public static byte[] encrypt(byte[] data, byte[] key) {
int lenght=0;
byte[] padding = new byte[1];
int i;
lenght = 8 - data.length % 8;
padding = new byte[lenght];
padding[0] = (byte) 0x80;
for (i = 1; i < lenght; i++)
padding[i] = 0;
byte[] tmp = new byte[data.length + lenght];
byte[] bloc = ... | 6 |
public static void writeMaze(PrintStream mazeStream, Set<Integer> knockdowns,
int height, int width) {
// draw maze except lower border
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
mazeStream.print("+");
// negative elements in knockdowns denote walls above ... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Simulation other = (Simulation) obj;
if (compute... | 6 |
public boolean exportSammellastschrift(
List<DataLastschriftMandat> lastschriften,
BeitragSammelLastschrift sl) {
// Gibt an, ob bisher alle Sammellastschriften erfolgreich an Hibiscus
// übergeben wurden
boolean allSuccessful = true;
SqlSession session = sqlSes... | 8 |
@Override
public void paint(Graphics g)
{
g.setColor(Color.BLACK);
g.fillRect(0,0,getWidth(),getHeight());
Rectangle r = g.getClipBounds();
g.setColor(Color.WHITE);
g.fillRect(r.x,0,KEYLENGTH,getHeight());
g.setColor(Color.BLUE);
for (int y = 0, keyIndBase = 0; y < getHeight(); y += BARHEIGHT *... | 4 |
private void writeNumber ( int side, int ln, long numb, boolean FF )
{
long r = numb;
byte[] g = new byte[ln];
for(int i=0, l=ln;l>0;l--)
{
if(side>0) r=(l==1? numb : numb>>((l-1)<<3) );
int b = (int)((FF && numb==-1) ? 0xff : (r & 0xff));
g[i++]=(byte)b;
if(side==0) r>>=8;
}
try { fidx.write... | 7 |
public void putRunBits(int i, int len) throws IOException {
for (int j = len - 1; j >= 0;) {
if (bits_left != 0 || j < 8) {
putBit(i);
j--;
} else {
if (i == 0)
out.write(0x00);
else
o... | 4 |
public static long projectEulerNumber43() {
long sum = 0;
long startNum = 1406357289;
long endNum = 1406357289;
for (long i = startNum; i <= endNum; i++) {
if (!isPandigital(i)) {
continue;
}
long d1 = i / 1000000000l;
lo... | 9 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Get session object.
HttpSession session = request.getSession();
// Attempt to get POJO stored inside session object.
Video_27_POJO pojo = (Video_27_POJO)session.getAttribute("pojo");
... | 7 |
public String mahdollisetYhdistelmatToString(){
String s="";
ArrayList<Yhdistelma> y = mahdollisetYhdistelmat();
int ind=y.size();
for(int i=0; i<y.size(); i++){
s=s+(i+1)+" - "+y.get(i).getNimi()+": "+y.get(i).getPisteet()+"p"+"\n";
if(i==y.size()-1){
s=s+"---------------------yliviivaa--------------... | 3 |
public void add(Explorable e) throws ExplorationException {
assert (e instanceof Conflict);
Conflict c = (Conflict) e;
/*
* Relative ID should always be complete, it's an ID after all.
* Therefore we throw an exception if it's too long.
*/
String relativeId = c.getRelativeId();
if (rel... | 7 |
public int countBonusFromIngwer(GameBoard gb) throws Exception {
int bonusCount = 0;
try {
bonusCount += getValue(gb, new Coordinates(1, 1));
bonusCount += getValue(gb, new Coordinates(boardSize, 1));
bonusCount += getValue(gb, new Coordinates(1, boardSize));
... | 6 |
public static int addReverse(Node a, Node b, int carry, String work){
System.out.println("Work : " + work);
if (a != null && b != null){
int digit = a.data + b.data + carry;
int c = 0;
if (digit >= 10){
digit = digit%10;
}
addReverse(a.next, b.next,c, Integer.toString(digit) + work);
}
if (a ... | 7 |
public void update() {
mapX += velocityX;
mapY += velocityY;
velocityY -= 0.25f;
if (pixelizeManager.checkForBlock(getCenterPoint()) != 0) {
isDirty = true;
}
} | 1 |
public static List<Entreprise> selectEntreprise() throws SQLException {
String query = null;
List<Entreprise> entreprise = new ArrayList<Entreprise>();
ResultSet resultat;
try {
query = "SELECT * from ENTREPRISE order by ENTNOM";
PreparedStatem... | 2 |
private final static OSType determineOSType() {
final String osName = System.getProperty("os.name");
if (osName.startsWith("Windows")) {
return OSType.WINDOWS.setSubtype(osName.substring(8));
} else if (osName.startsWith("Unix") || osName.startsWith("Linux")) {
return OSType.UNIX;
}
// } else if (osName... | 3 |
public float getVelocityY() {
return dy;
} | 0 |
public eState toContinue() {
double relNorm = gNormLast / gNormInit;
int size = values.size();
double newestVal = values.get(size - 1);
double previousVal = (size >= 10 ? values.get(size - 10) : values.get(0));
double averageImprovement = (previousVal - newestVal) / size;
// This i... | 9 |
static final void method220(int i, int i_0_, float[] fs, int[] is, int i_1_, float[] fs_2_, int i_3_, int i_4_, int[] is_5_, int i_6_, int i_7_, int i_8_, int i_9_) {
if (i_8_ == -5) {
anInt221++;
int i_10_ = i_9_ * i_1_ - -i_7_;
int i_11_ = i * i_3_ + i_4_;
int i_12_ = -i_0_ + i_1_;
int i_13_ = -i_0_ ... | 9 |
@Override
public void windowClosed(WindowEvent e) {
} | 0 |
@Override
public boolean equals(Object eql) {
if (!(eql instanceof Parameters))
return false;
// We are dealing with an Instance of Parameters:
boolean areBlastParamsEqual = true;
for (String blastDb : getBlastDbParameters().keySet()) {
for (String iterKey : getParametersOfBlastDb(blastDb).keySet()) {
... | 8 |
protected int[] mapColumnsToProperties(ResultSetMetaData rsmd,
PropertyDescriptor[] props) throws SQLException {
int cols = rsmd.getColumnCount();
int[] columnToProperty = new int[cols + 1];
Arrays.fill(columnToProperty, PROPERTY_NOT_FOUND);
for (int col = 1; col <= cols; c... | 6 |
public void actionPerformed(ActionEvent arg0) {
String command = arg0.getActionCommand();
System.out.println(command);
String current = screen.getText();
current = current.replaceAll("\\s+", " ");
if (current.contains("ERROR")) {
current = "";
screen.setText("");
}
if (command.e... | 8 |
public static void randTest() {
double labelCeil = 10.0;
Double unLabel = new Double(1.0);
double fracCon = 0.3;
int numVertices = 10;
int numLabels = 3;
Random rand = new Random(1847860);
HashMap<Integer,Double> ls = new HashMap<Integer,Double>(numLabels);
for (int i=0; i < numLabels; ) {
Integer ne... | 7 |
public void setButtonGap(int gap) {
if (this.buttonGap == gap) {
return;
}
this.buttonGap = gap;
installGUI();
} | 1 |
public void unreadFrame() throws BitstreamException
{
if (wordpointer==-1 && bitindex==-1 && (framesize>0))
{
try
{
source.unread(frame_bytes, 0, framesize);
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR);
}
}
} | 4 |
public boolean checkInterleave(int idx1, int idx2, int idx3)
{
if (idx1 == -1 && idx2 == -1 && idx3 == -1)
return true;
if (idx1 >= 0 && in1.charAt(idx1) == out.charAt(idx3)
&& checkInterleave(idx1-1, idx2, idx3-1))
return true;
if (idx2 >= 0 ... | 9 |
public int maxProfit(int[] prices) {
int profit =0;
if(prices.length == 0)
return 0;
int up = prices[0];
int low = prices[0];
for (int i = 0; i < prices.length ;i++ ){
if(prices[i] > up){
up = prices[i];
profit = Math.max(u... | 4 |
public boolean method286(int arg0, int arg1, Entity entity, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10) {
return entity == null || method287(arg0, arg7, arg10, arg8 - arg7 + 1, arg4 - arg10 + 1, arg5, arg1, arg6, entity, arg3, true, arg9, (byte) 0);
} | 1 |
public ByteVector putLong(final long l) {
int length = this.length;
if (length + 8 > data.length) {
enlarge(8);
}
byte[] data = this.data;
int i = (int) (l >>> 32);
data[length++] = (byte) (i >>> 24);
data[length++] = (byte) (i >>> 16);
data[length++] = (byte) (i >>> 8);
data[length++] = (byte) i;
... | 1 |
public String determineMatchWinner() {
String winner = "";
if (wins == losses) {
winner = "Tie";
} else if (wins > losses) {
winner = "User";
} else {
winner = "CPU";
}
return winner;
} | 2 |
@Override
public void processWalks(final WalkArray walks, final int[] atVertices) throws RemoteException {
try {
pendingQueue.put(new WalkSubmission(walks, atVertices));
int pending = pendingQueue.size();
if (pending > 50 && pending % 20 == 0) {
logger.inf... | 3 |
@Override
public void objectReceived(Object o) {
try {
NetMessage n = NetMessage.parseFrom((byte[])o);
System.out.println(n.getType().toString() + " message received");
switch (n.getType()) {
case CHAT_MESSAGE:
chatWindow.addMessage(n.getChatMessage()... | 3 |
public String getName() {
return this.name;
} | 0 |
@Basic
@Column(name = "user_agent")
public String getUserAgent() {
return userAgent;
} | 0 |
public Object getAggregateColumnValue(String table, Column column, QUERY_TYPE aggregate) throws SQLException, NoValueException{
Object res = new Object();
Statement s = DBAccess.getConnection().createStatement();
String query = "SELECT " + aggregate + "(" + column.getColumnName() + ") FROM " + table +... | 5 |
private JsonObject readFiles() throws IOException {
JsonObject json = new JsonObject();
Set<File> files = getsubFileList(this.config.getPath());
BufferedReader read = null;
for(File file :files){
JsonObject fileData = new JsonObject();
read = new BufferedReader(new FileReader(file));
int i=... | 2 |
@Override
public MOB determineMonster(MOB caster, int material)
{
final MOB victim=caster.getVictim();
final MOB newMOB=CMClass.getMOB("GenMOB");
int level=adjustedLevel(caster,0);
if(level<1)
level=1;
newMOB.basePhyStats().setLevel(level);
newMOB.basePhyStats().setAbility(13);
newMOB.baseCharStats()... | 7 |
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 static String compressedToString(String str)
{
String strBuild="";
if(str.charAt(1) == '1') strBuild += "Ctrl + ";
if(str.charAt(0) == '1') strBuild += "Shift + ";
if(str.charAt(2) == '1') strBuild += "Alt + ";
strBuild += KeyEvent.getKeyText(Integer.parseInt(str.substring(3)));
return strBuild;
} | 3 |
protected static byte[] decrypt(byte[] encryptedData, Algorithm algorithm,
SecretKey secretKey, byte[] iv) throws JironException {
Cipher cipher;
try {
cipher = Cipher.getInstance(algorithm.transformation);
} catch (NoSuchAlgorithmException e) {
throw new JironException("Encryption algorithm "
+ al... | 6 |
/* */ public String attemptingToConnectNewAccount(String username, char[] password, char[] passwordConfirm)
/* */ {
/* 160 */ if (username.length() < 3)
/* */ {
/* 162 */ return "Your username must contain at least 3 characters.";
/* */ }
/* */
/* 165 */ if (password.lengt... | 9 |
public Element insertChildren(int index, Collection<? extends Node> children) {
Validate.notNull(children, "Children collection to be inserted must not be null.");
int currentSize = childNodeSize();
if (index < 0) index += currentSize +1; // roll around
Validate.isTrue(index >= 0 && inde... | 3 |
public static int findMagicIndex(int[] array, int i, int j){
//Since the array is sorted, we can perform a binary search in log(n) time
//WHAT about if elements are not distinct? If elements are not distinct, this
//algorithm will not work. Instead we must iterate through each element and search... | 5 |
public void execute() throws MojoExecutionException, MojoFailureException {
// Temp file
File tempFile = null;
try {
this.getLog().info("Starting OpenCms Local Mojo...");
this.getLog().info(
"OpenCms Zip File: " + this.getOpenCmsEnvironmentZipFile());
this.getLog().info(
"Destory Environment... | 9 |
protected static List<Card> getAllFlushCards(Set<Card> cardSet) {
if (cardSet.size() < 5) {
return null;
}
// Note that we could return more than 5 cards here.
Map<Suit, List<Card>> suitMap = new HashMap<Suit, List<Card>>();
for (Card card : cardSet) {
List<Card> flushLists = suitMap.get(car... | 5 |
public static int getShort(int num, int which)
{
if(which == 0){
num = num << 16;
}
num = num >>> 16;
return num;
} | 1 |
public static byte intToByte(int number){
return (byte) ((number<0?-number:number) & 0xff);
} | 1 |
@Override
public void handleNotification(Object producer, String name, Object data) {
if (name == TreeNotificationKeys.ROW_REMOVED) {
for (TreeRow row : new TreeRowIterator((TreeRow[]) data)) {
mSelectedRows.remove(row);
if (row instanceof TreeContainerRow) {
mOpenRows.remove(row);
}
if (mRow... | 4 |
private void leftMouseButtonClicked(int x, int y)
{
if (!isPaused && !gameOver) {
if(this.currentPlayer!=null && this.currentSelectedBlock!=null){
setPlaceBlockFlag(true);
}
}
} | 4 |
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
Class clazz;
try {
clazz = getParent().loadClass(name);
return clazz;
}
catch (ClassNotFoundException e) {
}
String classFileLocation = name.substring(name.lastIndexOf(".") + 1) + ".class";
Path p... | 4 |
public void setLAN(Boolean x)
{
if(x!=null)
{
blLAN = x;
}
//Kill/Reset connection
if(blLAN == true && conProt == null)
{
conProt = new RCEstablishConnection(true);
conProt.setBase(me);
conProt.setName(strName);
}
if(blLAN == false && conProt != null)
{
conProt.killCurrent();
conPro... | 5 |
public GrupoVO[] consultar (GrupoVO grupo){
String query = "SELECT * FROM grupos WHERE";
Statement consulta = Conexion.getConexion().hacerConsulta();
boolean bandera = false;
GrupoVO [] grupos = null;
if(grupo.getEnAutorizado() != null){}
if(grupo.getIdGrupo() != null){}
if(grupo.getJefeGrupo(... | 7 |
@Override
public String toString()
{
String informacio = "[Mida: " + mida + ", num. fitxes jugador A: " + num_fitxes_a + ", " +
"num. fitxes jugador B: " + num_fitxes_b + ", estat de les caselles:\n";
for ( EstatCasella[] fila : caselles )
{
informacio = informacio + "\t";
for ( Est... | 5 |
public static void main(String[] args){
try {
String name = "main2";
int num_rand;
ArrayList<JvnObjectImpl> array = new ArrayList<JvnObjectImpl>();
MonObjet o1 = new MonObjet("objet2");
JvnObjectImpl shared_object_2 = (JvnObjectImpl) JvnServerImpl.jvnGetServer().jvnCreateObject(o1);
JvnServerImpl.jv... | 6 |
private void waitSockClose(Sock sock) {
boolean loop = true;
Timing new_timer = new Timing();
while (loop) {
if ((sock.getSocket() == null && sock.getIn() == null && sock.getOut() == null) || new_timer.getTime() > timeout) {
loop = false;
}
}
... | 5 |
private Model generateTerrain(String heightMap) {
BufferedImage image = null;
try {
image = ImageIO.read(new File("assets/terrain/" + heightMap + ".png"));
} catch (IOException e) {
e.printStackTrace();
}
int vertexCount = image.getHeight();
heigh... | 5 |
@Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... | 3 |
@Override
public void messageHandler(String messageName, Object messagePayload) {
if (messagePayload != null) {
System.out.println("MSG: received by model: "+messageName+" | "+messagePayload.toString());
} else {
System.out.println("MSG: received by model: "+messageName+" | No data sent");
}
... | 4 |
public void setId(Integer id) {
this.id = id;
} | 0 |
protected Tile pickSample() {
final int range = World.SECTOR_SIZE * 2 ;
Tile picked = null ;
float bestRating = 0 ;
for (int n = 10 ; n-- > 0 ;) {
final Tile s = Spacing.pickRandomTile(this, range, world) ;
if (s == null || s.pathType() != Tile.PATH_CLEAR) continue ;
float rating = s.h... | 4 |
public void tick(){
tickCount++;
for(cell[] p1: bitMap.Map){ // foreach grade in grades
for(cell q1: p1){
try{
q1.Resident.ready = 1;
}catch(NullPointerException e ){
}
}}
for(cell[] p: bitMap.Map){ // foreach grade in grades
for(cell q: p){
try{
q.Resident.ti... | 6 |
public static int countNeighbours(long world, int col, int row){
int total = 0;
total = getCell(world, col-1, row-1) ? total + 1 : total;
total = getCell(world, col , row-1) ? total + 1 : total;
total = getCell(world, col+1, row-1) ? total + 1 : total;
total = getCell(world, col-1, row ) ? total + 1 : total... | 8 |
public static void main(String[] args) {
split(" "); // Doesn't have to contain regex chars
split("\\W+"); // Non-word characters
split("n\\W+"); // 'n' followed by non-word characters
} | 0 |
private String getFile(String link)
{
String download = null;
try
{
// Open a connection to the page
URL url = new URL(link);
URLConnection urlConn = url.openConnection();
InputStreamReader inStream = new InputStreamReader(urlConn.getInputStrea... | 6 |
public static List<Archive> getPlugins() {
List<Archive> plugins = new ArrayList<Archive>();
for (File file : DIRECTORIES[0].listFiles()) {
String name = file.getName();
if (name.endsWith(".class"))
plugins.add(new ClassFile(file));
else if (name.endsWith(".jar"))
try {
plugins.add(new JavaArc... | 4 |
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 static void borderize(MapView mv, Gob player, Coord sz,
Coord border) {
if (Config.noborders) {
return;
}
Coord mc = mv.mc;
Coord oc = m2s(mc).inv();
int bt = -((sz.y / 2) - border.y);
int bb = (sz.y / 2) - border.y;
int bl = -((sz.x / 2) - border.x);
int br = (sz.x / 2) - border.... | 5 |
public SourceType getSourceType(Stmt sCallSite, InterproceduralCFG<Unit, SootMethod> cfg) {
assert cfg != null;
assert cfg instanceof BiDiInterproceduralCFG;
// This might be a normal source method
if (super.isSource(sCallSite, cfg))
return SourceType.MethodCall;
// This call might read out sensitive da... | 6 |
public Object down(Event evt) {
switch(evt.getType()) {
case Event.VIEW_CHANGE:
View view=evt.getArg();
handleView(view);
break;
case Event.SET_LOCAL_ADDRESS:
local_addr=evt.getArg();
break;
case ... | 8 |
public void checkCustomUp(Node node) {
this.up = -1; // reset value to -1
// Prevent out of bounds (negative coordinates)
if((node.getX()-2) >= 0) {
if(checkWall(new Node( (node.getX()-2), (node.getY()) ))) {
if(this.closedNodes.size()==0)
this.up = 1;
else {
for(int i = 0; i < this.closedNod... | 5 |
@Override
public boolean equals(Object other){
if(other == null || other.getClass() != getClass())
return false;
if(other == this)
return true;
Movie otherMovie = (Movie)other;
if(name.equals(otherMovie.name) && director.equals(otherMovie.director) && rating =... | 6 |
public int resend(int clientId, int originalMessageId, String message) throws CouldNotSendPacketException {
synchronized(CONNECTION_LOCK) {
Packet packet = Packet.createApplicationPacket(clientId, message);
packet.setDuplicateSequenceNumber(originalMessageId);
//if the client isn't connected then throw an e... | 1 |
public void start() throws TooManyListenersException {
if (isStarted()) {
throw new TooManyListenersException();
}
setStarted(true);
Thread engine = new Thread() {
@Override
public void run() {
Thread.currentThread().setPriority(Thread.... | 3 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.