text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void run() {
while(running){
try{
if(inStream.available() > 0){
gameTime = inStream.readDouble();
gamePeriod = inStream.readInt();
gameState = inStream.readInt();
playerArray = (int[][]) inStream.readObject();
for(int i=0;i<3;i++){
ballArray[i] = inS... | 6 |
@Override
public void actionPerformed(ActionEvent e) {
String action = e.getActionCommand();
System.out.println(action);
if (action == "W") {
keyState.W = true;
}
if (action == "released W") {
keyState.W = false;
}
if (action == "A") {
keyState.A = true;
}
if (action == "rel... | 8 |
private static boolean endsWith_cvc(final String word)
{
char[] c = word.toLowerCase().toCharArray();
if (c.length >= 3)
{
if (isConsonant(c[c.length - 3], c[c.length - 4]) && // c
!isConsonant(c[c.length - 2], c[c.length - 3]) && // v
isConsonant(... | 5 |
private UtilityClass() {
throw new AssertionError();
} | 0 |
public Card getCard() {
Card c;
cardGetter = myCards.iterator(); // Start from beginning each time
int next = (int) (Math.random() * size()) + 1;
c = cardGetter.next();
for (int i = 1; i < next; i++) {
c = cardGetter.next();
}
cardGetter.remove(); // ... | 1 |
@Override
public void onNextTetrominoesChanged(List<Tetromino> tetrominoes) {
for (int i = 0; i < tetrominoes.size(); i++) {
next.get(i).setTetromino(tetrominoes.get(i));
}
} | 1 |
public static String lettersToPractice(String letters, int[] times)
{
StringBuilder sb = new StringBuilder();
float avg = 0;
int[] r = new int[times.length];
for(int i = 0; i < times.length; i++)
{
if(i == 0) { r[i] = times[i]; avg += r[i]; }
else { r[i] = times[i] - times[i - 1]; avg += r[i]; }
... | 4 |
static public boolean isValidValueName(String name)
{
int i;
for(i = 0; i < name.length(); i++)
{
char c = name.charAt(i);
if(!(Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-'))
{
return false;
}
}
return true;
} | 5 |
public void visit(final int version, final int access, final String name,
final String signature, final String superName,
final String[] interfaces) {
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
cp.newUTF8("Deprecated");
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
cp.newUTF8("Synthetic");
}
c... | 6 |
public static ParsableCommand getCommandFromLetter(String identifier) throws Exception{
if(_commandList != null){
for(int i=0; i<_commandList.length; i++){
if(_commandList[i].getIdentifier().equals(identifier)){
return _commandList[i];
}
... | 3 |
public void update(float delta) {
int nBlocks=0;
processInput();
processCollisions();
// We update the ball and check how many blocks are left
for (Entity entity : world.getEntities()) {
entity.update(delta);
if (entity.getObjectID() == ObjectIDType.BALL) {
if (((Ball)entity).getState()==Ball.State.... | 9 |
protected boolean createPath(Lane next)
{
fPath.add(next);
if(next.equals(fEnd))
{
return true;
}
//draw((Graphics2D)(next.getGlobals().getMap().getGraphics()),new Candidate(next));
Collection<Lane> candidates = next.getEnd().getOutputLanes();
List<Ca... | 8 |
public boolean userHasGamedSaved(User user) {
File file = new File("Users.txt");
Scanner scanner;
try {
scanner = new Scanner(file);
while (scanner.hasNextLine()) {
String lineFromFile = scanner.nextLine();
if(lineFromFile.contains(user.getUsername())) {
lineFromFile = scanner.nextLine(... | 6 |
public void updateGame(double time) {
if (getHero().getPlayerLose()) {
updatesBeforeLoseMade++;
if (updatesBeforeLoseMade > UPDATES_BEFORE_LOSE_SCREEN) {
isRunning = false;
}
}
for (MovingObject unit : LevelDesign.getFrameDesigns().get(current... | 7 |
private boolean jumpingEnemy(Move m) {
int dx = (m.getCol1() - m.getCol0()) / m.length();
int dy = (m.getRow1() - m.getRow0()) / m.length();
for (int i = 1; i < m.length(); i++) {
if (_contents[m.getRow0() + i * dy - 1][m.getCol0() + i * dx - 1].
side() == turn().... | 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 fe... | 6 |
@Override
public String inferBinaryName(Location location, JavaFileObject file) {
if (file instanceof UrlJavaFileObject) {
UrlJavaFileObject urlFile = (UrlJavaFileObject) file;
return urlFile.getBinaryName();
} else {
return super.inferBinaryName(location, file);
... | 1 |
public static void readInput(int where, Object[] stringPath) {
String path = (String)stringPath[0];
File file = null;
FileReader fr = null;
BufferedReader br = null;
String text = "";
try {
file = new File (path);
fr = new FileReader (file);
br = new Buffer... | 5 |
@Override
public boolean canDeleteSelection() {
if (mDeletableProxy != null && !mSelectedRows.isEmpty()) {
return mDeletableProxy.canDeleteSelection();
}
return false;
} | 2 |
public static LinkedList<String> getInputNatureList()
{
LinkedList<String> l = new LinkedList<String>();
try
{
BufferedReader in = new BufferedReader(new FileReader(
"nature-of-input.lst"));
String algo;
while ((algo = in.readLine()) != null)
l.add(algo);
in.close();
}
catch (IOExceptio... | 2 |
public static ImageIcon getImageIcon(String name){
return new ImageIcon(Resources.class.getResource(name));
} | 0 |
public void atualiza(double taxa){
if(cliente != null){
if(cliente.getTipoCliente() == TipoCliente.UNIVERSITARIO){
this.saldo += this.saldo * taxa * TipoCliente.UNIVERSITARIO.getMultiplicador();
}else
if(cliente.getTipoCliente() == TipoCliente.CORPORATIVO... | 4 |
static void floodFill( int i,int j, char targetColor ){
Queue<Integer> posX = new LinkedList<Integer>();
Queue<Integer> posY = new LinkedList<Integer>();
posX.add(i);
posY.add(j);
visitados[i][j] = true;
while(!posX.isEmpty()){
int x = posX.poll();
int y = posY.poll();
for (int k = 0; k < dx.lengt... | 8 |
protected void checkLogFile() {
if (printWriter != null)
return;
try {
printWriter = new PrintWriter( new BufferedWriter(new FileWriter(logFilePath)));
}
catch (IOException e) {
System.err.println("Error creating log file " + logFilePath);
... | 3 |
private boolean refreshJTable()
{
try
{
try
{
this.jtblProcessList.removeAllRows();
} catch (Exception localException1) {
}
for (int i = 0; i < this.alCurrentDisplayedProcesses.size(); i++)
{
if (this.filterEnabled_ProcessList)
{
this.addPr... | 9 |
public int _flushKey(int key) throws RegistryErrorException
{
try
{
Integer ret = (Integer)flushKey.invoke(null, new Object[] {new Integer(key)});
if(ret != null)
return ret.intValue();
else
return -1;
}
catch (InvocationTargetException ex)
{
throw new Regis... | 4 |
private void initUi() {
JMenuBar menuBar = new JMenuBar();
JMenu factMenu = new JMenu("Facts");
JMenu ruleMenu = new JMenu("Rules");
menuBar.add(factMenu);
menuBar.add(ruleMenu);
//-------------
// ADD FACT
//-------------
JMenuItem ... | 2 |
@Override
public String getGUITreeComponentID() {return this.id;} | 0 |
public static boolean eliminarSucursal (String ip) {
Document doc;
Element root;
List <Element> rootChildrens;
boolean found = false;
int posAEliminar = 0,posIzquierda = 0,posDerecha = 0;
SAXBuilder builder = new SAXBuild... | 7 |
protected boolean centerCause(int x1, int x2, int y1, int y2, int r1, int r2){
double d = pow(x2 - x1, 2) + pow(y2 - y1, 2);
if (d <= pow(r1, 2)){
return true;
}
else {
return false;
}
} | 1 |
public static void selectDownText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
Node currentNode = textArea.node;
int currentPosition = textArea.getCaretPosition();
if (currentPosition == textArea.getText().length()) {
return;
}
// Update Preferred Caret Position
... | 2 |
public SemanticRec term(Attribute formalParam) {
SemanticRec factor;
SemanticRec ft;
SemanticRec term = null;
debug();
switch (lookAhead.getType()) {
case MP_IDENTIFIER:
case MP_FALSE:
case MP_TRUE:
case MP_STRING_LIT:
case MP_FLOAT_LIT: /... | 9 |
public Queue<String> enfermeroXMLUnit (){
try {
path = new File(".").getCanonicalPath();
FileInputStream file =
new FileInputStream(new File(path + "/xml/papabicho.xml"));
DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
... | 9 |
public IVPBoolean lessThan(IVPNumber num, Context c, HashMap map, DataFactory factory) {
IVPBoolean result = factory.createIVPBoolean();
map.put(result.getUniqueID(), result);
boolean resultBoolean = false;
if(getValueType().equals(IVPValue.INTEGER_TYPE) && num.getValueType().equals(IVPValue.INTEGER_TYPE)){
... | 5 |
@Override
public String getDesc() {
return "PulseStrike";
} | 0 |
public static int maxPathSum2(TreeNode root) {
if(root == null) return 0;
if(root.left == null && root.right == null) return root.val;
//helper[0] min, helper[1] leftMax, helper[2] rightMax
int[] helper = new int[3];
int max = 0;
helper[0] = Integer.MIN_VALUE;
... | 4 |
private int calcBiggestFeasible (int currentQuantity, Set<Integer> productPackCapacitySet) {
int bf = 0;
int i;
for (i = currentQuantity; i >= 1; i--) {
if (productPackCapacitySet.contains(i)) {
bf = i;
return bf;
}
}
return bf;
} | 2 |
*/
protected String withBookkeepingInfo() {
String projectName = "nil";
if (project != null) {
projectName = project.stringApiValue();
}
String cyclistName = "nil";
if (cyclist != null) {
cyclistName = cyclist.stringApiValue();
}
return "(with-bookkeeping-info (new-bookkeep... | 2 |
private void AbstractMatterAction(Tile tile) {
if (selected.getClass().getSuperclass() == City.class) {
if (selected.tile == tile) {
createUnit(tile);
}
}
if (selected.getClass().getSuperclass() == Unit.class) {
move(tile);
}
} | 3 |
private String searchingFile(final String name) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(file));
try {
String line;
while ((line = br.readLine()) != null) {
StringTokenizer str = new StringTokenizer(line, ",");
if ... | 2 |
public int equi ( int[] A ) {
// write your code here
int equilibrium = -1;
int arraySize = A.length;
int[] upwardCount = new int[arraySize];
int[] downwardCount = new int[arraySize];
for (int i = 0; i < arraySize; i++){
//case where we are on the first element
if (i == 0... | 7 |
public void createAndSaveLocs(){
File file = new File(this.getDataFolder(), "arenaLocs.yml");
try {
if(!this.getDataFolder().exists()){
this.getDataFolder().mkdir();
}
file.createNewFile();
FileConfiguration yaml = YamlConfiguration.loadConfiguration(file);
if(this.l != null && this.l.getSpawn() ... | 6 |
private boolean second_round_strategy() {
if (bowlId == 0) maxScoreSoFar = 0;
if (bowlId < chooseLimitTwo) {
maxScoreSoFar = Math.max( maxScoreSoFar, get_bowl_score(bowl) );
System.out.println("Not reached chooseLimit yet, updated maxScoreSoFar = " + maxScoreSoFar);
... | 3 |
@Override
public void updateTitle()
{
final List<Room> V=getAllTitledRooms();
final String owner=getOwnerName();
final int price=getPrice();
final boolean rental=rentalProperty();
final boolean gridLayout = gridLayout();
final int back=backTaxes();
String uniqueID="ROOMS_PROPERTY_"+this;
if(V.size()>0... | 8 |
private void splitHelper(String s, int pos, int seg) {
if (seg == 4 && pos == s.length()) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 4; i++) {
if (i > 0)
sb.append(".");
sb.append(buff[i]);
}
r... | 8 |
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g.drawOval(WIDTH / 2 - TABLE_DIAM... | 8 |
public static String rotateAlgorithm(String alg) {
List<Integer> FPos = new ArrayList<Integer>();
for (int i = 0; i < alg.length(); i++) {
if (alg.charAt(i) == 'F') {
FPos.add(i);
}
}
alg = alg.replace('R', 'F');
alg = alg.replace('B', 'R');
alg = alg.replace('L', 'B');
for (int i : FPos) {
a... | 4 |
private static String replaceSubstitutionVariables(String pParsedStatementString, PromotionFile pPromotionFile)
throws ExLoader {
//Replace variables only if one exists and a property has not been set instructing not to substitute
if(pParsedStatementString.indexOf("$${") > 0){
if(!"true".equals(p... | 4 |
public static void main(String[] args) {
final int WIDTH = 800;
final int HEIGHT = 600;
final String TITLE = "Test frame 12345";
JFrame frame = new JFrame();
frame.setSize(WIDTH, HEIGHT);
frame.setTitle(TITLE);
frame.setResizable(false);
frame.setLocation... | 0 |
public static Description findDuplicateComplexDescription(Description self) {
{ IntegerWrapper index = IntegerWrapper.wrapInteger(Proposition.propositionHashIndex(self.proposition, null, false));
List bucket = ((List)(Logic.$STRUCTURED_OBJECTS_INDEX$.lookup(index)));
Module homemodule = self.homeContext... | 9 |
public static Cons clTranslateMethodParameters(MethodSlot method) {
{ boolean functionP = method.methodFunctionP;
boolean abstractP = method.abstractP;
Cons otree = Stella.NIL;
Stella_Object oparameter = null;
Stella_Object firstparametertype = null;
{ Symbol parameter = null;
... | 9 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Hospede other = (Hospede) obj;
if (this.IdHospede != other.IdHospede && (this.IdHospede == null || !this.... | 5 |
@Override
public String toString() {
return (isLof() ? "LOF=" + toStringVcfLof() + " " : "") //
+ (isNmd() ? "NMD=" + toStringVcfNmd() : "") //
;
} | 2 |
public void Initialize() {
try {
Class.forName(this.dbDriver);
}
catch (ClassNotFoundException ex) {
System.out.println("Impossible d'initialiser le driver.\n" + ex.getMessage());
}
} | 1 |
private ValCol negaMaxWithABPruning(int depth, int counter, int sign,
int alpha, int beta) {
if (isStopSignaled) {
return null;
}
if (boardCopy.gameOver() || depth == depthLimit) {
int util = (int) (Math.pow(discountFactor, depth) * sign * boardCopy.getAnalysis(counter));
return new ValCol(util, -1);/... | 9 |
private void BtGravarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtGravarActionPerformed
if (camposobrigatoriospreenchidos()) {
if (JOptionPane.showConfirmDialog(null, "Tem certeza que deseja Gravar esta operação e de que todas as informações estçao corretas?", "Deseja gravar?... | 8 |
public static void main(String args[]) {
//**********************************************************************************************************************
//**********************************************************************************************************************
// <editor-fo... | 7 |
public static int getCRuleID(String name)
{
for(int i = 0; i < numCRules; i++)
{
if(cRules[i].name().equalsIgnoreCase(name))
{
return i;
}
}
return -1;
} | 2 |
public void tallennaTiedostoon(){
if (kasittelija.getFile() != null) {
kasittelija.muokkaaTiedostonTiettyjaRiveja(kerrattavat);
}
} | 1 |
public static Attributed readAttrs2(Reader source){
Scanner in = new Scanner(source);
Pattern COMMENT = Pattern.compile("#.*");
Pattern attrPat = Pattern.compile("(.*?)=(.*)$", Pattern.MULTILINE);
String comment;
AttributedImpl attrs = new AttributedImpl();
while(in.hasNext()){
if(in.hasNext(COMMENT)){
... | 3 |
public void addCard(Card c) {
if (c == null)
throw new NullPointerException("Can't add a null card to a hand.");
hand.add(c);
} | 1 |
public void setEventBranchList(final List<EventBranch> eventBranchList) {
this.eventBranchList = eventBranchList;
} | 0 |
public boolean detachNext(Linkable paramLinkable) {
boolean b = false;
Object localObject;
if ((paramLinkable instanceof Instruction))
{
localObject = (Instruction)paramLinkable;
if ((((Instruction)localObject).getPreviousInstruction() == null) && (this.CurrentProgram.getFirstInstruction() =... | 6 |
public void removeAttendantFromCourse(int courseId, int studentId) {
if(!isValidId(courseId) || !isValidId(studentId)) {
return;
}
Course course = courseDao.getCourse(courseId);
Student student = studentDao.getStudent(studentId);
if(course != null && student != null) {
course.getAttendants().rem... | 4 |
public List<String> num2words(String phoneNum) {
// List to store all words
List<String> wordList = new ArrayList<String>();
// Extract number, ignore whitespace and punctuation
String _phoneNum = extractPureNumbers(phoneNum);
// Get Phone Number Combinations
List<String> combinations = getNumCombination... | 1 |
private final void gotoBand(final Git gitSession) {
if (gitSession == null) {
return;
}
try {
final String branch = gitSession.getRepository().getBranch();
if (!branch.equals(this.BRANCH.value())) {
this.io.printMessage(
null,
"Not on working branch \"" + this.BRANCH.value()
+ "\"... | 4 |
public static String preProcess(Reader reader) {
int columnStart = 6;
int columnEnd = 72;
try {
// FileInputStream propsStream = new FileInputStream("cb2xml.properties");
Properties props = new Properties();
// props.load(propsStream);
// pro... | 8 |
public void NotifyRunModeChanged(boolean isLocalRunMode) {
for (IRunModeChangedNotification rmc : runModeChangedNotificationListeners) {
rmc.onRunModeChanged(isLocalRunMode);
}
} | 1 |
public HashMap printCliche() throws Exception
{
ArrayList<Integer> answer = this.device.send(0x52, 3, new char[]{});
if (answer.size() == 0)
throw new Exception("Пустой ответ");
HashMap<String, Integer> result = new HashMap<String, Integer>();
if (answer.get(0) == Statu... | 3 |
public void setSuccess(final Boolean success) {
this.success = success;
} | 0 |
public static void toggleCommentText(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree);
toggleCommentForSingleNode(currentNode, undoable);
if (!undoable.isEmpty()) {
undoable.setName("Toggle Comment for Node");
... | 1 |
public void testWithField_unknownField() {
MonthDay test = new MonthDay(9, 6);
try {
test.withField(DateTimeFieldType.hourOfDay(), 6);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
public String getwinner(){
if(stateArrayList[0].size()>stateArrayList[1].size() && stateArrayList[0].size()>stateArrayList[2].size())
return "blue";
if(stateArrayList[1].size()>stateArrayList[0].size() && stateArrayList[1].size()>stateArrayList[2].size())
return "green";
... | 6 |
private PreparedStatement buildUpdateStatement(Connection conn_loc, String tableName,
List colDescriptors, String whereField)
throws SQLException {
StringBuffer sql = new StringBuffer("UPDATE ");
(sql.append(tableName)).append(" SET ");
final Iterator i = colDescriptors.i... | 1 |
public static void main(String args[]){
int op = 6;
//lea.useDelimiter(System.getProperty("line.separator"));
do{
try{
System.out.println("1- Agregar Cuenta");
System.out.println("2- Agregar Amigo");
System.out.println("3- Info... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Conta other = (Conta) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
ret... | 6 |
public static TypePraticien selectOne(EntityManager em, String code) throws PersistenceException {
TypePraticien unTypePraticien = null;
unTypePraticien = em.find(TypePraticien.class, code);
return unTypePraticien;
} | 0 |
@Override
public int compareTo(Object o) {
if (o instanceof Score) {
long otherScore = ((Score) o).getScore();
if (otherScore > _score)
return -1;
else if (otherScore < _score)
return 1;
else {
return -_date.comp... | 3 |
public static ENCODE vauleOf(String value){
if(value.equalsIgnoreCase(ENCODE.Big5.getValue())){
return ENCODE.Big5;
} else if(value.equalsIgnoreCase(ENCODE.UTF8.getValue())){
return ENCODE.UTF8;
} else if(value.equalsIgnoreCase(ENCODE.MS950.getValue())){
return ENCODE.MS950;
} else if(value.equalsIgnor... | 4 |
private float getRatioTop20() {
BigDecimal elapsedTimeTop20 = new BigDecimal(0);
BigDecimal elapsedTimeTotal = new BigDecimal(1);
Connection connection = ConnectionPoolUtils.getConnectionFromPool();
try {
PreparedStatement elapsedTop20Statement = connecti... | 5 |
private int merge(BufferedRandomAccessFile fin, DataOutputStream fout, long offset, long chunkSize, int[][] blocks) throws IOException {
long size1 = fin.length();
if (offset >= size1) {
return -1;
}
int chunkCount = 1;
while (offset + chunkCount * chunkSize < siz... | 7 |
public void setDateFormatString(String dateFormatString) {
try {
dateFormatter.applyPattern(dateFormatString);
} catch (RuntimeException e) {
dateFormatter = (SimpleDateFormat) DateFormat
.getDateInstance(DateFormat.MEDIUM);
dateFormatter.setLenien... | 3 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int[] v = readInts(line);
if (v[0] == 0 && v[1] ==... | 6 |
@Override
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
Mission mission = null;
//如果获取输出对象有问题,不要往下运行了
OutputStream os = response.getOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(os);
InputStream is = request.getInputStre... | 6 |
private void merge( int[] array, int b1, int e1, int b2, int e2 ) {
int i = b1;
int j = b2;
int k = 0;
int[] tempArray = new int[ e2-b1+1 ];
while( i <= e1 && j <= e2 ) {
if( array[i] < array[j] ) {
tempArray[k++] = array[i++];
} else {
tempArray[k++] = array[j++];
}
}
while( i <... | 6 |
@Override
public void keyReleased(KeyEvent ke) {
if (ke.getKeyCode() == KeyEvent.VK_UP) {
palkki2.setNopeus(0);
} else if (ke.getKeyCode() == KeyEvent.VK_DOWN) {
palkki2.setNopeus(0);
}if(ke.getKeyCode() == KeyEvent.VK_W){
if(peli.getClass()==kPeli.getClas... | 6 |
public static void transferFiles(Cons files, Keyword outputLanguage) {
if (Stella.stringEqlP(Stella.rootSourceDirectory(), Stella.rootNativeDirectory())) {
return;
}
{ String flotsamfilename = "";
String systemSubDirectory = (Stella.stringEqlP(((String)(Stella.$CURRENTSYSTEMDEFINITIONSUBDIRECTOR... | 8 |
public static Portal getPortal( String name ) {
for ( ArrayList<Portal> list : portals.values() ) {
for ( Portal p : list ) {
if ( p.getName().equalsIgnoreCase( name ) ) {
return p;
}
}
}
return null;
} | 3 |
public boolean isAttacking() {
return attacking;
} | 0 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Semaphore other = (Semaphore) obj;
if (id == null) {
if (other.id != null)
return false;
} else {
if (!id.equals(other.id))
ret... | 6 |
private void setAlpha(int delta){
int swing = 0;
if (hours >= 20 || hours < 6){
alpha = max;
}
else if (hours >= 6 && hours <= 8){
swing = -1;
}
else if (hours >= 18 && hours < 20){
swing = 1;
}
else{
alpha = min;
}
alpha += swing * rate * delta / 1000.0;
} | 6 |
static boolean tagcompare(byte[] s1, byte[] s2, int n){
int c=0;
byte u1, u2;
while(c<n){
u1=s1[c];
u2=s2[c];
if('Z'>=u1&&u1>='A')
u1=(byte)(u1-'A'+'a');
if('Z'>=u2&&u2>='A')
u2=(byte)(u2-'A'+'a');
if(u1!=u2){
return false;
}
c++;
}
r... | 6 |
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
if(arg0.getSource() == close)
{
player.Stop();
controller.removePlayer(player);
dead=true;
newWindow.dispose();
}
if(arg0.getSource() == static_Open || arg0.getSource() == addSong)
{
JFileChooser choo... | 7 |
private void openExperiment() {
int returnVal = m_FileChooser.showOpenDialog(this);
if (returnVal != JFileChooser.APPROVE_OPTION) {
return;
}
File expFile = m_FileChooser.getSelectedFile();
// add extension if necessary
if (m_FileChooser.getFileFilter() == m_ExpFilter) {
if... | 8 |
static final Class252 method2300(IndexLoader class45, String string,
boolean bool, byte i) {
try {
anInt3877++;
int i_0_ = class45.getArchiveId(string);
if (i != -91)
return null;
if ((i_0_ ^ 0xffffffff) == 0)
return new Class252(0);
int[] is = class45.getActiveChildren(i_0_);
... | 8 |
public static Spell getAirSpell(int i)
{
switch (i)
{
default:
case 0:
return new Airbending();
case 1:
return new AirbendingJump();
case 2:
return new AirbendingTornado();
case 3:
... | 7 |
public int getRomanValue(char c) {
switch (c) {
case 'I':
return 1;
case 'V':
return 5;
case 'X':
return 10;
case 'L':
return 50;
case 'C':
return 100;
case 'D':
return 500;
case 'M':
return 1000;
default:
return 0;
}
} | 7 |
public static void Merge(int[] n, int start, int middle, int finish)
{
int i = start, j = middle + 1;
int m[] = new int [finish - start + 1];
boolean jDone = false, iDone = false;
for(int k = 0; k < m.length; k++)
{
if(!jDone && n[i] > n[j] || iDone)
{
m[k] = n[j];
j++;
if(j > finish)... | 9 |
public int stackSize() {
switch (typecode) {
case TC_VOID:
return 0;
case TC_ERROR:
default:
return 1;
case TC_DOUBLE:
case TC_LONG:
return 2;
}
} | 4 |
public void initializeDB() {
try {
// Load the JDBC driver
Class.forName("org.postgresql.Driver");
System.out.println("Driver loaded");
// Establish a connection
String url = "jdbc:postgresql://ozguryazilim.bilkent.edu.tr/projectsme";
/* String user = "user12";
... | 1 |
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.