text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
sb = new StringBuilder();
String line = in.readLine();
for ( ; line!=null; ) {
int n = Integer.parseInt(line);
if(n==0)break;
vAx = new ArrayList<Integer>();
vAy = new ... | 9 |
protected synchronized void deliverObserverEvents(
Vector<TSEvent> _eventList, boolean snapshot) {
String tsEventLog = null;
if (_eventList == null)
return;
int metaCode;
int cause;
if (snapshot) {
metaCode = 135;
cause = 110;
} else {
metaCode = 136;
cause = 100;
}
int nextMetaEventI... | 9 |
public float nextRatio() {
float u, v, x, xx;
do {
// u and v are two uniformly-distributed random values
// in [0, 1), and u != 0.
while ((u = gen.nextFloat()) == 0); // try again if 0
v = gen.nextFloat();
float y = C1*(v - 0.5f)... | 4 |
@Override
public void invalidateLayout(Container target) {
for (PrecisionLayoutData one : mConstraints.values()) {
one.clearCache();
}
} | 1 |
private void computeGridCountAndCentroids(HashMap<ArrayList<Integer>, Integer> data) {
// create the number of grid for each dimension
dimSize = new int[numDimension]; // the number of grids for each dimension
for (int i=0; i<numDimension; i++) {
int rangeDimension = maxList[i] - minList[i];
dimSize[i] = ra... | 4 |
public void desconectar(){
connection = null;
} | 0 |
private static void calcNoOfNodes(Node node) {
if (node instanceof Parent) {
if (((Parent) node).getChildrenUnmodifiable().size() != 0) {
ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable();
noOfNodes += tempChildren.size();
f... | 3 |
public static void createLocalDatabaseAndUser(MySQLIdentity root, MySQLIdentity newIdentity) throws SQLException, MySQLException {
if((root.host == null) || (newIdentity.host == null)) { throw new MySQLException("Host not specified");}
if(root.host.equals(newIdentity.host) == false) { throw new MySQLException("Hos... | 3 |
public static void main(String[] args)
{
long start = System.currentTimeMillis();
try
{
ObjectInputStream inputFile =
new ObjectInputStream( new
FileInputStream("myBInaryIntegers.dat"));
for (int i = 1; i <= 1000000; i++){
int tempInt = inputFile.readInt();
System.out.println(t... | 2 |
public int[] searchRange(int[] A, int target) {
int mid = 0;
int start = 0, end = A.length - 1;
int[] index = { -1, -1 };
boolean flag = true;
while (start <= end) {
mid = (start + end) >> 1;
if (A[mid] == target) {
flag = false;
break;
}
if (A[mid] > target)
end = mid - 1;
else
... | 8 |
@Override
protected void setBounds(Rectangle bounds) {
super.setBounds(bounds);
map = new Tile[bounds.height][bounds.width];
// Tile instance properties is null when this method is called from
// the constructor of MapLayer
if (tileInstanceProperties != null) {
t... | 1 |
public void helper(BoggleBoard board, int r, int c, ArrayList<BoardCell> list,
StringBuilder searchWord, ILexicon lex) {
if(r < 0 || r>= board.size() || c < 0 || c >= board.size()) {
return;
}
BoardCell init = new BoardCell(r,c);
if(list.contains(init)) {
return;
}
String letterHere = board.getF... | 9 |
static void preprocess(char[] p) {
int i = 0, j = -1, m = p.length;
b = new int[p.length + 1];
b[0] = -1;
while (i < m) {
while (j >= 0 && p[i] != p[j])
j = b[j];
b[++i] = ++j;
}
} | 3 |
public static void main(String[] args) {
MainWindowModel mainWindowModel = new MainWindowModel();
MainWindowView mainWindowView = new MainWindowView();
InterpolatorModel interpolatorModel = new InterpolatorModel();
PlotBuilder plotBuilder = new PlotBuilder();
plotBuilder.setInte... | 0 |
public AutoTotaalDienst getATD() {
ArrayList<AutoTotaalDienst> alleATDDB = new ArrayList<AutoTotaalDienst>();
try {
this.leesDatabase();
output = statement.executeQuery("SELECT * FROM autototaaldienst");
while (output.next()){
double lp = output.getDouble("literprijs");
double wup = output.getDoub... | 2 |
private boolean OpenFile()
{
//read status
boolean status = false;
try
{
//open the file output stream
FileOutputStream outStream = new FileOutputStream(System.getProperty("user.dir")+"\\"+fileName);
//set the data stream for the file
... | 1 |
public void stopLoop(){
isRunning = false;
// Stop the game-loop:
try {
game_loop_executor.shutdown();
game_loop_executor.awaitTermination(10, TimeUnit.SECONDS);
} catch (SecurityException e){
e.printStackTrace();
} catch (InterruptedException ... | 4 |
private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 62
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 62
... | 8 |
private final void read(SelectionKey key) {
@SuppressWarnings("resource")
SocketChannel socketChannel = (SocketChannel) key.channel();
Session session = (Session) key.attachment();
mReadBuffer.clear();
int amount;
try {
amount = socketChannel.read(mReadBuffer);
if (amount > 0) {
session.requestHan... | 3 |
private void printBezochteVelden(RouteMetaData[][] bezochtevelden) {
System.out.println("");
System.out.println("");
for (int i = 0; i < bezochtevelden.length; i++) {
for (int j = 0; j < bezochtevelden[i].length; j++) {
if (bezochtevelden[i][j] != null) {
... | 3 |
private boolean booleanOption(String s) {
if (s == null) return true;
switch (s) {
case "true": case "yes": case "on": case "1": return true;
case "false": case "no": case "off": case "0": return false;
}
throw new IllegalArgumentException("unrecognized boolea... | 9 |
private void insertEmployeeIntoTable(Employee employee) {
Object[] fields = new Object[7];
fields[0] = employee.getEmployeeNumber();
fields[1] = employee.getFirstName();
fields[2] = employee.getInsertion().isEmpty() ? "" : employee.getInsertion();
fields[3] = employee.getFamilyNa... | 2 |
synchronized void delayAndPrint(int cnt)
{
try{
System.out.print("Thread:"+cnt+",Mehod:1-Am in");
Thread.sleep(2000);
System.out.println(", After 2 sec out");
}
catch(Exception e)
{
System.out.println("Error-"+e);
}
} | 1 |
private void recoleccion() {
int estado;
boolean cont=carro.evaluarActHuerto();
while(!carro.getCargado() && cont)
{
estado=carro.evaluarRecoleccion();
if(estado==Huerto.DISPONIBLE){
carro.recolectar();
try {
sleep(harvestTime);
}
catch (InterruptedException e)
{
e.pr... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Column other = (Column) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return fa... | 9 |
public Void visitConditionDirective(ConditionDirectiveContext ctx) {
if (ctx.LEFT_PAREN() != null)
appendCode("(");
switch (ctx.conditionDirective().size()) {
case 0:
if (ctx.definedCondition() != null)
visitDefinedCondition(ctx.definedCondition());
... | 9 |
private void verifyUser(String username, String password) throws Exception{
schema = (FdotSchemaImpl) factory.getBean("connection_specs");
SdeConnection conn = new SdeConnection(schema.getServer(),
schema.getInstance(),
schema.getDatabase(),
username,
password);
try{
... | 4 |
private ChatSocketServer() {
super();
for (int i = 0; i < rooms.length; i++) {
if (i == DEFAULT_ROOM)
rooms[i] = ChatRoom
.getInstance(ManagerSocketServer.MAX_CLIENTS);
else
rooms[i] = ChatRoom
.getInstance(GameSocketServer.MAX_NUMBER_OF_USERS_PER_GAME);
}
} | 2 |
public Map<String, Constructor<? extends ICreature>> getConstructorMap() {
return constructorMap;
} | 1 |
public int getEast(){
return this.east;
} | 0 |
protected void change()
{
Integer tickets = ticketsBox.getValue();
Integer friends = friendsBox.getValue();
Integer winners = winnersBox.getValue();
Integer limit = limitBox.getValue();
if (validate(tickets, 1000, 1, ticketsBox) &&
validate(winners, tickets, 1, winnersBox) &&
validate(limit, 100, 1,... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Role other = (Role) obj;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.de... | 9 |
@EventHandler
public void onHit(EntityDamageByEntityEvent e ){
if(e.getEntity() instanceof Player && e.getDamager() instanceof Player){
Player p = (Player) e.getEntity();
Player d = (Player) e.getDamager();
if(PlayerListener.getGhostMode(d)){
PlayerListener.toggleGhostMode(p);
Main.getAPI().startSpe... | 3 |
@Override
public void itemStateChanged(ItemEvent ie) {
if (ie.getStateChange() == ItemEvent.SELECTED) {
switch (opcao) {
case 'm':
jp = new ExibeAtracoes('m', linguagem, utilizador);
//System.out.println("FrPrincipal... | 9 |
public ParseTreeNode rexp3() throws SyntaxError {
ParseTreeNode node = new ParseTreeNode("<rexp3>");
if (symbol == '.' || symbol == '[' || isDefinedClass()) {
node.addChild(charClass());
return node;
}
return node;
} | 3 |
public Rectangle boundingBox(){
BufferedImage bi = animation.getImage();
Rectangle rect = new Rectangle();
switch(spikeDir){
case top:
rect.x = (int) position.x();
rect.y = (int) position.y();
rect.width = bi.getWidth();
rect.height = 10;
break;
case bottom:
rect.x = (int) position.x();
r... | 4 |
public static void makeRandomInteger(Matrix matrix) throws MatrixIndexOutOfBoundsException {
int rows = matrix.getRowsCount();
int cols = matrix.getColsCount();
double temp = 0;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
// fill with ra... | 2 |
@Override
public boolean removeAll(Collection<?> list) {
boolean changed = false;
for (Object o: list)
if (remove(o))
changed = true;
return changed;
} | 3 |
public static void offerOrDropItem(EntityMinecart cart, ItemStack stack) {
stack = transferHelper.pushStack(cart, stack);
if (stack != null && stack.stackSize > 0)
cart.entityDropItem(stack, 1);
} | 2 |
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event){
Action action = event.getAction();
if (action.equals(Action.RIGHT_CLICK_BLOCK)){
Player player = event.getPlayer();
Block block = event.getClickedBlock();
if ((block.getType().equals(Material.SIGN) || block.getType().equals(Material.SI... | 5 |
int readCorner4(int numRows, int numColumns) {
int currentByte = 0;
if (readModule(numRows - 3, 0, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(numRows - 2, 0, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(numRo... | 8 |
public boolean getIsFinished() {
return finished;
} | 0 |
public static void main(String[] args) {
try {
String input = null, output = "out.s";
for(int i = 0; i<args.length; i++) {
switch(args[i]) {
case "-o":
// next item will be the filename of the disassembler
// output
... | 5 |
public void ResetPlayer() {
//booleans to control win and lose conditions
raceWin = false;
crashed = false;
//place the car on the canvas
x = (int) (Framework.frameWidth * 0.20);
y = (int) (Framework.frameHeight * 0.70);
//speed of the car
speed... | 0 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
String line = "";
while ((line = in.readLine()) != null) {
char[] m = line.trim().toCharArray();
int n = m.length;
long row = 0,... | 5 |
public Set<T> less(Set<T> s)
{ Set<T> res=this;
if(s==null)
{ return res;}
else
{ if(res.next!=null)
{ return res.del(s.a).less(s.next);}
else//res.next==null
{ return null;
}
}
} | 2 |
private void evalArrayStore(Type expectedComponent, Frame frame) throws BadBytecode {
Type value = simplePop(frame);
Type index = frame.pop();
Type array = frame.pop();
if (array == Type.UNINIT) {
verifyAssignable(Type.INTEGER, index);
return;
}
... | 3 |
public static Ability getMyPlantsSpell(Item I, MOB mob)
{
if((I!=null)
&&(I.rawSecretIdentity().equals(mob.Name()))
&&(I.owner()!=null)
&&(I.owner() instanceof Room))
{
for(final Enumeration<Ability> a=I.effects();a.hasMoreElements();)
{
final Ability A=a.nextElement();
if((A!=null)
&&((A.i... | 9 |
private boolean uhattuVasemmalta(int pelaajaNumero, int x, int y) {
int i = 1;
while(y-i >= 0 && kentta[x][y-i].onTyhja()) i++;
if(y-i == -1) return false;
if(kentta[x][y-i].getNappula().omistajanPelinumero() != pelaajaNumero) {
if(i == 1 && kentta[x][y-i].g... | 8 |
void getCommands()
{
ArrayList<Commands> commands;
DBase dbase = new DBase();
commands = dbase.getParserCommands();
for (Commands c : commands)
{
if (c.type.equalsIgnoreCase("Move"))
{
movement.add(c.word);
} else if... | 7 |
public KeyFrame getNextKey() {
Iterator<KeyFrame> itr = keys.iterator();
while (itr.hasNext()) {
KeyFrame k = itr.next();
if (k == currentKey) {
if (itr.hasNext())
return itr.next();
}
}
return keys.get(0);
} | 3 |
public void terminate() {
stop = true;
try {
socket.close();
in.interrupt();
out.interrupt();
} catch (final IOException ioe) {
// Ignore
}
logger.debug("Terminated peer exchange with " + peer + "...");
} | 1 |
public void constructPieWithPieBuilder(PieBuilder pb) {
this.pb = pb;
constructed = false;
if (this.pb != null) {
this.pb.createNewPie();
this.pb.buildDough();
this.pb.buildFilling();
constructed = true;
} else {
BuilderClient.addOutput("error - no pie builder found!");
}
} | 1 |
protected void render() {
if (allEntries.size() == 0) return ;
//
// First, determine a 'viewing window' for the text, if larger than the
// visible pane-
final Box2D textArea = new Box2D().set(0, 0, xdim(), ydim()) ;
if (scrollbar != null) {
final float lineHigh = 0 ;// alphabet.map[' '... | 7 |
public Color convertToColor(SquareColor color) {
if (color == null) {
return Color.WHITE;
}
switch (color) {
case BLUE:
return Color.BLUE;
case RED:
return Color.RED;
case YELLOW:
return Color.YELLOW;... | 8 |
private void receiveAndDispatch() throws Exception {
try {
Session session = receiveTemplate.getSession();
MessageConsumer consumer = receiveTemplate.getMessageConsumer();
Message msg = consumer.receive(500);
if (msg != null) {
if (MSG_TYPE_REQUEST... | 9 |
private static void clearBuffer() {
if (N == 0) return;
if (N > 0) buffer <<= (8 - N);
try { out.write(buffer); }
catch (IOException e) { e.printStackTrace(); }
N = 0;
buffer = 0;
} | 3 |
public boolean canMove(int i, int j, Direction d) throws CellDoesNotExistException {
checkCellExists(i, j);
if (isWallUp(i, j, d)) {
// There is a wall that is blocking us, so we cannot move that way.
return false;
} else {
// No wall, so let's see if we can move that way.
int i1 = i;
int j1 = j;
... | 7 |
public static <T extends DC> Set<Pair<PT<Integer>,T>> dom(Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>> phiMax)
{ if(phiMax!=null)
{ if(phiMax.getNext()!=null)
{ return new Set(phiMax.getFst().fst(),dom(phiMax.getNext()));
}
else
{ return new Set(phiMax.getFst().fst(),null);
}
... | 2 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tuple3 tuple3 = (Tuple3) o;
if (_0 != null ? !_0.equals(tuple3._0) : tuple3._0 != null) return false;
if (_1 != null ? !_1.equals(tuple3._1) : ... | 9 |
@Override
public void enumerate(String uid, String connectedUid, char position,
short[] hardwareVersion, short[] firmwareVersion,
int deviceIdentifier, short enumerationType) {
// configure bricks on first connect (ENUMERATION_TYPE_CONNECTED)
// or configure bricks if enumerate was raised externally (ENUME... | 6 |
public CheckReport1(File file) throws Exception {
this.file = file;
fileName = file.getName();
fileNameSections = fileName.split("\\.")[0].split("_");
if (fileNameSections.length == 4) {
// 记录期数
monthDate = fileNameSections[3];
} else if (fileNameSections.length == 3) {
// 记录期数
monthDate = fileNam... | 2 |
@Override
public SQLExceptionConverter buildSQLExceptionConverter() {
return new SQLExceptionConverter() {
private static final long serialVersionUID = 1L;
public JDBCException convert(SQLException sqlException,
String message, String sql) {
final int errorCode = JdbcExceptionHelper.extractErrorCode(... | 8 |
public void WGStatus(String channel, String sender) {
Integer setwords = 0;
String availablewords = new String();
HashMap<String, Integer> setusers = new HashMap<String, Integer>();
Game game;
game = games.get(getServer() + " " + channel);
if(game == nul... | 6 |
public Boolean isFinished() {
return isFinished;
} | 0 |
public Deck() {
init();
} | 0 |
public void startGame(List<Player> players, MenuPanel menu){
this.allGameFrames = new HashMap<Player,GameFrame>();
getContentPane().remove(menu);
setVisible(false);
dispose();
if(players == null || players.size() <2){
throw new IllegalArgumentException("Invalid players number. Can't start the game.");... | 4 |
private double checkTransform() {
if(getLoc().nextTile != null) {
if(getLoc().getCoordinates().x - getLoc().nextTile.getCoordinates().x > 0)
return (-Math.PI/2);
else if(getLoc().getCoordinates().y - getLoc().nextTile.getCoordinates().y < 0)
return (Math.PI);
else if(getLoc().getCoordinates().x - getLoc(... | 7 |
boolean resolve(final MethodWriter owner, final int position,
final byte[] data) {
boolean needUpdate = false;
this.status |= RESOLVED;
this.position = position;
int i = 0;
while (i < referenceCount) {
int source = srcAndRefPositions[i++];
int reference = srcAndRefPositions[i++];
int offset;
if... | 5 |
DeclarationsNode declaration() {
// Declarations = [�CONST� ident �=� Expression �;� {ident �=�
// Expression �;�}]
// [�TYPE� ident �=� Type �;� {ident �=� Type �;�}]
// [�VAR� IdentList �:� Type �;� {IdentList �:� Type �;�}]
// {ProcedureDeclaration �;�}
ArrayList<ConstDeclarationNode> consts = new Arr... | 7 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if((tickID==Tickable.TICKID_MOB)
&&(statue!=null)
&&(affected instanceof MOB))
{
final MOB mob=(MOB)affected;
mob.makePeace(true);
if((statue.owner()!=null)&&(statue.owner()!=mob.location()))
{
Room room=null;
if(statue.owner() ... | 9 |
public boolean loadPanel(){
try{
/*fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
int returnVal = fc.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();*/
BufferedReader br = new BufferedReader(new FileReader(new File("panels.xml")));... | 5 |
public long getSeatType() {
return this._seatType;
} | 0 |
public static void main(String[] args) throws IOException {
File f = new File("src/IntegerArray.txt");
Scanner s = new Scanner(f);
int i = 0;
while(s.hasNext()){
array[i] = s.nextInt();
i++;
}
// BruteForceMethod();
int n = array.length;
Mergeforcemethod(0 , n);
} | 1 |
public static int countAdjecentTracks(World world, int x, int y, int z) {
int i = 0;
if (isTrackFuzzyAt(world, x, y, z - 1))
++i;
if (isTrackFuzzyAt(world, x, y, z + 1))
++i;
if (isTrackFuzzyAt(world, x - 1, y, z))
++i;
if (isTrackFuzzyAt(w... | 4 |
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc)
throws IOException {
String name = "" + dir;
if (!name.toLowerCase().contains("sopa")) {
return CONTINUE;
}
if (name.equalsIgnoreCase(ROOTDIR))
return CONTINUE;
String[] comps = ... | 7 |
public static int indexOf(Object[] arr, Object obj)
{
if (obj == null)
{
for (int c = 0; c < arr.length; c++)
{
if (arr[c] == null)
{
return c;
}
}
}
else
{
for (int c = 0; c < arr.length; c++)
{
if (obj.equals(arr[c]))
{
return c;
}
}
}... | 5 |
public void init(int nplayers, int[] pref)
{
this.nplayers = nplayers;
this.index = getIndex();
this.pref = pref;
length = pref.length;
transform = new int[length];
distribution = new int[length];
observedlist = new int[length];
distsum = new int[length];
choicelist = new int[nplayers + 1][length];
... | 1 |
private String formatKey(String key){
if(!caseSensitiveLookup){
key = key.toLowerCase();
}
if(asciiFoldingLookup){
key = StringUtils.stripAccents(key);
}
return key;
} | 2 |
protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... | 9 |
public static long getLong(ByteBuffer in)
{
int a = in.get() & 0xFF;
int sign = (a & BYTE_SIGN_NEG);
long value = (a & 0x3fL);
int shift = -1;
while ((a & BYTE_MORE) != 0)
{
a = in.get() & 0xFF;
value |= (a & 0x7FL) << (shift += 7);
... | 2 |
private static void makeTet6(SquareColor[][] tet) {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (((i == 1 || i == 2) && j == 0) || ((i == 2 || i == 3) && j == 1)) {
tet[i][j] = SquareColor.RED;
} else tet[i][j] = null;
... | 8 |
public void setDim(int dim) throws ConnectException {
int maxDim = dim;
for (InputConnector ic : inputs) {
if (ic.isConnected()) {
if (dim != 0 && ic.getSource().getDim() != dim)
throw new ConnectException(ic.getSource(), dim);
if (maxDim < ic.getDim())
maxDim = ic.getDim();
}
}
if (outp... | 7 |
static <T> Class<T> boxClass(Class<T> type) {
if (type == boolean.class) {
return (Class<T>) Boolean.class;
} else if (type == byte.class) {
return (Class<T>) Byte.class;
} else if (type == char.class) {
return (Class<T>) Character.class;
} else if (ty... | 8 |
public boolean atBP()
{
double predictedTemp = getBPTemp();
if(temp <= predictedTemp+2 && temp >= predictedTemp-2)
return true;
return false;
} | 2 |
@Test
public void testPausedState() throws ProcessExecutionException, ProcessRollbackException {
IProcessComponent<?> comp = TestUtil.executionSuccessComponent(true);
// use reflection to set internal process state
TestUtil.setState(comp, ProcessState.PAUSED);
assertTrue(comp.getState() == ProcessState.PAUSE... | 5 |
public void printMessageContainer() {
System.out.println("MessageContainer for round " + round);
for (int i = 0; i < msgs.length; i++) {
if (msgs[i] == null) {
}
else if (i != (pid - 1)) {
System.out.println("Pid: " + msgs[i].pid + " Round: " + msgs[i].round);
msgs[i].printMessage();
}
}
} | 3 |
private static Vector<Integer> checkNeighbourhood(BufferedImage img, int x,
int y, int r) {
Vector<Integer> vect = new Vector<>();
for (int i = x - r; i <= x + r; i++) {
for (int j = y - r; j <= y + r; j++) {
if (i >= 0 && j >= 0 && i < img.getWidth()
&& j < img.getHeight()) {
if (img.getRGB(i... | 9 |
public static HtmlRedirect parse(String content, VariableMap variables) {
HtmlRedirect ret = new HtmlRedirect();
int semi = content.indexOf(";");
if (semi == -1) { // Just a number, no URL, e.g., MRTG does this
ret.seconds = Integer.parseInt(content);
return ret;
}
Matcher match = META_REFRESH_CONTENT_... | 4 |
public int lengthOfLongestSubstring(String s) {
int longest, mindex, n = s.length(), startindex = 0, endindex = 1, lastindex;
int[] map = new int[26];
char[] c = s.toCharArray();
if (n == 0) {
return 0;
} else {
longest = 1;
}
for (int m = 0; m < 26; m++) {
map[m] = -1;
}
while (startindex ... | 9 |
public RoomCell(int i, int numRows, int numCols, String config) {
super(i, numRows, numCols);
// Door handling.
doorDirection = DoorDirection.NONE;
roomInitial = config.charAt(0);
String roomSpec = config;
if(roomSpec.length() > 1) { // Then we have a door.
char door = roomSpec.charAt(1);
if(door =... | 5 |
public void calculateInitialScore(ROB_entry entry) {//calculate the score based on which heuristic we use for the score function
if(heuristic.type == HeuristicType.heuristic_LATENCY_SNR ) {//sum of sequence number and multiplier * latency
entry.score += latencyMultiplier * entry.theUop.exec_latency;... | 9 |
public void llenarTabla(JTable tabla)throws Exception{
ResultSetMetaData rsm;
DefaultTableModel dtm;
Menu menu = new Menu();
Statement consulta = menu.conexion();
ResultSet resultado = consulta.executeQuery("SELECT * FROM tblproductos ");
rsm=resultado.getMetaData();
... | 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 |
protected void requireConfigKey(final String key) {
if (config.getProperty(key) == null) {
throw new Error("missing required configuration key: '" + key + "'");
}
} | 1 |
public static <T extends Model> List<T> createSQLQuery(final Class<T> cls, final String sql, final String... params) {
final List<T> result = new ArrayList<T>();
synchronized (Lock) {
final DBOpenHelper helper = Beans.getBean(DBOpenHelper.class);
SQLiteDatabase database = helper.getReadableDatabase();
f... | 1 |
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... | 3 |
protected boolean disconnectInput(NeuralConnection i, int n) {
int loc = -1;
boolean removed = false;
do {
loc = -1;
for (int noa = 0; noa < m_numInputs; noa++) {
if (i == m_inputList[noa] && (n == -1 || n == m_inputNums[noa])) {
loc = noa;
break;
}
}
if (loc >= 0... | 8 |
public void checkBattle() {
if (noBattle == false) {
if (stepscount >= rndwildmodify) {
lastBGM = currentBGM;
currentBGM.stop();
currentBGM = wildbattle;
currentBGM.start();
enemylvl = (byte) (first.getLevel() * (9 / 10)... | 7 |
public void printSquares(List<Point2D> list, Point2D p1, Point2D p2, Game game)
{
Square origin = squareAt(p1);
Square goal = squareAt(p2);
System.out.println(" == MAP SIZE: "
+ (xArraySize*TILE_SIZE) + "x" + (yArraySize*TILE_SIZE) + " == ");
for (int y = 0; y < yArraySize ; y++) {
for ... | 8 |
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.