text stringlengths 14 410k | label int32 0 9 |
|---|---|
public int findMin(List<Integer> l){
if(l==null){
return 0;
}
if(l.size()==0){
return 0;
}
if(l.size()==1){
return l.get(0);
}
int min = -1;
int tmp;
for(int i=0;i<l.size();i++){
if(i==0){
min = i;
}else{
tmp = l.get(i);
if(tmp <min){
min = tmp;
}
}
}
return ... | 6 |
public static void main(String[] args)
{
System.out.println("Hello and welcome to team 3-3's 449 a1, java version!" + '\n' );
// check if the correct arguments are being used
// myProgram myInput myOutput
_args = args;
if (args.length != 2)
{
System.out.println("Usage: <input file> <output file>");
... | 9 |
@EventHandler(ignoreCancelled = true)
public void handle(BlockPlaceEvent event) {
Player player = event.getPlayer();
GameSession session = plugin.getGameManager().getGameSessionOfPlayer(
player);
if (session == null) {
return;
}
if (!(session.isStarted()) && !(session.isAdmin(player))) {
event.setC... | 5 |
public void move()
{
String snarkyComment = "Can't do that! *mumbles under breath* dummy";
System.out.println("Where to?");
String dir = Driver.getScanner().nextLine();
if(dir.equalsIgnoreCase("up"))
{
if(getCurrentRoom().moveUp())
{
... | 9 |
private static TspPopulation[] generate(){
Graph g = new Graph(INDIVIDUAL_SIZE);
TspPopulation[] h = new TspPopulation[GLOBAL_STEPS];
for (int i = 0; i < GLOBAL_STEPS; ++i){
h[i] = new TspPopulation(POPULATION_SIZE, INDIVIDUAL_SIZE, g.getGraph());
}
resultsRandom = ne... | 7 |
protected JPanel getFontFamilyPanel()
{
if (fontNamePanel == null)
{
fontNamePanel = new JPanel();
fontNamePanel.setLayout(new BorderLayout());
fontNamePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
fontNamePanel.setPreferredSize(new Dim... | 1 |
@Override
public void ParseIn(Connection Main, Server Environment)
{
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null)
{
return;
}
if (Main.Data.RatedRooms.contains(Room.Id) || Room.CheckRights(Main.Data, true))
... | 5 |
public void ChangeStatus(){
if (x.textfieldStartStop.getText().equals("Working")){
x.textfieldStartStop.setText("WaitingForProcessor");
} else if (x.textfieldLoader.getText().equals("Working")){
x.textfieldLoader.setText("WaitingForProcessor");
}else if (x.textfieldMain... | 7 |
private void addOutsideCurve(int end, int newRadius) {
if (restricted.isSelected()) {
int sectionBeginning = road.sectionBeginning();
road.addOutsideCurve(end, false, newRadius);
if (sectionLongerThanSmax(end, sectionBeginning)) return;
} else {
road.addOutsideCurve(end, true, newRadius);
}
} | 2 |
private static DecimalImpl safeAdd(final long d1, final long d2, final int factor)
{
final long sum = d1 + d2;
if (DPU.isSameSign(d1, d2) && !DPU.isSameSign(sum, d1))
{
final long shrinkedSum = d1 / 10 + d2 / 10;
return safegetInstance(shrinkedSum, factor - 1);
}
else
{
return safegetInstance(sum, fact... | 2 |
public void makeSidePanel() {
JPanel sideBar = new JPanel(new GridLayout(3,1,20,20));
// Buttons
JPanel sideBarButtons = new JPanel(new GridLayout(2,1));
JButton add = new JButton("Add");
add.setPreferredSize( new Dimension(80, 30) );
add.addActionListener(new ActionListener() {
public void actionP... | 4 |
private void connectConnection(String host, int port)
throws ChannelError {
if (HydnaDebug.HYDNADEBUG) {
DebugHelper.debugPrint("Connection", 0, "Connecting, attempt ");
}
try {
SocketAddress address = new InetSocketAddress(host, port);
m_s... | 5 |
static int[] calculateVendingMachineChange(int[] coin_totals, BigDecimal balance) {
String[] change_denomination = {"1.0", "0.5", "0.2", "0.1"};
for(int i = 0; i < coin_totals.length; i++) {
balance = change(coin_totals, balance, change_denomination[i], i);
}
return coin_t... | 1 |
private void initBorderMaze() {
for (int x = 0; x < bufferedImage.getWidth(); x++) {
for (int y = 0; y < bufferedImage.getHeight(); y++) {
if (x == 0 || x == bufferedImage.getWidth() - 1 || y == 0
|| y == bufferedImage.getHeight() - 1) {
bufferedImage.setRGB(x, y, Color.BLACK.getRGB());
continu... | 6 |
public synchronized void close() {
AudioDevice out = audio;
if (out != null) {
closed = true;
audio = null;
// this may fail, so ensure object state is set up before
// calling this method.
out.close();
lastPosition = out.getPositio... | 2 |
private void fireServerEvent(ServerEvent evt) {
Object[] listeners = serverEventListenerList.getListenerList();
for (int i=0; i<listeners.length; i+=2) {
if (listeners[i]==IServerEventListener.class) {
((IServerEventListener)listeners[i+1]).OnServerEvent(evt);
}
}
} | 2 |
private void changeLead() {
Anstalld selAnst = (Anstalld) cbLead.getSelectedItem();
if (selAnst.getAid() != -1) { //if not no predefined lead
try {
String query = "update spelprojekt set aid=" + selAnst.getAid() + " where sid=" + selectedSpelprojekt;
DB.update... | 3 |
public Object getValueAt(int rowIndex, int columnIndex) {
switch (columnIndex) {
case 0:
return listMembre.get(rowIndex).getId();
case 1:
return listMembre.get(rowIndex).getNom();
case 2:
return listMembre.get(rowIndex).getPreno... | 9 |
private void findNegativeCycle(EdgeWeightedDigraph G)
{
// Create a Digraph from edgeTo[]
Digraph spt = new Digraph(G.V());
try
{
for (int v = 0; v < G.V(); v++)
if (vertex[v].edgeTo != null)
spt.addEdge(vertex[v].edgeTo.from(), vertex[v].edgeTo.to());
}
catch (Exception e)
{
System.out.pr... | 4 |
public static JInternalFrame createHeirarchyFrame(final JFrame frame)
{
BasicFrames.removeDropdown(internalFrame);
internalFrame.setVisible(true);
internalFrame.setBounds(200, 200, 518, 352);
internalFrame.setFocusable(true);
try {
internalFrame.setSelected... | 6 |
public boolean isConjugateTo(PGridPath path) {
if (path == null) {
throw new NullPointerException();
}
String common = commonPrefix(path);
if (path.length() == path_.length()) {
int otherLen = path.length() - common.length();
int thisLen = path_.lengt... | 4 |
protected Icon getIcon() {
java.net.URL url = getClass().getResource("/ICON/blockTransition.gif");
return new javax.swing.ImageIcon(url);
} | 0 |
private int trMedian3 (final int ISA, final int ISAd, final int ISAn, int v1, int v2, int v3) {
final int[] SA = this.SA;
int SA_v1 = trGetC (ISA, ISAd, ISAn, SA[v1]);
int SA_v2 = trGetC (ISA, ISAd, ISAn, SA[v2]);
int SA_v3 = trGetC (ISA, ISAd, ISAn, SA[v3]);
if (SA_v1 > SA_v2) {
final int temp = v1;
... | 3 |
private void loadLayout(){
//Do a random layout for now...
if(texturePack == null || texturePack.floor == null || texturePack.wall == null || texturePack.brick == null)
System.out.println("ERROR: Broken texture pack!");
Random rand = new Random();
for(int x=0; x<size.width; x++){
for(int y=0; y<size.he... | 9 |
public void setId(int id) {
this.id = id;
} | 0 |
private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startButtonActionPerformed
int servicePort = new Integer(bootstrapServicePortTextField.getText()).intValue();
int registryPort = new Integer(registryPortTextField.getText()).intValue();
bootstrapServer = new Boo... | 9 |
private void processTile(ArrayList<ArrayList<DataTile>> tiles, float lat,
float lon) throws InterruptedException {
int rankAverage;
int rankTotal = 0;
Double finalHeight;
Double heightTotal = 0d;
ArrayList<Integer> rankArray = new ArrayList<Integer>();
ArrayList<Float> heightArray = new ArrayList<Float... | 6 |
private ArrayList<EziInfo> indexFolder(File filesFolder, File eziFolder, ArrayList<EziInfo> eziFiles) {
try {
for (File file : filesFolder.listFiles()) {
if (file.isDirectory()) {
eziFiles = indexFolder(file, eziFolder, eziFiles);
} else {
... | 9 |
private void classNotInEditorFolder(File file)
{
String filePath;
File fileDir;
filePath = file.getParent();
fileDir = new File(filePath);
if(fileDir.exists() && fileDir.isDirectory())
{
System.out.println("Class Not in editor");
... | 3 |
int getB(String s1, String s2) {
int b = 0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (i == j) {
continue;
}
if (s1.charAt(i) == s2.charAt(j)) {
b++;
}
}
... | 4 |
@Override
public boolean accept(File f) {
if (f.isDirectory())
return true;
String s = f.getName();
int index = s.lastIndexOf('.');
if (index > 0 && index < s.length() - 1) {
String ext = s.substring(index+1).toLowerCase();
return (ext.equals("... | 7 |
public void cleanStop() {
this.running = false;
}//stop | 0 |
public boolean match(ScheduleItem item) {
long runtime = 0;
if(item instanceof SSGridlet) {
runtime = forecastExecutionTime((SSGridlet)item);
} else {
runtime = ((ServerReservation)item).getDurationTime();
}
if(runtime < minRuntime || runtime >= maxRuntime) {
return false;
}
return true;
} | 3 |
@Override
public String getDesc() {
return "EarthSpike";
} | 0 |
private void firePieceSent(Piece piece) {
for (PeerActivityListener listener : this.listeners) {
listener.handlePieceSent(this, piece);
}
} | 1 |
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (par1MovingObjectPosition.entityHit != null && par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.thrower), 0))
{
;
}
if (!this.worldObj.isRemote && thi... | 8 |
public void set(Integer key, Integer value) {
if(!super.containsKey(key)){
if(count == capacity){
--count;
Integer keyDel = super.keySet().iterator().next();
super.remove(keyDel);
}
super.put(key, value);
++count;
... | 2 |
public void addAtIndex(int index, int item)
{
if(index > size || index < 0)
{
System.out.println("Index out of boundary");
}
else
{
if(index == 0)
{
addFirst(item);
}
else if(index == size)
{
addLast(item);
}
else
{
int i = 0;
Node node = head;
while(i ... | 6 |
public int evalRPN(String[] tokens) {
Stack<Integer> stack = new Stack<Integer>();
int result = 0;
for (String t : tokens) {
if ((t.charAt(0) == '-' && t.length() > 1) || (t.charAt(0) >= '0' && t.charAt(0) <= '9')) {
stack.push(Integer.parseInt(t));
} else... | 9 |
public boolean setPlayer2(Player p) {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: setPlayer2() BEGIN");
}
m_player2 = p;
if (test || m_test) {
System.out.println("FileManager :: setPlayer2() END");
}
return true;
} | 4 |
private boolean verticalLineTo(Graphics2D g, Connector c, Point ep) {
Point p = c.getDirectP();
Point tp;
if (c.isVertical())
tp = new Point(ep.x, p.y);
else
tp = new Point(p.x, ep.y);
if (eFrom.intersects(tp, p) || eTo.intersects(tp, p)
|| eFrom.intersects(tp, ep) || eTo.intersects(tp, ep))
ret... | 5 |
private JPanel getSaveConfigurationsPanel(){
JPanel saveConfigurationPanel = new JPanel(new BorderLayout());
// Create the check box that will enable/disable the user to modify the file
JCheckBox enableSphinxConfiguration = new JCheckBox("Disable modifications");
enableSphinxConfiguratio... | 5 |
public double getRelativeY() {return pos.getY();} | 0 |
protected boolean isIntervalEditable(Interval interval)
{
if (editedBy != null)
return true;
for (Interval i : editedIntervals)
if (i.contains(interval))
return true;
return false;
} | 3 |
@Test
public void itSetsWarmerPlateStatus() {
maker.setWarmerPlateStatus(CoffeeMakerAPI.WARMER_ON);
assertEquals(CoffeeMakerAPI.WARMER_ON, maker.getWarmerPlateStatus());
maker.setWarmerPlateStatus(CoffeeMakerAPI.WARMER_OFF);
assertEquals(CoffeeMakerAPI.WARMER_OFF, maker.getWarmerPla... | 0 |
private boolean destroyBlocksInAABB(AxisAlignedBB par1AxisAlignedBB)
{
int var2 = MathHelper.floor_double(par1AxisAlignedBB.minX);
int var3 = MathHelper.floor_double(par1AxisAlignedBB.minY);
int var4 = MathHelper.floor_double(par1AxisAlignedBB.minZ);
int var5 = MathHelper.floor_doubl... | 8 |
public static void main(String[] arg)
{
if (arg.length != 2) {
System.out.println("Usage:\n java Reorganize [source] [target]");
return;
}
BufferedImage source = null;
try {
source = ImageIO.read(new File(arg[0]));
} catch (IOException e... | 3 |
@BeforeClass
public static void setUpBeforeClass() {
try { new MySQLConnection(); }
catch (InstantiationException e) { e.printStackTrace(); }
catch (IllegalAccessException e) { e.printStackTrace(); }
catch (ClassNotFoundException e) { e.printStackTrace(); }
catch (SQLException e) { e... | 5 |
public int alphaBetaNegamax( Board board, int depth, int alpha, int beta ) {
if ( board.isCheckmate() ) {
return ( Integer.MIN_VALUE + 1 + this.depth - depth );
} else if ( board.isStalemate() ) {
return 0;
} else if ( depth <= 0 ) {
return ( evaluator.evaluate( board ) );
}
int s... | 6 |
public Locus(String locusName, double position, String[] alleleNames,
PopulationData popdata) {
if (locusName==null || locusName.trim().isEmpty()) {
DecimalFormat fix3 = new DecimalFormat("#0.000");
locusName = fix3.format(position);
} else {
this.locusNam... | 5 |
public void mouseDragged(MouseEvent arg0) {
// MOUSE_MOVED sluzy do przesuwania wzgledem x, a dragged y
boolean isChanged = false;
int centerX = Application.getWindow().getWidth() / 2
+ Application.getWindow().getXposition();
int centerY = Application.getWindow().getHeight() / 2
+ Application.getWindow(... | 4 |
public Scanner(String rootDir, int interval) {
if (StrKit.isBlank(rootDir)) {
throw new IllegalArgumentException("the rootDir can not be blank");
}
this.rootDir = new File(rootDir);
if (!this.rootDir.isDirectory()) {
throw new IllegalArgumentException("the "+rootDir+"is not a directory");
}
if (interv... | 3 |
public void put(final E element) {
int index = 0;
boolean added = false;
while (!added) {
// #1
// To set or not to set...
if (array.getElement(index) == null) {
array.setElement(index, element);
added = true;
... | 4 |
public Population stochasticUniversalSampling(Population pop, int outSize){
Individual [] subset = new Individual[outSize];
double[] maxFitScores = new double[pop.population.size()];
double populationFitness = pop.calculateTotalFitness();
for (int i = 0; i<pop.population.size(); i++){//calcula... | 4 |
public boolean fromDiscardForReal(Game g, Rack r)
{
int index = indexer.index(g, r);
int newDrawAction = drawStates[index].getBestReward();
if (newDrawAction == 0)
return false;
else
return true;
} | 1 |
public Behavior getSailor()
{
if(affected instanceof PhysicalAgent)
{
PhysicalAgent agent=(PhysicalAgent)affected;
if((sailor == null)||(agent.fetchBehavior("Sailor")!=sailor))
{
final Behavior B=agent.fetchBehavior("Sailor");
if(B!=null)
agent.delBehavior(B);
sailor = CMClass.getBehavior... | 7 |
public ResponseList<UserList> getLists() {
try {
return getTwitter().getUserLists(-1);
} catch (TwitterException e) {
e.printStackTrace();
return null;
}
} | 1 |
public Document getDocument() throws Exception {
Document doc = Utilities.createDocument();
Map<String, String> namespaces = this.initializeDocument(doc);
Element root = this.createTransactionElement(doc, namespaces);
Element payloadElem = doc.createElementNS(DEFAULT_NAMESPACE, XMLLabels.ELEM_SERVICE_G... | 2 |
private void generate(Class c) {
if (generated(c)) {
return;
}
Class super_ = c.getSuperclass();
boolean extendSuper = super_.isAnnotationPresent(GenerateWrapper.class);
if (extendSuper) {
generate(super_);
}
System.out.println("Generating ... | 9 |
private boolean findUnexploredCellWithDist(int rowCount, int colCount) {
boolean foundMin = false;
for(int rowID = 0;rowID < rowCount ; rowID++){
for(int colID = 0;colID < colCount;colID++){
for(int drcID = OREITATION_MIN;drcID <= OREITATION_MAX;drcID ++){
if(!explored[rowID][colID][drcID] &&
d... | 5 |
private boolean existsCellOnOrientaion(Robot robot, Orientation ori,CellState state){
Boolean needExplore = null;
if(robotOnArenaEdge(robot, ori)) return false;
if(ori.equals(Orientation.NORTH)) needExplore = existsCellOnTheNorth(robot,state);
if(ori.equals(Orientation.WEST)) needExplore = existsCellOnTheWest... | 5 |
private void mayor() throws Exception{
op2 = pila.pop();
if (op2.getValor().equals("null"))
throw new Exception("Una de las variables esta sin inicializar!");
op1 = pila.pop();
if (op1.getValor().equals("null"))
throw new Exception("Una de las variables esta sin inicializar!");
Elem resultado = new Ele... | 8 |
public void setManaTypes(String manaTypes) {
if (manaTypes.equals("")) {
this.manaTypes = "";
if (this.cardText.contains("{R}"))
this.manaTypes += "R";
if (this.cardText.contains("{U}"))
this.manaTypes += "U";
if (this.cardText.contains("{B}"))
this.manaTypes += "B";
if (this.cardText.co... | 7 |
private boolean GetOverlapSegment(IntPoint pt1a, IntPoint pt1b, IntPoint pt2a, IntPoint pt2b, final AtomicReference<IntPoint> pt1, final AtomicReference<IntPoint> pt2) {
// precondition: segments are colinear.
if(Math.abs(pt1a.x - pt1b.x) > Math.abs(pt1a.y - pt1b.y)) {
if(pt1a.x > pt1b.x) {
IntPoint t = pt1a... | 9 |
public void actionPerformed(ActionEvent e) {
Object s = e.getSource();
if (s instanceof JButton && (JButton)s == clearButton) {
current = "";
textArea.setText(current);
} else if (s instanceof JButton && (JButton)s == sendButton) {
current = textArea.getText();
cc.writeClientCutText(... | 6 |
public Select tables(String... tables) {
int counter = 0;
//int added = 0;
for (String table : tables) {
if (table != null && !table.isEmpty()) {
if (!table.contains("`")) {
this.tables.add(table);
//added++;
} else {
db.writeError("Skipping table " + table + " in SELECT statement that h... | 4 |
public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... paramTypes) {
Class<?>[] t = toPrimitiveTypeArray(paramTypes);
for (Constructor<?> c : clazz.getConstructors()) {
Class<?>[] types = toPrimitiveTypeArray(c.getParameterTypes());
if (equalsTypeArray(types, t))... | 8 |
public ArrayList viewMyBookingPayment() {
ArrayList temp = new ArrayList();
Query q = em.createQuery("SELECT t from BookingEntity t");
for (Object o : q.getResultList()) {
BookingEntity p = (BookingEntity) o;
temp.add(String.valueOf(p.getPayment().getAmountPaid()));
... | 1 |
protected boolean hasIndirectValueForTargetType(int targetType) {
switch (targetType)
{
case TARGET_TYPE__AWARD:
case TARGET_TYPE__ITEM:
case TARGET_TYPE__NPC_IN_PARTY:
case TARGET_TYPE__NPC_PROFESSION_IN_PARTY:
case TARGET_TYPE__EVENT_AUTONOTE:
case TARGET_TYPE__CLASS:
case TARGET_TYPE__QUES... | 7 |
public void draw(Graphics2D graphics, int width, int height) {
// Convert text if needed
String drawnText = text;
int start, end;
boolean found;
do {
found = false;
start = drawnText.indexOf("$date{");
if (start != -1) {
end = drawnText.indexOf('}', start);
if (end != -1) {
found = true;... | 7 |
@Override
public void startSetup(Attributes atts) {
JCheckBox component = new JCheckBox();
setComponent(component);
super.startSetup(atts);
component.addActionListener(new CheckboxListener(component, getPreference()));
} | 0 |
protected void newPurchaseButtonClicked() {
log.info("New purchase started");
try {
domainController.startNewPurchase();
startNewSale();
} catch (VerificationFailedException e1) {
log.error(e1.getMessage());
}
} | 1 |
public void charger(Element deSixFace)
{
valeur = Integer.valueOf(deSixFace.getChildText("valeur"));
switch(deSixFace.getChildText("isUtilise")){
case "oui":isUtilise = true;break;
case "non":isUtilise = false;
}
switch(deSixFace.getChildText("couleurDe")){
case "BLANC":couleurDe = CouleurCase.B... | 5 |
public Neuneu getInstanceNeuneu(String name, Loft loft) {
if(this.getClassNom().equals(Lapin.class.getName())) {
return new Lapin(name, this.energie, this.caseDeplacement, loft);
} else if(this.getClassNom().equals(Cannibale.class.getName())) {
return new Cannibale(name, this.energie, this.caseDeplacement, lo... | 4 |
public static boolean validDate(String date){
boolean valid = true;
String strDay = date.substring(0,date.indexOf("/"));
date = date.substring(strDay.length() + 1, date.length());
String strMonth = date.substring(0,date.indexOf("/"));
String strYear = date.substring(strMonth.length() + 1, date.length());
... | 9 |
public static boolean canAccess(String position, String subsystem){
if(position.equals("manager"))
return true;
if(position.equals("pharmacist")&&!subsystem.equals("employee"))
return true;
if(position.equals("tech")&&subsystem.equals("patient"))
return true;
return false;
} | 5 |
public boolean check_any_marker_at(int[] pos, Colour colour){
boolean bool = false;
int i = 0;
Cell c = world.getCell(pos[0],pos[1]);
if (colour==Colour.RED){
while(!bool && i <6){
bool = c.getRMarker()[i];
i++;
}
}
else{
while(!bool && i <6){
bool = c.getBMarker()[i];
i++;
}
}... | 5 |
public static Stock QueryOne(String code) {
URL url;
InputStream is = null;
BufferedReader br;
String line;
Stock s = null;
String urlStr = "http://finance.yahoo.com/d/quotes.csv?s=" + code + "&f=nsl1";
try {
url = new URL(urlStr);
is = u... | 3 |
@Override
public void validate(Object target, Errors errors) {
GameInfoWrapper gameInfo = (GameInfoWrapper) target;
if(gameInfo.getMaxRounds() > MAX_ROUND_NUM_VALUE) {
errors.rejectValue("maxRounds", "Max.gameInfoWrapper.maxRounds", new Integer[]{MAX_ROUND_NUM_VALUE}, "");
}
... | 5 |
public static BufferedImage HistogramEqualization(BufferedImage image) {
int width = image.getWidth();
int height = image.getHeight();
int[] H = new int[256];
BufferedImage temp = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
for(int i = 0; i < 256; i++)
... | 7 |
private void takeItem(Command command){
if(!command.hasNthWord(2)){
System.out.println("Take what?");
} else {
Item i = rooms.get(currentRoom).removeItem(command.getNthSegment(1));
if(i == null){
System.out.println("There is no " + command.getNthSegmen... | 4 |
public static boolean valida_contrasenia(String contraseniaUno, String contraseniaDos) {
String contrasenia_pat = "^[^';]+$";
if (contraseniaUno == null || contraseniaDos == null) {
return false;
}
return contraseniaUno.matches(contrasenia_pat) && contraseniaUno.length() >... | 5 |
private boolean valid() {
if (actors == null) {
return false;
}
if ((spawningPositions == null) || (spawningPositions.size() < 1)) {
return false;
}
if (name == null) {
return false;
}
if (skybox == null) {
return fa... | 5 |
@Override
public double getAverageClientWaitTime() {
int clients = 0;
int totalWaitTime = 0;
for(int i = 0; i < cashiers; i++){
for(int j = 0; j < lines[i].size(); j++){
clients++;
totalWaitTime += lines[i].get(j).getExpectedServiceTime();
}
}
return totalWaitTime/clients;
} | 2 |
@Override
public int stepThrough() {
if(ptr==0){
if(isCompileClicked()){
setCompileClicked(false);
this.setViewToDefault();
}
else{
refreshOutputs();
this.setViewToDefault();
}
this.runner = new Runner(this.compiler);
}
else {
this.runner = new Runner(this.compiler, this.sim40,... | 3 |
@Override
public void execute(VirtualMachine vm) {
DebuggerVirtualMachine dvm = (DebuggerVirtualMachine) vm;
dvm.setFunctionInfo(functionName, startLineNumber, endLineNumber);
} | 0 |
public remove()
{
this.requireLogin = true;
this.info = "remove an appointment";
this.addParamConstraint("id", ParamCons.INTEGER);
this.addRtnCode(405, "appointment not found");
this.addRtnCode(406, "permission denied");
this.addRtnCode(407, "illegal time");
} | 0 |
public boolean isCheckMate() {
if (
(this.board.getBlackTime() == 0 || this.board.getWhiteTime() == 0) &&
this.hasTimer()
) {
this.cancelTimer();
return true;
}
boolean possibleCheckmate = false;
for (Piece p : this.board.getPieces()) {
if (p.isWhite() == this.board.isWhiteTurn()) {
if (!p... | 9 |
public boolean hitSquare(){
World myWorld = getWorld();
int x = getX();
int y = getY();
switch(direction) {
case SOUTH :
y++;
break;
case EAST :
x++;
break;
case NORTH :
... | 5 |
private int getMaxidUsuario(){
int max = 0;
try {
conn = PaginaWebConnectionFactory.getInstance().getConnection();
String sql = "select MAX(id_usuario) as maximo from usuario";
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
if (rs.next()){
max = rs.getInt("maximo");
}
} ... | 6 |
@Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if(!sender.hasPermission(pluginMain.pluginManager.getPermission("thf.ban"))){
sender.sendMessage(ChatColor.DARK_RED + "You cannot BAN ME!");
return true;
}
if(args.length == 0){
sender.sendMessage... | 7 |
@EventHandler
public void SnowmanJump(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getsnowgolemConfig().getDouble("Snowman.Jump.... | 6 |
private static void setEmptyTile(TileType[][] data, int x, int y, TileType type) {
if (data[x][y] == TileType.NONE)
data[x][y] = type;
} | 1 |
private int stripMultipartHeaders(ByteBuffer b, int offset) {
int i;
for (i = offset; i < b.limit(); i++) {
if (b.get(i) == '\r' && b.get(++i) == '\n' && b.get(++i) == '\r' && b.get(++i) == '\n') {
break;
}
}
return i + ... | 5 |
public void updateItems()
{
try
{
String strResult = ""+(char)6,
strStore;
int i;
Item itmStore;
LifoQueue qStore;
Iterator iter=vctItems.keySet().iterator();
while(iter.hasNext())
{
qStore = (LifoQueue)vctItems.get(iter.next());
if (qStore.size() > 0)
{
itmStore = (Item)... | 7 |
protected boolean checkXObstacle(CommonObject so, double time) {
return (((this.currentCoord.getX() + this.currentWidth + currentHorizontalSpeed * time >= so.getCurrentCoordinates().getX()
&& currentHorizontalSpeed > 0 && this.currentCoord.getX() < so.getCurrentCoordinates().getX())
... | 7 |
public void setStatge(int stageID, Map<String, String> data) {
if(this.mouseListener != null){
gamePanel.removeMouseListener(this.mouseListener);
}
startedLoadingTime = System.nanoTime();
if (stage != null) {
Stage s = stage;
stage = null;
s.close();
}
if (stageID == STAGE_WELCOME) {
stage = ... | 9 |
public static int getStateMetric(State s) {
switch(STATE_METRIC) {
case DIV:
return (((s.rngState>>16)&0x3F)<<8) + ((s.rngState>>22)&0xFF);
case DSum:
return (((s.rngState>>8)&0xFF) + (s.rngState&0xFF))&0xFF;
case RNG:
return s.rngState & 0xFFFF;
case RNG1:
return s.rngState ... | 6 |
@Test
public void testServerClientDisconnectWithHash() {
LOGGER.log(Level.INFO, "----- STARTING TEST testServerClientDisconnectWithHash -----");
String client_hash = "";
String server_hash = "";
server1.setUseDisconnectedSockets(true);
try {
server1.startThread();... | 6 |
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof Tag)) {
return false;
}
Tag o = (Tag) obj;
if (getId() != o.getId()) {
return false;
}
if (name == null && o.name != null || name != null && o.name == null) {
... | 9 |
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.