text stringlengths 14 410k | label int32 0 9 |
|---|---|
public KeyStroke getKey() {
return KeyStroke.getKeyStroke('r');
} | 0 |
public LatLong(double latitude, double longitude) {
if (latitude > 90 || latitude < -90) {
throw new IllegalArgumentException("Latitude:" + latitude +", is outside of acceptable values (-90<x<90)");
} else if (longitude < -180 || longitude > 180) {
throw new IllegalArgumentException("Longitude :" + longitude ... | 4 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the server with glorious data
task = plugin.getServer().getScheduler()
.runTaskTimerAsynch... | 7 |
public String getSkillName() {
return skillName;
} | 0 |
String escapeLastSemicolon(String sql) {
Assert.notNull(sql, "SQL不能为空");
if (sql.endsWith(";")) {
sql = sql.substring(0, sql.length() - 1);
}
return sql;
} | 1 |
public String getNameLab() {
return nameLab;
} | 0 |
public static void loadSpriteSheet(String name, String path, int xFrames, int yFrames) {
BufferedImage sheet = ProjUtils.readImage(path);
int spriteWidth = sheet.getWidth()/xFrames;
int spriteHeight = sheet.getHeight()/yFrames;
for (int x = 0; x < xFrames; x++) {
for (int y ... | 2 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Event)) return false;
Event event = (Event) o;
if (attenders != null ? !attenders.equals(event.attenders) : event.attenders != null) return false;
if (date != null ? !date.equals(even... | 8 |
public void passEigenValues(
double[] eigenValues,
double[][] eigenVectors )
{
if ( firstN >= eigenValues.length )
{
this.eigenValues = eigenValues;
this.eigenVectors = eigenVectors;
}
else
{
int m = Matrix.getNumOfRows(eigenVectors);
int n = firstN;
this.eigenValues = Vector.newVector(n);
this.eigen... | 3 |
public static Dropzone parse(HtmlElement element, String str){
switch(str){
case "copy":
return COPY;
case "move":
return MOVE;
case "link":
return LINK;
case "none":
default:
return NONE;
}
} | 4 |
public void terminate() {
if (subGoals.size() > 0) {
//terminate sub goals
for (int i = 0; i < subGoals.size(); i++) {
Goal subGoal = subGoals.get(i);
if(subGoal != null) {
subGoal.terminate();
}
}
... | 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 Character buyCharacter(String type) {
Character character = null;
switch(type) {
case Constants.CHARACTER_ASSASSIN:
character = new Assassin();
break;
case Constants.CHARACTER_ROGUE:
character = new Rogue();
break;
case Constants.CHARACTER_PRITEST:
character = new Priest();
br... | 5 |
@SuppressWarnings("unchecked")
public static String pack(ItemStack is) {
JSONObject obj = new JSONObject();
obj.put("amount", new Integer(is.getAmount()));
obj.put("durability", new Short(is.getDurability()));
MaterialData md = is.getData();
obj.put("material", md.getItemType().name());
if( is... | 9 |
private void floodFill(int i, int j, int[][] graph, boolean[][] visted) {
LinkedList<Pair> stack = new LinkedList<Pair>();
int c = graph[i][j];
stack.push(new Pair(i, j));
visted[i][j] = true;
while (!stack.isEmpty()) {
Pair p = stack.pop();
for (i = p.i - 1; i <= p.i + 1; i++) {
for (j = p.j - 1... | 9 |
private void loadCoauthors() {
if (coauthorsLoaded)
return;
plist.clear();
try {
URL u = new URL("http://dblp.uni-trier.de/rec/pers/" + urlpt
+ "/xc");
coauthorParser.parse(u.openStream(), coauthorHandler);
} catch (IOException e) {... | 3 |
public void faireOffre(Offre acheteur) throws InvalidArgumentException {
if (null == acheteur)
throw new InvalidArgumentException("L'acheteur ne peut être null.");
if (enchereFinie())
throw new InvalidArgumentException("L'enchère est deja terminée.");
if (etatEnchere != EtatEnchere.PUBLIEE)
throw new ... | 9 |
@Override
public SyntaxNode parse() throws SyntaxException, IOException {
scanner.nextToken();
if (scanner.getCurrentToken().isType(TokenType.LITERAL)) {
ast.setAttribute(SyntaxNode.Attributes.TITLE, scanner.getCurrentToken().getValue(true));
scanner.nextToken();
}
... | 8 |
public Writer write(Writer writer) throws JSONException {
try {
boolean b = false;
int len = length();
writer.write('[');
for (int i = 0; i < len; i += 1) {
if (b) {
writer.write(',');
}
Obj... | 5 |
public ChunkyCommand getCommandByName(String fullName) {
String[] commands = fullName.split("\\.");
String currentName = commands[0];
ChunkyCommand currentCommand = registeredCommands.get(commands[0]);
for (int i = 0; i < commands.length; i++) {
if (currentCommand == null) br... | 3 |
public void testOverlap()
{
try
{
Collection<Record> records = GetRecords.create().getRecords("Overload");
List<String> overloadReps = new LinkedList<String>();
for (Record rec : records)
if (rec.getFormat().getBaseFormat().equals("CD"))
overloadReps.... | 6 |
public void analyseDLGFlights() {
window.altimeterChart.clearDLGAnalysis();
// ask the user which parts of the analysis they wish to carry out
DLGAnalysisDialog dialog = new DLGAnalysisDialog(this);
dialog.setVisible(true);
if (dialog.isSuccessful()) {
DLGFlightAnalyser finder = new DLGFlightAnalyser()... | 9 |
public static ListNode removeNthFromEnd(ListNode head, int n) {
ListNode p = head;
ListNode q = null;
int num = 0;
while (null != p) {
p = p.next;
num = num + 1;
}
if (n > num) return head;
if (n == num) return head.next;
p = head; q = he... | 6 |
private boolean signin() throws SDKException, SignInException{
final long current_time = System.currentTimeMillis();
HashMap<String, String> signinData = new HashMap<>();
if (session_pass != null && session_expired_time > current_time
&& time_of_last_signin_attempt > mpc... | 8 |
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) {
if(var5.nextInt(100) == 0) {
var1.playSoundEffect((double)var2 + 0.5D, (double)var3 + 0.5D, (double)var4 + 0.5D, "portal.portal", 1.0F, var5.nextFloat() * 0.4F + 0.8F);
}
for(int var6 = 0; var6 < 4; ++var6... | 4 |
@Override
public String format(double value, boolean localize) {
String textValue = localize ? Numbers.format(value) : Double.toString(value);
return MessageFormat.format(FORMAT, Numbers.trimTrailingZerosAfterDecimal(textValue, localize), getAbbreviation());
} | 1 |
@Override
public boolean open() {
WidgetChild wc;
return superTab.open() && (isOpen() || (wc = Widgets.get(BOOK_WIDGET, component)) != null && wc.visible() && wc
.click(true) && new TimedCondition(2000) {
@Override
public boolean isDone() {
return InnerAbilityTabs.this.isOpen();
}
}.waitStop());... | 5 |
@EventHandler(priority=EventPriority.NORMAL)
public void click(PlayerInteractEvent event) {
if (event.getClickedBlock() == null)
return;
Block i = event.getClickedBlock();
if ((event.hasItem()) && (event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
CustomBlock toPlace = this.plugin.getCustomBlock(event.getI... | 7 |
@Override
public int compare(HumanBeings o1, HumanBeings o2) {
if(o1 instanceof Men && o2 instanceof Men)
return 0;
else if(o1 instanceof Men && o2 instanceof Women)
return -1;
else if (o1 instanceof Women && o2 instanceof Men)
return 1;
return 0;
} | 6 |
public Leaving(String alias) {
station = alias;
} | 0 |
public int numDecodings(String s) {
if (s.length() == 0 || s.charAt(0) == '0') {
return 0;
}
int[] store = new int[s.length() + 1];
store[0] = 1;
store[1] = 1;
if (s.charAt(s.length() - 1) == '0') {
store[1] = 0;
}
for (int i = 2; i... | 8 |
@Test
public void testOfflineClient() {
System.out.println("offlineClient");
try {
final Counter counter = new Counter();
final int multiplier = 3;
final AssignmentListener al = new AssignmentListener() {
@Override
public void rece... | 8 |
public void update(){
key.update();
if(key.up) y--;
if(key.down) y++;
if(key.left) x--;
if(key.right) x++;
} | 4 |
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int n = Integer.parseInt(br.readLine());
for(int i = 0; i < n; i++){
String num = br.readLine();
... | 8 |
public static Integer le(Object o1, Object o2){
if (o1 == null && o2 == null){
return 1;
} else if (o1 == null && o2 != null){
return 1;
} else if (o1 instanceof Number && o2 instanceof Number){
return ((Number)o1).doubleValue() <=((Number)o2).doubleValue() ? 1 : 0;
}
return 0;
} | 7 |
public boolean simpan(){
boolean adaKesalahan = false;
java.sql.Connection cn = null;
try{
Class.forName(Koneksi.driver);
} catch (Exception ex){
adaKesalahan = true;
JOptionPane.showMessageDialog(null,"JDBC Driver tidak ditemukan atau ru... | 9 |
static int useA(int[]count){
for(int k=1; k<count.length;k++){
for(int j=0; j<count.length;j++)
System.out.print(count[j]+",");
System.out.println();
if(count[k]==1){
if((k<count.length-1 )&&(count[k+1]==1)&&(count[0]>0)){
count[k]--;
count[k+1]--;
count[0]--;
k=k+1;
... | 7 |
@Override
public void run() {
try {
do {
FileInputStream buff = new FileInputStream(fileLocation);
player = new Player(buff);
player.play();
} while (loop);
} catch (Exception ioe) {
System.out.println(ioe.toString());... | 2 |
@Override
public String execute(TDTDataStore data) {
String label = getLabelName().toUpperCase();
int taskId = getTaskID();
String commandDetails = getCommandDetails();
boolean isHighPriority = isHighPriority();
TDTDateAndTime dateAndTime = getDateAndTime();
// edit task from current label
if (label.equ... | 9 |
public boolean sendMessage(String message) {
System.out.println("Controller:sendMessage() is working");
try {
String computername = InetAddress.getLocalHost().getHostName();
OtpErlangObject[] tuple = new OtpErlangObject[2];
tuple[0] = new OtpErlangAtom("message");
... | 1 |
public Move getMove(Board board, Field from, Field to, Piece piece) {
Player player = this.getPlayerFromColor(from.getPiece().isWhite);
if (this.isPromotionMove(piece, to)) {
return new PromotionMove(player, this.window.board, piece, from, to);
} else if (this.isEnPassantMove(piece, from, to, this.getLastMove(... | 5 |
public static String getMouseName(int mouseCode) {
switch (mouseCode) {
case MOUSE_MOVE_LEFT: return "Mouse Left";
case MOUSE_MOVE_RIGHT: return "Mouse Right";
case MOUSE_MOVE_UP: return "Mouse Up";
case MOUSE_MOVE_DOWN: return "Mouse Down";
case MOUSE... | 9 |
@Override
public void actionPerformed(ActionEvent ae)
{
// WHICH BUTTON WAS PRESSED?
String command = ae.getActionCommand();
// CHANGE THE BACKGROUND IMAGE?
if (command.equals(BG_IMAGE_COMMAND))
{
// UPDATE THE BACKGROUND IMAGE IF THE USER
... | 6 |
public static int convertType( int axis )
{
int t = axis;
switch( axis )
{
case XAXIS:
t = ObjectLink.TYPE_XAXIS;
break;
case YAXIS:
case XVALAXIS:
t = ObjectLink.TYPE_YAXIS;
break;
case ZAXIS:
t = ObjectLink.TYPE_ZAXIS;
break;
}
return t;
} | 4 |
public void update(){
if(bulletTime&&btTimer > 0&&!btCooldown){
try {
btTimer = btTimer - 8;
System.out.println("BULLET TIME");
Thread.sleep(btTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
}else if(btTimer < 320){
btTimer++;
}else if(btTimer == 320){
btCooldown = ... | 7 |
public void sauvegarderRapport(){
System.out.println(this.vue.getjComboBoxPraticien().getSelectedItem());
System.out.println(this.vue.getjTextFieldDateRapport().getText());
System.out.println(this.vue.getjTextFieldMotifVis().getText());
System.out.println(this.vue.getjTextAreaBilan().get... | 0 |
void setParseTable(LRParseTable table) {
if (tableView == null) {
tableView = new LRParseTableChooserPane(table);
split2.setRightComponent(new JScrollPane(tableView));
// add(new JScrollPane(tableView), BorderLayout.SOUTH);
} else
tableView.setModel(table);
} | 1 |
public void setRecordTime(Integer recordTime) {
this.recordTime = recordTime;
} | 0 |
public static void main(String[] args) {
ArrayList<Integer> intList = new ArrayList<>();
ArrayList<Double> dblList = new ArrayList<>();
// if(intList instanceof ArrayList<Integer>) {} //complier error
// if(intList instanceof ArrayList<E>) {} //complier error
if (intLi... | 8 |
public boolean isEmailExist(String email) {
Session session =null;
try {
session= HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
Criteria criteria = session.createCriteria(User.class);
if(criteria.add(Restrictions.eq("email",... | 4 |
public Numberfield(int initialValue, int maxInputLength, Color bg, String fieldTitle, String fieldlabel, boolean showResetBtn) {
this.numberLength = maxInputLength;
if (bg == null) {
bg = Color.WHITE;
}
if (fieldTitle == null) {
fieldTitle = "";
}
... | 3 |
public void setImages() {
if (waitImage == null) {
File imageFile = new File(Structure.baseDir + "HellFireCannon.png");
try {
waitImage = ImageIO.read(imageFile);
} catch (IOException e) {
e.printStackTrace();
}
}
if (attackImage == null) {
File imageFile = new File(Structure.baseDir
... | 8 |
private void btnEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditActionPerformed
if(btnEdit.getText().equals("Editar")){
String pass = JOptionPane.showInputDialog(this, "Ingrese su Password", "Confirmacion");
if(pass!=null && getUser().pass(pass)){
... | 4 |
@Override
public ArrayList<Excel> getColoredExes() {
return coloredEx;
} | 0 |
public void read(){
try {
if (url!=null){
//reads from a remote URL server
is = new InputSource(url.openStream());
is.setEncoding("ISO-8859-15");
saxParser.parse(is, this);
}else{
String xmlFile = System.getProperty("user.dir") + "\\src\\" + xmlS... | 2 |
public void sendHighlight(String position, int r, int g, int b){
JSONObject o = new JSONObject();
try {
o.put("message", "highlight");
o.put("coordinate", position);
o.put("color", new JSONArray().put(r).put(g).put(b));
sendMessage(o);
}
catch(JSONException e){}
catch(IOException e){}
} | 2 |
public Player getPlayer(){
return player;
} | 0 |
public void testConstructorEx7_TypeArray_intArray() throws Throwable {
int[] values = new int[] {1, 1, 1};
DateTimeFieldType[] types = new DateTimeFieldType[] {
DateTimeFieldType.dayOfMonth(), DateTimeFieldType.year(), DateTimeFieldType.monthOfYear() };
try {
new Partial(... | 6 |
private final String showInputDialog(String message, String title, int messageType, int optionType, final String[] text, boolean combo)
{
String input;
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
panel.add(new JLabel(message));
final JTextField textField = n... | 8 |
public static void main(String[] args) {
coordTypes.add('C');
coordTypes.add('P');
// CREATING RANDOM INSTANCES
List<Long> valuesD1Instances = new ArrayList<Long>();
List<Long> valuesD2Instances = new ArrayList<Long>();
List<Long> valuesD4Instances = new ArrayList<Long>();
System.out.println("Each me... | 7 |
private String[] listTickets(String url, String json) throws Exception {
//The url to the JSON listener
URL http = new URL(url);
//Make the connection to the listener
HttpURLConnection con = (HttpURLConnection) http.openConnection();
//add reuqest headers
con.setRequestMethod("POST");
con.setRequest... | 3 |
public Variables() {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
WINDOW_HEIGHT = screenSize.height;
WINDOW_WIDTH = screenSize.width;
CANVAS_HEIGHT = WINDOW_HEIGHT * 4/5 ;
CANVAS_WIDTH = WINDOW_WIDTH *4/5;
THUMBNAIL_HEIGHT = WINDOW_HEIGHT... | 0 |
public void processInstructions(int amount) {
int instr = 0;
int cycles = 0; // Amount of consumed cycles (afaik this is used internally somewhere)
int opcode;
while (instr++ != amount) {
opcode = rom[pc] & 0xFF;
if ((opcode & 0xC0) == Instructions.LD_R_R) {
int dst = (opcode >> 3) & 7;
int... | 5 |
public BookBuilder<P> paperColors(Map<PaperBuilder<?>, ColorBuilder<?>> paperColors) {
verifyMutable();
if (this.paperColors == null) {
this.paperColors = new HashMap<PaperBuilder<?>, ColorBuilder<?>>();
}
if (paperColors != null) {
for (Map.Entry<PaperBuilder<?>, ColorBuilder<?>> e : paperColors.entrySe... | 9 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public void generateCave(int x,int y){
int sizex = rand.nextInt(19)+1;
int sizey = rand.nextInt(19)+1;
for(int i=x;i<sizex+x;i++){
for(int j=y;j<sizey+y;j++){
if(i>=SIZE || j>=SIZE) continue;
if(rand.nextInt(30)>5){
world[i][j] = Ti... | 5 |
public void setLogTime(Timestamp logTime) {
this.logTime = logTime;
} | 0 |
@RequestMapping(value="/BusinessUnit.do", method=RequestMethod.POST)
public String doActions(@ModelAttribute BusinessUnit BusinessUnit, BindingResult result, @RequestParam String action, Map<String, Object> map){
BusinessUnit BusinessUnitResult = new BusinessUnit();
switch(action.toLowerCase()){
case "add":
B... | 5 |
@Override
public void returnBomb() {
bombs++;
} | 0 |
private double factorial(int n){
if(n == 0) {
return 1;
}
double j = 1;
for(int i = 1; i <= n;i++){
j *= i;
}
return j;
} | 2 |
@Override
public void keyPressed(int k) {
if(player.getMovable()){
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_W) player.setJumping(true);
if(k == KeyEvent.VK_R) player.setScratching();
if(k == KeyEvent.VK_F) player.setFiring();
}
... | 6 |
public TrieNode getOrAddChild(boolean isWord, char c, TrieSymbolTable table, int code) throws SymbolException {
if (cachedValueTrieNode == null) {
cachedValueTrieNode = new TrieNode(c, this);
cachedKeyChar = c;
if (isWord) {
cachedValueTrieNode.addEntry(table, code);
}
return cachedValueTrieNode;
... | 7 |
public static void main(String[] args) throws IOException, Exceptions.SRLException {
if (args.length < 4) {
System.out.println("4 arguments (paths) needed: <separatedCorpusFolder> <singleCorpusFile> <modelFile> <annotatedFile>");
return;
}
Corpus corpus = new Cor... | 2 |
public static String getClipboardString() {
try {
Transferable var0 = Toolkit.getDefaultToolkit().getSystemClipboard().getContents((Object)null);
if(var0 != null && var0.isDataFlavorSupported(DataFlavor.stringFlavor)) {
String var1 = (String)var0.getTransferData(DataFlavor.stringFlav... | 3 |
public boolean Salvar(Venda obj) {
try {
if (obj.getId() == 0) {
PreparedStatement comando = bd.getConexao().prepareStatement("insert into Vendas(ValorTotal, Data, Id_Cliente, Id_Usuario_Sistema, Id_Forma_Pagamento) values(?,?,?,?)");
comando.setDouble(1, obj.getValor... | 5 |
public GraphClick(int ttype, String tid, int twhichone)
{
type=ttype;
id=tid;
whichOne=twhichone;
} | 0 |
public void processClientHandShak(Client sockector, String msg){
String[] requestDatas = msg.split("\r\n");
if(requestDatas.length < 4){
return;
}
ClustersHandShak handShak = sockector.<ClustersHandShak>getHandShakObject();
String line = requestDatas[0];
if(!line.equalsIgnoreCase(ClustersConstant... | 8 |
@Override
public void addClientDisconnectListener(DisconnectOnServerListener listener) {
if (clientDisconnectListenerList != null) {
clientDisconnectListenerList.add(DisconnectOnServerListener.class, listener);
}
} | 1 |
private void parsePacket(byte[] data, InetAddress address, int port) {
String message = new String(data).trim();
PacketTypes type = Packet.lookupPacket(message.substring(0, 2));
Packet packet = null;
switch (type) {
default:
case INVALID:
break;
case L... | 6 |
public static XmlRpcStruct parseFile(BufferedReader input)
throws IOException, InvalidPostFormatException {
XmlRpcStruct p = new XmlRpcStruct();
String line;
String prevKey = null;
String prevValue = null;
Pattern keyPattern;
keyPattern = Pattern.compile("^[\\d\\w_]+:", Pattern.CASE_INSENS... | 7 |
public void setMaxParticleNumber(int maxParticles) {
if (maxParticles <= 0) {
throw new IllegalArgumentException("The maximum particle number cannot be set to zero or less!");
}
if (particleArray == null || maxParticles != particleArray.length) {
particleArray = ... | 3 |
public Object timeFlexJson(long reps) throws Exception
{
if (_flexJsonDeserializer == null) {
_flexJsonDeserializer = new JSONDeserializer<TwitterSearch>();
}
TwitterSearch result = null;
while (--reps >= 0) {
// Seriously?! Can't read using a Stream?
... | 3 |
@Override
public Vector<Double> call() throws Exception {
long startTime = System.nanoTime();
Vector<Double> output = new Vector<Double>();
MctsTree playerControl = new MctsTreeDag();
MctsTree playerTesting = new MctsTreeLearner();
// Write the results to a file as we get them
double extendedPlayerWins =... | 9 |
@Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just did a hammer fall!");
return random.nextInt((int) agility) * 2;
}
return 0;
} | 1 |
@Override
public String getDispositionDescList(Physical obj, boolean useVerbs)
{
if(obj == null)
return "";
final int disposition = obj.phyStats().disposition();
final StringBuffer buf=new StringBuffer("");
if(useVerbs)
{
for(int i=0;i<PhyStats.IS_VERBS.length;i++)
if(CMath.isSet(disposition,i))
... | 7 |
private ReplicaLoc[] selectRandomReplicas() {
ReplicaLoc[] result = new ReplicaLoc[NUM_REPLICA_PER_FILE];
boolean[] visited = new boolean[replicaServerAddresses.length];
for (int i = 0; i < result.length; i++) {
int randomReplicaServer = rand(replicaServerAddresses.length);
System.out.println(visited.length... | 2 |
private void printSelectedUpdates() {
console.printf("Going to apply the following updates: \n");
for (int i = first - 1; i < last; i++) {
DBUpdate u = updates.get(i);
console.printf("%s\n", u.getFileName());
}
} | 1 |
public String getPositionDescription() {
StringBuilder buffer = new StringBuilder(mType.name());
buffer.append(" @" + mLine + COLON + mColumn + ": "); //$NON-NLS-1$ //$NON-NLS-2$
if (mType == XMLNodeType.START_TAG) {
buffer.append('<');
buffer.append(mName);
buffer.append('>');
} else if (mType == XML... | 3 |
private List<String> get_tokens(NameCallback nameCb) {
MultiValuePasswordCallback mv_passCb = new MultiValuePasswordCallback("Enter authentication tokens: ", false);
List<String> result = new ArrayList<String>();
try {
/* Fetch a password using the callbackHandler */
callbackHandler.handle(new Callback[] {... | 8 |
public Color getFirstColor() {
// find and cache first colour found in stack
if (shapes != null && unColored == null) {
for (int i = 0, max = shapes.shapes.size(); i < max; i++) {
if (shapes.shapes.get(i) instanceof Color) {
unColored = (Color) shapes.shap... | 5 |
public static void longestIncreasingSubsequenceInPairs(ArrayList<Person> mPersons){
//This problem is very similar to LIS, except with a twist. We will first sort
//according to height, and then perform LIS on the weight
Collections.sort(mPersons);
//next we run custom LIS
int[] sizes = new int[mPersons.siz... | 7 |
public double[] getGrid(long density) {
int numberOfDots = (int) (density * getWidth());
double gridStep = 1 / (double) density;
double[] grid = new double[numberOfDots];
for (int i = 0; i < numberOfDots; i++) {
grid[i] = x_start + ((double) i + 0.5) * gridStep;
}
... | 1 |
private static byte[] unicode(String string)
{
BBAOS stream = new BBAOS();
for(char c : string.toCharArray())
{
if((c >= '\u0001') && (c <= '\u007f'))
{
stream.write(c & 0x7f);
}
else if((c == '\u0000') || ((c >= '\u0080') && (c... | 8 |
private static void QueueWithListMenu(QueueWithList<Integer> QueueWithList){
System.out.println("What do you want to do ?");
System.out.println("1) Dequeue");
System.out.println("2) Enqueue");
System.out.println("3) Print");
System.out.println("Enter your option");
try{
choose = in.nextInt();
switch (... | 6 |
private void finishConnect() throws Exception {
if (client.isConnectionPending()) {
client.finishConnect();
}
// Now that we're connected, re-register for only 'READ' keys.
client.register(selector, SelectionKey.OP_READ);
sendHandshake();
} | 1 |
public void getHurt(Sprite sprite)
{
if (deathTime > 0 || world.paused) return;
if (invulnerableTime > 0) return;
if (large)
{
world.paused = true;
powerUpTime = -3 * 6;
world.sound.play(Art.samples[Art.SAMPLE_MARIO_POWER_DOWN], this, 1, 1, 1);
... | 7 |
void setListXML() {
hasSuperUser = false;
vc_files = new ArrayList<String>();
// String[] filenames;
File f = new File(".");
String files[] = f.list();
for (int i = 0; i < files.length; i++) {
if (files[i].endsWith(".xml")) {
if (files[i].equal... | 5 |
public void simulatePart(int from,int to){
vector2d sep,ali,coh,lead,rand,pred, avoid, predH,toAim,forag;
ArrayList<boid> tempBoids;
Random randGen = new Random();
for(int i=from;i<to;i++){
if (boids.get(i).getType()==2){continue;}
tempBoids=getNeighbourhoodOptmTopological(boids.get(i),main... | 8 |
public List<List<Integer>> levelOrderBottom(TreeNode root) {
LinkedList<List<Integer>> result = new LinkedList<List<Integer>>();
if(root==null){
return result;
}
List<Integer> rootValue = new ArrayList<Integer>();
rootValue.add(root.val);
result.push(rootValue... | 7 |
private void setPhysicalHeightDpi(int newValue) {
physicalWidthDpi = newValue;
} | 0 |
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.