text stringlengths 14 410k | label int32 0 9 |
|---|---|
public ResultSet enviarConsulta(String consulta) {
ResultSet resultado = null;
try {
query = factory.getConnection().createStatement();
System.out.println("DEBUG: Consulta: " + consulta);
esConsulta = query.execute(consulta);
if (esConsulta) {
resultado = query.getResultSet();
} else {
filasA... | 2 |
public ElementMenu(Component e) {
this.element = e;
JMenuItem tm = new JMenuItem("Menu for " + e.getName());
tm.setFont(new Font(Font.DIALOG, Font.BOLD, 14));
tm.setForeground(Color.red);
tm.setBackground(Color.cyan);
add(tm);
tm.setEnabled(false);
add(new JPopupMenu.Separator());
boolean has = fal... | 7 |
@Override
public void start() {
super.start();
config = container.config();
logger = container.logger();
eb = vertx.eventBus();
address = config.getString("address") == null ? "shortener.persister" : config.getString("address");
host = config.getString("host") == null ? "localhost" : config.getString("h... | 6 |
public static void resignationMsg(String loserName){
System.out.println(loserName + "さんの負けです。");
} | 0 |
public static void deleteSpeculativeInstsFromReservationStations()
{
ArrayList<ReservationStationEntry> todelete = new ArrayList<ReservationStationEntry>();
for(ReservationStationEntry rset: ReservationStationALU1.rseSet)
{
if(rset.inst.specualtive) todelete.add(rset);
}
ReservationStationALU1... | 8 |
private int doLogin () throws InterruptedException{
boolean isLogin = false;
boolean first = true;
int count =0;
do {
if (!first){
log.error("login error. retry!");
ThreadUtil.sleep( RandomUtil.getRandomInt(YueCheHel... | 9 |
@Override
public List<Tour> findTours(Criteria criteria) throws DaoException {
if (criteria.getParam(DAO_TOUR_STATUS) == null) {
criteria.addParam(DAO_TOUR_STATUS, ACTIVE);
}
if (criteria.getParam(DAO_TOUR_DATE_FROM) == null && criteria.getParam(DAO_TOUR_DATE_TO) == null) {
... | 3 |
private LinkedList<Sprite> getValidTargets(LinkedList<Sprite>sprites){
LinkedList<Sprite>possibleTargets = new LinkedList<Sprite>();
for(int i = 0; i < sprites.size(); i++){
Sprite s = sprites.get(i);
if(validTarget(s))possibleTargets.add(s);
}
//no targets were found make the list a null val
if(possibl... | 3 |
@Test
public void testAgeLimits() {
Metabolism m = new Metabolism();
try {
m.setAge(0);
fail("An IncoherentAgeException should have been thrown.");
} catch(IncoherentAgeException e) {}
try {
m.setAge(-12);
fail("An IncoherentAgeException should have been thrown.");
} catch(IncoherentAgeException ... | 4 |
public void removeAllNonCreativeModeEntities() {
for (int x = 0; x < width; ++x) {
for (int y = 0; y < depth; ++y) {
for (int z = 0; z < height; ++z) {
List<?> entitySlotInGrid = entityGrid[(z * depth + y) * width + x];
for (int i = 0; i < ent... | 6 |
public void setId(int id) {
this.id = id;
} | 0 |
private static boolean isTri(String s, Set<Integer> set){
int v = 0;
for(char c : s.toCharArray()){
v+= c - 'A' + 1;
}
return set.contains(v);
} | 1 |
public void paintComponent(Graphics g){
if(save==null)
init(g);
super.paintComponent(g);
if(back!=null)
g.drawImage(back, startX, startY, this);
grid.paint(g);
g.translate(startX, startY);
for (int x = 0; x< Map.width; x++){
for(int y = 0; y< Map.height; y++){
int type = current.getRawCell(x, y... | 7 |
public Game(String mapFilePath) {
this.commandsQ = new ArrayBlockingQueue<ActionEvent>(1024);
timer = new Timer();
this.mapModel = new MapModel(mapFilePath);
playerPawns = new ArrayList();
com = new Connection(new IncomingActionListener());
long updateDe... | 6 |
public static void main(String[] args) {
LinkList list = new LinkList();
list.insert(1, 1.01);
list.insert(2, 2.02);
list.insert(3, 3.03);
list.insert(4, 4.04);
list.insert(5, 5.05);
list.printList();
while(!list.isEmpty()) {
Link deletedLink = list.delete();
Syste... | 1 |
@Override
public Character dataFromSignal(List<Double> output) {
int highestOutputIndex = -1;
double minimum = output.get(0).doubleValue();
for (Double node : output) {
if (node.doubleValue() < minimum) {
minimum = node.doubleValue();
}
}
double highestOutput = minimum;
for (int i = 0; i < output... | 5 |
public int GetTrips()
{
return trips;
} | 0 |
int insertKeyRehash(char val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... | 9 |
private static boolean validLoginParameters(String username, String password){
boolean isValid = false;
if(validateStringLength(username) & validateStringLength(password)){
isValid = true;
}
return isValid;
} | 1 |
@Override
public boolean equals(Object m) {
if (m == this) {
return true;
}
if (m == null || m.getClass() != this.getClass()) {
return false;
}
Move move = (Move) m;
if (move.start.equals(this.start) &&
move.end.equals(this.end)) {
return true;
}
return false;
} | 5 |
public static WallType getTypeWithReference(int ref)
{
WallType wallType = WallType.NONE;
for (WallType wall : WallType.values()) {
if (wall.getReference() == ref) {
wallType = wall;
}
}
return wallType;
} | 2 |
public void update(int delta) {
// method to anim the fly to go straight(? good english ?)
if (current_state != States.FIX) {
if (previous_state == current_state) {
time_same_state += delta;
if (time_same_state > 100 && previous_state != States.FIX) {
fix();
}
}
... | 4 |
public void update() {
angle = angleCalc();
checkMove();
if (x == targetX)
xa = 0;
if (y == targetY)
ya = 0;
move(xa, ya);
if (x <= targetX + 5 && x >= targetX - 5 && y <= targetY + 5 && y >= targetY - 5) {
checkHit();
}
} | 6 |
public static void startupSequenceIndices() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$... | 7 |
public void regroup(Prop foreground) {
for(int x = 1; x<members.size(); x++) {
int tempX = (int)((Math.random()*200)-100) + (int)members.get(0).getX();
int tempY = (int)((Math.random()*200)-100) + (int)members.get(0).getY();
members.get(x).setCourse(PathQuadStar.get().findPath(members.get(x), tempX, tempY));... | 1 |
public void render(Renderer renderer) {
renderer.setColor(1, 1, 1);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 1); // 1 will always be the map texture
for (int z = 0; z < this.getLength() - 1; z++) {
glBegin(GL_TRIANGLE_STRIP);
for (int x = 0; x < this.getWidth(); x++) {
glTexCoord2f(x / ... | 4 |
public StatsPanel(final MineWindow window) {
final MineBoard gameBoard = window.getMineBoard();
// Adds a timer label
final JLabel timerLabel = new JLabel("Current Time: "
+ Integer.toString(timePassed));
this.add(timerLabel, BorderLayout.WEST);
// adds a "New Game" button
//uncomment for new game but... | 9 |
@Override
public SceneNode build(Node node) {
String id = "";
Vec3 pos = new Vec3();
NodeList nodeLst = node.getChildNodes();
for (int s = 0; s < nodeLst.getLength(); s++) {
Node fstNode = nodeLst.item(s);
if (fstNode != null) {
if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
if ("id"... | 5 |
private static void findPrimes(int aCeiling, boolean aNoPrintFlag)
{
PrimeFinder primeFinder = new Eratosthenes();
Instant startTime = Instant.now();
int[] primes = primeFinder.primesNotGreaterThan( aCeiling);
Instant stopTime = Instant.now();
Duration computeTime = Duration.... | 4 |
private void startLatestJiraIssuesWorker() {
SwingWorker<ArrayList<Object>, Void> worker = new SwingWorker<ArrayList<Object>, Void>() {
@Override
public ArrayList<Object> doInBackground() {
//Disable the UI
updateButton.setEnabled(false);
loadLabel.setVisible(true);
ArrayList<O... | 7 |
private Balance() {
this.balance = Constants.initialBalance;
} | 0 |
@Override
public void evaluateLabels(Map<String, Integer> labelValues, int position)
throws TokenCompileError {
if(reference != null) {
Integer value = labelValues.get(reference);
if(value == null)
throw new SymbolLookupError(reference, getToken());
... | 3 |
public void setHealth(int health) {this.health = health;} | 0 |
public String getSimpleCode(){
String str = this.printLineNumber(true) +
this.operand.getSimpleCode() + this.place + " := ";
if(!this.isPostFix){
str += this.operator.getValue() + this.place;
}
else{
str += this.place + this.operator.getValue();
}
return str + "\n";
} | 1 |
public void generateSides()
{
//North
if (getNorthNeighbor() != null && getNorthNeighbor().getSouthSide() != null)
{
fSides.put(COMPASS_POINT_N, getNorthNeighbor().getSouthSide());
}
else
{
fSides.put(COMPASS_POINT_N, new HorizontalSide(fGlobals, this, new Point2D.Double(fPosition.getX() + fWidth / ... | 8 |
public int readInt() throws IOException
{
switch ( type )
{
case MatDataTypes.miUINT8:
return (int)( buf.get() & 0xFF);
case MatDataTypes.miINT8:
return (int) buf.get();
case MatDataTypes.miUINT16:
return (int)( buf.... | 9 |
public String getMethod(Method method){
String result = null;
method.setAccessible(true);
Class[] paramTypes = method.getParameterTypes();
if (paramTypes.length == 0) {
String resultOfMethod = "";
resultOfMethod = getFieldValue(ValueType.METHOD_VALUE,... | 1 |
public void testGetPartialConverterBadMultipleMatches() {
PartialConverter c = new PartialConverter() {
public int[] getPartialValues(ReadablePartial partial, Object object, Chronology chrono) {return null;}
public int[] getPartialValues(ReadablePartial partial, Object object, Chronology... | 1 |
public String toString() {
String rep = "";
switch (_Type) {
case STRING:
for (Entry<String, Integer> ent : TMS.entrySet()) {
rep += ent.getKey() + " -occurs>" + ent.getValue() + "\n";
}
break;
case INTEGER:
for (Entry<Integer, Integer> ent : TMI.entrySet()) {
rep += ent.getKey() + " ... | 6 |
private void executeUpTo(PreparedStatementKey lastToExecute, boolean moveToReuse) throws SQLException {
for (Iterator<Map.Entry<PreparedStatementKey, StatementData>> iterator = statementsData.entrySet().iterator(); iterator.hasNext(); ) {
Map.Entry<PreparedStatementKey, StatementData> entry = iterat... | 6 |
void openUrl(String url) {
try {
if(java.awt.Desktop.isDesktopSupported()) {
java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
if(desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
java.net.URI uri = new java.net.URI(url);
... | 3 |
public static void main(String[] args) throws IOException, ParseException {
int classNumber = 5; //Define the number of classes in this Naive Bayes.
int Ngram = 2; //The default value is unigram.
int lengthThreshold = 5; //Document length threshold
int minimunNumberofSentence = 2; // each sentence should have... | 9 |
public static String translate(String str) {
if (!turnedon)
return str;
String res = "";
URL url = url(str);
if (url == null)
return str;
try {
final HttpURLConnection uc = (HttpURLConnection) url
.openConnection();
... | 6 |
public boolean advance( Pos pos, char c )
{
if ( pos.node == null )
{
pos.node = findSon( root, c );
if ( pos.node != null )
{
pos.edgePos = pos.node.edgeLabelStart;
return true;
}
else
return false;
}
else
{
int nodeLabelEnd = getNodeLabelEnd( pos.node );
// already matched ... | 5 |
public void setWaarde(int waarde){
//controle
if(waarde < minWaarde) waarde = minWaarde;
if(waarde > maxWaarde) waarde = maxWaarde;
this.waarde = waarde;
//stel label in
slider.setValue(this.waarde);
textField.setText(String.valueOf(this.waarde) + eenheid);
... | 4 |
private static void parseToolsForInitialDataRepository(Node kitchenToolsNode, Vector<AcquirableKitchenTool> RestKitchenTools) {
if (kitchenToolsNode.getNodeType() == Node.ELEMENT_NODE) {
Element kitchenToolsElement = (Element) kitchenToolsNode;
String toolName= kitchenToolsElement.getElementsByTagName("name").i... | 4 |
@Override
public void enregistrer() {
//String v_titre, String v_region, int v_exp, int v_salMin, int v_salMax, HashMap<Competence, CompType> tblComps
// int compsSize = m_tblComps.size();
//System.out.println("size" + m_tblComps.size());
//System.out.println(m_tblComps);
Stri... | 6 |
static synchronized void setFilename(String filename) {
if(writer != null) {
try {
writer.close();
writer = null;
} catch (IOException e) {
System.out.println("Unable to close log file");
}
}
if(filename == null) {
writer = null;
return;
}
FileWriter out = null;
try {
out = ... | 5 |
public Barrier(int x1, int y1, int x2, int y2, int type) {
sx = x1;
sy = y1;
ex = x2;
ey = y2;
attribute = type;
switch(type) {
case Terrarium.BARRIER_GAP_MINI:
color = Color.YELLOW;
break;
case Terrarium.BARRIER_GAP_BIG:
color = Color.ORANGE;
break;
case Terrarium.BARRIER_NET_MINI:... | 6 |
@Override
public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
if (object == null
|| (object instanceof String && ((String) object).length() == 0)) {
return null;
}
if (object instanceof Motivo) {
Motivo o = (Mot... | 4 |
public ArrayList<Integer> grayCode(int n) {
ArrayList<Integer> result = new ArrayList<Integer>();
result.add(0);
if (n == 0)
return result;
int adder = 1;
while (n > 0) {
for (int i = result.size() - 1; i > -1; i--)
result.add(adder + re... | 3 |
@Override
public void move() {
for (int i = 0; i < Initialization.getStepToPredator(); i++) {
super.move();
}
} | 1 |
@Override
public void run() {
while(true) {
try {
//Start server and wait for connection
System.out.println("Waiting on port " + serverSocket.getLocalPort());
Socket server = serverSocket.accept();
System.out.println("Connection to " + server.getRemoteSocketAddress());
//after connected, ... | 6 |
public static <A, B, C, D, E, F$> Equal<P6<A, B, C, D, E, F$>> p6Equal(final Equal<A> ea, final Equal<B> eb,
final Equal<C> ec, final Equal<D> ed,
final Equal<E> ee, final Eq... | 5 |
boolean isValidMatch(Detection other) {
return parameterIdMsb != other.parameterIdMsb
&& parameterIdLsb != other.parameterIdLsb
&& inRatioRange(w_vel, other.w_vel)
&& inRatioRange(peak_flux, other.peak_flux)
&& inRatioRange(int_... | 5 |
@Override
public Queue<WebPage> getUnsearchQueue() {
// TODO Auto-generated method stub
return null;
} | 0 |
public static int[] indicesOfSublist(byte[] array, byte[] sublist) {
LinkedList<Integer> indexes = new LinkedList<Integer>();
if (array == null || sublist == null || array.length == 0
|| sublist.length == 0 || sublist.length > array.length) {
return new int[0];
}
... | 9 |
public List<MenuElement> getChildren() {
if (this.children == null) {
return new ArrayList<MenuElement>();
}
return this.children;
} | 1 |
private void match(Matcher matcher) {
String message = null;
if (negation) {
if (!matcher.matchNegation()) {
message = matcher.getMatchNegationMessage();
}
} else {
if (!matcher.match()) {
message = matcher.getMatchMessage();
}
}
negation = false;
if (message != null) {
Throwable exce... | 6 |
private synchronized void dequeue(PacketScheduler sched)
{
Packet np = sched.deque();
if (np != null)
{
// process ping() packet
if (np instanceof InfoPacket) {
((InfoPacket) np).addExitTime( GridSim.clock() );
}
if (super.rep... | 5 |
protected static Ptg calcDProduct( Ptg[] operands )
{
if( operands.length != 3 )
{
return new PtgErr( PtgErr.ERROR_NA );
}
DB db = getDb( operands[0] );
Criteria crit = getCriteria( operands[2] );
if( (db == null) || (crit == null) )
{
return new PtgErr( PtgErr.ERROR_NUM );
}
int fNum = db.fin... | 8 |
public static void main(String[] args) {
int sum = 0;
for (int i = 1; i < 1000; i++) {
sum += spell(i);
// System.out.println(sum);
// if (i==342 || i ==115) System.out.println(spell(i));
}
sum+=11;
System.out.println(sum);
} | 1 |
public void destroy() {
ui.mapview.disol(17);
if(walkmod)
ui.mapview.release(this);
if(ol != null)
ol.destroy();
super.destroy();
} | 2 |
public void newMixer( Mixer m )
{
if( myMixer != m )
{
try
{
if( clip != null )
clip.close();
else if( sourceDataLine != null )
sourceDataLine.close();
}
catch( SecurityException e... | 8 |
public State getStoppedDirectionState(Point point) {
Point position = new Point(super.getIntX(), super.getIntY());
if(Point.insideAngle(Point.DOWN_LEFT, Point.DOWN_RIGHT, position, point)) { // Face up
return State.STOPPED_UP;
} else if(Point.insideAngle(Point.DOWN_RIGHT, Point.UP_RIGHT, position, point)) { //... | 3 |
@Override
public void actionPerformed(ActionEvent e) {
String selectedType = (String) colorOf.getSelectedItem();
if (e.getSource() == ok || e.getSource() == apply) {
Color selectedColor = chooser.getColor();
if (selectedType.equals(TO_BE_TYPED))
pref.setToBe... | 9 |
public static void setSpotLights(SpotLight[] spotLights) {
if (spotLights.length > MAX_SPOT_LIGHTS) {
System.err
.println("Error: You passed in too many spot lights. Max allowed is "
+ MAX_SPOT_LIGHTS
+ ", you passed in "
... | 1 |
public boolean isCar(char current, char[] neighbors, int[] position){
if(current == neighbors[0]){
int[] positionTwo = {(position[0]-1), position[1]};
if(!letterExistsElsewhere(current, position, positionTwo, null)){
//System.out.println("car position 1");
return true;
} else {
return false;
}... | 8 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((folderPath == null) ? 0 : folderPath.hashCode());
return result;
} | 1 |
public static ItemStack upgrade(Inventory inv, Player p){
ItemStack is = inv.getItem(0);
if(is.hasItemMeta()){
if(is.getItemMeta().hasLore()){
//Check old upgrade
int oldUp = 1;
int newUp = 1;
if(is.getItemMeta().getDisplayName().contains("+")){
String name = is.getItemMeta().ge... | 8 |
public static Member getMemberByID(int memberID){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
Statement stmnt = conn.createStatem... | 5 |
private static void AllSubsets(String s){
int l = s.length();
StringBuilder sb = new StringBuilder();
for(int i=0;i<Math.pow(2,l);i++){
sb = new StringBuilder();
int base = 1;
for(int j=0;j<l;j++){
if((i & base) > 0){
sb.append(s.charAt(j));
}
base = base << 1;
}
System.out.println... | 3 |
public void run() {
while (!stop) {
try {
if ( autoScale == true ) {
if ( getYmax() < bufferYmax ) setYmax(bufferYmax);
if ( getYmin() > bufferYmin ) setYmin(bufferYmin);
}
redrawGra... | 5 |
public byte nearHandle(double x, double y) {
double dx = this.x - x;
double dy = this.y - y;
if (dx * dx + dy * dy < 16)
return UPPER_LEFT;
dx = this.x + this.width - x;
dy = this.y - y;
if (dx * dx + dy * dy < 16)
return UPPER_RIGHT;
dx = this.x + this.width - x;
dy = this.y + this.height - y;
... | 8 |
public DiskBasedCobweb(){
try {
in = new BufferedReader(new FileReader(searchedSitesFilePath));
bw = new BufferedWriter(new FileWriter(tmpSearchedSitesFilePath));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-gener... | 4 |
public static final String aAn(String text) {
return Text.startsWithVowel(text) ? AN : A;
} | 1 |
@Override
public Player getPlayerById(Long id) {
checkDataSource();
if (id == null) {
throw new IllegalArgumentException("id is null");
}
try (Connection conn = dataSource.getConnection();
PreparedStatement st = conn.prepareStatement("SELECT idname,surname... | 4 |
private void addEncoder(Encoder encoder) {
encoders.add(encoder);
} | 0 |
public Long getIdConnection() {
return idConnection;
} | 0 |
public static void print(RandomListNode a) {
while (null != a) {
int next = -1;
int rand = -1;
if (null != a.next) next = a.next.label;
if (null != a.random) rand = a.random.label;
System.out.println(a.label + "(" + next + "," + rand +")");
a = a.next;
}
} | 3 |
public void setRecursiveNotDirty()
{
super.setRecursiveNotDirty();
if(this.overlayXY!=null && this.overlayXY.isDirty())
{
this.overlayXY.setRecursiveNotDirty();
}
if(this.screenXY!=null && this.screenXY.isDirty())
{
this.screenXY.setRecursiveNo... | 8 |
private void init( File file )
{
fullName = file ;
String fileName = fullName.getName() ;
int i1 = fileName.indexOf( '_' ) ;
int i2 = fileName.indexOf( '.', -1 ) ;
prefix = "" ;
suffix = "" ;
if ( i1 > 0 ) // has _ => filename with language extension
{
prefix = fileName.substr... | 6 |
public void evolve() throws GenerationEmptyException { /* @ \label{Population.java:evolve} @ */
if (generation == 0) {
makeFirstGeneration();
}
if (currentGeneration.size() <= 1) {
throw new GenerationEmptyException("Current generation size " + currentGeneration.size() + " too small to evolve");
}
... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Cliente other = (Cliente) obj;
if (idCliente == null) {
if (other.idCliente != null)
return false;
} else if (!idCliente.equals(other.id... | 6 |
@Override
public void removePlayer(Player player) {
debug("Attempting to remove player " + player.getName());
int go = 0;
for (ItemStack i : player.getInventory().getContents()) {
if (i == null)
continue;
if (i.getType() == Material.GOLD_BLOCK) {
... | 7 |
@Override
public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
if (cs instanceof Player) {
final Player player = (Player) cs;
if (args.length == 1) {
final int mapid = Integer.parseInt(args[0]);
if (mapid == 1 || mapid == 2 || mapid == 3) {
if (mapid == 1) {
... | 8 |
public void passagePert() {
Fenetre.lePert.arcs = new ListeArcs();
for (int i = 0; i < Fenetre.lePert.sommets.size(); i++) {
Sommet biparti1 = Fenetre.lePert.sommets.elementAt(i);
for (int j = 0; j < Fenetre.lePert.sommets.size(); j++) {
Sommet biparti2 = Fenetre.lePert.sommets.elementAt(j);
for (int ... | 8 |
private double denari(ICard card) {
//Una presa contiene anche la carta in esame
List<List<ICard>> prese = Rules.getPrese(card, table.cardsOnTable());
if(prese.size() > 0){
double fp = 0.0;
for(List<ICard> presa : prese)
for(ICard c : presa)
if(c.getSeed() == Seed.DENARI)
fp+=0.3;
return f... | 4 |
public double getMin() {
if (total_size == 0) return Double.NaN;
double min = Double.POSITIVE_INFINITY;
if (type == Integer.class) {
for (int i = 0; i < total_size; i++) {
if (min > ((int[])vals)[i]) min = ((int[])vals)[i];
}
} else {
... | 6 |
public static void main(String[] args) {
int turn = DEFAULT_TURN;
boolean vis = DEFAULT_VISUALIZE_FLG;
Player p1 = null;
Player p2 = null;
try {
String[] playerClass = new String[2];
int p = 0;
for (int i = 0; i < args.length; i++) {
if ("-turn".equals(args[i]))
turn = Integer.valueOf... | 4 |
void parseCp() throws java.lang.Exception
{
char c;
if (tryRead('(')) {
dataBufferAppend('(');
parseElements();
} else {
dataBufferAppend(readNmtoken(true));
c = readCh();
switch (c) {
case '?':
case... | 4 |
public ReturningProjectile createReturningProjectile(Actor source, String im, int sp, Point start, Point end, boolean f, boolean p, boolean dt, int d) {
if (gameController.multiplayerMode != gameController.multiplayerMode.CLIENT) {
ReturningProjectile projectile = new ReturningProjectile(this, regis... | 5 |
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 |
@Override
public TestResult test(Object input, Void... args) {
//如果不是基本类型
if( !InputType.isPrimitiveType(input) ){
throw new IllegalArgumentException("Parameter 'input' ONLY support primitive type.");
}
String inputS = String.valueOf(input);
boolean passed = inputS.length() >= 0 && !inputS.trim().re... | 3 |
public ClientModel(ServerModel serverModel) {
this.serverModel = serverModel;
gameModel = new GameModel(serverModel);
HashMap<String, CatanColor> playerColorMap = this.getPlayerColorMap();
log = new ArrayList<client.communication.CommsLogEntry>();
chat = new ArrayList<client.communication.CommsLogEntry>();
... | 3 |
protected Room alternativeLink(Room room, Room defaultRoom, int dir)
{
if(room.getGridParent()==this)
for(int d=0;d<gridexits.size();d++)
{
final CrossExit EX=gridexits.elementAt(d);
try
{
if((EX.out)&&(EX.dir==dir)
&&(getGridRoomIfExists(EX.x,EX.y)==room))
{
final Room R=CMLib.map().ge... | 8 |
public void newGame() {
spaces = new Space[height][];
int col = 0;
for(int y = 0; y < height; y++)
{
spaces[y] = new Space[width];
for(int x = 0; x < width; x++) {
if(col == 0)
spaces[y][x] = new BlackSpace(y, x);
else
spaces[y][x] = new WhiteSpace(y, x);
col = 1 - col;
... | 9 |
public List<Entity> getEntitiesContainingAny(Class<?>... componentClassList) {
List<Entity> entityList = new LinkedList<Entity>();
for (Class<?> clazz : componentClassList) {
// Get all entities that have this component
HashMap<Entity, IComponent> entityMap = registeredComponents.get(clazz);
// Remember we... | 4 |
@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 MasterDataEntity)) {
return false;
}
MasterDataEntity other = (MasterDataEntity) object;
if (this.id == null ? ... | 3 |
private void checkPitch()
{
if( channel != null && channel.attachedSource == this &&
LibraryLWJGLOpenAL.alPitchSupported() && channelOpenAL != null &&
channelOpenAL.ALSource != null )
{
AL10.alSourcef( channelOpenAL.ALSource.get( 0 ),
AL1... | 5 |
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.