text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Player() {
for (int i = 0; i < 11; i++) {
frame[i] = new Frame();
accumScore[i] = -1;
}
} | 1 |
private int[] paataSuunta(int i, int j){
Random r = new Random();
int suunta = r.nextInt(4);
int[] palkoord = new int[2];
if(suunta == 0){
if(tarkistin(i, j+1)){
palkoord[0] = i;
palkoord[1] = j+1;
}
}
else if(suunta... | 8 |
@Override
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == btnGenerate)
{
int w = 0, h = 0;
try
{
w = Integer.parseInt(tfMazeWidth.getText());
h = Integer.parseInt(tfMazeHeight.getText());
if (w < 5 || h < 5)
{
throw new NumberFormatException();
}
} catch (Nu... | 7 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Theme)) return false;
Theme theme = (Theme) o;
return id == theme.id;
} | 2 |
public Element handle(FreeColServer server, Player player,
Connection connection) {
ServerPlayer serverPlayer = server.getPlayer(connection);
Unit carrier;
try {
carrier = player.getFreeColGameObject(carrierId, Unit.class);
} catch (Exception e) {
... | 8 |
private boolean camposCompletos (){
if((!field_codigo.getText().equals(""))&&
(!field_descripcion.getText().equals(""))&&
(!field_cantidad.getText().equals(""))&&
(!field_costo_u.getText().equals(""))&&
(!field_precio_venta.getText().equals(""))&&
(!field_t... | 8 |
public boolean hitWall(Wall w){
if(this.isLive && this.getRect().intersects(w.getRect())){
this.stay();
return true;
}
else
return false;
} | 2 |
void exec_if() throws StopException, SyntaxError{
var_type cond;
return_state r;
cond = evalOrCheckExpression(false); //evaluate the conditional statement
if(cond.value.doubleValue()!=0){ // if any bit is not 0
statementColor = trueHightlightColor;
symbolTable.pushLocalScope();
r = interp_block(bloc... | 7 |
public void mettreAJourLignes() {
//synchronized(MenuDroite.modelListeLigne) {
MenuDroite.modelListeLigne.clear();
Iterator it = Main.lignes.entrySet().iterator();
while(it.hasNext()) {
Map.Entry pairs = (Map.Entry)it.next();
System.out.println(pairs.getKey());
MenuDroite.mode... | 1 |
public static void setSpeed(int x)
{
if(x < 1 || x > 10)
return;
diff = x * 0.1;
} | 2 |
public void hit(Card card) {
cards.add(card);
try {
score += Integer.parseInt(card.getValue());
} catch (NumberFormatException e) {
if (card.getValue().equals("KING")
|| card.getValue().equals("JACK")
|| card.getValue().equals("QUEEN")) {
score += 10;
}
if (card.getValue().equals("ACE"))... | 5 |
public void paivitaTilanne(int creaturetPoydassa) {
if (this.tuplamanat&&this.cradle) {
this.mana = (creaturetPoydassa + this.landit) * 2;
} else if (this.tuplamanat&&!this.cradle) {
this.mana = this.landit * 2;
}else if (!this.tuplamanat&&this.cradle) {
this.... | 8 |
public static boolean isPrimitiveWrapper(Object o) {
return o instanceof Boolean || o instanceof Character || o instanceof Byte || o instanceof Short
|| o instanceof Integer || o instanceof Long || o instanceof Float || o instanceof Double
|| o instanceof Void;
} | 8 |
public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equal... | 6 |
private boolean saveSettings() {
int maxDownloads, downloadPartCount, serverCheckInterval;
float deleteLimit;
try {
maxDownloads = Integer.parseInt(maxParallelDownloadsText.getText());
if (maxDownloads < 0)
throw new NumberFormatException();
} catc... | 8 |
public void init() {
// se inicializa la pausa en falso
booPausa = false;
//se inicializa guardar en false
booGuardar = false;
// se inicializa space en false
booSpace = false;
// se incializa la ayuda en true para que se muestr... | 6 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} | 0 |
public String getSelectedFastbootDevice() {
if (jList2.getSelectedValue() != null)
return (String) jList2.getSelectedValue();
else
return null;
} | 1 |
void createSetGetGroup() {
/*
* Create the button to access set/get API functionality.
*/
final String [] methodNames = getMethodNames ();
if (methodNames != null) {
final Button setGetButton = new Button (otherGroup, SWT.PUSH);
setGetButton.setText (ControlExample.getResourceString ("Set_Get"));
s... | 3 |
public void skladanie(){
dysk = fabrykaPodzespolowKomputerowych.produkujemyDysk().dawajDysk();
grafika = fabrykaPodzespolowKomputerowych.produkujemyGrafike().dawajGrafike();
procesor = fabrykaPodzespolowKomputerowych.produkujemyProcesor().dawajProcesor();
ram = fabrykaPodzespolowKomputerowych.produkujemyRam().d... | 0 |
public String getAgencia()
{
return this.agencia ;
} | 0 |
public static void writeXML() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document highScoreListe = builder.newDocument();
Element root = highScoreListe.createElement("root");
... | 1 |
@Override
public boolean activate() {
return (!Inventory.isFull()
&& Settings.root.getRoot() == 1
&& !Inventory.contains(Constants.INVENTORY_BURNED_ROOT_ID)
&& !validate(Constants.WAITFOR_WIDGET)
&& !validate(Constants.FLETCH_WIDGET)
&& !Settings.burning
);
} | 5 |
private boolean isWinningMove(Move move) {
return winsOnColumn(move) || winsOnRow(move) || winsOnDiagnal(move);
} | 2 |
public void addRow(Object... params) {
if (params.length != definition.length) {
Session.logger
.warn("Element counts doesn't match column definition");
}
TableRow row = new TableRow(definition.length);
int len = (params.length < definition.length ? params.length
: definition.length);
for (int i =... | 3 |
public void serializationLoadNo() {
if (JOptionPane.showConfirmDialog(this, "This will erase the existing data. Continue?", "Confirm Operation",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
StartupSequence.deleteSerializedData();
... | 2 |
private boolean isThreeOfAKind(ArrayList<Card> player) {
if(isFullHouse(player)){
return false;
}
ArrayList<Integer> sortedHand= sortHand(player);
int tripleCounter=0;
for(int i=0;i<player.size()-1;i++) {
if(sortedHand.get(i)==sortedHand.get(i+1))
tripleCounter++;
else {
if(tripleCounter==1)... | 5 |
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
public List<Film> getFilm() {
return film;
} | 0 |
private void gaussianHeightScaling() {
int kernel_size = (int)(Math.sqrt(gaussian_kernel.length));
int kernel_size2 = kernel_size / 2;
int startx = FROMx == 0 ? kernel_size2 : FROMx;
int starty = FROMy == 0 ? kernel_size2 : FROMy;
int endx = TOx == detail ? detail - kernel_size... | 8 |
private void extractFile(ZipFile zipFile, ZipEntry src, String destDir) {
String filename = src.getName();
/*check existence of subdirectory*/
String[] paths = filename.split("/");
String curP = "";
for (int i = 0; i < paths.length; i++) {
if (paths[i] != null && !pa... | 7 |
public void draw(Graphics g, JPanel p, int x, int y, int height, int width) {
Image img = null;
if(getModel() == null)
{
try {
img = ImageIO.read(new File("empty.jpg"));
g.drawImage(img, x, y, p);
} catch (IOException e) {
e.printStackTrace();
}
}
else
{
if (((Pion)getModel()).getPio... | 6 |
private void debugPrint(GameBoard game) {
String title = "Tetris";
for (int i = 0; i < ((game.COLUMS - (title.length()/2) )/ 2); i++) {
System.out.print(SPACE);
}
System.out.println(title);
System.out.print('+');
for (int i = 0; i < game.COLUMS; i++) {
... | 6 |
public static boolean isPalindrome(String string) {
if (string == null || string.length() == 0)
return false;
String s = string.toLowerCase();
String regex = "[a-z]";
Pattern pattern = Pattern.compile(regex);
int leftIndex = 0;
int rightIndex = string.length() - 1;
while (leftIndex < rightInde... | 9 |
@Override
public ArrayList<Visiteur> getAll() throws DaoException {
ArrayList<Visiteur> result = new ArrayList<Visiteur>();
ResultSet rs;
// préparer la requête
String requete = "SELECT * FROM VISITEUR";
try {
PreparedStatement ps = Jdbc.getInstance().getConnexion... | 2 |
public void handleInput() {
if ((p.health <= 1) || (op.health <= 1) || (endResult.length() > 1)) {
if (KeyHandler.isPressed(KeyHandler.ENTER)) {
gsm.setState(GameStateManager.STARTMENU);
}
return;
}
p.setLeft(KeyHandler.keyState[KeyHandler.LEFT]);
p.setRight(KeyHandler.keyState[KeyHandler.RIGHT])... | 8 |
@Override
public Set<String> getWorlds() {
return getList(worldYamlConfiguration);
} | 0 |
private double[][] generatePerlinNoise(double[][] baseNoise, int octaveCount) {
int width = baseNoise.length;
int height = baseNoise[0].length;
double[][][] smoothNoise = new double[octaveCount][][]; // an array of 2D arrays containing
//double persistance = 0.5f;
// generate smooth noise
for (int i = 0;... | 8 |
public void runProgram() throws FileNotFoundException,
IOException
{
//Deserializes the file
objectsVector = deSerFile.DeserializeFile();
//Count the number of each object
if(debug.getDebugVal() == 0)
{
int numType1 = 0;
int numType2 = 0;
Boolean bln = true;
//Check & display unique # of c... | 9 |
final Object pop() {
int size = stack.size();
return size == 0 ? null : stack.remove(size - 1);
} | 1 |
@Override
public void projectChanged(Project source, ProjectInfo i) {
if ((i.isSimulationControlStateModified() || i.isSimulationChanged())
&& source.hasSimulation() && source == session.getCurrentProject()) {
simulationTimer.setDelay(source.getTimerDelay());
if (sour... | 9 |
public String processInstructions(String instructions) {
/*regex to check if the input is valid.
to break it down further: ^\d+ \d+\n checks for a number followed by a space and a number, then a line break.
This is the platform size.
Then, (\d+ \d+ [NESW] check is the same but followed ... | 4 |
public int[] next()
{
if (repeat-- > 0) {
shuffle(p, random);
return p;
}
else
return null;
} | 1 |
public void paint( Graphics g ){
super.paint(g);
if (isSelect()) g.setColor(getColorSelect());
else g.setColor(getColorNormal());
switch (relacion.getTipo()){
case CONST.R_ASOCIACION : pintarAsociacion(g); break;
case CONST.R_AGREGACION : pintarAgregacio... | 5 |
public String addEdge(String src_region, String src_agent, String src_plugin, String dst_region, String dst_agent, String dst_plugin, String className)
{
String edge_id = null;
int count = 0;
try
{
while((edge_id == null) && (count != retryCount))
{
... | 5 |
public boolean isBlocked(Location l, boolean playersBlock){
if (playersBlock)
{
//Return true if occupied by any player
for (Player player : players)
{
if (l.equals(player.getLocation()))
return true;
}
}
//Return true if the location is beyond the edge of the map
if(l.getX() >= MAX_X ||... | 9 |
public Ausrichtung string2Ausrichtung(String input) {
int richtung = 0; // -1,1,-2,2 == -x,x,y,-y
Ausrichtung ausrichtung = null;
try {
richtung = Integer.parseInt(input);
} catch (Exception e) {
// Nothing
}
switch (richtung) {
case 1:
ausrichtung = Ausrichtung.XPLUS;
break;
case -1:
... | 5 |
public void setTopping(String topping) { this.topping = topping; } | 0 |
void inputAppend(String s){
int maxLength = 4;
if (currentState == MasterMindGraphic.FEEDBACK) {
maxLength = 2;
}
if (input.length() < maxLength) {
this.input += s;
}
} | 2 |
public void testGetValue() throws Throwable {
MockPartial mock = new MockPartial();
assertEquals(1970, mock.getValue(0));
assertEquals(1, mock.getValue(1));
try {
mock.getValue(-1);
fail();
} catch (IndexOutOfBoundsException ex) {}
try {
... | 2 |
@Override
public void keyPressed(KeyEvent e) {
int KeyCode = e.getKeyCode();
if (KeyCode == KeyEvent.VK_A || KeyCode == KeyEvent.VK_LEFT) {
left = true;
}
if (KeyCode == KeyEvent.VK_D || KeyCode == KeyEvent.VK_RIGHT) {
right = true;
}
if (Key... | 8 |
public UserDTO getUserByNickname( String nickname ) throws DAOException{
UserDTO user = null;
query = "";
query += "SELECT \n";
query += "id, passwd, register_date, email, status \n";
query += "FROM chat_user \n";
query += "WHERE nickname = ? \n";
try{
connection = DBManager.getConnection( );
... | 6 |
@Override
public void run() {
boolean done = false;
try {
Shell sh = ShellManager.getReference().getShell(m_ConnectionData.getLoginShell());
do {
sh.run(this);
if (m_Dead) {
done = true;
break;
... | 6 |
private List<MorrisLineAdjacent> getColumnLineAdjacent() {
List<MorrisLineAdjacent> lines = new ArrayList<MorrisLineAdjacent>();
boolean bu = this.hasUp();
boolean bd = this.hasDown();
MorrisLineAdjacent oneLine = null;
if (bu && bd) { //this is in the middle
oneLine = new MorrisLineAdjacent(this, this.up(... | 6 |
public ArrayList<String> apiGetLinks (String Client_ID, String url) throws IOException {
ArrayList<String> foundLinks = new ArrayList<String>();
if(isRunning){//We only want to do this if the app is running.
String YOUR_REQUEST_URL = url;
URL imgURL = new URL(YOUR_REQUEST_URL);
HttpURLConnect... | 6 |
@Override
public long periodUntil(DateTime endDateTime, PeriodUnit unit) {
if (endDateTime instanceof LocalTime == false) {
throw new DateTimeException("Unable to calculate period between objects of two different types");
}
LocalTime end = (LocalTime) endDateTime;
if (unit instanceof ChronoUnit... | 9 |
public static void main(String[] args) throws ClassNotFoundException,SQLException {
Connection conn = null;
PreparedStatement ps = null;
try{
conn = DBConnection.getConnection();
//just a test to get some user input and insert into the db
Scanner scanner = new Scanner(System.in);
System.out.p... | 6 |
@Override
public void display(UserInterface ui) {
UserInterface.print("Breakpoints cleared on lines: ");
for (String breakpointLine : breakpointLinesToClear) {
UserInterface.print(breakpointLine + " ");
}
UserInterface.println("\n");
ui.signalNeedToDisplayFunction... | 1 |
@Override
public void render(Graphics2D g)
{
double angle = Math.toDegrees(connectedObject.getRotationAngle());
angle = angle < 0 ? 360 + angle : angle;
double radius = connectedObject.getRadius();
double diameter = 2 * radius;
double x = connectedObject.getX() - radius;
... | 3 |
public void setNumber(int number) {
if (number <= 0) {
throw new IllegalArgumentException("Number should be bigger than zero.");
}
this.number = number;
} | 1 |
private boolean isCorrect(JTextField field) {
boolean correct = false;
if (field.getText().length() == 5) {
String[] pieces = field.getText().split(":");
if (Utils.isNumeric(pieces[0]) && Utils.isNumeric(pieces[1])) {
correct = true;
}
}
... | 3 |
public boolean isBoundingBoxBurning(AxisAlignedBB var1) {
int var2 = MathHelper.floor_double(var1.minX);
int var3 = MathHelper.floor_double(var1.maxX + 1.0D);
int var4 = MathHelper.floor_double(var1.minY);
int var5 = MathHelper.floor_double(var1.maxY + 1.0D);
int var6 = MathHelpe... | 7 |
public static void setText(ArrayList<JavaProcess> newLabel){
newLabels = newLabel;
labelListValue = labelList.size()/6;
newLabelsValue = newLabels.size();
//System.out.println(newLabels.size() + " "+ labelList.size());
if(newLabelsValue < labelListValue){
SwingUtilities.invokeLater(new Runnab... | 8 |
public void roundComplete() throws Exception {
this.roundCount++;
if (roundCount % 100 == 0) {
List<Statistics> stats = listStats();
Collections.sort(stats);
if (stats.size() < 3) //not enough stats yet
{
return;
}
... | 8 |
public static boolean innersolveSudoku(char[][] board) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if ('.' == board[i][j]) {
for (int k = 0; k < 9; k++) {
board[i][j] = (char) ('1' + k);
if (isValidSudoku(board)) {
... | 6 |
public static final Formula empiricalFromMolecular(String formula) {
int gcd = Integer.MAX_VALUE;
Formula empiricalFormula = FtHelper.parseFormula(formula);
List<Integer> subscripts = empiricalFormula.getSubscripts();
// We'll find GCDs in pairs and store them in tryGCD
int[] tryGcd = new int[10];
... | 7 |
public static void removeWordsStartWithConsonant(Text text, int length) {
log.trace("Subtask N12");
for (int i = 0; i < text.getAllElements().size(); i++) {
Sentence sentence = text.getChildElement(i);
if (sentence.getClass() != Listing.class) {
for (int j = 0; j ... | 6 |
public static void navigate(String url) {
if (java.awt.Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException e) {
BmLog.error(e);
} catch (URISyntaxException e) {
BmLog.error(e);
... | 4 |
public static void closeDB(DB db) {
if (db != null) {
LOGGER.trace("正在关闭MongoDB[" + db.getName() + "]");
try {
db.requestDone();
} catch (Throwable ex) {
LOGGER.debug("关闭MongoDB时发生未知异常", ex);
}
}
} | 2 |
@Override
public void dosomething() {
super.dosomething();
this.anothing();
} | 0 |
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
String line = (caseSensitive) ? value.toString() : value.toString().toLowerCase();
for (String pattern : patternsToSkip) {
line = line.replaceAll(pattern, "");
... | 4 |
public void handleEntityMovement() {
MovementPoint walkingPoint = null, runningPoint = null;
if (getEntity().getUpdateFlags().contains("teleporting")) {
resetMovement();
} else {
walkingPoint = getNextPoint();
if (isRunning()) {
runningPoint = getNextPoint();
}
getEntity().setWalkingDirection(w... | 8 |
protected void printTopWordsDistribution(int topK, String topWordFile) {
Arrays.fill(m_sstat, 0);
System.out.println("print top words");
for (_Doc d : m_trainSet) {
for (int i = 0; i < number_of_topics; i++)
m_sstat[i] += m_logSpace ? Math.exp(d.m_topics[i])
: d.m_topics[i];
}
Utils.L1Normaliza... | 9 |
private static void printBuildingTable(ArrayList<ParkerPaulTaxable> taxables) {
double totalTaxes = 0.00; // total taxes for items
double minTaxes = -1.00; // min taxes for items
double maxTaxes = 0.00; // max taxes for items
int count = 0; // count of items
printBuildingHeader... | 2 |
public void save(File file) {
FileOutputStream outputStream = null;
try {
if (!file.exists()) {
file.getParentFile().mkdirs();
file.createNewFile();
}
if (file.canWrite()) {
outputStream = new FileOutputStream(file);
for (Device device : devicesHistory.values()) {
device.write(outputSt... | 8 |
public void monitorFileModify(Path file){
if(file.startsWith(targetPath) &&
!Files.isDirectory(file)){
Path subPath = targetPath.relativize(file);
Path newPathSource = sourcePath.resolve(subPath);
Path newPathTarget = targetPath.resolve(subPath);
try {
if(!FileUtils.conten... | 4 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Customer customer = (Customer) o;
if (!firstName.equals(customer.firstName)) return false;
if (!id.equals(customer.id)) return false;
i... | 7 |
static final void loadScriptSettings(int i) {
if (i != 1)
aString1761 = null;
anInt1760++;
FileOnDisk class234 = null;
try {
SignlinkRequest class144
= Class348_Sub23_Sub1.signlink.method2233((byte) -46,
"2", true);
while ((class144.state ^ 0xffffffff) == -1)
Class286_Sub5.method2161((byt... | 9 |
public void showPersonalPosts() {
for (TimedPosts post : posts) {
long elapsedTimeInSec = (System.nanoTime() - post.getTime()) / 1000000000;
if (elapsedTimeInSec < 60) {
int elapsedTime = (int) elapsedTimeInSec;
System.out.println(post.getPost() + "(" + el... | 2 |
protected Node representData(Object data) {
objectToRepresent = data;
// check for identity
if (representedObjects.containsKey(objectToRepresent)) {
Node node = representedObjects.get(objectToRepresent);
return node;
}
// }
// check for null first
... | 7 |
public void mouseDragged(MouseEvent e) {
if(Global.isRunning) { return; } // block mouse input while simulating
if(shiftStartPoint != null) {
// shift the view
pt.moveView((int) ((shiftStartPoint.x - e.getX()) / pt.getZoomPanelZoomFactor() * pt.getZoomFactor()),
(int) ((shiftStartPoint.y - e.g... | 4 |
public void run() {
PrintStream outOld = null;
PrintStream outNew = null;
String outFilename = null;
// is the output redirected?
if (m_CommandArgs.length > 2) {
String action = m_CommandArgs[m_CommandArgs.length - 2];
if (action.equals(">")) {
outOld = System.out;
try {
... | 8 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int nCase = 1;
while ((line = in.readLine()) != null) {
if (line.trim().startsWith("#"))
break;
char[] a = ... | 5 |
private void parse(JSONObject action) {
// Initialize the keywords available for this Action
keywords = new ArrayList<String>();
// Assign the name and execution code for this Action
name = action.getString("name");
execute = action.getString("execute");
// Pull off the keywords from the JSONObject an... | 4 |
public Rule cloneWithModeChange(final Mode toMode) throws RuleException {
if ("".equals(toMode)) throw new RuleException("invalid mode [" + toMode + "] to convert");
boolean isModified = false;
Rule newRule = clone();
List<Mode> modeUsedInBody = getModeUsedInBody();
if (modeUsedInBody.size() == 0) {
} els... | 9 |
public int getBlockTypeIdFromPixel(int imagePixel) {
int blockTypeId = -1;
String[] line = (String[])groups.get(imagePixel);
if(line != null) {
int newBlockType = blockManager.getRandomIdByGroup(line[0]);
if(newBlockType > 0) {
blockTypeId = newBlockType;
... | 5 |
@Override
public void onEnable()
{
loadConfig();
PluginManager pm = getServer().getPluginManager();
pSpout = pm.getPlugin("Spout");
pTag = pm.getPlugin("TagAPI");
formatTranslations();
setupDatabase();
pm.registerEvents(playerlistener, this);
for (DNCCommands cmd : DNCCommands.val... | 8 |
@Override
public boolean subscribe(Client client, SubscribeMessage message) throws Exception {
String[] topics = message.getTopics();
QoS[] qoses = message.getRequestedQoSes();
List<String> allowedTopics = new ArrayList<String>();
List<QoS> allowedQoses = new ArrayList<QoS>();
int index = 0;
for (St... | 2 |
public Element featureChange(Element element) {
Game game = getGame();
Specification spec = game.getSpecification();
boolean add = "add".equalsIgnoreCase(element.getAttribute("add"));
FreeColGameObject object = game.getFreeColGameObject(element.getAttribute("id"));
NodeList nodes... | 6 |
public boolean doSendPackage() {
boolean result = false;
try {
synchronized (mOutPkgs) {
while (mOutPkgs.size() > 0) {
mBos.reset();
ObjectOutputStream out = new ObjectOutputStream(mBos);
NetSystem.Package pkg = mOutPkgs.poll();
out.writeObject(pkg);
byte[] data = mBos.toByteArray()... | 3 |
private int selectRGBTransform(RGBTransformAvailable chanel,Color color){
int colorReturn=0;
switch (chanel){
case GBR:
colorReturn=super.colorRGBtoSRGB(new Color(color.getGreen(),
color.getBlue(), color.getRed(),color.getAlpha()));
br... | 5 |
private void printTotalScores(Player player, int count)
{
System.out.println(player.getName() + " wins "
+ player.getNumberOfWins() + " of " + count + " games.");
} | 0 |
private static Entry[] merge(Entry[] list1, Entry[] list2) {
Entry[] output = new Entry[list1.length + list2.length];
int p1 = 0, p2 = 0;
for(int i = 0; i < output.length; i++) {
if(p2 >= list2.length) {
output[i] = list1[p1];
p1++;
} else if(p1 >= list1.length || list1[p1].getScore() < list2[p2].ge... | 6 |
protected void processCondCommentBlocks(List<String> condCommentBlocks) {
if(generateStatistics) {
for(String block : condCommentBlocks) {
statistics.setPreservedSize(statistics.getPreservedSize() + block.length());
}
}
} | 2 |
private void showAboutPanel()
{
String html = MessageFormat.format(resources
.getString("dialog.about.text"), new Object[]
{ resources.getString("version.id") });
String[] props = { "java.version", "java.vendor", "java.home", "os.name", "os.arch", "os.version", "user.... | 2 |
@Override
public List<? extends DefaultModel> getObj(String campo) {
return null;
} | 1 |
public Address getAddresses(String content, String encodingString) throws UnsupportedEncodingException {
// 这里调用pconline的接口
String urlStr = "http://ip.taobao.com/service/getIpInfo.php";
// 从http://whois.pconline.com.cn取得IP所在的省市区信息
String returnStr = this.getResult(urlStr, content, encodi... | 9 |
public void enterParkedState(int parkingTime, int intendedDuration)
throws VehicleException {
exitTime = parkingTime + intendedDuration;
this.parkingTime = parkingTime;
// this.intendedDuration = intendedDuration;
if (isParked() == true) {
throw new VehicleException("Vehicle is already parked.");
}
... | 4 |
public boolean isE(char c) {
if ((c >= 'a' && c <= 'z')) {
return true;
}
switch (c) {
case '.':
return true;
case '-':
return true;
case '/':
return true;
case '#':
return true;
case '?':
return true;
}
return false;
} | 7 |
public ProcessState execute(final CommandSender sender, final Command cmd, final String label, final String[] args) {
ProcessState state = null;
if ( sender instanceof Player ) {
final IPlayerExecutor exec = this.playerExec.get(args.length);
if ( exec != null )
state = exec.execPlayer((Player) s... | 5 |
public int[][][] loadLevel(String levelName) {
int[][][] level = new int[2][Constants.levelHeight][Constants.levelWidth];
try {
Scanner scanner = new Scanner(this.getClass().getResourceAsStream("resources/levels/" + levelName + ".lvl"));
while (scanner.hasNext()) {
for (int i = 0; i < level[0].le... | 6 |
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.