text stringlengths 14 410k | label int32 0 9 |
|---|---|
static final String encode(final String s) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '\\') {
sb.append("\\\\");
} else if (c < 0x20 || c > 0x7f) {
sb.append("\\u");
... | 7 |
public void run(){
Polygon poly = new Polygon();
System.out.println("Inside the Thread");
for(int i = 0; i < points.length; i++){
poly.add(new Point(points[i]));
//System.out.println("Point #" + i + "out of " + points.length);
}
poly.setColor(org.jzy3d.colors.Color.BLUE);
Syst... | 1 |
public static void decompress(bitReader br, bmpWriter out) {
try {
System.out.print("Decompressing file... ");
long initTime = System.currentTimeMillis();
int width = out.getWidth();
int height = out.getHeight();
byte[] filters = readFilters(br, width, height, filterZoneDim);
... | 8 |
public LoggingInterceptor(){
} | 0 |
@Override
protected Object doInBackground() throws Exception {
System.out.println("================ Running thread =============");
String prevString = "";
while(true){
Thread.sleep(10000);
String urlString = "http://localhost:8080/WebServer/UserListFetcher";
URL url;
String ... | 5 |
public static void main(String[] args) throws Exception {
OrderService orderSystem = new OrderSystem();
orderSystem.add(OrderLedger.getInstance());
String userAuthToken = "tom@example.com";
String searchString = "";
int timeDelay = 0;
DataInputStream dataInputStream = new... | 5 |
public static void main(String arg[]) {
Connection conn = null;
Statement stmt = null;
try {
// STEP 2: Register JDBC driver
Class.forName("com.mysql.jdbc.Driver");
// STEP 3: Open a connection
System.out.println("Connecting to database...");
conn = DriverManager.getConnection(DB_URL, USER, PASS)... | 7 |
public double[] convolve_cols_gauss(double[] h,double[] mask)
{
long j, r, c, l;
double sum;
double[] k;
int n;
n=(int) ((mask.length-1)*0.5);
k=new double[(int) (width*height)];
// Inner region
for (r=0; r<height; r++) {
for (c=n; c<width-n; c++) {
l = LINCOOR(... | 9 |
public void dosomething() {
System.out.println("功能A");
} | 0 |
private void saveAndCloseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAndCloseButtonActionPerformed
// TODO add your handling code here:
matchReader read = new matchReader();
ArrayList<MatchObject> matches = null;
try {
matche... | 8 |
@Override
public void parseCommandLine(CommandLine line)
{
if ( line.hasOption("ftpserver") )
{
setDomain(line.getOptionValue("ftpserver"));
}
if ( line.hasOption("ftpuser") )
{
setUsername(line.getOptionValue("ftpuser"));
}
if ( line.hasOption("ftppassword") )
{
setPassword(line.getOpt... | 6 |
public void actualizaMarcador(String cod_Competicao, HashMap<String, Integer> Jogadores1, HashMap<String, Integer> Jogadores2)
{
try {
Statement stm = conn.createStatement();
Set set = Jogadores1.keySet();
Iterator iter = set.iterator();
while (i... | 3 |
public float getTextureWidth() {
if(texture != null) {
return (float)texture.getTextureWidth();
}
else {
System.err.print("RoyalFlush: Texture2D.getTextureWidth - No texture has been loaded.\n");
return -1.0f;
}
} | 1 |
public static long getLongValue(String value) {
if(value != null) {
try {
return Long.parseLong(value);
} catch(NumberFormatException exception) {}
}
throw new IllegalArgumentException("Invalid value");
} | 2 |
public void doPost(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
String str1 = "";
//
str1=request.getParameter("opiton");
System.out.println("option is"+str1);
Connection conn;
Statement stmt;
PrintWriter out=response.getWriter();
response.setContentType("te... | 2 |
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRe... | 5 |
private boolean isConflictWith(long startTime, long endTime, int frequency,
long lastDay) {
// day span
long startDay1 = DateUtil.getStartOfDay(this.startTime);
long startDay2 = DateUtil.getStartOfDay(startTime);
long endDay1 = this.lastDay;
long endDay2 = lastDay;
if (endDay2 < startDay1 || endDay1 < s... | 9 |
public void kill() {
try {
// kill receiving thread and wait for it to close out
if (username!= null) {
try {
exitComplete.setValue(false);
makeRequest("exit "+username).join();
timeout(exitComplete, timeoutLength, "Exiting");
} catch (InterruptedException e) {
e.printStackTrace();
... | 4 |
@Override
public boolean shouldKeepAlive(int i, int j) {
return (getCell(i, j).isAlive())
&& (numberOfNeighborhoodAliveCells(i, j) == 2 || numberOfNeighborhoodAliveCells(i, j) == 3);
} | 2 |
public AnnotationVisitor visitParameterAnnotation(final int parameter,
final String desc, final boolean visible) {
cp.newUTF8(desc);
if (visible) {
cp.newUTF8("RuntimeVisibleParameterAnnotations");
} else {
cp.newUTF8("RuntimeInvisibleParameterAnnotations");
}
return new AnnotationConstantsCollector(... | 1 |
@Override
public void cast(Player p) {
if (super.attemptCast(p)) {
p.setVelocity(p.getLocation().getDirection().multiply(3.45).setY(1.35));
p.setFallDistance(0);
exempt.add(p.getName());
}
} | 1 |
public void addAchievementToDB() {
try {
String statement = new String("INSERT INTO " + DBTable
+ " (type, name, url, description, threshold)"
+ " VALUES (?, ?, ?, ?, ?)");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement, new String[] {"aid"});
stmt.setInt(1, type);
stmt.s... | 1 |
private void generateSelectExpression(MySqlSelectQueryBlock stmt, MVContext context) {
List<SQLSelectItem> selectList = stmt.getSelectList();
if(selectList != null && selectList.size() > 0) {
String sql = "insert into mview_expression(type, mview_id, expression, expr_order) values('select', ... | 5 |
public void setClobField(Clob clobField) {
this.clobField = clobField;
BufferedReader reader = null;
try {
reader = new BufferedReader(clobField.getCharacterStream());
setClobData(reader.readLine());
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} f... | 4 |
private void addControlPanel(){
controlPanel = new JPanel();
FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT);
controlPanel.setLayout(flowLayout);
controlPanel.setPreferredSize(new Dimension(frameWidth, controlPanelHeight));
controlPanel.setMinimumSize(new Dimension(frameWidth, controlPanelHeight));
... | 4 |
public static String tableSchemaFromMetaData(
ResultSetMetaData rsMetaData) throws SQLException {
final StringBuilder createQuery = new StringBuilder();
for (int i = 1; i <= rsMetaData.getColumnCount(); i++) {
if (i != 1) {
createQuery.append(",");
}... | 6 |
@Test(groups = { "Integer-Sorting", "Fast Sort" })
public void testRadixSortInt() {
Reporter.log("[ ** Radix Sort ** ]\n");
try {
RadixSort testRadix = new RadixSort(
fastShuffledArrayInt.clone());
Reporter.log("1. Unsorted Random Array : ");
timeKeeper = System.currentTimeMillis();
testRadix.... | 4 |
private static boolean isValidKnightMove(Board b, Move m, int opponentColor) {
try {
if (b.spaceIsEmpty(m.end) || b.spaceHasOpponent(m.end, opponentColor)) {
return true;
}
return false;
} catch (IndexOutOfBoundsException e) {
// Since we're not checking bounds before passing the possible move
//... | 3 |
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 analyzeCode(MethodIdentifier methodIdent, BytecodeInfo bytecode) {
this.bytecode = bytecode;
TodoQueue modifiedQueue = new TodoQueue();
MethodInfo minfo = bytecode.getMethodInfo();
for (Iterator iter = bytecode.getInstructions().iterator(); iter
.hasNext();) {
Instruction instr = (Instructio... | 8 |
private void delimit ()
{
if (state == State.active) {
state = State.delimited;
return;
}
if (state == State.pending) {
outpipe = null;
send_pipe_term_ack (peer);
state = State.terminating;
return;
}
// Delimiter in any other state is in... | 2 |
private static void addParameter(INIFile file, String line, INISection section){
String[] data = line.split("=");
String name = data[0];
String value = data[1];
INIParameterType type = INIParameterType.UNKNOWN;
if(StringParser.isBoolean(value)){
type = INIParamete... | 5 |
@Override
public void rotate(int angle)
{
super.rotate(angle, center);
setColoredExes();
} | 0 |
public static int encryptPlayerChat(byte[] is, int i_25_, int i_26_, int i_27_, byte[] is_28_) {
try {
i_27_ += i_25_;
int i_29_ = 0;
int i_30_ = i_26_ << -2116795453;
for (; i_27_ > i_25_; i_25_++) {
int i_31_ = 0xff & is_28_[i_25_];
int i_32_ = anIntArray233[i_31_];
int i_33_ = aByteArray235... | 6 |
public static String decodeUTF8(String s) {
if (s == null)
return "";
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
switch (c) {
case '+':
sb.append(' ');
break;
case '%':
try {
// 将16进制的数转化为十进制
sb.append((char) Integer.par... | 6 |
private void addToList(Class<?> c, Listener l){
if(map.containsKey(c)){
if(map.get(c)!= null){
if(!map.get(c).contains(l)){
map.get(c).add(l);
}
}
}
} | 4 |
protected void checkType() {
for (int x = 0; x < getWidth(); x++) {
for (int y = 0; y < getHeight(); y++) {
double r = red.getPixel(x, y);
double g = green.getPixel(x, y);
double b = blue.getPixel(x, y);
if (r != g || r != b || g != b) {
type = ImageType.COLOR;
return;
}
}
}
ty... | 5 |
public MemoryNode construirKDTree(ArrayList<double[]> puntos, int splitAxis) throws IOException{
if (puntos.size() == 1) {
return new MemoryNode(puntos.get(0)[0] , puntos.get(0)[1], 'y', -1, -1);
}
// generar eje nuevo
double newSplitAxis = getSplitAxis(puntos, splitAxis);
// separar los puntos en dos grup... | 4 |
public void setInputParamReal(final int paramIndex, final Object array) throws IllegalArgumentException, NullPointerException {
if (array==null) throw new NullPointerException(ARRAY_IS_NULL);
InputParameterInfo param = getInputParameterInfo(paramIndex);
if ((param==null) || (param.type()!=InputP... | 5 |
private boolean haveIWonYet(){
for (int i = 2; i < 5; i++) {
for (int j = 2; j < 5; j++) {
Tile tile=null;
try {
tile = (Tile) target.board[i - 2][j - 2].clone();
} catch (CloneNotSupportedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tile.setX(t... | 9 |
public String getLongestItemName(){
String longest = "";
for(int i = 0; i < items.size(); i++){
if (items.get(i) == null){return longest;}
if (items.get(i).getName().length() > longest.length()){
longest = items.get(i).getName();
}
}
re... | 3 |
public boolean add(Usuarios u){
PreparedStatement ps;
try {
ps = mycon.prepareStatement("INSERT INTO Usuarios VALUES(?,?,?)");
ps.setString(1, u.getCodigo());
ps.setString(2, u.getNombre());
ps.setString(3, u.getDNI());
return (ps.executeUpdate... | 1 |
public static boolean isApplicable(Object object) {
return object instanceof Automaton;
} | 0 |
private static URL __getWsdlLocation() {
if (HELLOWWORLDIMPLSERVICE_EXCEPTION!= null) {
throw HELLOWWORLDIMPLSERVICE_EXCEPTION;
}
return HELLOWWORLDIMPLSERVICE_WSDL_LOCATION;
} | 1 |
public void heapify(int indeksi) {
int vasen = vasen(indeksi);
int oikea = oikea(indeksi);
int suurin;
if (oikea + 1 <= keko.size()) {
if (keko.get(vasen) > keko.get(oikea)) {
suurin = vasen;
} else {
suurin = oikea;
... | 5 |
public final void oper_list(SS_script script, SS_statement stat) throws RecognitionException {
ParserRuleReturnScope x =null;
ParserRuleReturnScope y =null;
try {
// SayScript.g:145:48: (x= oper[$script] ( COMMA y= oper[script] )* )
// SayScript.g:145:50: x= oper[$script] ( COMMA y= oper[script] )*
{
... | 8 |
public boolean setItemsCompra(String [][] data){
boolean ok= false;
String [][] nuevosItems= data;
try{
PreparedStatement pstm = this.getConexion().prepareStatement("");
for (int i=0; i<this.getItems().length; i++) {
String [] itemDB=this.getItems()[i];
... | 9 |
private void poistaTiedote(HttpServletRequest request,
HttpServletResponse response, TiedoteService service, String action)
throws IOException, ServletException {
// otetaan buttonin valuesta irti tiedotteen id
String id = action.substring(7);
try {
TiedoteForm validoitavaId = new TiedoteForm(i... | 2 |
public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3)
{
GL11.glPushMatrix();
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, EQUIPPED);
if (customRenderer != null)
{
GL11.glBindTexture(GL11.GL_TEXTURE_... | 8 |
public void setChallenge(byte[] challenge) {
this.challenge = challenge;
if (needAuth() && (getDigest() == null || getDigest().length == 0)) {
digest();
}
} | 3 |
static Event makeEvent(GreenhouseControls gc, Map.Entry<String, Long> me) {
String key = me.getKey();
Long value = me.getValue();
if(key.equals("Bell")) {
return new BellFactory().getEvent(gc, value);
} else if(key.equals("LightOn")) {
return new LightOnFactory().... | 7 |
public void setNum(long num) {
this.num = num;
} | 0 |
public Unit(String id, int spawnX, int spawnY){
ID = id;
x = spawnX;
y = spawnY;
} | 0 |
@Override
public void mouseDragged(MouseEvent event) {
if (mDragColumnDivider != -1) {
Point where = event.getPoint();
mViewArea.convertPoint(this, where);
dragColumnDividerAndScrollIntoView(where);
}
} | 1 |
@Override
public MyGraph readCSVFile(String filename) {
BufferedReader CSVFile = null;
try {
CSVFile = new BufferedReader(new FileReader(filename));
} catch(FileNotFoundException e1) {
System.err.println(e1.getMessage());
}
g = new MyGraph();
try {
String dataRow = CSVFile.readLine();
whil... | 5 |
private void drawSprites(Graphics2D bufferGraphics) {
int xDraw = getVirtualX(model.getPlayerX() - SPRITE_SIZE/2);
int yDraw = getVirtualY(model.getPlayerY() - SPRITE_SIZE);
model.canChat = false;
if (xDraw >= 0-SPRITE_SIZE && xDraw <= width && yDraw >= 0-SPRITE_SIZE && yDraw <= height)
bufferGraphics.... | 9 |
static void estimationCal(String[] hashRecord,File segFile,int sampleNumPerSeg,Map<String, long[]> estimateBase ) throws FileNotFoundException {
/*
* Load the input file into the index,
* initialize the uniqueRecord,sampledRecord,hashRecord
* if sampled, compare it to the index:match? extract FP from th... | 9 |
public void startGame() {
if (playersInBoat() > 2) {
gameTimer = GAME_TIMER;
waitTimer = -1;
//spawn npcs
spawnNpcs();
//move players into game
for (int j = 0; j < Server.playerHandler.players.length; j++) {
if (Server.playerHandler.players[j] != null) {
if (Server.playerHandler.players[j]... | 7 |
@Override
public void paint(Graphics g)
{
g.setColor(this.getBackground());
g.fillRect(0, 0, this.getWidth(), this.getHeight());
Color colBorder1, colBorder2, colBack1, colBack2, colSlider, colSliderBorder;
if (this.isEnabled())
{
colBorder1 ... | 3 |
public static boolean isSingle(char c) {
return (c == '(' || c == ')' || c == '[' || c == ']' || c == ':'
|| c == ';' || c == ',' || c == '=');
} | 7 |
@Override
public boolean unload(Class<? extends Unloadable> clazz) {
for (Injectable i : getInjected()) {
if (i.getClass().getName().equalsIgnoreCase(clazz.getName())) {
if (i instanceof Unloadable) {
UnloadEvent ue = new UnloadEvent((Unloadable) i);
... | 9 |
public boolean setPlayer2(Player p2) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: setPlayer2() BEGIN");
}
m_player2 = p2;
if (test || m_test) {
System.out.println("GameBoardGraphics :: setPlayer2(... | 4 |
private void finishLeftDiagonal(int playerNumber) {
int i = 0;
int j = 0;
switch (playerNumber) {
case 1: {
while (i < gameField.getFieldSize()) {
if(!gameField.isFill(i,j)) {
gameField.putX(i,j);
b... | 6 |
public void renderLevelDetails(Graphics2D g2)
{
// GET THE CURRENT LEVEL
pathXLevel level = data.getLevel();
PropertiesManager props = PropertiesManager.getPropertiesManager();
g2.setFont(FONT_TEXT_DISPLAY);
HashMap<TextAttribute, Object> map = new HashMap<TextAttrib... | 7 |
public static String formatXML(String input) {
try {
Source xmlInput = new StreamSource( new StringReader(input) );
StringWriter stringWriter = new StringWriter();
StreamResult xmlOutput = new StreamResult(stringWriter);
TransformerFactory transformerFactory = Tra... | 1 |
double getAggregate( int aggType )
{
switch ( aggType )
{
case AGG_MINIMUM:
case AGG_MAXIMUM:
case AGG_AVERAGE:
case AGG_FIRST:
case AGG_LAST:
return values[0];
case AGG_TOTAL:
return (values[0] * values.length) ;
}
return Double.NaN;
} | 6 |
public static String selectUserType(){
Scanner scan = new Scanner(System.in);
do{
System.out.printf("\n***TIPOS DE USUARIO***\n1-%s\n2-%s\n3-%s\nEscoja uno: ",
ADMINISTRADOR, CONTENIDO, LIMITADO);
int opt = scan.nextInt();
switch(opt){
... | 4 |
private float calculateParsed(List<String> parsed) {
float result = 0;
while (parsed.size() > 1) {
for (int i = 0; i < parsed.size(); i++) {
String element = parsed.get(i);
if (isOperation(element)) {
result = performCalculations(parsed, el... | 3 |
@Override
public void update(GameContainer gc, StateBasedGame arg1, int delta)
throws SlickException {
if(firstRun) {
gc.getInput().isKeyPressed(Input.KEY_ENTER);//reset ENTER key state
firstRun = false;
}
if(battle.isOver()) {
if(gc.getInput().isKeyPressed(Input.KEY_ENTER)) {
selectedMove = -1;
... | 9 |
public String tempsToChrono(int temps){
String chrono = (temps - temps%60)/60 + ":";
if (temps%60 < 10){
chrono = chrono + "0" + temps%60;
}else
chrono = chrono + temps%60;
return chrono;
} | 1 |
public ArrayList<CellStringPair> findStrings(){
ArrayList<CellStringPair> result = new ArrayList<CellStringPair>();
int width = getWidth();
int height = getHeight();
for(int y = 0; y < height; y++){
for(int x = 0; x < width; x++){
if(!isBlank(x, y)){
Cell start = new Cell(x, y);
String str = St... | 8 |
public static void fizzbuzz(){
for (int i = 1; i <= 100; i++) {
switch (i % 15) {
case 0:
System.out.println("FizzBuzz");
break;
case 3:
case 6:
case 9:
case 12:
... | 8 |
public static int pieceValue(int piece, int square) {
if ((square & 0x88) != 0) return 0; // TODO: throw exception
int result = 0;
int pieceType = piece & 31;
switch (pieceType) {
case Position.ROOK:
result = 510;
break;
case Position.KNIGHT:
result = 300;
break;
case Position.BISHOP:
resu... | 9 |
private static void readInMessage(Core output, Document xml, String updateId) {
long source = Long.parseLong(xml.getElementsByTagName(SOURCE).item(HEAD).getTextContent());
long target = Long.parseLong(xml.getElementsByTagName(TARGET).item(HEAD).getTextContent());
String titulo = xml.getElementsB... | 2 |
private void write(BufferedWriter out) {
StringBuffer sb = new StringBuffer();
sb.append("db." + JSONWriter.COLLECTION_NAME + ".insert({");
sb.append("year: \"" + _year + "\"");
sb.append(", month: \"" + _month + "\"");
sb.append(", quarter: \"" + _quarter + "\"");
sb.append(", NSW: " + _ns... | 1 |
@SuppressWarnings("unchecked")
@Override
public String displayQuestionWithAnswer(int position, Object userAnswer) {
ArrayList<String> questionList = (ArrayList<String>) question;
String questionStr = questionList.get(0);
ArrayList<String> answerList = (ArrayList<String>) answer;
ArrayList<String> userAnswerLi... | 5 |
public void processButton(int programButton) {
if (programButton == 0 && currentThread.isAlive()) {
currentThread.interrupt();
}
if (!currentThread.isAlive()) {
switch (programButton) {
case 0:
currentThread = new WashingProgram0(mach... | 7 |
@EventHandler
public void onFurnaceSmelt(FurnaceSmeltEvent event) {
plugin.cancelEvent(event);
plugin.debugMessage(event);
plugin.godMode(event);
if (event.getSource().getType().equals(Material.SAND)) {
event.setResult(new ItemStack(Material.BONE, 2, (short) 0));
... | 2 |
public void set_point( int point, int tick, int ampl, boolean delta ) {
if( point >= 0 && point < ticks.length ) {
if( point == 0 ) {
tick = 0;
}
if( point > 0 ) {
if( delta ) tick += ticks[ point - 1 ];
if( tick <= ticks[ point - 1 ] ) {
System.out.println( "Envelope: Point not valid (" + t... | 7 |
public void show(){
for(T key : histogram.keySet()){
System.out.println(key + ": " + histogram.get(key));
}
} | 1 |
public static void DoRandomBotTurn(PlanetWars pw) {
Random random = new Random();
Planet source = null;
List<Planet> myPlanets = pw.MyPlanets();
//Randomly select source planet
if (myPlanets.size() > 0) {
Integer randomSource = random.nextInt(myPlanets.size());
source = myPlanets.get(randomSource);
... | 4 |
public Component getListComponentForDataSection(TaskObserver taskObserver, String dataSectionName, List list, Iterator indexIterator) throws InterruptedException
{
if (dataSectionName == DATA_SECTION_UNKNOWN0) { return getGeneralPanel(taskObserver); }
else if (dataSectionName == DATA_SECTION_VISIBLE... | 7 |
public void selectObject(MouseEvent evt) {
Object obj = window.getPetriNetGraph().getObjectPosition(evt.getX(), evt.getY());
if (obj != null) {
selectObj = obj;
if (selectObj instanceof PlaceUI) {
// window.placeAction.setSelectedPlace((PlaceGraph) selectObj);
// window.placeAction.enablePlaceInfo();
... | 9 |
public Sprite getBackground() {
return background;
} | 0 |
public static void main(String[] args) {
List<String> list = new ArrayList<String>(
Arrays.asList("cat", "dog", "horse")
);
System.out.println(list);
ListIterator<String> it = list.listIterator();
while (it.hasNext())
System.out.println(it.next());
System.out.println();
while (it.hasPre... | 3 |
public AirCreep(int id){
if (id > 0 && id < 4){
if (id == 1){
maxHp = 50;
armor = 10;
speed = 3f;
}else if (id == 2){
maxHp = 500;
armor = 15;
... | 5 |
public Rectangle getBoundingBox()
{
return recognizer.boundingBox;
} | 0 |
public final boolean matchesSub(Identifier ident, String name) {
if (ident instanceof PackageIdentifier)
return true;
if (ident instanceof ClassIdentifier) {
ClassIdentifier clazz = (ClassIdentifier) ident;
return (clazz.isSerializable() && (!onlySUID || clazz.hasSUID()));
}
return false;
} | 4 |
public void removeItem (final SoldItem soldItem){
StockItem stockItem = getItemById(soldItem.getId());
if(stockItem.getQuantity() < soldItem.getQuantity()) {
throw new IllegalArgumentException("invalid remove count: " + soldItem.getQuantity()
+ " | have: " + stockItem.getQuantity());
}
stockItem.setQuan... | 1 |
public ChatController() {
settings = Settings.getInstance();
participantList = ParticipantList.getInstance();
chatHistory = ChatHistory.getInstance();
chatCore = new ChatCore();
chatGui = new ChatGui();
trayView = new TrayView();
settingsGui = new SettingsGui();
chatGui.addChatGuiListener(this)... | 4 |
public int getType() {
return type;
} | 0 |
public void addComment(String fileName, String path, String... comments) {
if (isFileLoaded(fileName)) {
for (String comment : comments) {
if (!configs.get(fileName).contains(path)) {
configs.get(fileName).set("_COMMENT_" + comments.length, " " + comment);
}
}
}
} | 3 |
public vector2d better_avoid(ArrayList<Obstacle> obs, double waga, int dl) {
vector2d value = new vector2d(0, 0);
double min = Double.MAX_VALUE;
int minn = -1;
for (int i = 0; i < obs.size(); i++) {
double odl = this.getOdl(obs.get(i));//szukam najbliższej przeszkody
... | 9 |
public Point pixelChooser() {
// if (used == true) {
// used = false;
// right = true;
// a += 1;
// return lastPoint;
// }
if (right == true) {
if (lastPoint.x + 3 < c) {
newPoint = new Point(lastPoint.x + 3, lastPoint.y);
... | 8 |
protected String addMGameFeatures()
{
myMDisplay = new JTextField(10);
((JTextField)myMDisplay).addActionListener(new ActionListener()
{
public void actionPerformed (ActionEvent ev)
{
try
{
reset();
... | 4 |
private static IntJoukko mikaJoukko() {
String luettu;
Scanner lukija = new Scanner(System.in);
luettu = luku();
while (true) {
if (luettu.equals("A") || luettu.equals("a")) {
return A;
} else if (luettu.equals("B") || luettu.equals("b")) {
... | 7 |
boolean isAdherentStrikeout(TextStyle style) {
if (this == style)
return true;
if (style == null)
return false;
if (strikeout != style.strikeout)
return false;
if (strikeoutColor != null) {
if (!strikeoutColor.equals(style.strikeoutColor))
return false;
} else {
if (style.strikeoutColor != ... | 9 |
public static double WagnerFischer(String s, String t) {
int l1 = s.length(), l2 = t.length();
int[][] matrix = new int[l1 + 1][l2 + 1];
for (int row = 1; row < l1 + 1; row++)
matrix[row][0b00000000000000000000000000000000] = row;
for (int col = 1; col < l2 + 1; col++)
matrix[0][col] = col;
for (int j =... | 5 |
@Override
public Set<String> getEntities() {
return getList("entities");
} | 0 |
@Override
public void append(Framedata nextframe) throws Exception {
if (unmaskedpayload == null) {
unmaskedpayload = ByteBuffer.wrap(nextframe.getPayloadData());
} else {
ByteBuffer tmp = ByteBuffer
.allocate(nextframe.getPayloadData().length
+ unmaskedpayload.capacity());
tmp.put(unmaskedpay... | 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.