text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public void parse() {
coordinate = new TextureCoordinate();
try {
if (words.length >= 2) coordinate.setU(Float.parseFloat(words[1]));
if (words.length >= 3) coordinate.setV(1 - Float.parseFloat(words[2])); // OBJ origin is at upper left, OpenGL origin is at lower left.
if (words.length >= 4)... | 4 |
@SuppressWarnings("unchecked")
private void menuItemOpenActionPerformed(ActionEvent evt)
{
JFileChooser fc = new JFileChooser();
fc.setAcceptAllFileFilterUsed(false);
fc.setFileFilter(new FileFilter()
{
public boolean accept( File f )
{
return f.isDirectory() || f.getName().toLowerCase().endsWith(... | 5 |
public static void writeOdsProperties(String projN, ArrayList<String> tl, ArrayList<String> wf){
ArrayList<String> odsPpts=rfa.readInputStream(GenerateInitScripts.class.getResourceAsStream("config/srcOds/template.properties"),"UTF-8");
StringBuffer content=new StringBuffer();
for(int i=0; i<odsP... | 6 |
public List<Group> getAllChildrenGroup(int parentId) {
List<Group> list = new LinkedList<>();
Connection connection = ConnectionManager.getConnection();
if (connection == null) {
logger.log(Level.SEVERE, "Couln't establish a connection to database");
return list;
... | 3 |
public static Rectangle defineChar(){
try {
boyStandFront = ImageIO.read(CharacterManager.class.getClassLoader().getResourceAsStream("images/BoyStandFront.gif"));
boyStandLeft = ImageIO.read(CharacterManager.class.getClassLoader().getResourceAsStream("images/BoyStandLeft.gif"));
boyWalkLeft1 = ImageIO.read(C... | 1 |
public static List<InfoTrack> readLayoutCSV(String fileName) {
List<InfoTrack> tracks = new LinkedList<InfoTrack>();
File file = null;
FileReader fr = null;
BufferedReader br = null;
try {
file = new File(fileName);
fr = new FileReader(file);
b... | 5 |
public double getDistance(int nodeA, int nodeB) {
int w = _map[0].length;
int yA = nodeA / w;
nodeA = nodeA % w;
int yB = nodeB / w;
nodeB = nodeB % w;
if (Math.abs(nodeA-nodeB) == 1 && yA != yB) {
return DIAG * (_map[yA][nodeA] + _map[yB][nodeB]);
}
return _map[yA][nodeA] + _map[yB][nodeB];
} | 2 |
private int calculateStrikeScore() {
int score = getThrowsScore();
if (nextFrame != null) {
if (nextFrame.getThrows().size() == 1) {
score += nextFrame.getThrowsScore();
if (nextFrame.getNextFrame() != null) {
if (nextFrame.getNextFrame().g... | 6 |
private void isCorrectDirectory(final String dirName) {
File file = new File(dirName);
if (file.isFile()) {
throw new MultiDataBaseException(dirName + " isn't a directory!");
}
String[] dirs = file.list();
checkNames(dirs, "dat");
for (int i = 0; i < dirs.len... | 3 |
public int ReadFile2DB(File TargetFile, String host, String hostPath, String FileURL, DatabaseAccess JavaDBAccess, boolean ConfirmDialog) {
PreparedStatement ps = null;
int TARGET_PHP_FILES_ID = 0, TARGET_PHP_WEB_APPLICATION_ID = -1, count = 0, fileLength = 0;
String Line = "", PHPFileTextClean ... | 7 |
public SelectQuery in(String... args) {
if (args.length == 1) {
for (String arg : args) {
if (arg.startsWith("(")) { // nested select
query.append(" IN ").append(arg);
} else { // just single value, same as below
query.append(" ... | 4 |
public static void main(String[] args) throws Exception
{
HashMap<Integer, Integer> countMap = new LinkedHashMap<Integer,Integer>();
BufferedWriter lengthWriter = new BufferedWriter(new FileWriter(new File(ConfigReader.getSandraRiverJune2012Dir() + File.separator +
"lengths.txt")));
BufferedWriter write... | 9 |
final public void While_statement() throws ParseException {
/*@bgen(jjtree) While_statement */
SimpleNode jjtn000 = new SimpleNode(JJTWHILE_STATEMENT);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_consume_token(WHILE);
... | 8 |
private UserStory persistUserStory(Project project, Map<String, Release> projectReleases,
HierarchicalRequirementType hierarchicalRequirementType, Iteration iteration) throws JAXBException {
UserStory userStory = Mapper.mapUserStory(hierarchicalRequirementType);
for (TaskType taskType : hierarchicalRequirementTy... | 9 |
public boolean hasPathSum(TreeNode root, int sum) {
boolean result = false;
if (root != null) {
int currentSum = root.getVal();
if (root.getLeft() == null && root.getRight() == null) {
return currentSum == sum;
}
sum -= currentSum;
... | 6 |
public JCheckBoxMenuItem getAcceptByFinalStateCheckBox() {
return turingAcceptByFinalStateCheckBox ;
} | 0 |
@After
public void tearDown() throws Exception {
File f = new File(tmpFilename);
if (f.exists())
if (!f.delete())
throw new IOException("Can't delete cache file after testing\n");
f = null;
} | 2 |
public boolean validPosition(Position position) {
return position != null && squares.get(position) != null;
} | 1 |
public static int compare(String s, String s1) {
if ((s.length() - s1.length()) != 0) {
return s.length() - s1.length();
}
byte b[] = s.getBytes();
byte b1[] = s1.getBytes();
for (int i = 0; i < b.length; i++) {
if ((b[i] - b1[i]) != 0) {
return b[i] - b1[i];
}
}
return 0;
} | 3 |
public void testDelegatedMethods() {
DateTimeField fieldOne = UnsupportedDateTimeField.getInstance(
dateTimeFieldTypeOne, UnsupportedDurationField
.getInstance(weeks));
PreciseDurationField hoursDuration = new PreciseDurationField(
DurationFieldTyp... | 8 |
public boolean isBreakableLine(int lineNumber) {
return sourceLines.get(lineNumber).isPossibleBreakpoint();
} | 0 |
public int rechercherPoste(Position position){
int i = 0 ;
int indice = -1 ;
while(i < postes.size() && indice == -1){
if(position.equals(postes.get(i).getPosition())){
indice = i ;
}
else {
i++ ;
}
}
return indice ;
} | 3 |
public static Fraction parseExpression(List<Fraction> fracArray, List<String> opString) {
Fraction newFraction = null;
List<String> precedence = new ArrayList<String>();
List<Integer> precLoc = new ArrayList<Integer>();
for(int i = 0; i < opString.size(); i++) {
if(opString.get(i).equals("*") || opString.get... | 9 |
public static ArrayList<Customer> getAll(){
SQLiteJDBC db = new SQLiteJDBC();
ArrayList<Customer> customers = new ArrayList<Customer>();
String sql = "SELECT * FROM customers";
ResultSet resultSet = db.query(sql);
try {
while(res... | 2 |
@Override
public double[] computeValue(char refBase, FastaWindow window, AlignmentColumn col) {
values[major] = 0.0;
values[minor] = 0.0;
int maxQualMajor = 0;
int maxQualMinor = 0;
if (col.getDepth() > 0) {
calculateAlleles(col.getBases(), col.getDepth(), ref... | 8 |
public void CellFit(final float w, final float h, final String txt, final Borders border, final Position ln,
final Alignment align, final boolean fill, final int link, final ScaleMode scale, final boolean force)
throws IOException {
// Get string width
float str_width = this.getStringWidth(txt);
// Calcula... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ChartItem other = (ChartItem) obj;
if (id != other.id)
return false;
if (point == null) {
if (other.point != null)
return false;
} ... | 8 |
public float getTotalRotation(float userRotation) {
float totalRotation = getPageRotation() + userRotation;
// correct to keep in rotation in 360 range.
totalRotation %= 360;
if (totalRotation < 0)
totalRotation += 360;
// If they calculated the degrees from radian... | 9 |
public byte[] getGraph(String dot_source, String type)
{
File dot;
byte[] img_stream = null;
try {
dot = writeDotSourceToFile(dot_source);
if (dot != null)
{
img_stream = get_img_stream(dot, type);
if (dot.delete() == false)
Sys... | 3 |
@EventHandler
public void onInteract(PlayerInteractEvent e){
Player p = e.getPlayer();
// If it was right clicked, in air, or on a block and is an iron chestplate...open the menu!
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)
if(p.getItemInHand().getType() == Materia... | 6 |
protected String encodeJsonString(CharSequence str){
StringBuilder buf = new StringBuilder();
int len = str.length();
for (int i = 0; i < len; i++) {
char c = str.charAt(i);
switch(c)
{
case '"':
buf.append('\\').append('"');
break;
case '\\':
buf.append('\\').append('\\');
break;
... | 9 |
public void readInputDataFromExcel(String excelPath, int answerColNumber) {
ExcelReader reader = new ExcelReader();
reader.loadFile(excelPath);
datas = reader.readData();
for (List<Double> row : datas) {
answers.add(row.get(answerColNumber - 1));
row.remove(answer... | 1 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Contact other = (Contact) obj;
if (firstname == null) {
if (other.firstname != null)
return false;
} else if (!firstname.equals(other.fi... | 9 |
@Override
public Polinome parsePolinome(String input) {
Polinome polinom = new Polinome();
String[] negativeGroups = input.split("[-]");
List<String> monoms = new ArrayList<String>();
int index = 0;
Integer exponent;
Integer coeficient;
for (String g : negativeGroups) {
... | 7 |
public void setPreset(int preset) throws UnsupportedOptionsException {
if (preset < 0 || preset > 9)
throw new UnsupportedOptionsException(
"Unsupported preset: " + preset);
lc = LC_DEFAULT;
lp = LP_DEFAULT;
pb = PB_DEFAULT;
dictSize = presetToDic... | 6 |
@Override
protected final String getCommand() {
Scanner inFile = new Scanner(System.in);
String command;
boolean valid = false;
do {
command = inFile.nextLine(); //gets input
command = command.trim().toUpperCase(); //changes it to uppercase
... | 6 |
public void toggleDataSetSelected(int index)
{
// Itereer door dataset/category/subcategory
for (DataSet set: this.datasets)
{
if (set.id == index)
{
// toggle alles hieronder
for (Category cat: set.categories)
{
for (SubCategory scat: cat.subcategories)
... | 9 |
public void resume() {
if (this instanceof Main) {
if (((Main) this).stateType != InputState.PAUSED)
if (music != null)
music.fadeIn(music.prevVolume);
} else if (music != null)
music.fadeIn(music.prevVolume);
} | 4 |
private Object[][] createItemsToCollect(int currentLevel) {
switch (currentLevel) {
case 3:
Object[][] level_3 = {{1}, {"Gem", 0, 2}};
return level_3;
case 4:
Object[][] level_4 = {{2}, {"Gem", 0, 1}, {"Money", 0, 1}};
retu... | 8 |
final Interface18_Impl3 method3587(byte i, int i_0_) {
anInt4529++;
Object object = aClass60_4531.method583((long) i_0_, 107);
if (object != null)
return (Interface18_Impl3) object;
if (!aD4528.method4(-7953, i_0_))
return null;
if (i > -30)
anInt4532 = 37;
TextureDefinition class12 = aD4528.getTex... | 8 |
private void listMemberMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listMemberMouseClicked
try
{
try
{
int select = listMember.getSelectedIndex();
listMember.setSelectedIndex(select);
String tempFirst = arrayFirst... | 5 |
public NoMobility() {
super(false);
if(firstTime && Configuration.mobility && Configuration.showOptimizationHints) {
Main.warning("At least some nodes use the '"+ this.getClass().getSimpleName() + "' mobility model. " +
"If you do not consider mobility at all in your project, you can " +
... | 3 |
@Override
public void fill(Parameter parameter, Type type, Annotation[] annotations)
{
for (Annotation annotation : annotations)
{
if (annotation instanceof Label)
{
// override when using explicit label
parameter.offer(Properties.VALUE_LAB... | 3 |
private ArrayList<String> findAndupdateReceivers(ArrayList<ReplyToLink> receivers, double currentCommentNumber){
ArrayList<String> receiverNames = new ArrayList<String>();
ArrayList<Integer> commentNumberIndexes = new ArrayList<Integer>();
for (ReplyToLink ppLink : receivers) {
if(ppLink.type.equals("Number"))... | 9 |
@Override
public void collidedWith(Entity other) {
//if collides with food add new tail segments
if (other instanceof FoodEntity) {
for(int i=0; i < 6; i++){
SnakeTailEntity tailSeg = new SnakeTailEntity("snakeclone/Res/BlueSnakeBody.gif", this);
entities.addLivingEntity(tailSeg);
snakeTail.add(... | 3 |
public boolean equals(Object obj) {
if (!(obj instanceof ImageObject))
return false;
ImageObject that = (ImageObject) obj;
return this.topLeft.equals(that.topLeft) &&
this.width == that.width && this.height == that.height &&
this.imageID == that.imageID;
} | 4 |
private void requestPro(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String view = null;
CommandAction com = null;
try {
String command = request.getRequestURI();
if ( command.indexOf(request.getContextPath()) == 0 ) {
command = command.substring(reque... | 5 |
public void moveEntity() throws Exception{
if (this instanceof Mob && !((Mob)this).getMovable())return;
if(moveStrategy != null) {
Vector2f velocity = moveStrategy.move(this);
this.setPosition(Vector2f.add(this.getPosition(), velocity));
}
else {
throw... | 3 |
public static final StdImageSet getOrLoad(String name) {
StdImageSet set = SETS.get(name);
if (set == null) {
List<StdImage> images = new ArrayList<>();
for (int size : STD_SIZES) {
StdImage img = StdImage.get(name + "_" + size); //$NON-NLS-1$
if (img != null) {
images.add(img);
}
}
if ... | 4 |
public static String saveObjectFile(Object content, String description,
String extension)
{
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileFilter(new FileNameExtensionFilter(description,
extension));
String path = "";
try
{
if (fileChooser.showSaveDialog(null) == JFileChooser.APPROVE... | 6 |
public static void main(final String[] args) throws Exception {
int i = 0;
int flags = ClassReader.SKIP_DEBUG;
boolean ok = true;
if (args.length < 1 || args.length > 2) {
ok = false;
}
if (ok && "-debug".equals(args[0])) {
i = 1;
flag... | 9 |
private String tipoResultante(Elem opA, Elem opB, String operador) {
boolean real, entero;
if(operador.equals("+") || operador.equals("-") || operador.equals("*") || operador.equals("/")) {
real = opA.getTipo().equals("float") || opB.getTipo().equals("float");
entero = opA.getTipo().equals("integ... | 8 |
public static void delete(Node node){
synchronized(node){
Node previous = node.getPrevious();
Node next = node.getNext();
if (previous!=null && next!=null){
synchronized(previous){
synchronized(next){
next.setPrevious(previous);
previous.setNext(next);
}
}
} ... | 3 |
public static void closeResultSet(ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
throw new RuntimeException(e.getSQLState()
+ "\nCaused by\n"
+ e.getCause(), e);
}
}
} | 2 |
private void drawBoard(Graphics g)
{
g.setColor(Color.white);
g.fillRect(0,0,VWIDTH,VHEIGHT);
g.setClip(0,0,VWIDTH,VHEIGHT);
// Max board size = 8 * VWIDTH
cut = vleft;
g.drawImage(bkgnd, -cut, 0, this);
g.drawImage(bkgnd, VWIDTH*2-cut, 0, this);
g.drawImage(bkgnd, VWIDTH*4-cut, 0, this);
g.dr... | 5 |
@Override
public void run() {
try {
for (FakeMob mob : this.plugin.getMobs()) {
if (!mob.isPlayerLook()) continue;
List<Player> players = mob.getNearbyPlayers(5D);
for (Player p : players)
mob.sendLookPacket(p, p.getLocation());
}
} catch (Exception e) {
//Do Nothing
}
} | 4 |
public int livingNeighbors(Grid grid){
int result = 0;
for(int i = -1; i <= 1; i++){
if(x + i < 0) continue; // the cell belongs to the first row
if(x + i >= Game.NumberOfCells) break; // the cell belongs to the last row
for(int j = -1; j <= 1; j++){
if(j == 0 && i == 0) continue; // there's... | 9 |
final public Value UpdateValue() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) {
case INT_LITERAL:{
jj_consume_token(INT_LITERAL);
{if ("" != null) return new Value(Integer.parseInt(token.image));}
break;
}
case FLOATING_POINT_LITERAL:{
jj_consume_token(FLOATING_POI... | 9 |
@Override
public XValue invoke(XRuntime runtime, XExec exec, int id, XValue thiz, XValue[] params, List<XValue> list, Map<String, XValue> map){
XObjectDataList l = (XObjectDataList)runtime.getObject(thiz).getData();
switch(id){
case 0:
return getIndex(l, params[0]);
case 1:
return length(l);
case 2:
... | 6 |
public void render(LinkedList<VoxelGrid> voxels, LinkedList<Entity> entities) {
int x = view.x;
int y = view.y;
int width = view.width;
int height = view.height;
Graphics2D g = (Graphics2D) buffer.getGraphics();
/* erase the image */
g.setColor(BACKGROUND);
g.fillRect(0, 0, width, height);
/* draw ... | 7 |
public void go(String[] argv) throws Exception {
int port = PORT_NUMBER;
if (argv.length > 0) { // Override default listen port
port = Integer.parseInt(argv[0]);
}
System.out.println("Listening on port " + port);
// Allocate an unbound server socket channel
ServerSocketChannel serverChannel = ServerSocke... | 6 |
@Test
public void NumberPlayerWinAndLosess() throws Throwable {
// create new game
model.newGame();
// player win 5 times
for(int i=0 ; i<5; i++)
{
model.newRound();
int betsGame=2;
model.setbets(betsGame);
// set the value of cards for the dealer and player
TestsHelper.AddCardsToPlayer(TestsHelp... | 4 |
public void run() {
while (eventList.size() > 0)
// Make a copy so you're not modifying the list
// while you're selecting the elements in it:
for (Event e : new ArrayList<Event>(eventList))
if (e.ready()) {
System.out.println(e);
e.action();
eventList.remove(e);
}
} | 3 |
public void onStatStateChanged(Stat stat) {
if (stat.isNormalState())
sendMail(normalMessage(stat), false);
else
sendMail(errorMessage(stat), true);
} | 1 |
public static void g() throws Exception {
try {
f();
} catch (Exception e) {
System.out.println("Inside g(),e.printStackTrace()");
e.printStackTrace(System.out);
throw e;
}
} | 1 |
public void lookUpPlayerWarns(String toPlayer, CommandSender sender) {
try {
//Bukkit.broadcastMessage("Test3: " + dataFolder.getPath());
BufferedReader br = new BufferedReader(new FileReader(warnLog));
String line;
String[] line2;
int q = 1;
while ((line = br.readLine()) != null) {
line2 = l... | 3 |
@Override
public int[] getAttributes() {
Random r = new Random();
int[] local = {0, 0, 0, 0, 0, 0};
for (int i = 0; i < 6; i++) {
int[] rolls = {0, 0, 0, 0};
for (int k = 0; k < 4; k++) {
int roll = 1;
do {
roll = r.... | 4 |
public void sink(int k) {
while (2 * k <= N) {
int j = 2 * k;
if (j < N && isGreater(j, j + 1))
j++;
if (isGreater(j, k))
break;
swapArrayValues(j, k);
k = j;
this.comparisions += 2;
}
} | 4 |
public List<Topic> getAllChildrenTopics(int parentId) {
List<Topic> list = new LinkedList<>();
Connection connection = ConnectionManager.getConnection();
if (connection == null) {
logger.log(Level.SEVERE, "Couln't establish a connection to database");
return list;
... | 3 |
@Override
public DefaultInferenceParameters toDefaultInferenceParameters(CycAccess cyc) {
if (this.getCycAccess() == cyc) {
return this;
} else {
DefaultInferenceParameters copy = new DefaultInferenceParameters(cycAccess);
Iterator<CycSymbol> iterator = this.keySet().iterator();
while ... | 2 |
public void run(LessCompiler compiler) {
lfs.setStatus(LessFileStatus.PROCESSING);
try {
compiler.setEncoding(charset);
compiler.setCompress(minify);
compiler.init();
compiler.compile(lfs.getFrom(), lfs.getTo(), true);
lfs.setStatus(LessFileStatus.UP_TO_DATE);
} catch (IOException e) {
lfs.setEr... | 2 |
public static void main(String[] args) {
String ข้อความ = "สวัสดี";
System.out.println(ข้อความ);
} | 0 |
public boolean contains(final AbstractInsnNode insn) {
AbstractInsnNode i = first;
while (i != null && i != insn) {
i = i.next;
}
return i != null;
} | 2 |
private boolean compareRoles(List<String> firstModelRoles, List<String> secondModelRoles) {
int firstContainsSecondDoesNotCount = 0;
int secondContainsFirstDoesNotCount = 0;
for (String firstModelRole : firstModelRoles) {
if (!secondModelRoles.contains(firstModelRole)) {
... | 8 |
private void assignGroups(int counter)
{
if (counter >= 12 && counter <= 16)
{
System.out.println("Assigning teams to groups!....");
try
{
teammgr.assignRandomGroups();
}
catch (Exception e)
{
Sy... | 4 |
public boolean addAdmin(User invoker, User adminToAdd) {
if (!invoker.hasPermission(Permissions.ADD_ADMIN)) return false;
administrators.add(adminToAdd);
save();
return true;
} | 1 |
public void terminate ()
{
if (!terminating && encoder != null && encoder.has_data ())
{
terminating = true;
return;
}
unplug ();
destroy ();
} | 3 |
public void ObtainPHPFileFunctions(DatabaseAccess JavaDBAccess, String TargetPHPFileSelected) {
int TARGET_PHP_FILES_ID = 0, VariableLocation = 0, StartCharTargetLine = 0, EndCharTargetLine = 0, StartTargetLine = 0, EndTargetLine = 0;
PreparedStatement ps = null;
String PHPFileText = "", PHPFil... | 6 |
public void trySetGroupColumns() {
project.demographic_columns.clear();
project.election_columns.clear();
project.election_columns_2.clear();
project.election_columns_3.clear();
project.substitute_columns.clear();
try {
setDemographicColumns();
setElectionColumns();
setElectionColumns2();
set... | 8 |
protected boolean parseArgs(String[] args)
{
boolean parsed = false;
if (args.length == 1)
{
init(args[0]);
parsed = true;
remote = false;
}
else if (args.length == 2)
{
if (!(args[0].equals("-url")))
{
showUsage();
}
else
{
init(args[1]);
parsed = true;
remote = tru... | 3 |
public static void main(String[] args) {
int x = 1;
switch (x) {
// int y;
case 1:
int a;
System.out.println(0);
break;
case 2: {
int b;
System.err.println(1);
break;
}
default:
System.err.println(2);
}
} | 2 |
public boolean hasNode(String[] url , int n){
if(url.length - 1 == n){
for(UrlNode childNode : childNodes){
if(childNode.selfUrl.equals(url[n])){
return true ;
}
}
return false ;
}else{
for(UrlNode node : childNodes){
if( node.hasNode(url, n+1))
return true ;
}
}
return ... | 5 |
public Neuron(Function function) {
this._function = function;
} | 0 |
public static List<Movie> readData(String filename) {
Map<String, Integer> map = getMovieType();
File file = new File(filename);
List<Movie> list = new ArrayList<Movie>();
try {
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
String line = null;
String[] strs = null... | 6 |
public DataSource(String URL, String username, String password) {
try {
Class.forName(DRIVERNAME);
con = DriverManager.getConnection(URL, username, password);
stmt = con.createStatement();
} catch (SQLException e) {
System.out.println("Cannot connect to database.");
isConnected = false;
} catch (Cl... | 2 |
public Ticket in(Car car) {
return strategy.in(car, getParkList());
} | 0 |
private int aslL(int dest, int n) {
clearFlags(SR_N, SR_Z, SR_V, SR_C);
boolean hibitSet = msbSetL(dest);
boolean hasOverflow = false;
int result = dest;
boolean msbSet;
for (int i = 0; i < n; i++) {
msbSet = msbSetL(result);
if (msbSet) setFlags(SR_X, SR_C);
else clearFlags(SR... | 9 |
public static synchronized Unsafe get() {
if (unsafe == null && !failed) {
for (Field field : UNSAFE_CLASS.getDeclaredFields()) {
if (!field.getType().equals(UNSAFE_CLASS) || !Modifier
.isStatic(field.getModifiers())) {
continue;
... | 7 |
public void setupAudio (WaveData waveData) {
try {
// If the audio is already setup then close it
if (audioReady==true) {
closeAudio();
return;
}
sampleCounter=0;
// If it is running stop the audio so it can be changed
audioMixer.stopAudio();
// Sample according to th... | 3 |
private void func_160_a(EntityPainting var1, float var2, float var3) {
int var4 = MathHelper.floor_double(var1.posX);
int var5 = MathHelper.floor_double(var1.posY + (double)(var3 / 16.0F));
int var6 = MathHelper.floor_double(var1.posZ);
if(var1.direction == 0) {
var4 = MathHelper.floor_... | 4 |
public boolean isValidBST(TreeNode root) {
if (root == null)
return true;
List<Integer> list = new ArrayList<Integer>();
toArray(root, list);
for (int i = 0; i < list.size() - 1; i++) {
if (list.get(i) >= list.get(i + 1))
return false;
}
... | 3 |
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
} | 0 |
public static ApplicationDescriptor generateApplication(ApplicationDescriptor appDesc, int numVs){
ApplicationDescriptor appGenerated = null;
try {
Collection<OVFVirtualNetwork> virtNets = new ArrayList<OVFVirtualNetwork>();
Collection<SharedDisk> sharedDisks = new ArrayList<SharedDisk>();
Collection<Disk>... | 8 |
private void addLayers(Element parent, Layers layers) /*throws XMLStreamException*/ {
if (layers == null || layers.getSize() == 0)
return;
//Check if there are non-empty layers
boolean foundNonEmptyLayer = false;
for (int i=0; i<layers.getSize(); i++) {
if (layers.getLayer(i).getSize() != 0)
{
f... | 7 |
public static void main(String[] args){
Scanner in = new Scanner(System.in);
PA pa = new PA();
int n = in.nextInt();
Point[] lap = new Point[n];
for(int i=0;i<n;i++){
lap[i]=pa.new Point(in.nextInt(), in.nextInt());
}
Arrays.sort(lap);
String ret = "Poor Alex";
for(int i=0;i<n-... | 3 |
@Override
public void determineBufferSizes() {
super.determineBufferSizes();
groupVertexBufferSize += this.vertexBufferSize;
groupTextureCoordsBufferSize += this.textureCoordsBufferSize;
groupColorBufferSize += this.colorBufferSize;
for (GUIComponent component : subComponen... | 2 |
public int numDistinct(String S, String T) {
// Start typing your Java solution below
// DO NOT write main() function
if (S.length() == 0 || S.length() < T.length()) {
return 0;
}
if (T.length() == 0) {
return 1;
}
int[][] dp = new int[S.length() + 1][T.length() + 1];
for (int j = 0; j <= T.length... | 8 |
public NanoPostPanel(NanoPost np, NBFrame nbf) {
this.np = np;
this.nbf = nbf;
initComponents();
this.panPostText.setText(HtmlUtils.markdownToHtml(HtmlUtils.stripHtmlTags(np.getPostText())).replaceAll("\n", "<br>"));
this.lblPostHeader.setText(np.toString());
if (np.ge... | 2 |
public String convert(String s, int nRows) {
if (nRows <= 1) {
return s;
} else {
int dis = (nRows - 1) * 2;
int length = s.length();
int index = 0;
char[] result = new char[length];
for (int row = 0; row < nRows; row++) {
... | 7 |
private void createTabButtonActionPerformed(java.awt.event.ActionEvent evt, JComponent newclass, String name, Icon icon) {
System.out.println("Add new tab!");
//tabCount++;
//JScrollPane scrollPane = new JScrollPane(new GroupsGrid());
if(ic... | 1 |
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.