text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public int castingQuality(MOB mob, Physical target)
{
if((mob!=null)&&(target!=null))
{
if(CMLib.flags().isSleeping(mob))
return Ability.QUALITY_INDIFFERENT;
if(!CMLib.flags().isAliveAwakeMobileUnbound(mob,false))
return Ability.QUALITY_INDIFFERENT;
final Item cloth=CMLib.materials().fi... | 8 |
private Object readDelimitedField()throws IOException,EOR{
//read starting delimiter
int i=reader.read();
if(i!=delimiter){//fail
reader.unread(i);
throw new EOR();
}
//Inside the field ...
boolean inside=true;
StringBuilder builder=new StringBuilder();
while(inside){
i=reader.read();
if(i... | 7 |
public void run() {
try {
boolean eos = false;
while (!eos) {
OggPage op = OggPage.create(source);
synchronized (drainLock) {
int listSize = pageOffsets.size();
long pos = listSize > 0 ? ... | 8 |
public void run()
{
try
{
this.MPrio.acquire();
this.MReading.acquire();
this.MPrioR.acquire();
if(this.counter == 0)
this.MWriting.acquire();
this.counter++;
this.MPrioR.release();
this.MReading.release();
this.MPrio.release();
System.out.println("Lecture");
... | 3 |
private static Map<String, RectBound> prepareGrid(Document iDoc) throws Exception {
Map<String, RectBound> map = new HashMap<String, RectBound>();
Node iSvg = iDoc.getChildNodes().item(1);
Node iG = iSvg.getChildNodes().item(3);
NodeList childNodes = iG.getChildNodes();
for (int i = 0; i < childNo... | 9 |
private String BoardPiece(int i, int j) {
assert(i>0 && i<rows && j>0 && j< cols);
String str = new String();
if(this.cell[i][j] == CellEntry.inValid){
str = " ";
}
else if(this.cell[i][j] == CellEntry.empty){
str = " _ ";
}
... | 9 |
private void list_movesMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_list_movesMousePressed
current_move=null;
current_frame=null;
current_hitbox=null;
hitbox_index_selected=-1;
frame_index_selected=-1;
//Add frames
listOfMoves_main_file = main_doc.getElementsByTagName("Move... | 5 |
public void updatePathInfo() {
this.romDisplay.setText(" No Rom Path Set");
this.boxDisplay.setText(" No Box Art Path Set");
this.cartDisplay.setText(" No Cart Art Path Set");
this.wheelDisplay.setText(" No Wheel Art Path Set");
this.videoDisplay.setText(" No Video Path Set");
if (this.activeSystem!=... | 6 |
@Test
public void twoTablespoonPlusOneOunceEqualTwelveTeaspoon(){
ArithmeticQuantity two_tbsp = new ArithmeticQuantity(2, Volume.TABLESPOON);
ArithmeticQuantity one_oz = new ArithmeticQuantity(1, Volume.OUNCE);
assertEquals(two_tbsp.add(one_oz), new ArithmeticQuantity(12, Volume.TEASPOON));... | 0 |
public EnvironmentalWidget(String titleIn, boolean hasField, boolean canEdit)
{
setBackground(Color.WHITE);
JPanel fieldPanel = new JPanel();
JPanel titlePanel = new JPanel();
fieldPanel.setBackground(Color.WHITE);
fieldPanel.setLayout(new BorderLayout());
titleP... | 3 |
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Airport other = (Airport) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return tru... | 6 |
private static void printLayerDetails(Model model, String mode) {
System.out.println("***************************************************************************");
System.out.println("****************************** Layer Details ******************************");
System.out.println("*****************************... | 7 |
public LinearInterpolation(double[] x, double[] y){
this.nPoints=x.length;
this.nPointsOriginal = this.nPoints;
if(this.nPoints!=y.length)throw new IllegalArgumentException("Arrays x and y are of different length "+ this.nPoints + " " + y.length);
if(this.nPoints<3)throw new IllegalA... | 3 |
public Day getDayStored ()
{
return dayStored;
} | 0 |
public void setA(int a) {
this.a = a;
} | 0 |
public static boolean isPrime(int number) {
if (number < 0) {
throw new IllegalArgumentException("Error: int cannot be < 0!");
}
int sqrt = (int) (Math.sqrt(number) + 1);
if (number == 2) {
return true;
}
if (number == 1) {
return false;
}
for (int j = 2; j <= sqrt; j += 1) {
if (number % j... | 5 |
public void checkPrinterStatus() {
int HOW_MANY_INSTALLED_PRINTERS = 3;
for (int i = 0; i < HOW_MANY_INSTALLED_PRINTERS; i++) {
String usbId;
byte[] array = new byte[32];
int returnedVal;
if (i == 0) {
returnedVal = eZioLib.FindFirstUSB(a... | 3 |
private Slot getSlot(String name, int index, int accessType)
{
Slot slot;
// Query last access cache and check that it was not deleted.
lastAccessCheck:
{
slot = lastAccess;
if (name != null) {
if (name != slot.name)
break la... | 8 |
public boolean cadastrarBanca(int matriculaAluno, String data, String horario,
String local, String usuarioOrientador,
String professor1, String professor2, String professor3) {
Aluno aluno = procurarAluno(matriculaAluno);
Professor professor = procurarProfessor(usuarioOrientado... | 4 |
public void close() {
EIError.debugMsg("Closing");
if (serverReceiveThread != null) {
serverReceiveThread.setRunning(false);
}
if (socket != null) {
try {
sendData("goodbye");
socket.close();
} catch (IOException e) {
... | 3 |
private void paivitaPelaajaKomponentit(int pelaajanumero) {
if (pelaajanumero == 0){
try{
ui.getPpanel().paivitaKomponentit();
}catch(Exception e){}
}
if (pelaajanumero == 1){
try{
ui.getN1panel().paivitaKomponentit();
... | 8 |
public void run(){
try {
// Starting all threads at the same time (clock == 0 / "8:00AM").
startSignal.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
//Initializing the current time and the Random object
startTime = System.currentTimeMillis();
Random r = new Random();
//System.... | 7 |
public void move(int dx, int dy) {
AffineTransform at = new AffineTransform();
at.translate(dx, dy);
((GeneralPath) shape).transform(at);
canvas.repaint();
} | 0 |
@Override
public boolean equals(Object o) {
if (!(o instanceof TokenTuple))
return false;
TokenTuple t = (TokenTuple)o;
return tokenType.equals(t.tokenType) && token.equals(t.token);
} | 2 |
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String data = "";
response.setContentType("text/plain");
response.setCharacterEncoding("UTF-8");
PrintWriter writer = response.getWriter();
String dbDriver = "org.postgresql.Driver";
... | 5 |
public void buildGraph(HashMap<String, LiveRange> liveRanges, HashMap<String, Integer> spillCosts)
{
for(String key: liveRanges.keySet())
{
InterferenceNode node = new InterferenceNode(key);
node.setSpillCost(spillCosts.get(key));
nodes.add(node);
}
for(InterferenceNode node: nodes)
{
String ... | 8 |
private void resaveParamsCountrySelected(SessionRequestContent request) throws ServletLogicException {
String page = (String) request.getSessionAttribute(JSP_PAGE);
String editHotelPage = ConfigurationManager.getProperty("path.page.edithotel");
String editDirectionPage = ConfigurationManager.get... | 4 |
public void testSet_DateTimeFieldType_int3() {
MutableDateTime test = new MutableDateTime(TEST_TIME1);
try {
test.set(DateTimeFieldType.monthOfYear(), 13);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals(TEST_TIME1, test.getMillis());
} | 1 |
public ArrayList<String> process(InputStream in) throws IOException
{
if(this._queue == null)
{
throw new ParserNotInitialized();
}
byte[] byteArray = null;
//to bypass problem with loading a pdf doc from stream which has been used before by Tika
byteArray = IOUtils.toByteArray(in);
InputStream in... | 8 |
void renderWorldFX(Rendering rendering) {
final Target
HS = (hovered == null) ? null : hovered .subject(),
SS = (selected == null) ? null : selected.subject() ;
if (HS != null && HS != SS) {
//renderSelectFX(hovered, HS, Colour.transparency(0.5f), rendering) ;
hovered.renderSelection(re... | 5 |
@Override
public boolean equals(Object o)
{
if (o instanceof Pair<?, ?>)
{
Pair<?, ?> p1 = (Pair<?, ?>) o;
if (p1.Key_.equals(this.Key_) && p1.Value_.equals(this.Value_))
{
return (true);
}
}
return (false);
} | 9 |
@Override
public void updateSymptom(SymptomDTO symptom) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.update(symptom);
session.getTransaction().commit(... | 3 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Colore other = (Colore) obj;
if (blue != other.blue)
return false;
if (green != other.green)
return false;
if (red != other.red)
ret... | 6 |
private void updateGui()
{
updateDisplay();
if (!itemSelected)
{
for (int i = 0; i<pockets.length; i++)
{
pockets[i].setVisible(true);
pages[i].setVisible(true);
}
for (JButton aDisplay : display) {
aDisplay.setVisible(true);
}
information.setVisible(tr... | 6 |
public boolean isindb(final Location sign) throws SQLException {
boolean a = false;
long time = 0;
plugin.getLoggerUtility().log("Checking if in table!", LoggerUtility.Level.DEBUG);
time = System.nanoTime();
Statement st = null;
String sql;
ResultSet result;
try {
st = connector.getConnection().creat... | 4 |
void initTypes() {
ArrayList<String> typeList = new ArrayList<String>();
boolean exonsAdded = false;
for (String type : DEFAULT_TYPES) {
// Add exons or introns?
if (type.equals(Exon.class.getSimpleName()) || type.equals(Intron.class.getSimpleName())) {
if (!exonsAdded) {
// Add all exons and intr... | 7 |
private void copyGrid(int[][] int1, int[][] int2) {
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
int1[i][j] = int2[i][j];
}
}
} | 2 |
private boolean checaSeExisteVariavelEmRegistro(String nomeVariavel) {
System.out.println("ACOLAA:"+ nomeVariavel);
if(!listaVariveisRegistro.isEmpty()){
if(!listaDeBlocos.isEmpty()){
for(int j=0;j< listaDeBlocos.size();j++){
String [] tabela1 = listaDeBlo... | 8 |
public void removeNeighboor(Ways w) {
switch (w) {
case NORTH:
if (north != null)
north.south = null;
north = null;
break;
case SOUTH:
if (south != null)
south.north = null;
south = null;
break;
case EAST:
if (east != null)
east.west = null;
east = null;
break;
case WEST... | 8 |
private static String getUserCommand() {
String command = null;
while (command == null) {
try {
System.out.println("Чтобы открыть ячейку введите координаты: " + FieldBorder.VerticalAxisName +
SaveLoad.WIGHT_HEIGHT_SPLITTER + FieldBorder.Hori... | 5 |
public void setGestureOk(boolean gestureOk) {
this.gestureOk = gestureOk;
} | 0 |
private static void testCase2(){
CellEntry[][] cell = new CellEntry[][]{
{CellEntry.empty, CellEntry.inValid, CellEntry.empty, CellEntry.inValid, CellEntry.empty, CellEntry.inValid, CellEntry.white, CellEntry.inValid},
{CellEntry.inValid, CellEntry.white, CellEntry.inValid, CellEntry.empty, CellEntry.inValid, Ce... | 1 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
EmployeeForm employeeForm = new EmployeeForm();
employeeForm.setName(request.getParameter("name"));
employeeForm.setSurname(request.getParameter("surname"));
... | 3 |
public void createFirst() {
// Initialize first with empty set
first = initFirst();
Map<Symbol, Set<Symbol>> prevFirst = initFirst();
Map<Symbol, Set<Symbol>> nextFirst = new HashMap<Symbol, Set<Symbol>>();
boolean hasChanged = false;
do {
nextFirst = initFirst();
for (NonterminalSymbol A : ... | 9 |
public static void main(String[] args) {
int x = 1;
if (x == 1) {
// empty statement
} else {
while (true) {
//empty statement
}
}
} | 2 |
public KeyUtils(AlgoCryptType algo, int keySize) {
if ((algo != AlgoCryptType.RSA) && (algo != AlgoCryptType.DSA)) {
throw new IllegalArgumentException("Invalid algo type (" + algo + ").");
}
this.keySize = keySize;
} | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Categoria other = (Categoria) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return fals... | 9 |
@Override
public String getColumnName(int column) {
switch (column) {
case 0:return "ID";
case 1:return "Nom";
case 2:return "Prénom";
case 3:return "E-mail";
case 4: return "Nb signalisation";
default:return "Autres";
}
... | 5 |
public static Color makeHSBColor(
double hue, double saturation, double brightness) {
float h = (float)hue;
float s = (float)saturation;
float b = (float)brightness;
h = (h < 0)? 0 : ( (h > 1)? 1 : h );
s = (s < 0)? 0 : ( (s > 1)? 1 : s );
b = (b < 0)? 0 : ( (b > 1)? 1 : b )... | 6 |
public static long playerNameToInt64(String s) {
long l = 0L;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
l *= 37L;
if (c >= 'A' && c <= 'Z') {
l += (1 + c) - 65;
} else if (c >= 'a' && c <= 'z') {
l += (1 +... | 9 |
@Test
public void hello() throws Exception {
Integer[] states;
double[] distributionTheorique;
AlgorithmMCMC<Integer> algo;
MarkovChain mc ;
double[] distributionExperimentale;
//
int i = 0;
while (i < 100) {
int N = rand.nextInt(10) + 1;
... | 3 |
private void addValidators() {
quantityoutlet.setInputVerifier(new AbstractValidator(this, quantityoutlet, "Ongeldige waarde! Verwacht formaat: x.y, groter dan 0.0") {
@Override
protected boolean validationCriteria(JComponent c) {
if (autobox.getSelectedIndex() == 0) {
... | 5 |
private void ReadProperty(String cfile) throws IOException{
String line = "";
FileInputStream fileinputstream = new FileInputStream(cfile);
BufferedReader bufferedreader = new BufferedReader(
new InputStreamReader(fileinputstream));
do {
if ((line = bufferedreader.readLine()) == null)
break;
... | 4 |
public void readFile() throws IOException {
BufferedReader fileIn;
try {
fileIn = new BufferedReader(new FileReader(fileName));
} catch (FileNotFoundException e){
File points = new File(fileName);
PrintWriter fileOut = new PrintWriter(points);
file... | 2 |
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 ht... | 6 |
public URL getUkeplan(String ID, int week, int x, int y) {
String adresse = "http://www.novasoftware.se/ImgGen/schedulegenerator.aspx?format=png&schoolid=72150/nb-no&type=3&id={" + ID + "}&period=&week=" + week + "&mode=3&printer=0&colors=32&head=0&clock=0&foot=0&day=0&width=" + x + "&height=" + y + "&maxwidth=" + x... | 2 |
private void paintPuzzle(Graphics g) {
g.setColor(Color.DARK_GRAY);
g.fillRect(0, 0, 1000, 1000);
if (menu != null) {
g.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 20));
g.setColor(Color.WHITE);
int yPos = 150;
int xPos = 80;
for (String curString : getMenuTitle()) {
g.dra... | 9 |
public static void main(String args[]){
PrestataireDeService p=new PrestataireDeService("lodsdggg", "pwwwd");
PrestataireDeService p1=new PrestataireDeService("lo", "pwwwd");
p.setAdresse("sqddqs");
p.setTelephone(123);
PrestataireDeServiceDAO prestataireDeServicedao =new Prestat... | 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://download.oracle.com/javase/t... | 6 |
public void setMainWindowModel(MainWindowModel mainWindowModel) {
this.mainWindowModel = mainWindowModel;
} | 0 |
public static void main(String... args) {
Map<String, List<PathPattern<ServletAction>>> map = new HashMap<String, List<PathPattern<ServletAction>>>();
//init one servlet action
ServletAction servletAction = new ServletAction("profile.jsp", ServletAction.Type.REDIRECT);
PathPattern<Servl... | 6 |
public boolean hasChanged(){
if(parent!=null && parent.hasChanged())
return true;
if(!position.equals(oldPosition) || !rotation.equals(oldRotation) || !scale.equals(oldScale))
return true;
return false;
} | 5 |
public static String runAllTests() throws ConnectionException,
RemoteException {
StringBuffer sbuff = new StringBuffer("");
ConnectorConfig config = new ConnectorConfig();
config.setUsername("asawant02@dev.com");
config.setPassword("test@234");
config.setAuthEndpoint("https://login.salesforce.com/services/... | 7 |
private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... | 6 |
public void setW(Integer value, boolean status_effect) {
if((value == 0) && status_effect) {
status.setBit(bits.Z);
PIC_Logger.logger.info("Flag: Zero");
}
else if(value > 255) {
value -= 256;
if(status_effect){
status.setBit(bits.C);
PIC_Logger.logger.info("Flag: C");
}
}
else if(valu... | 6 |
public static void console() {
Fachada fachada = Fachada.getInstance();
Scanner console = new Scanner(System.in);
boolean stop = false;
while(!stop) {
System.out.println("Escolha a opcao:\n" + "1. Indexar\n" + "2. Buscar\n" + "3. Encerrar");
int opcao = console.nextInt();
// ACTION 1 => INDE... | 4 |
public void update(BufferedImage bimg) {
int[] pixels = new int[bimg.getWidth() * bimg.getHeight()];
bimg.getRGB(0, 0, bimg.getWidth(), bimg.getHeight(), pixels, 0,
bimg.getWidth());
ByteBuffer buffer = BufferUtils.createByteBuffer(bimg.getWidth()
* bimg.getHeight() * 4);
for (int y = 0; y < bimg.getH... | 2 |
public void append(char c) {
if (c != '0' && c != '1') {
throw new IllegalArgumentException("Argument must be '0' or '1'");
}
path_ = path_ + c;
} | 2 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
String line;
while ((line = in.readLine()) != null) {
int n = Integer.parseInt(line.trim());
if (n == 0)
break;
p = new Poin... | 4 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Person)) return false;
Person person = (Person) o;
if (!firstName.equals(person.firstName)) return false;
if (!mail.equals(person.mail)) return false;
if (!phone.equals(person... | 6 |
public String getCountry() {
return super.getCountry();
} | 0 |
public void run() {
while (!isInterrupted()) {
// hier wird die Zieladresse (target) aus der Nachricht extrahiert
try {
String message = receive();
// System.out.println("ServerThread "+myNumber+":"+" "+message);
if (message != null) {
StringTokenizer ST = new StringTo... | 6 |
private int winnerIs(int WeaponOne, int WeaponTwo) {
if(WeaponOne<0 || WeaponOne>2 || WeaponTwo<0 || WeaponTwo>2) return-1;
int resultNum=(3+WeaponOne-WeaponTwo)%3;
int winningPlayerIsNum=resultNum;
return winningPlayerIsNum;
} | 4 |
public static void main(String[] args) {
com.proxious.jdblib.mysql.MySQL mySQL = new com.proxious.jdblib.mysql.MySQL("localhost", "3306", "root", "root", "test");
mySQL.openConnection();
if (mySQL.isOpen()) {
System.out.println("Connection open.");
}
else {
... | 6 |
public List listar() {
String sql = "SELECT * FROM PEDIDO as r inner join cliente as c on r.idCliente = c.idCliente";
try {
conn = GerenciaConexaoBD.getInstance().getConnection();
PreparedStatement stmt = conn.prepareStatement(sql);
ResultSet rs = stmt.executeQuery();
List<Reserva> listarReserva = new... | 2 |
public ListNode reverseBetween(ListNode head, int m, int n) {
if (head == null) return head;
int length = n - m +1;
if (length == 1) return head;
ListNode tail = head;
for (int i = 0;i<n ;i++) tail = tail.next;
if (m == 1)
{
return reverse(head,tail, length);
}
ListNode p ... | 5 |
public void dropClient(int clientId, String reason) {
logger.finer("Dropping client " + clientId + ": " + reason);
boolean clientDropped = false;
synchronized(CONNECTION_LOCK) {
if(clients.containsKey(clientId)) {
ClientInfo client = clients.get(clientId);
try {
sendPacket(Packet.createForceDiscon... | 3 |
public BigInteger[][] getEncryptionKeys(BigInteger[] keyArray) {
// String keyString
BigInteger[] outputArray = new BigInteger[52];
// BigInteger[] keyArray = Helper.stringToBigIntegerArray(keyString);
BigInteger key = Helper.bigIntegerArraySum(keyArray, 8);
BigInteger[] shortKeyArray = Helper.ext... | 7 |
public static void main(String[] args) {
ArrayList<Integer> primes = new ArrayList<Integer>();
for (int i = 0; i < isPrime.length; i++)
if (isPrime[i])
primes.add(i);
int first = 0, second = 0, third = 0;
for (int i = 0; i < primes.size(); i++)
for (int j = i + 1; j < primes.size(); j++){
int k =... | 8 |
private void begin() {
int[] i = new int[101];
int[] v = new int[101];
int[] x = new int[101];
int[] l = new int[101];
int[] c = new int[101];
for ( int n = 1; n <= 100; n++ ) {
i[n] = i[n-1];
v[n] = v[n-1];
x[n] = x[n-1];
l[n] = l[n-1];
c[n] = c[n-1];
String roman = romanize(n);
for ( ... | 8 |
private void hSplit() {
boolean keepReading = true;
int index;
while (keepReading) {
try {
String line = null;
Tuple t = null;
while ((line = input.getNextString()) != null) {
if (line.indexOf("END") == 0) {
keepReading = false;
}
else {
t = Tuple.makeTupleFromPipeDa... | 6 |
private void updateStateExit(List<Keyword> keywords, List<String> terms) {
for (Keyword kw: keywords) {
for (DialogState d : kw.getReference()) {
if (d.getCurrentState() == Start.S_EXIT) {
Main.giveMain().setUserLoggedIn(false);
return;
}
}
}
} | 3 |
private float limit(float eq)
{
if (eq==BAND_NOT_PRESENT)
return eq;
if (eq > 1.0f)
return 1.0f;
if (eq < -1.0f)
return -1.0f;
return eq;
} | 3 |
public static int luma(int color)
{
int red = (color & RED_MASK) >> 16;
int green = (color & GREEN_MASK) >> 8;
int blue = (color & BLUE_MASK);
double y = 0.3*red + 0.59*green + 0.11*blue;
return (int)y;
} | 0 |
public static void main(String[] args) {
final A a = new A();
for (int i = 0; i < 3; i++) {
new Thread() {
@Override
public void run() {
while (true) {
... | 4 |
public boolean equals(Object o) {
if (o == this)
return true;
if (o instanceof ArrayType) {
ArrayType type = (ArrayType) o;
return type.elementType.equals(elementType);
}
return false;
} | 2 |
public void keyReleased(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_A || e.getKeyCode() == KeyEvent.VK_D) p1.stop();
if(e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_RIGHT) p2.stop();
} | 4 |
@Test
public void nullAndEmptyStringsAreIgnored_whenAdded() {
trie.add(null);
trie.add("");
//assertFalse(trie.contains(null));
assertFalse(trie.contains(""));
} | 0 |
public int getX() {
return x;
} | 0 |
public BufferedImage load(String path)
{
try
{
return ImageIO.read(getClass().getResource(path));
}
catch (IOException ex)
{
System.out.println(ex.getMessage());
}
return null;
} | 1 |
private boolean startSprinkler(StartReason reason) {
if (DeviceStatus.humidityStatus >= 80 && reason != StartReason.MOTION) {
Log.log(reason.toString() + ": humidity too high, sprinkler not started", deviceName);
return false;
} else if (DeviceStatus.weatherStatus == DeviceStatus.WeatherStatus.HEAVY_RAIN || D... | 8 |
private boolean isWord( String s ) {
return ( !"/".equals( s ) && !SPECIAL.contains( s ) && !SPACE
.contains( s ) );
} | 2 |
protected void processTextAreaBlocks(List<String> taBlocks) {
if(generateStatistics) {
for(String block : taBlocks) {
statistics.setPreservedSize(statistics.getPreservedSize() + block.length());
}
}
} | 2 |
public static URL loadResourceAsURL(String resourcePath) {
if(resourcePath.startsWith("/")){
return ResourceLoader.class.getResource(resourcePath);
}else{
System.err.println("A resource path must(!) begin with a \"/\"");
return null;
}
} | 1 |
public static String loadFromFile() throws IOException {
Map<String, UserEntity> map = new HashMap<String, UserEntity>();
String webRoot = Utils.getWebRoot();//this.getServletConfig().getServletContext().getRealPath("/");
File file = new File(webRoot + "account.txt");
BufferedReader read... | 4 |
public Set<Map.Entry<Float,Byte>> entrySet() {
return new AbstractSet<Map.Entry<Float,Byte>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TFloatByteMapDecorator.this.isEmpty();
}
publ... | 8 |
public void resetAP(MapleClient c, byte stat) {
MapleCharacter player = c.getPlayer();
short amount = 0;
switch (stat) {
case 1: // STR
amount = (short) (player.getStat().getStr() - 4);
if ((player.getRemainingAp() + amount) > 32767) {
... | 8 |
@Override
public void onEnable() {
if (!beenEnabled) {
PluginManager pm = getServer().getPluginManager();
log.debug("Registering events:");
// The "UI", checks for hits against controller blocks
log.debug(" - BLOCK_DAMAGE");
pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Event.Priority.H... | 7 |
private int buildJump(int xo, int maxLength) {
gaps++;
//jl: jump length
//js: the number of blocks that are available at either side for free
int js = random.nextInt(4) + 2;
int jl = random.nextInt(2) + 2;
int length = js * 2 + jl;
boolean hasStairs = random.nex... | 9 |
protected void computeInitialFeasibleSolution() {
for (int j = 0; j < dim; j++) {
labelByJob[j] = Double.POSITIVE_INFINITY;
}
for (int w = 0; w < dim; w++) {
for (int j = 0; j < dim; j++) {
if (costMatrix[w][j] < labelByJob[j]) {
labelByJob[j] = costMatrix[w][j];
}
... | 4 |
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.