text stringlengths 14 410k | label int32 0 9 |
|---|---|
public int getFileRenamedMask() {
return JNotify.FILE_RENAMED;
} | 0 |
public static void main(String[] args) throws InterruptedException {
final LinkedBlockingQueue<Integer> queue = new LinkedBlockingQueue<>();
List<Thread> consumers = new ArrayList<>();
List<Thread> producers = new ArrayList<>();
// start 20 consumers
for(int i =0; i< 20; i++) {... | 6 |
@Override
public void actionPerformed(ActionEvent ae) {
String transportProtocol = "";
String resultado;
if (telaLeitora.getBtConectar().getText().equals("Conectar")) {
Enumeration<AbstractButton> elements = telaLeitora.getPcscProtocolTransportGroup().getElements();
... | 6 |
public void setAccountName(String accountName) {
this.accountName = accountName;
} | 0 |
@EventHandler(priority = EventPriority.HIGHEST)
public void OnLogin(PlayerLoginEvent event) {
if (!prekick.config.GetBoolean("PreKick.Enabled") || event.getResult() != PlayerLoginEvent.Result.ALLOWED)
return;
int reason = prekick.whitelist.IsPlayerOnWhitelist(event.getPlayer().getName(), event.getAddress().get... | 8 |
public void delleteProduct(Product product) {
try {
beginTransaction();
session.delete(product);
session.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeSesion();
}
} | 1 |
int[] gjFromFixed(long date) {
int year = gjYearFromFixed(date);
long priorDays = date - fixedFromGJ(year, 1, 1);
long correction;
if (date < fixedFromGJ(year, 3, 1)) {
correction = 0;
} else if (isLeapYear(year)) {
correction = 1;
} else {
... | 2 |
private void validate() throws RrdException {
boolean ok = true;
if(x.length != y.length || x.length < 3) {
ok = false;
}
for(int i = 0; i < x.length - 1 && ok; i++) {
if(x[i] >= x[i + 1] || Double.isNaN(y[i])) {
ok = false;
}
}
if(!ok) {
throw new RrdException("Invalid plottable data suppli... | 7 |
public void renderAbsolute(int xp, int yp, Sprite sprite) {
if (sprite == null) sprite = Sprite.rock;
for (int y = 0; y < sprite.HEIGHT; y++) {
int ya = y + yp;
int ys = y;
for (int x = 0; x < sprite.WIDTH; x++) {
int xa = x + xp;
int xs = x;
if (xa < -16 || xa >= width || ya < 0 || ya >= heigh... | 9 |
public boolean isAuthorised (String user, String target) {
int userRank = activeUsers.get(user).rank.getCode();
if (!checkActiveUser(target)) {
return false;
}
int targetRank = activeUsers.get(target).rank.getCode();
if (userRank > targetRank)
return tru... | 2 |
void zoom() {
if( getTilesize()==50)
{
setTilesize(25);
// offx = 0;
// offy = 0;
}
else
{
setTilesize(50);
}
if(this.offy<0) offy=0;
if(this.offx<0) offx = 0;
if(... | 5 |
private String getTime() {
StringBuilder time = new StringBuilder("");
elapsedTime = System.currentTimeMillis() - startTime;
long elapsedSecs = elapsedTime / 1000;
long elapsedMins = elapsedSecs / 60;
long hours = elapsedMins / 60;
long mins = elapsedMins % 60;
lo... | 5 |
public void run(){
Polygon poly = new Polygon();
for(int i = 0; i < points.length; i++){
poly.add(new Point(points[i]));
}
poly.setColor(org.jzy3d.colors.Color.BLUE);
System.out.println("Polygon Size:" + poly.size());
System.out.println("Length of Points: " + points.length);
... | 1 |
@EventHandler (priority = EventPriority.HIGHEST)
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
// Only ops or those with proper permissions get update messages.
if (!p.hasPermission("hunger.update") && !p.isOp())
return;
if (!plugin.update)
return;
plugin.tell(p, "&e" + plugin... | 3 |
public static void setActivity (Description description, Activity activity) {
if (description instanceof ActedOnBehalfOf) {
((ActedOnBehalfOf) description).setActivity (activity);
}
if (description instanceof WasAssociatedWith) {
((WasAssociatedWith) description).setRespo... | 9 |
private void waitForThread() {
if ((this.thread != null) && this.thread.isAlive()) {
try {
this.thread.join();
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
} | 3 |
@Test
public void testaaEttaTallennetaanTiedostoonPelaajanTiedotKunPeliLoppuu() {
try {
pelaaja = PelaajatIO.lataaPelaaja(pelaaja.getNimi());
} catch (IOException e) {
fail("Pelaajan lataus epäonnistui.");
} catch (ClassNotFoundException e) {
fail("Pelaaja... | 8 |
final void method611(int i, int i_74_,
Class348_Sub42_Sub17 class348_sub42_sub17) {
anInt1126++;
if ((i ^ 0xffffffff) != 0) {
method622();
if (!NA())
method621();
else {
Class4 class4 = (((Class348_Sub42_Sub17) class348_sub42_sub17)
.aClass4Array9673[i]);
Class348_Sub33 class348_sub33
... | 6 |
public static void main(String[] args) {
Scanner s = new Scanner(new RandomWords(10));
while (s.hasNext())
System.out.println(s.next());
} | 1 |
public ObjectenOpslag(Group root, File file) {
this.children=root.getChildren();
try {
JAXBContext jc = JAXBContext.newInstance(World.class);
if(file == null){
w = (World) jc.createUnmarshaller().unmarshal(ObjectenOpslag.class.getResource("Wereld.xml"... | 6 |
public int biSearch(int[] numbers, int start, int end, int target) {
// while(start <= end){
// int mid = (start + end) >> 1;
// if(numbers[mid] == target){
// return mid;
// }else if(numbers[mid] > target){
// end = mid - 1;
// }else {
// start = mid + 1;
// }
// }
// return -1;
for (int i = st... | 2 |
public long getElapsedTime()
{
return elapsedTime;
} | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... | 8 |
public void banUser(String name, String reason) {
User user = getByName(name);
if (user.isBlank())
return;
banList.put(user.getUserID(), reason);
} | 1 |
public void process(JCas aJCas) throws AnalysisEngineProcessException {
int MAX_N_BEST_CHUNKS = 5; // the number of most similar words
JCas jcas = aJCas;
String Str = jcas.getDocumentText();
String line = Str.substring(0, 14); // extrate the lineID
char cha[] = Str.toCharArray();
ConfidenceChunk... | 4 |
public int read(char[] buffer,
int offset,
int size)
throws IOException
{
int charsRead = 0;
if (this.atEndOfData) {
return -1;
}
if ((offset + size) > buffer.length) {
size = buffer.length - offset;
}
while (c... | 8 |
public Integer processCommand( int command ) {
Integer result = new Integer( ROGER );
int answer = 0;
String resignMessage = null;
System.out.println( "Entered processCommand." );
// If a draw offer is recieved, fire off an action event to inform the
// GUI.
... | 7 |
@Override
public void visit(MethodDeclaration method, Object arg) {
KoanExecution koanExecution = (KoanExecution)arg;
if(method.getName().equals(koanExecution.getMethod().getName())){
List<Comment> comments = method.getAllContainedComments();
for(Comment... | 4 |
public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... | 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 |
public byte mixWt(String fileName) throws IOException {
FileInputStream is = null;
DataInputStream dis = null;
BufferedWriter br = new BufferedWriter(new FileWriter("mixWt_bin.txt"));
NumberFormat formatter = new DecimalFormat();
formatter = new DecimalFormat("0.000E00");
try {
is = new FileInputStre... | 8 |
protected Input() {
System.out.println("Starting input...");
// keyboard events
for (Field f : KeyEvent.class.getDeclaredFields()) {
try {
if (java.lang.reflect.Modifier.isStatic(f.getModifiers()) && (f.getType() == int.class || f.getType() == short.class) && f.getName().startsWith("V... | 7 |
public void writeCDATA(String content) throws IOException {
if (bStartTagOpen) {
w.write(">" + newLine);
bStartTagOpen = false;
}
writeIndent();
w.write(content + newLine);
} | 1 |
public void setName(String name) {
this.name = name;
} | 0 |
void setSize(int width, int height) {
if (this.width != width) {
this.width = width;
walls.remove(xAxisWall);
walls.add(xAxisWall = new Wall(1, 0, width, Display.HORIZONTAL));
}
if (this.height != height) {
this.height = height;
walls.remove(yAxisWall);
walls.add(yAxisWall = new Wall(0, 1, heig... | 2 |
private synchronized void initialize() throws TorqueException {
log.debug("initialize()");
if (isInit) {
log.debug("Multiple initializations of Torque attempted");
return;
}
if (conf == null || conf.isEmpty()) {
throw new TorqueException(
"Torque cannot be initialized without... | 9 |
@Override
public void render() {
Iterator<IScreenItem> it = screenItems.descendingIterator();
while(it.hasNext()) {
IScreenItem item = it.next();
if(item.isVisible()) {
item.render();
}
}
} | 2 |
public static void iceManipulation(Player player) {
int radius = 25;
List<Entity> entities = player.getNearbyEntities(radius, radius, radius);
for (Entity entity : entities) {
if (entity.getLocation().distanceSquared(player.getLocation()) > radius)
continue;
if (entity instanceof Player) {
((Playe... | 4 |
@Override
public Query parse() {
if(!this.prepared) {
this.prepared = true;
StringBuilder sB = new StringBuilder();
sB.append("CREATE TABLE ");
sB.append(this.t.replace("#__", this.db.getPrefix()));
sB.append("\n");
sB.append(" (\n");
int i = 0;
for(Column f : this.fL) {
if(i ... | 6 |
public HashMap<String, Disc> asHash() {
LOGGER.log(Level.INFO, "Generating hash representation for bag " + this.hashCode());
HashMap<String, Disc> hash = new HashMap<String, Disc>();
Iterator<Disc> i = discs.iterator();
while (i.hasNext()) {
Disc disc = i.next();
hash.... | 1 |
public int removeFirst()
{
if(isEmpty())
throw new ArrayIndexOutOfBoundsException();
int temp = ListArray[0];
for(int i = 0; i < size; i++)
ListArray[i] = ListArray[i+1];
size--;
System.out.print("Removed Element: " + temp + "\n");
System.out.println(" ");
return temp;
} | 2 |
@Override
public void documentAdded(DocumentRepositoryEvent e) {} | 0 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Edge))
return false;
Edge other = (Edge) obj;
if (u == null) {
if (other.u != null)
return false;
} else if (!u.equals(other.u))
return false;
if (v == null) ... | 9 |
private boolean isFillField() {
if(getLogin().isEmpty() || getPassword().isEmpty() || getConfirmPassword().isEmpty()) {
setMessage("Fill all field.");
return false;
} else {
return true;
}
} | 3 |
@EventHandler
public void CreeperResistance(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.getCreeperConfig().getDouble("Creeper.R... | 6 |
public ApiDemo() {
Log.makeLog();
Log.current.println("Initializing Cyc server connection, and caching frequently used terms.");
try {
cycAccess = new CycAccess();
}
catch (Exception e) {
Log.current.errorPrintln(e.getMessage());
Log.current.printStackTrace(e);
}
cycAccess.... | 1 |
public static void quit() {
// Store List of Open Documents and close documents
if (!saveOpenDocumentList()) {
return;
}
// Store current window position
Dimension size = Outliner.outliner.getSize();
Point location = Outliner.outliner.getLocation();
Preferences.getPreferenceInt(Preferences.MAI... | 2 |
public int getTotalLogins(String playerName) {
int totalLogins = 0;
if (helper.isNotEmpty(playerName)) {
try {
ResultSet rs = _sqLite.query("SELECT count(time_login) "
+ "AS total_logins "
+ "FROM player, login "
+ "WHERE player.playername = '" + playerName + "' "
... | 8 |
public void emb(byte[] byte2emb) throws IOException {
// 获得Y的colorid
Integer colorid = (Integer) mImg.getColorIDs().toArray()[0];
// 获得Y的color unit
JPEGDataUnits dataUnits = mImg.getDataUnits();
List<int[]> YUnits = dataUnits.getColorUnit(colorid);
// 打乱数据顺序
try ... | 6 |
public void doGet(final HttpServletRequest servletRequest, final HttpServletResponse servletResponse)
throws ServletException, IOException {
final String commandName = servletRequest.getParameter("command");
System.out.println("COMMAND NAME " + commandName);
if (commandName != null && !commandName.isEmpty()... | 8 |
private String getMime(String extension) {
String mime = "";
switch (extension) {
case ".pdf":
mime = "application/pdf";
break;
case ".png":
mime = "image/png";
case ".css":
... | 6 |
@Override
public void request() {
if (mRealSubject == null) {
mRealSubject = new RealSubject();
}
mRealSubject.request();
} | 1 |
public boolean doInputParenthesesMatch(ArrayList<Character> parenPairsArray, String stringWithParens) {
StringBuilder stringBuilderWithParens = new StringBuilder(stringWithParens);
Stack<Character> parensStack = new Stack<Character>();
// Look at each character in the string and individually h... | 9 |
private Instruction matchInstruction() {
dispatchEvent(ParserEvent.BEGAN_PARSING_NON_TERMINAL_SYMBOL, "Instruction");
Instruction instruction = null; // TODO Invalid instruction.
if (SyntacticValidator.getInstance().isNextToken(ProductionRule.REQUIRED, Token.Type.IDENTIFIER, Reserved.Keyword.IF, Reserved.Keyword... | 8 |
public <T> ObjectConstructor<T> get(TypeToken<T> typeToken) {
final Type type = typeToken.getType();
final Class<? super T> rawType = typeToken.getRawType();
// first try an instance creator
@SuppressWarnings("unchecked") // types must agree
final InstanceCreator<T> typeCreator = (InstanceCreator<... | 5 |
public void bet() {
try {
bet = Integer.parseInt(JOptionPane.showInputDialog(this,
"Place a bet: "));
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(this, "Please enter a valid number");
return;
}
if (bet > player.getMoney()) {
JOptionPane.showMessageDialog(this,
"You do... | 4 |
static URL parse(String expr) {
URL url = new URL();
String host = expr;
short port = 80;
String path = "";
String tokens = "";
String auth = "";
String protocol = "http";
String error = "";
int pos;
// Expr can be on the form "http://... | 6 |
@Override
public EntityInfo getFileMetaData(String path) throws PathNotFoundException {
File file = getFile(path);
if (!file.exists())
throw new PathNotFoundException(path);
EntityInfo info = null;
if (file.isDirectory())
info = new DirectoryInfo(translateFilePath(file));
if (file.isFile())
info... | 4 |
public DataSet(int id, String naam)
{
this.id = id;
this.naam = naam;
this.categories = new ArrayList<Category>();
} | 0 |
@Override
public void run()
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str;
DatagramSocket datagramSocket = null;
try {
datagramSocket = new DatagramSocket();
while ((str = br.readLine()) != null) {
sentCount++;
byte[] buffer = (processId ... | 9 |
@SuppressWarnings("rawtypes")
public static SingleColumnComparator createLongComparator(NumberName numberName, boolean ascending, String defaultString) throws Exception
{
final String type="long";
if (ascending)
{
if (defaultString.equals(""))
{
return new SingleColumnComparator(numb... | 5 |
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
ItemStack clickIcon = this.getClickItem();
if (clickIcon != null) {
ItemStack itemStack = event.getItem();
if (itemStack != null && itemStack.isSimilar(clickIcon)) {
this.show(event.getPla... | 3 |
private void playlistMenu() {
System.out.println(" Playlists Menu ");
System.out.println("1. |Show all playlists |");
System.out.println("2. |Show songs in a playlist |");
System.out.println("3. |Edit playlists |");
System.out.pri... | 4 |
public void setReferRequestWrapper(RequestWrapper referRequestWrapper) {
this.referRequestWrapper = referRequestWrapper;
// this.referRequestWrapper.getCallback().setResponseWrapper(this);
} | 0 |
public int addBuddy(String username, String buddyname){
try {
String host = "localhost";
socket = new Socket(host, 2001);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(), true);
... | 4 |
public synchronized static PixelMap getImagePixels(String imageName,
final String DIRECTORY) {
PixelMap pixels;
try {
File file;
switch (DIRECTORY) {
case STATUS:
file = new File(String.format("%s%s%s%s%s%s%s", R, S, UI, S,
STATUS, S, imageName));
break;
case PLAYER:
file = new File... | 7 |
private void playButton() throws IOException {
final java.net.URL imageURL = AnimationPane.class.getResource("images/play.png");
final java.net.URL imageGreenURL = AnimationPane.class.getResource("images/playGreen.png");
final java.net.URL image05URL = AnimationPane.class.getResource("images/05.png");
final ja... | 8 |
private void redispatchMouseEvent(MouseEvent event) {
Point glassPanePoint = event.getPoint();
Point containerPoint = SwingUtilities.convertPoint(mGlassPane, glassPanePoint, mCaptureComponent);
Component component = SwingUtilities.getDeepestComponentAt(mCaptureComponent, containerPoint.x, containerPoint.y);
if ... | 1 |
@Override
public void run() {
while (alive) {
try {
sleep(random.nextInt(300));
} catch (InterruptedException ex) {
}
synchronized (field) {
Position[] neighbors = getNeighbors(position);
field.moveItem(this, pos... | 2 |
public static void menu(BufferedReader inp) throws IOException
{
String userInput = null;
loop:while(true)
{
try
{
LoginBean loginBean = new LoginBean();
System.out.println("Enter the following details");
System.out.println("UserName[String]");
loginBean.setUserName(inp.readLine());
... | 6 |
public boolean isSymmetric(TreeNode root) {
// Start typing your Java solution below
// DO NOT write main() function
if (root == null)
return true;
Queue<TreeNode> p = new LinkedList<TreeNode>(); // 可用stack替换
Queue<TreeNode> q = new LinkedList<TreeNode>();
p.offer(root.left);
q.offer(root.right);
whi... | 7 |
public Identifier getIdentifier(String name) {
if (loadOnDemand) {
Identifier ident = loadClass(name);
return ident;
}
int index = name.indexOf('.');
if (index == -1)
return (Identifier) loadedClasses.get(name);
else {
PackageIdentifier pack = (PackageIdentifier) loadedClasses.get(name
.subst... | 3 |
public static void connect2(TreeLinkNode root) {
if (root == null)
return;
if (root.left != null) {
root.left.next = root.right;
connect2(root.left);
connect2(root.right);
}
// if (root.left != null && root.left.right != null) {
// root.left.right.next = root.right.left;
// connect(root.left);
//... | 6 |
public ConnexionBuffers(){
arrayy=new ArrayList<String>();
geomms=new ArrayList<String>();
arrayy.clear();
geomms.clear();
Connection con = null;
try{
Class.forName("org.postgresql.Driver");
con = DriverManager.getConnection("jdbc:postgresql://"+ConnexionBaseDonnees.getHote()+":"+ConnexionBaseDo... | 7 |
public void deleteTag(StatusTag tag) {
if (this.tags != null) {
this.tags.remove(tag);
}
} | 1 |
private FileUtil(){} | 0 |
public void addTablesToJoin(ObjectStack stack)
{
// add the actual representation
ObjectRepresentation actual = stack.getActualRepresentation();
this.joinRepresentations.add(actual);
if (actual.isArray())
{
addTableToJoin(NameGenerator.getArrayTablename(adapter), actual.getAsName());
}
else
{
add... | 5 |
Item newFloat(final float value) {
key.set(value);
Item result = get(key);
if (result == null) {
pool.putByte(FLOAT).putInt(key.intVal);
result = new Item(index++, key);
put(result);
}
return result;
} | 1 |
private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... | 7 |
static final void method2460
(float f, int i, float f_100_, int i_101_, int i_102_, float f_103_,
Class186 class186, int i_104_, byte i_105_, int i_106_, float f_107_,
byte[] is, int i_108_, float f_109_) {
do {
try {
anInt10559++;
int i_110_ = i_102_ * i_106_;
float[] fs = new float[i_110_];
for (in... | 8 |
public void preencherTabela() throws Exception
{
ArrayList<String> colunas = new ArrayList<String>();
colunas.add("id");
colunas.add("nome");
Object linhas[][] = new Object[list.size()][];
int i = 0;
for (InstituicaoSubmissao instituicaosubmissao : list)
{
linhas[i] = formatoTabela(instituicaosubmissa... | 3 |
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputDirectory.exists()) {
getLog().debug("Creating the output resource directory.");
outputDirectory.mkdirs();
}
if (inputFile == null) {
throw new MojoExecutionE... | 9 |
public static String normalizePath(String path) {
String[] comps = path.split("/");
String[] ap = new String[comps.length];
int j = 0;
boolean absolute = comps[0].length() == 0;
for (int i = 0; i < comps.length; ++i) {
String s = comps[i];
if (s.equals("... | 9 |
public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... | 7 |
public void register(Listener l){
for(Method m: l.getClass().getDeclaredMethods()){
if(true){
if(m.isAnnotationPresent(EventHandler.class)){
if(m.getParameterTypes().length==1){
if(map.containsKey(m.getParameterTypes()[0])){
//if map has this object listed
if(map.get(m.g... | 6 |
private JMenuItem startNewGame(){
JMenuItem startNewGameItem = new JMenuItem("New Game");
startNewGameItem.addActionListener(new ActionListener(){
private JButton submitButton;
@Override
public void actionPerformed(ActionEvent arg0) {
final Window mainWindow = SwingUtilities.windowForComponent(menuIt... | 9 |
public static String getIframeSrc(String iframe)
{
iframe = iframe.toLowerCase(Locale.getDefault());
int srcIndex = iframe.indexOf("src=");
// 如果不存在src=
if (srcIndex < 0)
{
return null;
}
// 截取掉src前的所有字符
String indefiniteSrc = iframe.substring(srcIndex + 5);
String symbol = iframe.substring(sr... | 3 |
@Override
public String getValue(String paramName) {
Object o = messages.get(paramName);
return o == null ? "" : o.toString();
} | 1 |
private void projectRow(BasicMatrix data, BasicMatrix ret, int row) {
Vector r = data.get(row);
synchronized (this) {
r.map(new VectorMapper() {
@Override
public void map(int index, float value) {
if (!NumberUtils.isZero(value) && NumberUti... | 3 |
@EventHandler
public void IronGolemRegeneration(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.getIronGolemConfig().getDouble("Iro... | 6 |
@Override
public void endSetup(Attributes atts) {
super.endSetup(atts);
} | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!CMLib.flags().isAliveAwakeMobileUnbound(mob,false))
return false;
if((!auto)&&(!(CMLib.flags().isGood(mob))))
{
mob.tell(L("Your alignment has alienated your god from you."));
return ... | 9 |
public Vec3D position(Vec3D v) {
if (v == null) v = new Vec3D() ;
super.position(v) ;
if (type == TYPE_SECTION) v.z += 1.33f ;
else if (type == TYPE_TOWER ) v.z += 2.50f ;
else if (type == TYPE_SQUARE ) v.z += 1.00f ;
return v ;
} | 4 |
@Override
public JsonElement serialize(RemoteClass src, Type typeOfSrc, JsonSerializationContext context) {
JsonObject object = new JsonObject();
if (src.getName() != null) {
object.addProperty("name", src.getName());
}
if (src.getDoc() != null) {
object.addProperty("doc", src.getDoc())... | 8 |
@Test
public void pacmanMode() {
x = 4;
y = 4;
rule = new RuleSet("23/3");
grid = new Grille(x, y, rule);
grid.setWrap(true);
boolean[][] originalValue = {{false,false,false,false}, {true,false,true,false}, {true,false,false,true}, {false,true,false,false}};... | 0 |
protected boolean computeCell(int col, int row) {
// Compute whether this cell is alive or dead in the next generation
// using "countNeighbours"
boolean liveCell = getCell(col, row);
int neighbours = countNeighbours(col, row);
boolean nextCell = false;
if (neighbours < ... | 7 |
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
System.out.println("**** proxy: " + proxy.getClass() + ", method: "
+ method + ", args: " + args);
if (args != null)
for (Object arg : args)
System.out.println(" " + arg);
return method.invoke(proxied, args);
} | 2 |
private void generateValidIslandsRecursive(FixedCell fixedCell, Set<Cell> requiredCells,
Set<Cell> currentCells, Set<Set<Cell>> currentCellsSeen,
Map<Cell, Set<Cell>> validNeighborsCache, Set<Set<Cell>> result) {
if (fixedCell.getNumber() == currentCells.size()) {
// potential valid island
i... | 7 |
@Override
public boolean processPageOfData(List<Object> pageOfData) throws Exception {
// If this is the first page of data we've received,
// and log the start of the job
if (!this.running) {
// Set this.running = true so we know this step has been
// started, even if start() has not been called yet.
t... | 5 |
public static void crearVenta(HashMap<Integer, Ventas> tablaVentas)
{
int idCliente = 0;
int idMusica = 0;
boolean entradaCorrecta = false;
int error = 0;
Scanner entrada = null;
if (Clientes.getNumClientes() == 0) // Miramos si hay clientes en el sistema
{
error = 1;
System.out.println("No ... | 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.