text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void SetStartBusStop(int startBusStop)
{
//set the start bus stop
this.startBustop = startBusStop;
} | 0 |
private InEdgeIteratorImpl(InternalNodeWrapper<N, E> to, ContextualReachability<N, E, ?> contextualReachability) {
List<InternalNode<N, E>> reachableFromNodes = new ArrayList<InternalNode<N, E>>();
for (InternalNode<N, E> node : to.getReachableFrom()) {
if (contextu... | 3 |
public svm_node[] getTemplatePixelsInSVMFormat(int x0, int y0, int x1, int y1) {
int xDistance,yDistance;
int startX,startY;
int currentX,currentY;
int Ox,Oy;
double xRes,yRes;
double offsetY;
double scaleFactor;
svm_node node;
svm_node template[] = new svm_node[735]; /* template ... | 8 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Animal other = (Animal) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Machine other = (Machine) obj;
if (IP == null) {
if (other.IP != null)
return false;
} else if (!IP.equals(other.IP))
return false;
... | 8 |
@Override
public void initialize() throws Exception
{
this.buildTrain();
this.createPlanTickets();
} | 0 |
public String getPath() {
return this.key;
} | 0 |
public void actionPerformed(ActionEvent e) {
String nick = GUIMain.userList.getSelectedValue().toString();
if (nick.startsWith("@")) {
nick = nick.replace("@", "");
} else if (nick.startsWith("$")) {
nick = nick.replace("$",... | 5 |
public static void appendPoison(final Client c) {
if (c.playerEquipment[c.playerShield] == 18340) {
c.sendMessage("Your Anti-poison totem prevents you from being poisoned.");
return;
}
if (System.currentTimeMillis() - c.lastPoisonSip > c.poisonImmune) {
c.sendMessage("You have been poisoned.");
c.isPo... | 7 |
@Override
public void ParseIn(Connection Main, Server Environment)
{
Environment.InitPacket(451, Main.ClientMessage);
Environment.Append(0, Main.ClientMessage);
Environment.Append(Integer.toString(4), Main.ClientMessage);
List<Room> roomList = new ArrayList<Room>();
for(i... | 6 |
public void visitFieldExpr(final FieldExpr expr) {
if (expr.object() != null) {
expr.object().visit(this);
}
print(".");
if (expr.field() != null) {
print(expr.field().nameAndType().name());
}
} | 2 |
public void setBAsString(String b) {
this.b = b;
} | 0 |
public synchronized DataInputStream getChunkDataInputStream(int x, int z) {
if (outOfBounds(x, z)) {
debugln("READ", x, z, "out of bounds");
return null;
}
try {
int offset = getOffset(x, z);
if (offset == 0) {
// debugln("READ", x... | 7 |
public static LogFileInfo getLogFileInfo(HierarchicalConfiguration logFileData)
{
LogFileInfo logFileInfo = null;
if (logFileData != null) {
logFileInfo = new LogFileInfo();
logFileInfo.setRunId(logFileData.getLong(RUNID_TAG));
logFileInfo.setType(logFileData.getString(TYPE_TAG... | 1 |
@Override
public boolean add(EmpleadoDTO em) {
boolean valor = false;
try {
em.setId_usuario(getMaxidUsuario()+1);
em.setActivo(true);
em.setTiene_foto(true);
conn = PaginaWebConnectionFactory.getInstance().getConnection();
String sql = "insert into usuario values(?,?,?,?,?,?,?,?,?,?)";
... | 6 |
private static int loadTexture(String fileName)
{
String[] splitArray = fileName.split("\\.");
String ext = splitArray[splitArray.length - 1];
try
{
BufferedImage image = ImageIO.read(new File("./res/textures/" + fileName));
boolean hasAlpha = image.getColorMo... | 4 |
public static void divide(double basePercentage, int repetitions) {
// The percentage of the training set has to be between 0 and 1
if (0 > basePercentage || basePercentage > 1) {
System.err.println("The percentage of the training set has to be between 0 and 1.");
return;
}
for (int i = 1; i <= repetiti... | 9 |
@Override
public boolean retainAll( final Collection<?> os ) {
boolean result = false;
final Iterator<T> iter = iterator();
while( iter.hasNext() ) {
if( !os.contains( iter.next() ) ) {
iter.remove();
result = true;
}
}
return result;
} | 3 |
public int getS2() {
return this.state2;
} | 0 |
@Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if (getValueAt(0, column) == null) {
return String.class;
}
returnValue = getValueAt(0, column).getClass();
} else {
... | 3 |
private void calculateEnabledState(JoeTree tree) {
Document doc = tree.getDocument();
if (doc == Outliner.documents.getMostRecentDocumentTouched()) {
Node node = tree.getEditingNode();
if (tree.getComponentFocus() == OutlineLayoutManager.ICON && tree.getNumberOfSelectedNodes() >= 2) {
setEnabled(tr... | 3 |
private void parseZip(String s) {
String x = s.trim(), zip = "";
int start = -2;
int slut = 0;
for (int i = 0; i < s.length(); i++) {
if (Character.isDigit(s.charAt(i))) { //if current char is digit
if (start == -2) {
start = i;
... | 7 |
private int processCommentSymbol(final OutStream outStream, final Character currentChar) throws StreamException {
outStream.writeSymbol(currentChar);
switch (currentChar) {
case '"':
return MODE_STRING;
case '\'':
return MODE_CHAR;
case... | 3 |
public void updateRight(){
if(right > 0){
for(int i=top; i<height+top; i++){
for(int j=originalWidth; j<originalWidth+right; j++){
drawDiamond(j, i);
}
}
}
else if(right < 0){
for(int i=top; i<height+top; i++... | 6 |
int possibleMovesNum(Point[] grid, Pair pr) {
int possible = 0;
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
Point currentPoint = pointAtGridIndex(grid, i, j);
if (currentPoint.value == 0) {
continue;
}
for (Pair d : directionsForPair(pr)) {
if (isValidBoardIndex(i ... | 6 |
public byte[] toByteArray() throws PacketEncodingException {
ByteBuffer buffer = ByteBuffer.allocate(HEADER_SIZE + (message == null ? 0 : message.length()));
buffer.putInt(protocolId);
buffer.put(Packet.encodeConnectionId(connectionId));
buffer.putShort(Packet.encodeSequenceNumber(sequenceNumber));
buffer.put... | 3 |
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("rowset") && !stack.isEmpty()) {
EveAsset<EveAsset<?>> asset = stack.pop();
if (stack.isEmpty()) {
response.add(asset);
currentAsset = null;
}
}
if (qName.equals("row") && stack.is... | 7 |
@Override
public Object stringToValue(String text) throws ParseException {
if ("".equals(text)) {
getFormattedTextField().setBackground(Color.white);
return null;
}
Object retVal = null;
try {
retVal = super.stringToValue(text);
try {
Double.parseDouble(text);
if (!tex... | 7 |
public String getDay() {
return day;
} | 0 |
private int location(Value v, int position) throws Exception {
if(isSpilled(v) || v.getColor() == -2) {
int target = position == 1 ? t1 : t2;
// if this is a special spill case
if(v.getColor() < 0) {
if(v instanceof Fetch) {
int address = g... | 6 |
public static void remove(Object object) {
getController().rootPane.getChildren().remove(object);
} | 0 |
public ValidationErrorList validate(){
Person person = doctor.getPerson();
ValidationErrorList errorList = new ValidationErrorList();
Validator instance = ESAPI.validator();
DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
if ( (instance.getValidInput("username", userAccount.getUsername(), "Name", 2... | 9 |
public List<MapName> getMapNameById(String lang, String id) {
List<MapName> mapNames = new ArrayList<MapName>();
List<MapName> result = new ArrayList<MapName>();
mapNames = sendRequest(lang);
for(MapName mapName : mapNames) {
if(mapName.getId().equals(id)) {
result.add(mapName);
}
}
return result;... | 2 |
private void notifyListeners() {
for (int j = 0; j < keys.length; j++) {
if (keys[j].gotPressed()) {
for (int i = 0; i < listeners.size(); i++) {
if(!newListeners.contains(listeners.get(i))) {
listeners.get(i).actionPerformed(
new InputEvent(keys[j], InputEventType.PRESSED));
} else {
... | 4 |
public byte[] getBuf() {
return buf;
} | 0 |
@Override
public void deserialize(Buffer buf) {
experienceCharacter = buf.readDouble();
if (experienceCharacter < 0)
throw new RuntimeException("Forbidden value on experienceCharacter = " + experienceCharacter + ", it doesn't respect the following condition : experienceCharacter < 0");
... | 4 |
@Override
public boolean propertyIsDefault(String key) {
if (propertyDefaultExists(key) && propertyExists(key)) {
return propertyEquals(key, getPropertyDefault(key));
} else {
return false;
}
} | 2 |
private final String beginMultiLineCommentFilter( String line )
{
//assert !inJavadocComment;
//assert !inMultiLineComment;
if ( line == null || line.equals( "" ) )
{
return "";
}
int index;
//check to see if a multi-line comment starts on this l... | 6 |
public void fusionWithMultiplyFullAlpha(CPLayer fusion, CPRect rc) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(rc);
for (int j = rect.top; j < rect.bottom; j++) {
int off = rect.left + j * width;
for (int i = rect.left; i < rect.right; i++, off++) {
int color1 = data[off];
int alpha1... | 3 |
public ArrayList<String> getWorkPosition() {
return WorkPosition;
} | 0 |
@Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
objectGID = buf.readShort();
if (objectGID < 0)
throw new RuntimeException("Forbidden value on objectGID = " + objectGID + ", it doesn't respect the following condition : objectGID < 0");
powerRate = ... | 4 |
@Override
public void handleMessage(Message msg) {
String uri = (String) msg.obj;
if (mLoadingManager.isOutdated(uri)) return;
switch (msg.what) {
case ACTION_ON_START: {
Set<ResourceSpecs<T>> set = mLoadingManager.getSpecsList(uri);
... | 8 |
public static HashMap<String,Integer> getEffectStats(HashSet<Integer> infPpl, HashSet<Integer> closedLocs) {
HashMap<String,Integer> stats = new HashMap<String,Integer>();
int affCount = 0;
int infConCount = 0;
int totalConCount = 0;
try {
Connection con = dbConnect();
PreparedStatement getNumLocCon = c... | 7 |
public int compareTo( Object obj ) {
if( obj == null ) {
return( -1 );
}
else if( obj instanceof GenKbGelCounterBuff ) {
GenKbGelCounterBuff rhs = (GenKbGelCounterBuff)obj;
int retval = super.compareTo( rhs );
if( retval != 0 ) {
return( retval );
}
{
int cmp = getRequiredCounterName().c... | 9 |
protected static byte[] mintName(int ver, String node, String ns)
throws UUIDException {
/*
* Generates a Version 3 or Version 5 UUID. These are derived from a
* hash of a name and its namespace, in binary form.
*/
if (node.length() == 0)
throw new UUIDException(
"A name-string is required for V... | 6 |
public void clearMap(GameAction gameAction) {
for (int i=0; i<keyActions.length; i++) {
if (keyActions[i] == gameAction) {
keyActions[i] = null;
}
}
for (int i=0; i<mouseActions.length; i++) {
if (mouseActions[i] == gameAction) {
... | 4 |
private boolean jj_3_73() {
if (jj_scan_token(AND)) return true;
return false;
} | 1 |
protected String getMutatorName(Method m)
{
String name = m.getName();
if (name.startsWith("get"))
{
return "set" + name.substring(3);
}
else if (name.startsWith("is"))
{
return "set" + name.substring(2);
}
else
{
return null;// not valid, should not happen
}
} | 2 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Telefone other = (Telefone) obj;
if (this.id != other.id) {
return false;
}
i... | 5 |
@Override
public boolean isOutOfBounds(final char character){
return character != NONE && (character < HangulJamo.MIN_VALUE || HangulJamo.MAX_VALUE < character);
} | 2 |
private void readClassInfo(final DataInputStream in) throws IOException {
thisClass = in.readUnsignedShort();
superClass = in.readUnsignedShort();
final int numInterfaces = in.readUnsignedShort();
interfaces = new int[numInterfaces];
for (int i = 0; i < numInterfaces; i++) {
interfaces[i] = in.readUnsig... | 1 |
public Zone getZoneWithCardId(int id) throws NoZoneOpenException {
int c;
for(c = 0; c < 5; c++) {
if(!this.monsterzones[c].isOpen()) {
if(this.monsterzones[c].card.id == id) {
return this.monsterzones[c];
}
} else if(!this.magiczones[c].isOpen()) {
if(this.magiczones[c].card.id == id) {
... | 5 |
public static Point2D coordinates(final Rectangle2D rectangle,
final RectangleAnchor anchor) {
Point2D result = new Point2D.Double();
if (anchor == RectangleAnchor.CENTER) {
result.setLocation(rectangle.getCenterX(), rectangle.getCenterY());
}
... | 9 |
@Override
public List<Direction> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException {
int pageSize = 50;
List paramList = new ArrayList<>();
StringBuilder sb = new StringBuilder(WHERE);
String queryStr = new QueryMapper() {
@O... | 2 |
public void setGivenBy(String givenBy) {
this.givenBy = givenBy;
} | 0 |
private void initProgressBar(){
progressBar = new JProgressBar();
progressBar.setIndeterminate(true);
progressBar.setBounds(INDENT_LEFT, getHeight()-50, getWidth()-INDENT_LEFT*2,20);
progressBar.setVisible(true);
add(progressBar);
} | 0 |
public void update(int delta){
speedCounter += delta;
if(speedCounter >= speed){
speedCounter = 0;
}
for(int i=0;i<entities.size();i++){
Entity e = entities.get(i);
if(e instanceof Creature){
Creature c = (Creature)e;
c.ai.update(delta);
if(speedCounter == 0){
c.canAct = true;
}... | 6 |
public void run() {
try {
if (MTServer.available.tryAcquire()){
PrintStream out = new PrintStream(clientSocket.getOutputStream(), true);
Scanner in = new Scanner(clientSocket.getInputStream());
if (in.hasNextLine()... | 3 |
public static void handleExamine(final Player player, InputStream stream) {
int npcIndex = stream.readUnsignedShort128();
boolean forceRun = stream.read128Byte() == 1;
if(forceRun)
player.setRun(forceRun);
final NPC npc = World.getNPCs().get(npcIndex);
if (npc == null || npc.hasFinished()
|| !player.ge... | 9 |
public void setCp(String cp) {
this.cp = cp;
} | 0 |
private int method177(int arg0, int arg1, int arg3) {
if (arg3 > 179) {
arg1 /= 2;
}
if (arg3 > 192) {
arg1 /= 2;
}
if (arg3 > 217) {
arg1 /= 2;
}
if (arg3 > 243) {
arg1 /= 2;
}
return (arg0 / 4 << 10) + (arg1 / 32 << 7) + arg3 / 2;
} | 4 |
private void setElementField(String str1, String str2, double x) {
if (!(model instanceof MolecularModel))
return;
MolecularModel m = (MolecularModel) model;
int lb = str1.indexOf("[");
int rb = str1.indexOf("]");
double z = parseMathExpression(str1.substring(lb + 1, rb));
if (Double.isNaN(z))
return;... | 8 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Customer other = (Customer) obj;
if (this.customerId != other.customerId) {
return false;
... | 9 |
public void handleCommand(DOMBuilder builder, Element parentElement, CommandToken token)
throws SnuggleParseException {
/* Get the token to which the limit is being applied to, which is precisely the
* first argument.
*/
List<FlowToken> limitand = token.getArguments()[0].ge... | 9 |
public void countAllLinksStatus() {
for (String link : links) {
HttpURLConnection httpURL;
int code = 0;
try {
httpURL = (HttpURLConnection) new URL(link).openConnection();
httpURL.setRequestMethod("HEAD");
code = httpURL.getResponseCode();
} catch (IOException e) {
System.out.println("... | 7 |
public PanelOptions getPanelOptions() {
WindowPrincipale window = (WindowPrincipale) this.getParent().getParent().getParent().getParent().getParent();
return window.getPanelSettings();
} | 0 |
public void loadLevel(String filename) throws SlickException, IndexOutOfBoundsException{
Image level;
mobs = new ArrayList<Entity>();
player = new Entity(charFactory.GetTile(0, 0, 5, 6, Player.class));
level = new Image(filename);
if(level.getWidth() != TILE_COL || level.getHeight() != TILE_ROW){
throw new... | 6 |
@Override public ByteChunk getChunk( String urn, int maxSize ) {
try {
File f = _getFile( urn );
if( f == null || f.length() > maxSize ) return null;
int size = (int)f.length();
byte[] data = new byte[size];
FileInputStream fis = new FileInputStream( f );
try {
int r=0;
for( int z; r < s... | 6 |
public Tilaus haeTilauksenTiedot(int tilausID) throws DAOPoikkeus, SQLException {
// Avataan ensiksi yhteys:
Connection yhteys = avaaYhteys();
// Alustetaan tarvittavat oliot ja muuttujat.
Asiakas asiakas = new Asiakas();
Tilaus tilaus = new Tilaus();
Tuote tuote = new Tuote();
Pizza pizza = new Pizza(... | 6 |
public Player(){
frame = new JFrame("GrooveJaar Player");
frame.setIconImage((new ImageUtil().getLogo()));
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JScrollPane scrollPane = new JScrollPane();
JButton btnRemove = new JButton("Delete");
btnRemove.addActionListener(new ActionListener() {
... | 4 |
public String bubbleSort2(String a) {
char[] arr = a.toCharArray();
for (int i = arr.length - 1; i > 0; i--) {
for (int j = 0; j < i; j++) { // notice
if (arr[j] > arr[j + 1]) {
swap(arr, j, j + 1);
}
}
}
return new String(arr);
} | 3 |
public void readFile (String filename) throws IOException {
BufferedReader in = new BufferedReader(new FileReader(filename));
for (String line = in.readLine(); line != null; line = in.readLine()) {
if (line.trim().length() == 0) {
continue;
}
String[] ... | 8 |
boolean addCluster(NodeCluster seed) {
members.add(seed);
seed.isSetMember = true;
rawPull += seed.weightedTotal;
pullWeight += seed.weightedDivisor;
if (isRight) {
freedom = Math.min(freedom, seed.rightNonzero);
if (freedom == 0 || rawPull <= 0)
return true;
addIncomingClusters(seed);
... | 7 |
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column)
{
JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
String status = (String)value;
Icon icon=null;
... | 9 |
private void getNextPosition() {
// movement
if(!facingRight) {
dx -= moveSpeed;
if(dx < - maxSpeed) {
dx = -maxSpeed;
}
} else if(facingRight){
dx += moveSpeed;
if(dx > maxSpeed) {
dx = maxSpeed;
}
}
if(falling) {
dy += fallSpeed;
}
} | 5 |
private String[] parseValues(String input, int column) {
StringTokenizer st = new StringTokenizer(input);
SortedSet values = new TreeSet();
while (st.hasMoreTokens()) {
String token = st.nextToken();
token = parseValue(token, column);
if (token == null)
continue;
values.add(token);
}
return (S... | 2 |
public void HandleInput(GameTime gameTime)
{
InputHandler input = mGameWindow.GetInputHandler();
Level level = mGameState.GetLevel();
Vector2 mousePosition = new Vector2(input.GetMouseX(), input.GetMouseY());
mousePosition = mGameState.GetCamera().ScreenToWorld(mousePosition);
mAngle = (float)Math.to... | 9 |
private void movePosChildren(Vector2f vector2f){
for (GUI child:children){
child.setPosition(vector2f.add(child.getPosition().sub(getPosition()).getXY()));
}
} | 1 |
public static byte[] toByteArray(final Object obj)
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(baos);
oos.writeObject(obj);
} catch (Exception ex) {
throw n... | 3 |
public GetInvoiceDetailsResponse(Map<String, String> map, String prefix) {
if( map.containsKey(prefix + "responseEnvelope" + ".timestamp") ) {
String newPrefix = prefix + "responseEnvelope" + '.';
this.responseEnvelope = new ResponseEnvelope(map, newPrefix);
}
if( map.containsKey(prefix + "invoice" + ".me... | 7 |
@Override
@EventHandler(ignoreCancelled = true)
public void onPlayerInteract(final PlayerInteractEvent interaction) {
super.onPlayerInteract(interaction);
if (interaction.getAction() != Action.LEFT_CLICK_BLOCK) return;
if (!Kiosk.SIGN_BLOCKS.contains(interaction.getClickedBlock().getTyp... | 5 |
public void updateTable(){
//add columns
columns = new Vector();
columns.addElement("Alternatives");
objs = con.getObjPanel().getPrimitiveObjectives(); //do we really need this temp holder?
for(int i=0; i<objs.size(); i++){
columns.add(objs.get(i).toString());
}
//add data
rows = new Vector(... | 6 |
public static void main(String args[]) throws IOException {
/* 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 deta... | 6 |
private static void processKeyEvents(){
if(Keyboard.getEventKeyState()){
if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE){
Game.setState(previousState);
}
}
} | 2 |
protected String getPassword(final int times) {
if(times <= 0) {
throw new IllegalArgumentException("times cannot be lower than 1!");
}
String[] pwInput = new String[times];
// ask password n times
for(int i=0; i<times; i++) {
PasswordDialog pwdDialog = new P... | 6 |
public void testGetPhoneNumbers() throws InterruptedException{
driver.get(URL);
Thread.sleep(3000);
WebElement phone = driver.findElement(By.id("revPhone:firstField"));
WebElement city = driver.findElement(By.id("revPhone:city"));
WebElement search = driver.findElement(By.id("revPhone:search"));
try {
... | 9 |
public boolean isTBonded(Atom a) {
if (tbondList == null || tbondList.isEmpty())
return false;
synchronized (tbondList) {
for (TBond t : tbondList) {
if (t.getAtom1() == a || t.getAtom2() == a || t.getAtom3() == a || t.getAtom4() == a)
return true;
}
}
return false;
} | 7 |
@Override
public void selectInterface(String interfaceName) {
try {
NetworkInterface selected = NetworkInterface.getByName(interfaceName);
for ( int i = 0; i < selected.getInterfaceAddresses().size(); i++ )
{
InetAddress bcast = selected.getInterfaceAddresses().get(i).getBroadcast();
if ( bcast != ... | 4 |
private String adjustUnitsInString(String input, float scale){
StringBuilder output = new StringBuilder(input);
Matcher matcher = decimalPattern.matcher(input);
while ( matcher.find() ){
String group1 = ( matcher.group(1) == null ) ? "" : matcher.group(1).trim();
String... | 6 |
public static void main(String[] args) {
String line = "";
String message = "";
int c;
try {
while ((c = System.in.read()) >= 0) {
switch (c) {
case '\n':
if (line.equals("go")) {
PlanetWars pw = new PlanetWars(message);
DoTurn(pw);
pw.FinishTurn();
message = "";
} e... | 4 |
public void permuteRec(int level, int[] num, List<ArrayList<Integer>> res, Deque<Integer> stk, boolean[] visited){
if(level == num.length){
res.add(new ArrayList<Integer>(stk));
return;
}
for(int i = 0; i < num.length; ++i){
if(!visited[i]){
stk.addLast(num[i]);
visited[i] = true;
... | 3 |
public void usingEntrySetAndIterator(Map<Integer, String> map){
Iterator<Map.Entry<Integer, String>> itrtr = map.entrySet().iterator();
while (itrtr.hasNext()) {
Map.Entry<Integer, String> entry = itrtr.next();
System.out.println("Key: "+entry.getKey()+" Value: "+entry.getValue());
}
} | 1 |
public int largestRectangleArea(int[] height){
if(height==null || height.length==0) return 0;
if(height.length==1) return height[0];
Stack<Integer> stack=new Stack<Integer>();
stack.push(-1);
int max=0;
for(int i=0;i<height.length;i++){
int curHeight=height[i];
int peekIndex=stack.peek();
... | 7 |
@Override
public String execute(HttpServletRequest request) throws SQLException, ClassNotFoundException {
String tableName = request.getParameter("TableName");
System.out.println(tableName);
if (tableName != null && tableName != "") {
try {
Class.forName("org.h2.Driver")... | 6 |
protected void doDataIn(PeerMessage pm){
if(pm.type == PeerMessage.Type.CHOKE){
this.peer_choking = true;
//Drop our requests. They aint gana get done.
System.out.println(toString()+" choked us.");
}else if(pm.type == PeerMessage.Type.UNCHOKE){
System.out.println(toString()+" unchoked us.");
this.pee... | 5 |
public static void findTwoLargest(int[] a) {
int largest = a[0];
int nextLargest = a[0];
for (int i = 0 ; i < a.length ; i++) {
if (a[i] > largest) {
largest = a[i];
}
}
for (int i = 0 ; i < a.length ; i++) {
if (a[i] > nextLargest && a[i] < largest) {
nextLargest = a[i];
}
}
System... | 5 |
private boolean validPixel(int x, int y) {
boolean validX = x >= -this.getWidth() / 2 && x <= this.getWidth() / 2;
boolean validY = y >= -this.getHeight() / 2
&& y <= this.getHeight() / 2;
return validX && validY;
} | 3 |
public static void setSkin(final String skinName, final JFrame frame) {
try {
if (skinName.equals("seaGlass")) {
UIManager.setLookAndFeel(new SeaGlassLookAndFeel());
} else if (skinName.equals("syntheticaStandard")) {
UIManager.setLookAndFeel(new Synthetic... | 9 |
public void run()
{
Scanner in = new Scanner( System.in );
while (in.hasNextLine())
{
String line = in.nextLine();
if (line.equalsIgnoreCase( QUIT ))
{
finished = true;
break;
}
else
{
... | 2 |
public static void showEditor(String skinFilename) {
Path skinPath;
if (!skinFilename.endsWith(Constants.SKINFILE_SUFFIX)) {
skinPath = Constants.PROGRAM_SKINS_PATH.resolve(skinFilename + Constants.SKINFILE_SUFFIX);
} else {
skinPath = Constants.PROGRAM_SKINS_PATH.resolve... | 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.