text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public int hashCode() {
int result = firstName != null ? firstName.hashCode() : 0;
result = 31 * result + (secondName != null ? secondName.hashCode() : 0);
result = 31 * result + (email != null ? email.hashCode() : 0);
result = 31 * result + (phone != null ? phone.hashCode(... | 4 |
public List<Product> viewProduct(int offSet, int noOfRecords, String category){
List<Product> productList = new ArrayList<Product>();
Product product = null;
connMyDB = new ConnectDatabase();
try {
connMyDB.connect();
productDataset = connMyDB.query(getQuery(category, offSet, noOfRecords));
while(p... | 8 |
protected LoginResult loginEmailPassword(final LoginSessionImpl loginObj, final Session session) throws IOException
{
final String input=loginObj.lastInput.toUpperCase().trim();
if(input.startsWith("Y"))
{
String password=loginObj.player.password;
if(CMProps.getBoolVar(CMProps.Bool.HASHPASSWORDS))
{
... | 7 |
private int optional (int optional) throws KryoException {
int remaining = limit - position;
if (remaining >= optional) return optional;
optional = Math.min(optional, capacity);
int count;
// Try to fill the buffer.
count = fill(buffer, limit, capacity - limit);
if (count == -1) return remaining == 0 ... | 8 |
public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... | 7 |
public static NumberWrapper divideComputation(NumberWrapper x, NumberWrapper y) {
try {
{ double floatresult = Stella.NULL_FLOAT;
{ Surrogate testValue000 = Stella_Object.safePrimaryType(x);
if (Surrogate.subtypeOfIntegerP(testValue000)) {
{ IntegerWrapper x000 = ((IntegerWrapp... | 8 |
public CheckResultMessage check24(int day) {
int r1 = get(2, 5);
int c1 = get(3, 5);
int r2 = get(39, 5);
int c2 = get(40, 5);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r1 + 1... | 5 |
@Test
public void testPlayersQueriedInOrder() { // This tests that the players are surveyed in order to see if they hold the cards.
ArrayList<Player> playersTest = board.getPlayers();
ArrayList<Card> hold3 = playersTest.get(3).getCards();
ArrayList<Card> newHand = new ArrayList<Card>();
newHand.add(new Card(ty... | 8 |
public FlowBlock getNextFlowBlock(StructuredBlock subBlock) {
if (subBlock == subBlocks[0]) {
if (subBlocks[1].isEmpty())
return subBlocks[1].getNextFlowBlock();
else
return null;
}
return getNextFlowBlock();
} | 2 |
public boolean canMove(int oldX, int oldY, int newX, int newY, boolean isNewSpotEmpty) {
int deltaX;
int deltaY;
deltaX = Math.abs(newX-oldX);
deltaY = Math.abs(newY-oldY);
if (deltaX == 2 && deltaY == 1){
return true;
} else if (deltaX == 1 && deltaY == 2) {
return true;
}
return fals... | 4 |
private int read() throws IOException{
if(re){
re = false;
}else if(un){
current = unBuffer[uni--];
if(uni==-1){
uni = 0;
un = false;
}
}else{
current = input.read();
}
return current;
} | 3 |
public static void main(String[] args) {
// Create Display
try {
Display.setDisplayMode (new DisplayMode(800, 600));
Display.create ();
Display.setTitle("Hello!!");
} catch (LWJGLException ex) {
Logger.getLogger(LWJGL_Example1.cl... | 7 |
private String getPartOfDate(Integer hourOfDay){
if(hourOfDay >= 7 && hourOfDay <= 12){
return "morning";
} else if(hourOfDay > 12 && hourOfDay <= 18){
return "afternoon";
} else if(hourOfDay > 18 && hourOfDay <= 23 || hourOfDay == 0){
return "evening";
} else {
return "night";
}
} | 7 |
public String CaptureStillImage(String UrlParameter) {
if (Parent.GetNoCameraParameter()) {
return "";
}
String ReturnValue = "";
try {
String param_url = "";
URLConnection conn = null;
BufferedReader data = null;
String line;
... | 7 |
public int sortHardwareAlternatives() {
int maxDepth = 1;
for (HardwareSet hardwareSet : hardwareSets) {
maxDepth = hardwareSet.getCpuAlternatives().size() > maxDepth ? hardwareSet.getCpuAlternatives().size() : maxDepth;
maxDepth = hardwareSet.getHddAlternatives().size() > maxDepth ? hardwareSet.getHddAlterna... | 7 |
public void paint(Graphics2D g2) {
if ( nd_gc.powered && nd_gc.mode_map ) {
// only in map modes, not in PLAN, APP CTR, VOR CTR
//float current_altitude = this.aircraft.indicated_altitude();
float current_altitude = this.aircraft.altitude_ind();
float target_alt... | 8 |
@Override
public void onEnable() {
if (!this.loaded) {
this.getLogger().log(Level.SEVERE, "Disabling plugin; Dependencies not met during plugin load");
this.setEnabled(false);
return;
}
this.reloadConfig();
Main.courier = ConfigurationCourier.Fact... | 3 |
public void atualizar(AreaConhecimento areaconhecimento) throws Exception
{
String sql = "UPDATE areaconhecimento SET nome = ?, ciencia = ?, areaAvaliacao = ? WHERE id = ?";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
stmt.setString(1, areaconhecimento.getNom... | 1 |
@Test
public void testIncrementWins()
{
assertNotNull(_underTest);
int x = _underTest.getNumberOfWins(); // current count of wins, expected
// to be 0
_underTest.incrementWins();
assertEquals(x + 1, _underTest.getNumberOfWins());
... | 0 |
private void tarkistaJaToimi(int miinojaInteger, int kentanKokoInteger) {
if (miinojaInteger < kentanKokoInteger*kentanKokoInteger){
String profiiliNimiString = this.profiiliNimi.getText();
if (profiiliNimiString.length()<11 && profiiliNimiString.length() >0 && !this.nakyma.getPeliProfii... | 5 |
@Override
public boolean containsAll(Collection<?> c)
{
for (Object o : c) {
if (!contains(o)) {
return false;
}
}
return true;
} | 3 |
public void archiveQueueFailures(int time) throws VehicleException, SimulationException {
int maxTime = Constants.MAXIMUM_QUEUE_TIME;
for(int i =0; i < queue.size(); i++){
int arrivalTime = queue.get(i).getArrivalTime();
if(!(queue.get(i).isQueued()) || time > Constants.CLOSING_TIME || time < 0){
throw ne... | 5 |
@Override
public void startElement
(String uri, String localName, String qName, Attributes attributes) {
logger.info ("startElement, qName = " + qName);
if ("events".equals (qName)) {
startEventsElement (attributes);
}
else if ("event".equals (qName)) {
... | 8 |
public void run(String arg) {
// 1 - Obtain the currently active image if necessary:
ImagePlus imp = IJ.getImage();
if (null == imp) return;
int stackSize = imp.getStackSize();
if (imp.getBitDepth()!=8) {
IJ.showMessage("Error", "Only 8-bit images are supported");
return;
}
ImageStatistics stats... | 9 |
public static Texture getDudeImage(int dir){
Image dude = null;
if(dir == 0){
dude = textures.getSubImage(0, 0, 25, 49);
}else if(dir == 1){
//dude = textures.getSubImage(0, 25, 25, 49);
}else if(dir == 2){
}else if(dir == 3){
}else if(dir == 4){
}else if(dir == 5){
}else if(dir ==... | 8 |
private static final boolean isClassnamePart(char c) {
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))
return true;
switch (c) {
case '.':
case '$':
case '_':
return true;
default:
return false;
}
} | 9 |
@Override
public ReturnStruct parse(String[] lines) {
int i = 0;
int c = 1;
ArrayList<String> code = new ArrayList<String>();
while (i < lines.length) {
String line = Parser.clean(lines[i]);
if (line.startsWith("if ") || line.startsWith("for ")
|| line.startsWith("while ")
|| line.startsWith("f... | 7 |
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int opcao;
int valor;
Personagem personagem = new Personagem();
Personagem sistema = new Personagem();
do{
System.out.println("************");
Syste... | 4 |
public String dumpCircuit() {
int i;
int f = (showCurrent) ? 1 : 0;
f |= (smallGrid) ? 2 : 0;
f |= (showVoltage) ? 0 : 4;
f |= (showPowerDissipation) ? 8 : 0;
f |= (showValues) ? 0 : 16;
// 32 = linear scale in afilter
String dump = "$ " + f + " "
... | 9 |
public void actionPerformed(ActionEvent ev)
{
try
{
PalavraChave objt = classeView();
if (obj == null)
{
long x = new PalavraChaveDAO().inserir(objt);
objt.setId(x);
JOptionPane.showMessageDialog(null,
"Os dados foram inseridos com sucesso", "Sucesso", JOptionPane.INFORMATION_MESSAGE);
... | 3 |
public void removeDraggableComponent(DraggableComponent component) {
if (component != null && draggableComponentList.contains(component)) {
//component.abortDrag();
int index = layoutOrderList.indexOf(component.getComponent());
component.removeListener(draggableComponentListener);
if (compon... | 9 |
public static void needHelp(CommandSender sender, String cmd, String label, String[] args) {
// command
String command = cmd.toLowerCase();
// player
Player player = (Player) sender;
// root command split for public and moderator access!
if (command.equalsIgnoreCase("help")) {
try {
showHelpPage(pla... | 8 |
private void getImageTest(String asImageType, String asLastMod, int aiMaxSize,
boolean abIncludeEncodedData)
{
ArrayList<Image> laImages = null;
System.out.println("Running for LastMod: " + asLastMod + " and MaxSize: "
+ aiMaxSize);
ImageList laImageList = laClient.getImages("Registrant Photo",
abInc... | 4 |
static boolean schrikkelJaar(int jaar) {
boolean schrikkel;
if(jaar % 4 == 0)
schrikkel = true;
else if(jaar % 100 == 0)
schrikkel = true;
else if(jaar % 400 == 0)
schrikkel = true;
else
schrikkel = false;
return schrikkel;
} | 3 |
private void map(Map<?, ?> map) {
add("{");
Iterator<?> it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<?, ?> e = (Map.Entry<?, ?>) it.next();
value(e.getKey());
add(":");
value(e.getValue());
if (it.hasNext()) add(',')... | 9 |
private void updateDisplayString(){
PlayerBattleState playerState = null;
TargetableState targetState = null;
ObjectState pState = Directory.profile.getPlayer().getState();
//Get the player's state
if(pState != null && pState instanceof PlayerBattleState)
{
playerState = (PlayerBattleState) pState;
... | 8 |
public List<TravelTrip> findType(boolean typeBusiness){
//Query travelTripByType = em.createNamedQuery("TravelTrip.findByTripType");
TypedQuery<TravelTrip> travelTripByType = em.createNamedQuery("TravelTrip.findByTripType", TravelTrip.class);
travelTripByType.setParameter("business", typeBusiness);... | 0 |
@Override
public int compareTo(Joueur o) {
SimpleDateFormat formater=new SimpleDateFormat("dd/MM/yy HH:mm:ss");
Date dateO1 = null,dateO2 = null;
try {
dateO1=formater.parse(this.getDateJeu());
dateO2=formater.parse(o.getDateJeu());
} catch (ParseException e) {
JOptionPane.showMessageDialog(n... | 3 |
public static void main(String[] args) {
try {
if (args.length != 2) {
System.err.println("USAGE: java RenderMap map.txt image.png");
System.exit(1);
}
Game game = new Game(args[0], 100, 0, null);
if (game.Init() == 0) {
System.... | 3 |
public CurrentPlayerRenderer(Game game, JPanel panel, JLabel actions) {
super(game, panel);
if (actions == null)
throw new IllegalArgumentException("The given actions left panel is invalid!");
this.actionsLeft = actions;
} | 1 |
private void initialize() {
frame = new JFrame();
frame.setTitle("The Dungeon of Zelda");
frame.setIconImage(Toolkit.getDefaultToolkit().getImage(Menu.class.getResource("/background/icon.jpg")));
frame.setBounds(100, 100, 600, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Adds the layout : ... | 5 |
public void useDice(int itemId, boolean clan){
if (System.currentTimeMillis() - c.diceDelay >= 3000) {
c.sendMessage("Rolling...");
c.startAnimation(11900);
c.diceDelay = System.currentTimeMillis();
c.cDice = itemId;
c.clanDice = clan;
switch (itemId) {
//Gfx's
case 15086: c.gfx0(2072)... | 9 |
@Test
public void testViewDetailsForAllQueues() throws LuaScriptException {
List<String> noKeys = new ArrayList<String>();
List<String> args = Arrays.asList(JQlessClient.getCurrentSeconds());
String json = (String) _luaScript.callScript(this.scriptName(), noKeys,
args);
List<Map<String, Object>> queueDet... | 2 |
private void highlightButton(Graphics g) {
Rectangle bounds = null;
g.setColor(Color.red);
// check which button is selected
if (selected == ButtonSelected.NEW) {
bounds = getButtonBounds(BUTTON_X_START_PROPORTION,
NEW_PLAYER_Y_PROPORTION);
} else if (selected == ButtonSelected.LOAD) {
bounds = ge... | 5 |
public boolean onCommand(CommandSender sender, Command cmd, String label,String[] args){
if(sender instanceof Player && cmd.getName().equals("public")){
Player p = (Player) sender;
if(this.listener.isPrivate(p)){
this.listener.removePrivate(p);
p.sendMessage(ChatColor.DARK_PURPLE+"[Chat]"+ChatColor.WHIT... | 9 |
public void performStepp(int Stepps, Vector2 Position)
{
for(int i = 0; i < Stepps; i++)
{
if(Position.getX() > this.TargetLocation.getX())
{
Position.addX(- 1);
}
else if(Position.getX() < this.TargetLocation.getX())
{
... | 5 |
public Type getType(Identifier id) {
// traverse the list of types backwards
for(int i = types.size() - 1; i >= 0; i--) {
Type rval = types.get(i).get(id);
if(rval != null) {
return rval;
}
}
// exited the search without finding the Identifier, return null
return null;
} | 2 |
public static Surrogate verifyType(Surrogate self) {
if ((self.surrogateValue != null) &&
(!Stella_Object.stellaClassP(self.surrogateValue))) {
{
Stella.STANDARD_WARNING.nativeStream.println("Warning: Illegal object `" + self.surrogateValue + "' found");
Stella.STANDARD_WARNING.nativeS... | 6 |
public PDAStepByStateSimulator(Automaton automaton) {
super(automaton);
/** default acceptance is by final state. */
Object[] possibleValues = {"Final State", "Empty Stack"};
Object selectedValue = JOptionPane.showInputDialog(null,
"Accept by", "Input",
JOptionPane.INFORMATION_MES... | 2 |
private static boolean isNumber(String s)
{
if (s == null) return false;
try {
Double.parseDouble(s);
return true;
} catch (NumberFormatException e) {
return false;
}
} | 2 |
static final void method2092(int i, int i_25_, int[] is, int i_26_,
Object[] objects) {
try {
int i_27_ = -92 / ((i_26_ - -55) / 57);
if ((i ^ 0xffffffff) < (i_25_ ^ 0xffffffff)) {
int i_28_ = (i + i_25_) / 2;
int i_29_ = i_25_;
int i_30_ = is[i_28_];
is[i_28_] = is[i];
is[i] = i_30_;
Object... | 7 |
public ServerListener(int port) {
serverPort = port;
list = new ClientListManager();
} | 0 |
public PartnerListResponse(
final Boolean success, final String errorMessage, final List<Partner> partnerList
) {
super(success, errorMessage);
this.partnerList = partnerList;
} | 0 |
public boolean equals(Point o) {
return o.x == x && o.y == y ;
} | 1 |
public void use(int slot) {
if (slot < 0 || slot > 2)
return;
if (equipped[slot] != null) {
equipped[slot].use(player);
}
} | 3 |
public static void main(String[] args) {
// TODO code application logic here
String palabra="";
int brin=0;
char letra = 0;
int cantidad=0;
int opcion;
Scanner teclado=new Scanner(System.in);
do{
System.out.println("D... | 4 |
protected static Ptg calcAverageA( Ptg[] operands )
{
Ptg[] alloperands = PtgCalculator.getAllComponents( operands );
double total = 0;
for( Ptg p : alloperands )
{
try
{
Object ov = p.getValue();
if( ov != null )
{
if( String.valueOf( ov ) == "true" )
{
total++;
}
e... | 4 |
@Override
public List<MetaObject> getGroupMetaData() {
List<MetaObject> list = new ArrayList<MetaObject>();
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(... | 5 |
final public void exportDiagram(OutputStream os, StringBuilder cmap, int index, FileFormatOption fileFormatOption)
throws IOException {
List<BufferedImage> flashcodes = null;
try {
if ("split".equalsIgnoreCase(getSkinParam().getValue("flashcode"))
&& fileFormatOption.getFileFormat() == FileFormat.PNG) {
... | 9 |
public Boolean subTaskDateChecker(Date supTaskStartDate, Date supTaskEndDate, Date parentStartDate, Date parentEndDate) {
Boolean result = true;
if (supTaskStartDate.before(parentStartDate)
|| supTaskStartDate.after(parentEndDate)
|| supTaskStartDate.after(supTaskEndDate)... | 4 |
public void paintComponent(Graphics g) {
g.setColor(Color.black);
g.fillRect(0, 0, getHeight(), getWidth());
g.setColor(Color.white);
int[][] joints = moc.joints;
if (joints != null) {
try {
for (int skelIndex = 1; skelIndex <= 2; skelIndex++) {
... | 9 |
private void drawRestOfJPanelDisplay(Graphics g) {
userCard.drawCard(g, this);
int numberLeftInPack = cardStack.size();
if (numberLeftInPack > 0) {
aFaceDownCard.drawCard(g, this);
drawNumberInsideCardArea(g, aFaceDownCard);
}
drawGameInformation(g);
} | 1 |
public static String longestPalindromeByMid(String s, int i, int j) {
if (i != j && i != j - 1) {
return null;
}
int l = i, r = j;
while (l >= 0 && r < s.length() && s.charAt(l) == s.charAt(r)) {
l--;r++;
}
return s.substring(l+1, r);
} | 5 |
@Override
public Color getDominantClusterInNeighbourhood(Node node) {
Set<Node> neighbors = IteratorUtils.toSet(this.LPAClusteringEngine.getGraph().getNeighbors(node).iterator());
Color currentNodeCluster = this.LPAClusteringEngine.getNodeClusterMapping().get(node);
if (nei... | 6 |
public String sample_frequency_string()
{
switch (h_sample_frequency)
{
case THIRTYTWO:
if (h_version == MPEG1)
return "32 kHz";
else if (h_version == MPEG2_LSF)
return "16 kHz";
else // SZD
return "8 kHz";
case FOURTYFOUR_POINT_ONE:
if (h_version == MPEG1)
return "... | 9 |
@Override
public int getRow() {
ensureOpen("getRow");
//return cursor;
return (cursor < 0) ? 0 : cursor + 1;
} | 1 |
private static int partition(int[] array, int start, int end) {
int pivot = array[end];
int smallerIndex = start - 1;
for (int i = start; i < end; i++) {
if (array[i] <= pivot) {
smallerIndex++;
swap(array, smallerIndex, i);
}
}
smallerIndex++;
swap(array, smallerIndex, end);
return... | 2 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Orders)) {
return false;
}
Orders other = (Orders) object;
if ((this.orderId == null && other.orderId != null) ... | 5 |
public static String getTimestamp(int format) {
switch(format) {
case SHORT:
return shortFormat.format(new Date());
case MEDIUM:
return mediumFormat.format(new Date());
case LONG:
return longFormat.format(new Date());
case FULL:
return fullFormat.format(new Date());
... | 4 |
public void acquirePacketsTimed(final List<Packet> buffer,
final int count, long milliseconds) {
Thread sniffer = acquirePackets(buffer, count);
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
done = true;
} | 1 |
boolean validateMove(movePair movepr, Pair pr) {
// This is also from dumbPlayer, and seems like something we won't have to use
Point src = movepr.src;
Point target = movepr.target;
boolean rightposition = false;
if (Math.abs(target.x-src.x)==Math.abs(pr.p) && Math.abs(target.y-src.y)==Math.abs(pr.q)) {
ri... | 7 |
public static String numberToString(Number number)
throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
... | 6 |
public static String stringFor_cl_program_info(int n)
{
switch (n)
{
case CL_PROGRAM_REFERENCE_COUNT: return "CL_PROGRAM_REFERENCE_COUNT";
case CL_PROGRAM_CONTEXT: return "CL_PROGRAM_CONTEXT";
case CL_PROGRAM_NUM_DEVICES: return "CL_PROGRAM_NUM_DEVICES";
... | 9 |
final static public char[] trim(char[] chars) {
if (chars == null)
return null;
int start = 0, length = chars.length, end = length - 1;
while (start < length && chars[start] == ' ') {
start++;
}
while (end > start && chars[end] == ' ') {
end--;
}
if (start != 0 || end != length - 1) {
return subarray(c... | 7 |
public void setGain(float gain) {
if (gain != -1) {
if ((gain < 0) || (gain > 2)) {
throw new IllegalArgumentException("Volume must be between 0.0 and 2.0");
}
}
this.gain = gain;
if (outputLine == null) {
return;
}
try {
FloatControl control = (FloatControl) outputLine.getControl(F... | 6 |
public void testPropertySetMinute() {
LocalTime test = new LocalTime(10, 20, 30, 40);
LocalTime copy = test.minuteOfHour().setCopy(12);
check(test, 10, 20, 30, 40);
check(copy, 10, 12, 30, 40);
try {
test.minuteOfHour().setCopy(60);
fail();
... | 2 |
public void startGameForClients(MiniServer player[]) {
this.clientPlayersPlaying = player;
//Disallow the player array from having nulls in between players:
//TODO: test this loop
this.numberOfPlayers = 0;
for(int i=0; i<this.clientPlayersPlaying.length; i++) {
if(this.clientPlayersPlaying[i] == null... | 8 |
public Main() {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = "jdbc:mysql://localhost:3306/coffeebreak";
conn = DriverManager.getConnection(url, "root", "");
//doInsert("chocolat", 5);
//doInsert("capuccino", 6);
... | 4 |
public void setEntryText(String text, int pos) {
int current = 0;
for (Widget i = wdg().child; i != null; i = i.next) {
if (i instanceof TextEntry) {
current++;
if (current == pos) {
TextEntry te = (TextEntry) i;
te.settext(text);
return;
}
}
}
} | 3 |
public static void main(String[] args) {
// TODO Auto-generated method stub
DataModel model = null;
try {
model = new FileDataModel(new File("/home/naren/projects/minhash/user_brands.csv"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
UserSimilarity similarit... | 3 |
public static void main(String[] args) {
ExecutorService ctp = Executors.newCachedThreadPool(new ThreadFactory() {
private AtomicInteger count = new AtomicInteger();
public Thread newThread(Runnable r) {
int c = count.incrementAndGet();
... | 1 |
public static Matrix3D getRotationMatrix(double angle, int axis) {
double cos = Math.cos(angle);
double sin = Math.sin(angle);
switch (axis) {
case AXIS_X:
return new Matrix3D(1, 0, 0, 0, cos, -sin, 0, sin, cos);
case AXIS_Y:
return new Matrix3D(cos, 0, sin, 0, 1, 0, -sin, 0, cos);
case AXIS_Z:
re... | 3 |
private static void test2_4() throws FileNotFoundException {
String test1 = "new game\n"+"examine room\n"+"quit\n"+"yes\n";
HashMap<Integer, String> output = new HashMap<Integer, String>();
boolean passed = true;
try {
in = new ByteArrayInputStream(test1.getBytes());
System.setIn(in);
out = new Pr... | 7 |
public ButtonPanel () {
super (null);
try {
background = ImageIO.read (new File ("LoLTeamBuilder" + File.separator + "images" + File.separator + "button_background.png"));
} catch (IOException e) {
e.printStackTrace();
}
Dimension size = new Dimension (1000, 94);
setPreferredSize (size);
setMa... | 3 |
public void update() {
for (int row = 0; row < ROWS; row++) {
for (int col = 0; col < COLS; col++) {
Tile current = board[row][col];
if (current == null)
continue;
current.update();
resetPosition(current, row, col);
}
}
} | 3 |
private ArrayList methodParams(final MethodEditor method) {
final ArrayList locals = new ArrayList();
int index = 0;
if (!method.isStatic()) {
// Add the this pointer to the locals.
final Type type = method.declaringClass().type();
final LocalVariable var = method.paramAt(index++);
locals.add(new Lo... | 3 |
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getSource() == easy && e.getStateChange() == ItemEvent.SELECTED) {
whatIsDifficulty = 0;
}
if (e.getSource() == hard && e.getStateChange() == ItemEvent.SELECTED) {
whatIsDifficulty = 1;
}
} | 4 |
private void initTimeline() {
timeline = new Timeline();
timeline.setCycleCount(Timeline.INDEFINITE);
KeyFrame kf = new KeyFrame(Config.ANIMATION_TIME, new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
if (state == STATE_SHOW_TITLE) {
... | 9 |
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null || this.getClass() != obj.getClass())
{
return false;
}
Plan other = (Plan) obj;
/*
* Not sure why, but the favourite flag differs between raw plan and expanded plan.
* That is, "plan/DMW-MOBI... | 3 |
private void start()
{
player.playTrack(TrackType.START);
while (player.isPlaying()) {
}
timer = new Timer(TURN_DURATION, this);
timer.start();
} | 1 |
@Override
public boolean isCompleteMatch(List<Character> currentMatching) {
if(currentMatching.size() != 2)
return false;
if(currentMatching.get(0) != KeyMappingProfile.ESC_CODE)
return false;
if(currentMatching.get(1).charValue() > 26)
return false;
... | 3 |
private void copyRandom(RandomListNode headNew, RandomListNode head) {
while(head != null){
headNew.random = (RandomListNode) map.get(head.random);
head = head.next;
headNew = headNew.next;
}
} | 1 |
public String getNumberFormatParse() {
NumberFormat nf = NumberFormat.getInstance();
Object obj = null;
try {
obj = nf.parse("1234,56");
} catch (Exception e) {
System.out.println(e.getMessage());
}
return (obj.toString());
} | 1 |
public static UsersReader getInstance() throws IOException {
if (instance == null)
instance = new UsersReader();
return instance;
} | 1 |
@Test
public void getFutureMeetingListPerContactSortedTest() {
contacts2 = generateListOfContacts2();
Contact c = null;
Calendar may25_1430=Calendar.getInstance();
Calendar may25=Calendar.getInstance();
may25_1430.set(2014, Calendar.MAY, 25, 14, 30);
may25.set(2014, C... | 4 |
@Override
public void serialize(T t, JsonGenerator jg, SerializerProvider sp) throws IOException, JsonProcessingException {
jg.writeStartObject();
if (t.getId() != null) {
jg.writeStringField("id", t.getId().toString());
}
Set<TKey<?, ?>> keys = t.getAvailableKeys();
... | 8 |
protected void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String error = "Unsuccessful purchase";
HttpSession session = req.getSession(true);
if (session.getAttribute("currentSessionUser") == null) {
res.sendRedirect("login");
} else {
try {
String ... | 4 |
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (averageGroundLevel < 0)
{
averageGroundLevel = getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (averageGroundLevel < 0)
{
... | 8 |
private void calculatePrefixCode(PrefixTreeNode t, String s)
{
if (t instanceof PrefixTreeLeaf)
{
code.put(((PrefixTreeLeaf)t).letter, s);
return;
}
calculatePrefixCode(((PrefixTreeNode) t).left, s + '0');
calculatePrefixCode(((PrefixTreeNode) t).right, s + '1');
} | 1 |
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf8");
InvertedIndex.tryInit(getServletContext());
String userRequest = req.getParameter("q");
ArrayList<String> urs = tokenize(userReq... | 3 |
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.