text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean swiftRight(int idUser, boolean pickup) {
int passengers = 0;
int i = 0, j = 0;
Action a;
Action n = new Action(idUser, pickup);
for (i = 0; i < size(); ++i) { //Encontrar la acción
a = get(i);
if (a.idUser == idUser && a.isPickup == pickup) break;
else if (a.isPickup) ++passe... | 8 |
private void loadObjects(){
FileReader reader = null;
try{
String path = "D:\\SpringProjects\\TheGreyWolves\\FishingBoat\\msmunchen.obj";
if(unit!= null){
if(unit.getType()==TYPE.DESTROER){
path = "D:\\SpringProjects\\TheGreyWolves\\WICK40\\Wick40.obj";
}else if(unit.getType()==TYPE.SUBMAR... | 6 |
@Override
public void run() {
//Novo scanner usando o teclado como entrada
Scanner scanner = new Scanner(System.in);
try{
while(true){
if(stop)
break;
//operação bloqueante, travar até... | 5 |
public static String read(String filename) {
try {
BufferedReader br = new BufferedReader(new FileReader(filename));
String inputLine;
StringBuffer sb = new StringBuffer();
while ((inputLine = br.readLine()) != null) {
sb.append(inputLine + "\n");
}
br.close();
return sb.toString();
} catch... | 2 |
private String valida(HttpServletRequest request, Notas notas) {
String error = null;
String idnota = request.getParameter("idnota");
String idalumno = request.getParameter("idalumno");
String nota = request.getParameter("nota");
Integer idnotax = null;
if (idnota != nul... | 9 |
public static boolean index(char[] cs,char[] cl){
if(cs==null||cl==null){
return false;
}
if(cl.length!=cs.length){
return false;
}
boolean res= false;
for(int i=0;i<cl.length;i++){
for(int j=0;j<cs.length;j++){
}
}
return res;
} | 5 |
public LigneMarqueur compare ( Ligne comparant){
LigneMarqueur liMarq = new LigneMarqueur(taille); // On déclare une liste de marqueurs correspondant à la ligne
boolean[] existeTab = new boolean[taille]; // Ce tableau mettra true si la case correspondant à cet indice est présente. Ce tableau permet de n... | 9 |
public CycAssertion readAssertion()
throws IOException {
CycList formula = null;
Object formulaObject = null;
CycAssertion cycAssertion = null;
formulaObject = readObject();
if (formulaObject.toString().equals("NIL")) {
// bypass invalid assertion mt
readObject();
cycAsse... | 3 |
public static void main(String[] args) {
w = new Worker();
} | 0 |
public final void start(String[] args, boolean startProcess) {
ArgumentList argumentList = new ArgumentList(args);
// Ist der Parameter vorhanden
if (argumentList.hasArgument("-gui") == false) {
final String errorString = "Der Parameter -gui= wurde nicht angegeben";
JOptionPane.showMessageDialog(null, erro... | 8 |
protected static boolean reportError(final Electronics me, final Software controlI, final MOB mob, final String literalMessage, final String controlMessage)
{
if((mob!=null) && (mob.location()==CMLib.map().roomLocation(me)) && (literalMessage!=null))
mob.tell(literalMessage);
if(controlMessage!=null)
{
if(... | 7 |
public static Rectangle2D parseNormalisedRectangle(PDFObject obj)
throws IOException {
if (obj != null) {
if (obj.getType() == PDFObject.ARRAY) {
PDFObject bounds[] = obj.getArray();
if (bounds.length == 4) {
final double x0 = bounds[0... | 5 |
private int ensurePositiveCoordinate(int i, int dimension) {
int iPositive = i;
if (iPositive == 0) {
iPositive += dimension;
}
return iPositive;
} | 1 |
@Override
public int awardPoints(boolean[] sv,int objectSize) {
if(objectSize>sv.length){
for (boolean b : sv) {
if(!b) return 0; //If any part is free of the object
}
return 1;
}
else{ //Tracker should catch it
int c = 0;
for (boolean b : sv) {
if(b) c++;
}
return c == objectSi... | 6 |
public Updater(Plugin plugin, int id, File file, UpdateType type,
boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile = plugin.getDataFolder().getParentFile... | 9 |
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
//HyperPVP.checkWorlds();
/*if (event.getPlayer().getWorld() == HyperPVP.getDefaultWorld()) {
int max = 66; // 500
int least = -65; // -500
if (event.getTo().getX() > max || event.getTo().getX() < least) {
moveBack("You can't fly any f... | 4 |
private static void testSuite(){
/* TESTS
x [5,7,4,3,6,9]
x [1,7,5,6,9]
x [3,7,5,2,6]
x [1,7,5,4,6,9]
x [1,2,3,4,5]
x [5,4,3,2,1]
x [2,3,1,7,9,5,8]
x [2,3,1,7,5]
x [1,9,7,10]
x [4,1,3,2]
x [7,1,6,3,2]
x [7,9,6,10,5,8]
*/
int[] hand = new int[]{1,26,27,28,29,30,31,2};
Player[] players = n... | 1 |
public int queryReservation(String bookingID)
{
// id[0] = resID, [1] = reservID, [2] = trans ID
int[] id = parseBookingID(bookingID);
if (id == null) {
return GridSimTags.AR_STATUS_ERROR_INVALID_BOOKING_ID;
}
// search from the list first
ARObject obj = ... | 4 |
public void setBtn_Std_Fontcolor(int[] fontcolor) {
if ((fontcolor == null) || (fontcolor.length != 4)) {
this.buttonStdFontColor = UIFontInits.STDBUTTON.getColor();
} else {
this.buttonStdFontColor = fontcolor;
}
somethingChanged();
} | 2 |
public static ModuleSystemCollection parse(InputStream inputStream) throws SAXException, IOException, ParserConfigurationException{
Document doc = XmlUtil.loadDocument(inputStream);
if(doc != null){
Element root = doc.getDocumentElement();
if(root != null && root.getNodeName().equalsIgnoreCase("ipower") && ro... | 9 |
@Override
public void onCommand(CommandSender sender, Command cmd, String label, String[] arguments)
throws ConsoleOnlyException, InsufficientPermissionException, NotEnoughArgumentsException, PlayerOnlyException, TooManyArgumentsException
{
if(arguments[0].equalsIgnoreCase("reload"))
{
sender.sendMes... | 7 |
public String getCurrentPuzzle() {
String currentPuzzle = "";
for(int i = 0; i < 9; i++) {
for(int j = 0; j < 9; j++) {
if(entries[i][j].isEditable()) {
currentPuzzle = currentPuzzle + "E ";
} else {
currentPuzzle = currentPuzzle + "N ";
}
if(entries[i][j].getText().equals("")) {
c... | 4 |
public static boolean setTime (int i_timeTick) {
if (i_timeTick == m_start[m_curTime]) return false;
if ((m_curTime == -1) || (i_timeTick > m_start[m_curTime])) {
while ((m_curTime + 1 < m_nbMoves) && (i_timeTick >= m_start[m_curTime + 1])) {
m_curTime++;
m_label[m_curTime].move(m_angle[m_curTime]);
}... | 8 |
@Override
public void keyReleased(KeyEvent e) {
if (!view.getNameTextField().getText().equals("")){
boolean unique=true;
String visibility = (String) view.getVisibilityComboBox().getSelectedItem();
Visibility visi;
if (visibility.equals("private")) visi= Visibility.PRIVATE;
else if (visibility.equals(... | 9 |
private void bash(String cmd, File cwd) {
if (System.getProperty("os.name").startsWith("Windows")) {
println("only works with Unix-shell!");
return;
}
try {
println("Path: " + cwd.getAbsolutePath());
println(cmd);
ProcessBuilder pb = new ProcessBuilder("bash", "-c", cmd);
if (cwd != null) {
... | 5 |
private void addNode4everyone(Node n) {
if (n.getType() == NodeType.INPUT) {
if (!inNodes.contains(n)) {
inNodes.add(n);
}
} else if (n.getType() == NodeType.HIDDEN) {
if (!hiddenNodes.contains(n)) {
hiddenNodes.add(n);
}
... | 6 |
private void paramCompare(Method aMethod, ExprList exprList) {
// Se o metodo nao tiver parametros E nao houver parametros a serem passados
// simplesmente retorno
if (aMethod.getParamList().getSize() == 0 && exprList == null) {
return;
}
// SEM - comparando o NUMERO de parametros passados vs... | 8 |
private static <T extends Comparable<? super T>> int partition(ArrayList<T> list, int start, int end){
int pivPos = bestPivotStrategy(list,start,end);
T pivot = list.get(pivPos);
normalSwap(list, start, pivPos);
int left = start+1;
int right = end;
while(true){
while(left <= right)
if(list.get... | 7 |
public Participant(String id, String name, InetAddress addr, String textColor) {
this.id = id;
this.name = name;
this.addr = addr;
this.textColor = textColor;
lastSignal = System.currentTimeMillis();
} | 0 |
@SuppressWarnings("unchecked") // guarded by typeToken.equals() call
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
boolean matches = exactType != null
? exactType.equals(type) || matchRawType && exactType.getType() == type.getRawType()
: hierarchyType.isAssignableFrom(ty... | 4 |
private void userHelp (ArrayList < String > command)
{
String topic;
if (command.size () > 1)
{
topic = command.get (1);
}
else
{
topic = "";
}
System.out.println ("");
if (topic.equals (""))
{
System.out.
print ("alarm on|off..............turns audible alarm o... | 8 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Proveedores)) {
return false;
}
Proveedores other = (Proveedores) object;
if ((this.idproveedores == null && ot... | 5 |
public static boolean RectWithRect(float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2) {
if (x1 > x2+w2 || x1+w1 < x2 || y1 > y2+h2 || y1+h1 < y2) return false;
return true;
} | 4 |
public String trim() {
int i = 0;
boolean test = true;
for(int j = 0; j < this.number.length(); j++) {
if(this.number.charAt(j) != '0' && this.number.charAt(j) != '\0') {
test = false;
break;
}
}
if(test) {
return new String(new CharNode('0'));
}
for(; i < this.number.length() - 1; ... | 6 |
public static void main(String[] args) throws
InterruptedException {
if (args[0].equals("full") || args[0].equals("more")) {
BookBuilder bb;
if (args[0].equals("full"))
{
try {
ComputationController.launchComputation(args[1],
properties.getReduceOutput());
} catch (Exception e)... | 7 |
public static void fillKnapsack(double totalValue, double bagMaxWeight, double itemArray[][], double unitValue[], int itemNumber[], DecimalFormat df){
double[] originalWeight = {itemArray[1][0], itemArray[1][1], itemArray[1][2], itemArray[1][3]};
int limit = 0;
for(int i=0; i<4; i++){
while((itemArray[1][i]) ... | 4 |
public int getScore(Owner owner){
if (owner==Owner.Neutral) return -1;
int Score = 0;
City tempCity;
Iterator<City> CityIterator = iterator();
while(CityIterator.hasNext()){
tempCity = CityIterator.next();
if (tempCity.getOwner() == owner) Sco... | 5 |
protected void paintCenteredText(Graphics2D g2, String s, Rectangle rect,
double fontHeight, Color color)
{
g2 = (Graphics2D) g2.create();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(color);
Rectangl... | 2 |
public boolean containsOffset(int offset){
int b = start.getOffset();
int e = end.getOffset();
if ( b<e && offset >= b && offset < e ) return true;
return false;
} | 3 |
public boolean remove(DataRow row)
{
if(!checkUser())
{
return false;
}
boolean result;
row = addIdentifyingParameters(row);
DataRow removed = new DataRow(row.getTableName() + row.getName());
removed.setTableName("removedData");
removed.add... | 4 |
public static boolean isValidResult(Option[] options){
return isSuccessResult(options) || isFailureResult(options) || (isStoppedResult(options));
} | 2 |
public static void longestName(Scanner scanner, int number) {
String[] strings = new String[number];
int maxLength = 0;
for (int i = 0; i < number; i++) {
System.out.print("Name #" + (i + 1) + ": ");
strings[i] = scanner.nextLine();
if (maxLength < string... | 7 |
public Object getValueAt(int row, int column) {
switch(column) {
case 0 : return rowHeadings[row];
case 1 :
switch (row) {
case 0 : return statement.getSourceFile().getName();
case 1 : return statement.getLineNo();
... | 7 |
private void drawFans(Graphics2D g) {
List<Fan> fans = model.getFans();
if (fans.isEmpty())
return;
Stroke oldStroke = g.getStroke();
Color oldColor = g.getColor();
Symbol.FanIcon fanIcon = new Symbol.FanIcon(Color.GRAY, Color.BLACK, false);
synchronized (fans) {
for (Fan f : fans) {
if (f.isVisib... | 7 |
public static int[] selectionSort(int[] array) {
if(array == null || array.length <= 1) {
return array;
}
for(int i = 0; i < array.length; i++) {
int min = array[i];
int index = i;
for(int j = i; j < array.length; j++) {
if(array[j] < min) {
min = array[j];
index = j;
}
}
... | 5 |
public synchronized void addLobby(GameSettings gs, ClientThread ct) {
Packet answer = null;
if(gs == null || ct == null) {
answer = Packet.getServerErrorPacket();
} else {
lastID++;
Lobby l = new Lobby(lastID, gs, this);
... | 3 |
public static String StrFill(String fillStr ,String oldStr ,int length ,String place)
{
StringBuffer sb = new StringBuffer();
if("right".equals(place)){
sb.append(oldStr);
}
for(int i=0; i < (length - oldStr.length());i++){
sb.append(fillStr);
}
if("left".equals(place)){
sb.append(oldStr);
}
... | 3 |
public static <T extends Comparable<T>> BasicNode<T> getParentNodeOrNull(
BasicNode<T> root,
T valueToSearch) {
if (null == root || null == valueToSearch) {
throw new IllegalArgumentException("Root or value to be inserted can not be null.");
}
if (root.getValue().equals(valueToSearch)) {
... | 8 |
@Override
public void focusGained(FocusEvent e) {
if(e.getSource()==joinIP && getJoinIP().equals("localhost")) {
joinIP.setText("");
} else if (e.getSource()==hostPort && getJoinPort() == 1234) {
hostPort.setText("");
} else if (e.getSource()==joinPort && getJoinPort() == 1234) {
joinPort.setText("");
... | 8 |
private static String bindParamIntoQuery(String query, Object parameter) {
try {
String paramAsJson = convertParameter(parameter);
return query.replaceFirst(TOKEN, getMatcherWithEscapedDollar(paramAsJson));
} catch (RuntimeException e) {
return handleInvalidBinding(query, parameter, e);
}
} | 1 |
public static boolean GetKeyDown(int keyCode)
{
return GetKey(keyCode) && !m_lastKeys[keyCode];
} | 1 |
public static void main(String[] args) throws IOException {
int count_success = 0;
int count_failure = 0;
String bucket = getBucket();
Collection<MyTask> collection = new ArrayList<MyTask>();
for (int i = 0; i < NUM_TASKS; i++) {
String uniqueKey = "file-" + UUID.ra... | 4 |
static public String generalizeWildcard(String s) {
if (s==null)
return "*";
int ix=s.length()-1;
if(ix<=1)
return "*";
while(ix>0 && s.charAt(ix)=='*')
ix--; // skip any * fields starting from the end
return s.substring(0, ix)+"*";
} | 4 |
@Override
public boolean handleLogLevelCommand(String providedCommandLine,
PrintStream outputStream,
IServerStatusInterface targetServerInterface)
{
boolean retVal = false;
String[] commParts = GenericUtilities.splitBySpace(providedCommandLine);
if(commParts != null && commParts.length == 2)
{
Strin... | 6 |
@Override
public boolean isActive(){
if (context == 0) {
context = -1;
try {
if (getAppletContext() != null)
context = 1;
}catch(Exception e){/**/}
}
if (context == -1)
return active;
return super.isActive();
} | 4 |
public int changeAce(){
if ((cardValue==11)&&(rank.equalsIgnoreCase("Ace")))
cardValue=1;
return cardValue;
} | 2 |
public Klus zoekKlus(int id){
Klus antw = null;
for(Klus k: alleKlussen){
if(k.getKlusNummer()==id){
antw = k;
break;
}
}
return antw;
} | 2 |
public void clearGrid() {
for (int x = 0; x < 4; x++) {
for (int y = 0; y < 4; y++) {
grid[x][y] = 0;
}
}
} | 2 |
@Override
public void newbie() {
log.debug("newbie");
} | 0 |
private int[] getResList()
{
Object[] resList = super.getLocalResourceList();
int resourceID[] = null;
// if we have any resource
if ((resList != null) && (resList.length != 0))
{
resourceID = new int[resList.length];
for (int x = 0; x < resList.length; x++)
... | 4 |
public String multiply(String num1, String num2) {
if(num1.equals("0") || num2.equals("0") )return "0";
int R = 200;
int[] mul = new int[R];
int k = R-1, min = Integer.MAX_VALUE;
//multi
for(int i = num2.length()-1; i >= 0; i--){
int a = num2.charAt(i) - '0';
... | 7 |
public The5zigModUser(String player) {
this.player = player;
} | 0 |
public static int pointInArray(Point p, ArrayList<PathNode> array) {
for (int c = 0; c < array.size(); c++) {
if (p.equals(array.get(c).getLocation())) {
return c;
}
}
return -1;
} | 2 |
public float getProcessStatus() {
if (isComplete) return 100f;
if (process == 0) return 0;
return process / (build_time * 1.0f);
} | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Point3 other = (Point3) obj;
if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x))
return false;
if (Float.floatToIntBits(y) != Floa... | 6 |
public IntervalManager(List<Interval> inters)
{
intervals = new ArrayList<Interval>();
intervals.addAll(inters);
endPoints = new ArrayList<Endpoint>();
for (int i = 0; i < intervals.size(); ++i)
{
Endpoint endPoint = new Endpoint();
endPoint.type = Endpoint.Type.BEGIN;
endPoint.value = ... | 7 |
@Override
public boolean canSeek() {
return this.mAudioInputStream.markSupported() &&
this.mFrameSize != AudioSystem.NOT_SPECIFIED &&
this.mFrameLength != AudioSystem.NOT_SPECIFIED && !this.mClosed;
} | 3 |
@Override
public void run() {
Player player1 = new Player(2000, 0);
Player dealer = new Player(0, 1);
int exit = 0;
int totalPlayer = 0;
int totalDealer = 0;
int moneyBefore = 0;
ArrayList<Card> initialPlayerHand;
ArrayList<Card> initialDealerHand;
... | 9 |
@Override
public void updateBiblio(Bibliothecaire bibliothecaire) throws Exception {
if (bibliothecaire == null) {
throw new NullPointerException("Bibliothecaire null !");
}
if (bibliothecaire.getNom().equals("")) {
throw new Exception("Veuillez renseigner le nom du b... | 8 |
@EventHandler
public void onProxyPing(ProxyPingEvent e) {
PendingConnection c = e.getConnection();
ListenerInfo l = c.getListener();
if (config != null) {
Profile profile = config.findProfile(this, c, l);
if (profile != null) {
ServerPing response = e.... | 8 |
@Override
protected List<ResourceFile> prepareResourceFiles(List<ResourceFile> list) {
if (isInPreEnv) {
// 预发布脚本
List<ResourceFile> preFiles = new ArrayList<ResourceFile>();
// 其他脚本
List<ResourceFile> otherFiles = new ArrayList<ResourceFile>();
//... | 7 |
public YamlPermissionConsole(ConfigurationSection config) {
super("console", config);
} | 0 |
public int uncompress(InputStream in, OutputStream out) throws IOException {
try {
BitInputStream bis = new BitInputStream(in); //compressed file
BitOutputStream bos = new BitOutputStream(out);
int bitMagic = bis.readBits(IHuffConstants.BITS_PER_INT);
if(bitMagi... | 9 |
public static void sort(int[] randomSet)
{
int i = 0;
int m = 0;
while(i < randomSet.length)
{
int j = i + 1;
m = randomSet[i];
while(j < randomSet.length)
... | 3 |
@Override
public void mouseEntered(MouseEvent e) {} | 0 |
private void fixsize() {
if (res.get() != null) {
Tex tex = res.get().layer(Resource.imgc).tex();
sz = tex.sz().add(shoff);
} else {
sz = new Coord(30, 30);
}
} | 1 |
public static Object loadData(File inputFile) {
Object returnValue = null;
try {
if (inputFile.exists()) {
if (inputFile.isFile()) {
ObjectInputStream readIn = new ObjectInputStream(new FileInputStream(inputFile));
returnValue = readIn.readObject();
readIn.close();
} else {
System.er... | 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 |
final void method3773(int i, Interface11 interface11) {
try {
anInt7617++;
if (i != -1)
aString7845 = null;
if (((OpenGlToolkit) this).aBoolean7815) {
method3782(interface11, 327685);
method3751(interface11, i ^ ~0x4f);
} else {
if (anInt7746 >= 3)
throw new RuntimeException();
if (... | 6 |
public void setLatitude( double latitude ) {
this.latitude = latitude;
} | 0 |
protected void loadModules() {
ConcurrentHashMap<String, String> inputProperties = configuration.filter("eva.modules");
Iterator it = inputProperties.entrySet().iterator();
while (it.hasNext()) {
Map.Entry property = (Map.Entry) it.next();
String key = (String) property.... | 2 |
@Override
public void init() {
Label dakror = new Label(Display.getWidth() / 2 - 768 / 2, Display.getHeight() / 2 - 384 / 2, 768, 384, "");
dakror.setTexture("/graphics/logo/dakror.png");
content.add(dakror);
Label ichmed = new Label(Display.getWidth() / 2 - 768 / 2, Display.getHeight() / 2 - 384 / 2, 768, ... | 3 |
public double[] compareCollection(Collection otherCollection) {
int similarSongCount = 0;
HashMap<String, Artist> other = otherCollection.getArtists();
Set<String> keySet = other.keySet();
Iterator i = keySet.iterator();
while(i.hasNext()) {
String tmpName = (String)i.next();
if(artists.containsKey(tmpN... | 2 |
@Transactional
public Experiences GetAllExperiencesWithSharedEventsAndUsersMoodEvent(String username) {
Experiences exps = getExperiences(username);
Experiences sharedExps = new Experiences();
User user = getUser(username);
for (Experience experience : exps.getExperiences()) {
if (experience.isShared() && ... | 7 |
public void checkCollision() {
for (OperateShape shape : shapes) {
if (shape instanceof Circle) {
for (OperateShape checkShape : shapes) {
event = new CollisionEvent();
if (checkShape instanceof Circle) {
} else if (checkShape instanceof Block) {
} else if (checkShape instanceof Bar) {
... | 7 |
public void discoverWeb(String root) {
//BFS algorithm is implemented below
this.queue.add(root);
this.discoveredWebsiteList.add(root);
while (!queue.isEmpty()) {
String v = this.queue.remove();
String rowHtml = readURL(v); // read the html content of the newly found website
String regexp = "htt... | 4 |
private double getEntropy(List<Example> exampleCollection) {
double positiveExampleCount = 0;
double negativeExampleCount = 0;
double q;
for (Example e : exampleCollection) {
if (e.getWinner() == 1) {
positiveExampleCount++;
} else {
negativeExampleCount++;
}
}
if (!((positiveExampleCount... | 5 |
@Override
public void paintComponent(Graphics g){
super.paintComponent(g);
if(nodes.get(0) == null)
{
return;
}
Graphics2D g2 = (Graphics2D)g;
g2.setColor(Color.blue);
int x = 0;
int y = 0;
double xs = (double)(this.getWidth()-b-(no... | 8 |
private boolean withinBounds(String direction) {
ArrayList<Integer> neighbours = new ArrayList<Integer>(getNeighbours(location, size));
int check = 0;
boolean ret = false;
if(direction.equals("up")){
check = location - size;
if(neighbours.contains(check)){
ret = true;
}
}
if(direction.equ... | 8 |
public static List<List<Integer>> combine(int n, int k) {
if (0 == k || k > n) return null;
if (k == n) {
List<List<Integer>> res = new ArrayList<List<Integer>>();
List<Integer> l = new ArrayList<Integer>();
for (int i = 1; i <= n; i++) {
l.add(i);
}
res.add(l);
... | 8 |
@Override
public boolean shouldReact(Message message) {
if(message.text.equals("counter get"))
return true;
try {
getNum(message.text.replaceAll(" ", ""));
return true;
}
catch(NumberFormatException ex) {
return false;
}
} | 2 |
private static void test2_3() throws FileNotFoundException {
String test1 = "new game\n"+"examine\n"+"quit\n"+"yes\n";
HashMap<Integer, String> output = new HashMap<Integer, String>();
boolean passed = true;
try {
in = new ByteArrayInputStream(test1.getBytes());
System.setIn(in);
out = new PrintSt... | 7 |
public boolean connectServer(int port, String hostIp, String name) {
// 连接服务器
try {
socket = new Socket(hostIp, port);// 根据端口号和服务器ip建立连接
writer = new PrintWriter(socket.getOutputStream());
reader = new BufferedReader(new InputStreamReader(socket
... | 1 |
private void checkStudents(Group newGroup, Group oldGroup)
throws ServerException {
if (log.isDebugEnabled())
log.debug("Method call. Arguments: " + newGroup + " " + oldGroup);
for (Student oldStudent : oldGroup.getStudents()) {
int j = 0;
for (Student newStudent : newGroup.getStudents()) {
if (!old... | 8 |
public void salvar(String grupo, String nome, String numTelefone) {
telefoneDAO = new TelefoneDAO();
setTelefone(telefone);
if (this.telefone.getCodtelefone() == null) {
try {
telefoneDAO.busca(numTelefone);
JOptionPane.showMessageDialog(null, "Telefon... | 5 |
private BSTNode<T> recAdd(T element, BSTNode<T> tree) {
if (tree == null) // insert new element here
tree = new BSTNode<T>(element);
else if (element.compareTo(tree.getInfo()) <= 0) // Add in left subtree
tree.setLeft(recAdd(element, tree.getLeft()));
else ... | 2 |
@Override
public void process_term (int linger_)
{
if (timer_started) {
io_object.cancel_timer (reconnect_timer_id);
timer_started = false;
}
if (handle_valid) {
io_object.rm_fd (handle);
handle_valid = false;
}
if... | 3 |
public Icon getIcon() {
if (tile == null) {
return null;
}
else if (!tile.isFaceUp()) {
return ICON_FACE_DOWN;
}
else if (tile instanceof Bear) {
return ICON_BEAR;
}
else if (tile instanceof Duck) {
return ICON_DUCK;
}
else if (tile instanceof Fox) {
ret... | 9 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((msg.amITarget(affected))
&&(mobs.contains(msg.source())))
{
if((msg.targetMinor()==CMMsg.TYP_BUY)
||(msg.targetMinor()==CMMsg.TYP_BID)
||(msg.targetMinor()==CMMsg.TYP_SELL)
||(msg.targetMinor()==CMMsg.T... | 8 |
public final String getMethodName(int identifier) {
String mname = methods[identifier].getName();
int j = ClassMetaobject.methodPrefixLen;
for (;;) {
char c = mname.charAt(j++);
if (c < '0' || '9' < c)
break;
}
return mname.substring(j);
... | 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.