text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static boolean isRightLinearGrammar(Grammar grammar) {
ProductionChecker pc = new ProductionChecker();
Production[] productions = grammar.getProductions();
for (int k = 0; k < productions.length; k++) {
if (!ProductionChecker.isRightLinear(productions[k]))
return false;
}
return true;
} | 2 |
public static JSONArray JSONArrayOfGroupFromJsonArray(JSONArray organizedJson, String key){
int len = organizedJson.length();
int i,j, k,l;
JSONArray json = new JSONArray();
String group_name;
boolean ok = false;
for(i = 0; i < len && !ok; i++)
{
JSONArray groups = organizedJson.getJSONObject(i).getJ... | 9 |
public AlgoCryptType getASymmetricAlgo() {
return asymmAlgo;
} | 0 |
public CoberturaData(Collection<? extends Coverable> files) {
super(files);
this.files = files;
for (Coverable file : files) {
String path = getPackage(file.getUri());
if (!packageMap.containsKey(path)) {
packageMap.put(path, new HashSet<Coverable>());
... | 3 |
public Grid(Grid n) {
this.next = n;
this.largest = 0;
setLastLargest();
} | 0 |
void setOtherOptions() {
reverseMouseButtons2And3
= choices[mouseButtonIndex].getSelectedItem().equals("Reversed");
viewOnly
= choices[viewOnlyIndex].getSelectedItem().equals("Yes");
if (viewer.vc != null)
viewer.vc.enableInput(!viewOnly);
shareDesktop
= choices[shareDesktopI... | 9 |
@Override
public void run() {
System.out.println("--- Démarrage gestion client " + this.joueur.getName() + " ---");
try {
System.out.println("--- Création des flux ---");
InputStream is = socket.getInputStream();
OutputStream os = socket.getOutputStream();
br = new BufferedReader(new InputStreamRea... | 5 |
@Override
public void hhhh() {
log.debug("hhhh");
} | 0 |
public int stateHeuristic() {
if (Main.walkingDistance == null) {
return 0;
}
int sum = 0;
List<Position> boxesClone = new ArrayList<>();
List<Position> goalsClone = new ArrayList<>();
boxesClone.addAll(boxes);
goalsClone.addAll(Main.goals);
... | 8 |
public static float speedMultiplier(Command command, int speed) {
float f = 0f;
if (command == LEFT || command == DOWN || command == UP || command == RIGHT) {
f = 1f;
} else if (command == LEFT_UP || command == LEFT_DOWN || command == RIGHT_DOWN || command == RIGHT_UP) {
... | 9 |
public Graph4(Board board) {
board.normalize();
this.board = board;
for (ANode n : board.getNodes()) {
maxRow = Math.max(maxRow, n.getRow());
maxCol = Math.max(maxCol, board.getCol(n));
}
for (ANode n : board.getNodes()) {
nodePoints.put(n, new ANodePoint(n));
}
final InflationTransform inflatio... | 7 |
public static void merge(int A[], int m, int B[], int n) {
int indexA = m - 1;
int indexB = n - 1;
int indexMerge = m + n - 1;
while (indexA >= 0 && indexB >= 0) {
if (A[indexA] >= B[indexB]) {
A[indexMerge] = A[indexA];
indexA--;
indexMerge--;
} else {
A[indexMerge] = B[indexB];
inde... | 5 |
* @param selectionId 選択レコードID
*/
public void setTblSelection(boolean selectionQuery, String selectionId) {
if (recTable.getSelectedRow() < 0) {
return;
}
int idCol = recTable.getColumnModel().getColumnIndex(SearchPage.COL_LABEL_ID);
int typeCol = recTable.getColumnModel().getColumnIndex(SearchPage.COL_... | 8 |
public ExportAction(Environment environment) {
super("Export to SVG", null);
this.environment = environment;
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke
(KeyEvent.VK_E, MAIN_MENU_MASK));
} | 0 |
@SuppressWarnings({"UNUSED_SYMBOL"})
private boolean isMojo(TypeDeclaration d) {
Collection<InterfaceType> superinterfaces = d.getSuperinterfaces();
for (InterfaceType superinterface : superinterfaces) {
if (superinterface.getDeclaration().getQualifiedName... | 6 |
@Override
public String execute() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
Campaign camp = (Campaign) session.get("campa");
CampaignDevice campdev = new CampaignDevice(camp, getPlatform());
getMyDao().getDbsession().sa... | 3 |
public boolean woodcutting() {
int WCAxe = 0;
if (IsCutting == true) {
WCAxe = 1; //If Cutting -> Go trough loop, passby WCCheckAxe to prevent originalweapon loss, 1 to tell you got axe, no function left for WCAxe if cutting, so 1 is enough.
} else {
WCAxe = WCCheckAxe();
}
if (WCAxe > 0) {
if (playe... | 9 |
public static void manage (String in) {
int i;
// foo is never used.
String foo = "";
if (0 == in.indexOf('/')) {
String args = null;
i = in.indexOf(' ');
if (i > 0) {
args = in.substring(i + 1);
... | 5 |
public void optimize_data()
{
// Removing segments of length zero
for(int i=0;i < size();)
{
if(
(getPoint(i)[0] == getPoint(i + 1)[0])
&& (getPoint(i)[1] == getPoint(i + 1)[1]))
{
removePoint(i);
}
else
{
i++;
}
}
// Concatenati... | 8 |
public List<Double> getDoubleList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<Double>(0);
}
List<Double> result = new ArrayList<Double>();
for (Object object : list) {
if (object instanceof Double) {
... | 8 |
private final void setMinimumButtonBounds()
{
for (int i = 0; i < tButtons.size(); i++)
{
TButton b = tButtons.get(i);
if (resizeButtonArray.get(i))
if (orientation == HORIZONTAL)
{
if (b.width > minButtonWidth)
minButtonWidth = b.width;
b.height = he... | 6 |
public static Tile getByChar(final char c) {
for (Tile t : values()) {
if (t.c == c)
return t;
}
return null;
} | 2 |
public void actionPerformed(ActionEvent e) {
if(bid.deadline.after(new Date()) == false){
bid.endBid();
new TimeAlert().Alert(bid);
}
} | 1 |
public void setLeft(PExp node)
{
if(this._left_ != null)
{
this._left_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... | 3 |
private static List<JMenuItem> getMenuItems(JMenuItem item) {
List<JMenuItem> items = new ArrayList<>();
if (item instanceof JMenu) {
JMenu menu = (JMenu) item;
for (int i = 0; i < menu.getItemCount(); ++i) {
items.addAll(getMenuItems(menu.getItem(i)));
}
} else {
items.add(item);
}
return i... | 2 |
public void layerChange(CPArtwork artwork) {
if (artwork.getActiveLayer().getAlpha() != alphaSlider.value) {
alphaSlider.setValue(artwork.getActiveLayer().getAlpha());
}
if (artwork.getActiveLayer().getBlendMode() != blendCombo.getSelectedIndex()) {
blendCombo.setSelectedIndex(artwork.getActiveLayer().getB... | 2 |
public static void main(String args[]){
int i = 1;
while(i % 20 != 0 || i%19!=0 || i%18!=0 || i%17!=0 || i%16!=0 || i%14!= 0 || i%13!= 0 || i%12 != 0 || i%11 != 0){
i++;
}
System.out.println(i);
} | 9 |
protected TrieEntry<K,V> floorEntry(K key) {
// TODO: Cleanup so that we don't actually have to add/remove from the
// tree. (We do it here because there are other well-defined
// functions to perform the search.)
int keyLength = length(key);
if (ke... | 7 |
public boolean equals(Object object) {
try {
FSATransition t = (FSATransition) object;
return super.equals(t) && myLabel.equals(t.myLabel);
} catch (ClassCastException e) {
return false;
}
} | 2 |
@Override
public void run() {
OrclTableInfo oti=new OrclTableInfo(dbconS,un,pwd);
Hashtable<String, ArrayList<String>> cols;
if(dbconS.contains("sqlserver"))
cols=oti.getSqlServerColumns(tn,"hadoop");
else
cols=oti.getOracleColumns(tn,"hadoop");
ArrayL... | 9 |
private ActionListener createKickOutListener() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
PeerStatus status = LocalInfo.getPeerStatus();
if (!(status == PeerStatus.STARTER || status == PeerStatus.INVITEE)) {
... | 5 |
public int getNextLevel()
{
int level = 0;
boolean unsolved = false;
//all the levels have been solved, then get the first unsolved level
for (int i = 0; i < solved.length; i++)
{
if(solved[i] == 0 )
{
unsolved = true;
level = (byte)(i + 1);
if(level <= currentLevel && currentLevel < sol... | 6 |
@Override
public Entity[] pickTargets(Entity actor, boolean renderAnimations, Parameters parameters) {
Point[] frontVectors = ((Unit)actor).getDirection().get3FrontVectors();
List<Entity> targets = new ArrayList<Entity>();
for (Point vector : frontVectors) {
try {
Point targetLocation = Physics.getRelativ... | 5 |
private static BufferedImage loadImage(File f) throws Exception{
BufferedImage paintImage = ImageIO.read(f);
if(paintImage.getHeight() != 32 && paintImage.getWidth() != 32){
throw new Exception("Image dimensions incorrect!");
}
return paintImage;
} | 2 |
public PersonName(String firstName, String lastName){
if(firstName.isEmpty())
throw new IllegalArgumentException("First name is illegal");
if(lastName.isEmpty())
throw new IllegalArgumentException("Last name is illegal");
this.firstName = firstName;
this.lastName = la... | 2 |
@Override
public void sort(int[] list) {
for( int i = 1, s = list.length; i < s; ++i) {
int n = list[i];
int j = i-1;
while( j >= 0 && n < list[j] ) {
list[j+1] = list[j];
--j;
}
list[j+1] = n;
}
} | 3 |
void update(int delta) {
super.update(delta);
if (stateMachine.isHeroWithinAggroRangeAndReachable()) {
stateMachine.changeState(StateName.toHero);
} else if (stateMachine.isSomeTowerWithinAggroRangeAndReachable()) {
stateMachine.changeState(StateName.toTower);
}
if (!enemy.isSeeking()) {
if (enemy.e... | 4 |
private boolean withinBoardGameRange(int x1, int y1, int x2, int y2)
{
return (x1 >= 0 && x1 <= width - 1 && y1 >= 0 || y1 <= height - 1 && x2 >= 0 && x2 <= width - 1 && y2 >= 0 || y2 <= height - 1);
} | 7 |
private void AIC(int cluster, int size, double[] data, double[] trans,
double[] mean, double[] var, double[] weight, File resFile) { //AICo
try {
File aiclogFile = new File(resFile.getParentFile(), aiclogFileName);
OutputStreamWriter aiclogOsw = new OutputStreamWriter(new FileOutputStream(aiclogFile, true));... | 6 |
private synchronized void putMessage() throws InterruptedException {
while (messages.size() == MAXQUEUE)
wait();
messages.addElement(new java.util.Date().toString());
notify();
} | 1 |
public void buildPluginMenus() {
mb.removeAll();
ActionListener listener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
// the name of the plugin is in the ActionCommand
currentConstructor = factory.getConstructorMap().get(((JMenuItem) e.getSource()).getActionCommand());
... | 2 |
public double findMedianSortedArrays_2(int A[], int B[]) {
int m = A.length;
int n = B.length;
int a = 0;
int b = 0;
int des = (m+n) >> 1;
int c1 = 0, c2 = 0;
int i = 0, j = 0;
for(int k = 0; k <= des; ++k){
a = (m == 0 || i == m)? Integer.MAX_... | 7 |
private void boutonTerreBeniteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boutonTerreBeniteMouseClicked
// TODO add your handling code here:
if (partie.getTb().isActif()) {
if (!partie.getDieuActuel().isaJouerEnTerreBenite()
|| ((partie.getDieuActuel().... | 5 |
private void loadMap(String filename) throws IOException {
ArrayList lines = new ArrayList();
int width = 0;
int height = 0;
BufferedReader reader = new BufferedReader(new FileReader(filename));
while (true) {
String line = reader.readLine();
// no more lines to read
if (line == null) {
reader.c... | 6 |
private Tile[] nakedPair(Board board) {
boolean found = false;
Tile[] pair = null;
Tile tile;
for(int y = 0; (y < BOARD_SIZE && !found); y++) {
for(int x = 0; (x < BOARD_SIZE && !found); x++) {
if(board.getTile(x,y).getValue() == 0) {
if(board.getTile(x,y).getPossible().size() == 2) {
if((til... | 7 |
public HipRunner(String conf) {
try {
__configuration = HipConfiguration
.getConfiguration(conf.equals("") ? "hip_config.xml" : conf);
__netmon = NetMonitor.getMonitor(3000);
__netmon.registerCallback(this);
__sadb = HipSadbImpl.getInstance();
__ipsec = new HipIpsecImpl();
__protocol = new HipP... | 7 |
public static void nextPermutation(int[] num) {
if (num == null)
return;
if (num.length == 0)
return;
if (num.length == 1)
return;
if (checkOrder(num)) {
reverse(num);
} else {
changeOrder(num);
}
} | 4 |
@Override
public void received(final Connection connection, final Object object) {
if (object instanceof PacketDTO) {
logger.trace("from client $" + connection.getID() + " #" + ((PacketDTO) object).getPacketNr());
manager.putReceivedDTOs((PacketDTO) object);
}
if (object instanceof TimeSyncroDTO) {
logg... | 2 |
public void setMove(int type) {
if (type == 1 || type == 2) posChange.x *= -1;
if (type == 3 || type == 2) posChange.y *= -1;
} | 4 |
private void zipcodeTextFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_zipcodeTextFieldKeyTyped
zipcodeLabel.setForeground(Color.black);
int strLength = zipcodeTextField.getText().length();
char c = evt.getKeyChar();
if (strLength == 10 || !(Character.isAlphabetic(c) || Ch... | 6 |
public double modificador(double pBase)
{
if (pBase > 500) {
coeficiente = pBase*0.35;
}
else
{
coeficiente = pBase*0.10;
}
return coeficiente;
} | 1 |
private void StartMySQLListener(String MODE) {
int port = -1;
MySQLListener MySQLList;
try {
// get the command-line parameters
port = Integer.parseInt(MySQLListenerProxyPort.getText());
} catch (NumberFormatException e) {
port = -1;
}
... | 4 |
private static void generateUsecaseHtml(List<Object[]> values) throws IOException {
File htmlOut = new File(getOutputDir(), "index.html");
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(htmlOut, false), "utf-8");
writer.write("<html>\n");
writer.write("<head>\n")... | 1 |
@Override
public void actionPerformed(ActionEvent event) {
CloseHandler handler = getTarget(CloseHandler.class);
if (handler != null) {
if (handler.mayAttemptClose()) {
handler.attemptClose();
}
}
} | 2 |
private void addComment(String s) {
if (comments == null) {
comments = new Vector<String>();
}
comments.addElement(s);
} | 1 |
public void compute() {
recalcCount++;
if (recalcCount < recalcInterval)
return;
int distanceToNearestOpponent = getDistanceToNearestOpponent();
if (distanceToNearestOpponent < avoidBumpDistance) {
setDirection(getLocation().orientTo(getNearestOpponent().getLocation()) + 180, velocity);
} else {
Oppo... | 2 |
public void startup() {
if (serversocket != null) {
throw new IllegalStateException("Server already started up.");
}
// =====================================
// Logger initialization
// =====================================
try {
PropertyConfigura... | 6 |
private void closeOpeningTag(final boolean newLine) throws IOException {
if (!this.closed) {
writeAttributes();
this.closed = true;
this.writer.write(">");
if (newLine)
this.writer.write("\n");
}
} | 2 |
public HostGameServerThread(){
try {
server = new Server();
} catch (Exception e) {
e.printStackTrace();
}
} | 1 |
private BasicIcon find (String name)
{
int k;
for (k = 0; k < Left.size(); k++)
{
try
{
BasicIcon i = (BasicIcon)Left.elementAt(k);
if (i.getName().equals(name)) return i;
}
catch (Exception e)
{}
}
for (k = 0; k < Right.size(); k++)
{
try
{
BasicIcon i = (BasicIcon)Right.e... | 6 |
public int getI()
{
return i;
} | 0 |
public String getClassString(ClassInfo clazz, int scopeType) {
String name = clazz.getName();
if (name.indexOf('$') >= 0) {
if ((Options.options & Options.OPTION_INNER) != 0) {
String innerClassName = getInnerClassString(clazz, scopeType);
if (innerClassName != null)
return innerClassName;
}
i... | 8 |
public Command Kill(Info info){
List<InfoDetail> enemies = info.getEnemies();
int near = 0;
int ex=0;
int ey=0;
int mx = info.getX();
int my = info.getY();
for(int i=0;i<enemies.size();i++){
double dis = Math.pow((ene... | 7 |
public void zoomIn() {
if (created)
{
if (TILE_SIZE.x < MAX_TILE_SIZE.x && TILE_SIZE.y < MAX_TILE_SIZE.y)
{
this.TILE_SIZE.x = this.TILE_SIZE.x * 2;
this.TILE_SIZE.y = this.TILE_SIZE.y * 2;
zoom();
}
}
} | 3 |
@Override
public int getColumnCount() {
return colNames.length;
} | 0 |
public static double getRatio() {
int losses = getLosses();
int wins = getWins();
return losses == 0 ? 0 : ((double) wins) / ((double) losses + wins);
} | 1 |
public Player choosePlayer() {
System.out.println("Please select your opponent (1-3):");
for (int i=1; i<=opponents.length; i++){
String selected = "";
if (opponents[i-1].equals(player2.getName()))
selected = " (current)";
System.out.println(i + "." + opponents[i-1] + selected);
}
String respons... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ItemSet other = (ItemSet) obj;
if (items == null) {
if (other.items != null)
return false;
} else {
boolean itemsEgaux = true;
for... | 9 |
public static void main( String[] args )
{
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
DefaultHandler handler = new DefaultHandler() {
boolean bfname = false;
boolean bln... | 9 |
protected double [] makeDistribution(Instances neighbours, double[] distances)
throws Exception {
double total = 0, weight;
double [] distribution = new double [m_NumClasses];
// Set up a correction to the estimator
if (m_ClassType == Attribute.NOMINAL) {
for(int i = 0; i < m_NumClasses;... | 9 |
public String getDescription() {
return "" + this.requestStatus + " " + description;
} | 0 |
@Override
public AttributeValue getExampleAttributeValue(Example e) {
int playerToken = e.getResult().currentTurn;
int height = e.getBoard().height; // 6
int width = e.getBoard().width; // 7
int numTokensCountingFor = 3; // checking for 3 in a row
int countOfTokensEncounteredHorizontally = 0; // counter
... | 6 |
@Override
public boolean registerBackpack(BackpackConfiguration configuration) {
if (!this.acceptingRegistrations) {
BackpacksPlugin.getInstance().getLogger().warning("**** No longer accepting new registrations!");
return false;
}
if (idToBackpack.containsKey(configu... | 2 |
@Test
public void test_local_port() throws Exception
{
final Socket s = new Socket("localhost", getInt("b_local_port"));
s.getInputStream();
s.getOutputStream();
Assert.assertEquals("expected latency on this connection in ms", getLong("b_latency"), 1000);
Assert.assertTrue(s.isConnected());
s.close();
} | 0 |
private void jCheckBoxPracticiensActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxPracticiensActionPerformed
//Récupération de la méthode contrôleur 'afficherPraticiens'
this.getCtrlM().afficherPraticiens();
}//GEN-LAST:event_jCheckBoxPracticiensActionPerformed | 0 |
private String extract(final int i, final String program) {
int nrOpenBrackets = 1;
int p = i + 1;
while (nrOpenBrackets > 0) {
if (program.charAt(p) == '[') {
nrOpenBrackets++;
}
if (program.charAt(p) == ']') {
nrOpenBrackets-... | 3 |
private void doEditJHS(HttpServletRequest request, HttpServletResponse response, boolean isEditUser) throws ServletException, IOException {
String jhsId = StringUtil.toString(request.getParameter("jhsId"));
if(!StringUtil.isEmpty(jhsId)) {
LianXiWoMen lxfs = null;
try {
... | 3 |
private void RangeCheck(int index) {
if (index >= size || index < 0) {
throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size);
}
} | 2 |
@Override
public void broadcast(AIPlayer p, gamelogic.PublicGameBoard board) {
String message = "4/" + p.getID() + ",";
BoardCoordinate c = _target.location();
int v = -1;
boolean exp = board.isExpanded();
int nv = (exp)? NUM_VERTICES_EXP:NUM_VERTICES;
Map<Integer, List<Integer>> x_gr = (exp)? X_GROUPS_EXP... | 9 |
public double projectOne() {
int comsize = myHand.community.size();
int h0 = myHand.hole[0].toLibValue();
int h1 = myHand.hole[1].toLibValue();
int[] c = new int[comsize];
for (int i = 0; i < comsize; ++i)
c[i] = myHand.community.get(i).toLibValue();
boolean[] used = new boolean[52];
used[h0] = true;... | 7 |
public void writeTo(WordWriter out)
throws IOException {
if(!prepared)
throw new IllegalStateException("prepare method must be called before writeTo");
for(PositionedResolvable pr : resolvablesList) {
Resolvable r = pr.getResolvable();
if(r != null)
... | 3 |
private static void testTime() {
System.out.println("start test");
Map<String, Object> etalonMap = new HashMap();
BTMap testMap = new BTMap();
List<String> etalonKeys = new ArrayList();
List<String> testKeys = new ArrayList();
int size = 100000;
long ms = new Date().getTime();
for... | 8 |
private void fillPriceData(int j, float days, float[] weeksPrices,
float[][] dailyData) {
// days if float rep of this weeks date of collection - dailyData[0][0]
// is most recent dayNumber representation of historic prices data
// dailyData[0][6] is adjClose of most recent day
if (days - dailyData[0][0] < 4... | 2 |
public void testFormat_year() {
DateTime dt = new DateTime(2004, 6, 9, 10, 20, 30, 40, UTC);
DateTimeFormatter f = DateTimeFormat.forPattern("y").withLocale(Locale.UK);
assertEquals(dt.toString(), "2004", f.print(dt));
dt = dt.withZone(NEWYORK);
assertEquals(dt.toString(... | 2 |
@Override
public Serializable load(){
try {
db.start();
DBCollection collection = db.getDB().getCollection("gamedescriptions");
XStream xStream = new XStream();
DBObject obj = collection.findOne();
if (obj == null)
return null;
String xml = (String)obj.get("blob");
Serializable... | 2 |
@Override
public Object getAsObject(FacesContext arg0, UIComponent arg1, String valor) {
if (valor != null && !valor.equals("")){
PessoaDAO pessoaDAO = new PessoaDAO();
Pessoa disciplina = pessoaDAO.buscarPorNome(valor);
return disciplina;
}
return null;
} | 2 |
private int getSelectedFuelAmount() {
if(s.fuelBox == null) return 500;
int index = s.fuelBox.getSelectedIndex();
FuelTank tank = model.getRobot().getFuelTank();
switch(index) {
case 0:
return 1;
case 1:
return 5;
case 2:
return 10;
case 3:
return 20;
case 4:
int amount = tank.getFuelCa... | 6 |
private void tryLogin(String name, String password)
{
String errorMsg = "";
int result = server.login(name, password);
if (result < 0)
{
if (result == -1)
errorMsg = "User unknown";
else if (result == -2)
errorMsg = "Invalid password";
else if (result == -3)
errorMsg = "User al... | 4 |
final public CommandControl isValid(List<String> lines) {
if (isCommandForbidden()) {
return CommandControl.NOT_OK;
}
final Matcher m1 = starting.matcher(lines.get(0).trim());
if (m1.matches() == false) {
return CommandControl.NOT_OK;
}
if (lines.size() == 1) {
return CommandControl.OK_PARTIAL;
}... | 9 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public static void doLoadScene(JsonObject json) {
if(!currentlyOnStage()) {
return;
}
} | 1 |
public void move(){
// Moves your ship
movePirateShip();
// Checks to see if your ship is in the red box
checkShipInBox();
// Determines which phase the initial enemies are in
if(commenceGamePlay){
detectCollision();
makeEnemiesA... | 2 |
public int getTileAt(int x, int y) {
return (x > 0 && x < GameGlobals.mapSize && y > 0 && y < GameGlobals.mapSize) ? map[x][y] : -1;
} | 4 |
public CommonLisp() {
environment.defineFunction("<", new Function() {
@Override
public LispObject evaluate(List arguments,
Environment environment) {
return asFixnum(arguments.first()).smallerThan(asFixnum(arguments.second()));
}
})... | 7 |
public static boolean canRead(String fileName) {
if (fileName.equals("-")) return true; // Assume we can always read STDIN
File inputFile = new File(fileName);
if (inputFile.exists() && inputFile.canRead() && inputFile.isFile()) return true;
inputFile = new File(fileName + ".gz");
if (inputFile.exists() && ... | 7 |
public Token markTokens(Segment line, int lineIndex)
{
if(lineIndex >= length)
{
throw new IllegalArgumentException("Tokenizing invalid line: "
+ lineIndex);
}
lastToken = null;
LineInfo info = lineInfo[lineIndex];
LineInfo prev;
if(lineIndex == 0)
prev = null;
else
prev = lineInfo[lineI... | 5 |
private Object forFile(File file) {
Object botClass = null;
try {
URL url = new URL("file://"
+ file.getPath().replace(file.getName(), ""));
ClassLoader cl = new URLClassLoader(new URL[] { url });
botClass = cl.loadClass(file.getName().replace(".class", ""))
.newInstance();
} catch (Exc... | 1 |
public void tick() {
fireTicks++;
// increase the count displayed while reloading
if (isReloading && reloadTicks % RELOAD_TIME == 0) {
if (ammo < clipSize && availableAmmo > 0) {
ammo++;
availableAmmo--;
} else {
isReloading = false;
reloadTicks = 0;
return;
}
}
if (isReloading... | 6 |
public boolean goesThroughTown(int activePlayer) {
Town enemyNeighbour = null; // La ville ennemie voisine.
Town friendNeighbour = null; // La ville alliee voisine.
for (Town t: townNeighbours) { // Pour chaque ville voisine de la route.
if (t.isBuilt() && t.getPlayer() != activePlayer) enemyNeighbour = t; // ... | 7 |
public void draw(String string, State first) {
state = first;
for (int i = 0; i < string.length(); ++i) {
switch (string.charAt(i)) {
case 'F':
drawStep();
break;
case 'b':
moveStep();
... | 7 |
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.