text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void save() {
final ColumnMapper mapper = getColumnMapper();
final ContentValues values = new ContentValues();
final Field[] fields = Reflection.getNonStaticDeclaredFields(getClass());
for (Field field : fields) {
if (!isMultiValued(field) && !isTransient(field)) {
values.put(field.getName(), map... | 5 |
public Endereco Abrir(int idEndereco){
try{
PreparedStatement comando = banco.
getConexao().prepareStatement("SELECT * FROM enderecos WHERE id =? AND ativo = 1");
comando.setInt(1, idEndereco);
ResultSet consulta = comando.executeQuery();
coman... | 2 |
protected int positionsTotal(Instrument instrument) throws JFException {
int counter = 0;
for (IOrder order : engine.getOrders(instrument))
if (order.getState() == IOrder.State.FILLED) counter++;
return counter;
} | 2 |
private boolean setDrawing(Drawing drawing) {
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: SetDrawing() BEGIN");
}
m_drawingControl = drawing;
if (test || m_test) {
System.out.println("GameWindow :: SetDrawing() END");
}
return true;
} | 4 |
public void updateLyricsPane(final Track t) {
if(!currentTrack.equals(t)) {
currentTrack = t;
new Thread() {
@Override
public void run() {
String artist = t.get("artist");
String title = t.get("title");
... | 7 |
private void generateLevel() {
doors = new ArrayList<>();
enemies = new ArrayList<>();
collisionPosStart = new ArrayList<>();
collisionPosEnd = new ArrayList<>();
medKits = new ArrayList<>();
ArrayList<Vertex> vertices = new ArrayList<>();
ArrayList<Integer> indi... | 7 |
public Set<Map.Entry<Float,Float>> entrySet() {
return new AbstractSet<Map.Entry<Float,Float>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TFloatFloatMapDecorator.this.isEmpty();
}
p... | 8 |
private Printer(){} | 0 |
private void rec(int as, int bs, int rets, int n){
if(n<=SMALL){
for(int i=0;i<2*n;++i) t[rets + i] = 0;
for(int i=0;i<n;++i)
for(int j=0;j<n;++j) t[rets + i+j] += t[as + i] * t[bs + j];
return;
}
int ar = as;
... | 7 |
public String toString() {
StringBuffer result;
int i;
int n;
boolean found;
result = new StringBuffer();
// title
result.append(this.getClass().getName().replaceAll(".*\\.", "") + "\n");
result.append(this.getClass().getName().replaceAll(".*\\.", "").replaceAll(".", "=") ... | 7 |
public JTextField getjTextFieldLieux() {
return jTextFieldLieux;
} | 0 |
public void render() {
bg.bind();
Molybdenum.GLQuad(0, 0, Display.getWidth(), Display.getHeight());
Molybdenum.setAwtColor(Color.WHITE);
Molybdenum.getText().drawStringS("Molybdenum | Properties", 16, 16, Text.LEFT, 3f,4);
Molybdenum.getText().drawStringS("Press enter to confirm a choice!", 64, 64, Text.LEF... | 9 |
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{
if(sender instanceof ConsoleCommandSender)
{
getLogger().info("Console cannot use this plugin.");
return true;
}
if(args.length == 0)
return true;
if(p.has(sender, cmd, Arrays.copyOfRange(args, 0, 1), fa... | 9 |
public String getName() {
return Name;
} | 0 |
@Override
public void performUseAction(Player user, UI ui) {
Location current = user.getCurrentLoc();
for (Item item : current.getItems())
{
if (item instanceof BasiliskItem)
{
current.removeItem(item);
ui.display("A giant duck swoops through a broken window, into the hall, and sings the \"quac... | 2 |
@EventHandler
public void GhastResistance(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Ghast.Resist... | 7 |
double gradCorrect(double g, double eta)
{
int nPos = sequence.length();
int y = sequence.getY(0);
double[] grad = new double[]{g};
updateU(grad, 0, y, 1, eta);
double sum = u[0][y];
for (int pos = 1; pos < nPos; ++pos)
{
int lasty = y;
... | 7 |
public EnigmaMachine(int r1, int r2, int r3, int pos1, int pos2, int pos3, String p1, String p2, String p3){
reflector = new Reflector();
if(pos1 < 26 && pos2 < 26 && pos3 < 26){
rotor1 = new Rotor(r1, pos1, null);
rotor2 = new Rotor(r2, pos2, rotor1);
rotor3 = new Rotor(r3, pos3, rotor2);
}
if(p1.l... | 6 |
public boolean suurempiKuin(Siirto toinen){
if (this.arvo > toinen.arvo){
return true;
} else if (this.arvo < toinen.arvo){
return false;
} else {
// jos siirroilla on sama arvo, priorisoidaan syntyneiden rivien mukaan
if (this.rivit > toinen.rivit... | 3 |
public void calculateLoS()
{
lineOfSight.reset();
int Xx;
int Yy;
int d;
int dr;
int dx;
int dy;
boolean yes;
int resolution = 18;
for (int i = 0; i < resolution; i++)
{
Xx = (int)world.x-world.viewX;
... | 5 |
private static void help() {
System.out.println("The allowed commands are:");
System.out.println(" n/north");
System.out.println(" s/south");
System.out.println(" e/east");
System.out.println(" w/west");
System.out.println(" h/help");
System.out.println(... | 0 |
public void preencherTabela() throws Exception
{
ArrayList<String> colunas = new ArrayList<String>();
colunas.add("id");
colunas.add("titulo");
colunas.add("orientador");
colunas.add("pesquisadorResponsavel");
colunas.add("colaboradores");
colunas.add("anoSubmissao");
colunas.add("tempoDuracao");
col... | 3 |
public void printResultTable(String queryString) {
String query = queryString;
try {
Statement st = connection.createStatement();
ResultSet rs = st.executeQuery(query);
ResultSetMetaData rsmd = rs.getMetaData();
// printColTypes(rsmd);
// System.out.println();
int numberOfColumns = rsmd.getColumnC... | 6 |
public static char[][] generate_bifid_square(String keyword)
{
boolean[] alpha=new boolean[26];
char[][] square=new char[5][5];
int cur_row=0;
int cur_col=0;
//write the keyword to the square in a clockwise spiral
for(char c:keyword.toLowerCase().toCharArray())
{
if(c=='j')
{
c='i';
//i... | 7 |
private JPanel getInstallationPanel(final InstallationWorker installationWorker){
JPanel installationPanel = new JPanel();
installationPanel.setBackground(Color.WHITE);
final JProgressBar installationDirectoryProgress = new JProgressBar();
// TODO: Test this width in different OS
... | 7 |
public void findMostValuableCombination(int itemIndex, int price, int weight) {
if (weight <= maxWeight && price > bestFoundPrice) {
this.bestFoundPrice = price;
this.bestFoundWeight = weight;
bestSet = Arrays.copyOf(tempSet, tempSet.length);
}
int nextItemInd... | 4 |
public void loadHighScores() throws IOException, FreeColException {
highScores = new ArrayList<HighScore>();
File hsf = FreeColDirectories.getHighScoreFile();
if (!hsf.exists()) return;
XMLInputFactory xif = XMLInputFactory.newInstance();
FileInputStream fis = null;
try {... | 6 |
public static void main(String[] args) {
List<String> list = new ArrayList<String>(
Arrays.asList("cat", "dog", "horse")
);
System.out.println(list);
String item = list.get(1);
System.out.println(item);
boolean contains = list.contains(item);
System.out.println(contains);
int index = list.... | 0 |
public static void main(String[] args){
final int N = 10;
final int[] values = new int[N];
for (int i = 0; i < N; i++) values[i] = 0;
final Frame frame = new Frame("Random test");
Canvas canvas = new Canvas(){
public void paint(Graphics g){
g.setColor(new Color(255,255... | 5 |
ThreadDemo(String str) {
t = new Thread(this, str);
// this will call run() function
t.start();
} | 0 |
private void makeConnection(ArrayList<String> connection)
{
// Check the type of gate and call the appropriate function
if (connection.get(0).equals("INVERTER"))
createInverter(connection.get(1), connection.get(2));
else if (connection.get(0).equals("AND"))
createAnd(connection.get(1), connection.get(2), c... | 7 |
public void setSootConfig(IInfoflowConfig config) {
this.sootConfig = config;
} | 0 |
private void onSessionClosed() {
if (this.isSendingFile) {
if (this.exceptionOccurred || this.closedByRemote) {
this.finishSendingFile(false);
this.fileSendingEventHandler.onSendingFailed(this.sendingFile);
}
} else if (this.isReceivingFile) {
if (this.exceptionOccurred || this.closedByRemote) {
... | 9 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.out=response.getWriter();
PrintWriter out=response.getWriter();
String message=request.getParameter("msgtxt");String pnumber=request.getParameter("da");String time=request.getParameter("dt... | 7 |
private void doLaunchButton() {
launchButton.setEnabled(false);
if (frame == null) {
frame = new Pentominos("Pentominos",8,8,true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEv... | 1 |
public Coffee() {
this.setName("Coffee");
this.setPrice(new BigDecimal(10));
} | 0 |
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... | 6 |
@Override
public String getDesc() {
return "DarknessJupitel";
} | 0 |
public static boolean renameTo(File file1, File file2) throws IOException {
if (!file1.exists()){
throw new IOException(file1.getAbsolutePath()+" does not exist");}
/// That's right, I can't just rename the file, i need to move and delete
if (isWindows()){
File temp = new File(file2.getAbsoluteFile() +"."+n... | 6 |
private void addMarker(final MarkerTile markerTile) {
add(markerTile);
markerTile.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
Position huffPosition;
board.removeMarkers();
AbstractPlay play= markerTile.getRelatedPlay();
play.execute();
... | 8 |
public static void updateCarte(Carte carte) {
PreparedStatement stat;
try {
stat = ConnexionDB.getConnection().prepareStatement("select * from carte where id_carte=?",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
stat.setInt(1, carte.getId_carte());
... | 3 |
@Override
public void actionPerformed(ActionEvent e)
{
String event = e.getActionCommand();
if(event.equals("Add item"))
{
// get description of the item
String description;
do
{
description = JOptionPane.showInputDialog(null, "Description of the item: ", "Add an item", JOptionPane.QUESTION_MES... | 9 |
public static void checkAutoBroadcastMessagesYAML() {
File file = new File(path + "AutoBroadcast/messages.yml");
if(!file.exists()) {
try {
file.createNewFile();
FileConfiguration f = YamlConfiguration.loadConfiguration(file);
List<String> messages = new ArrayList<String>();
messages.add("&lThis ... | 2 |
public static void swapElements(Vector someVector, int indexOne, int indexTwo) {
// size is useful
int size = someVector.size() ;
// validate parameters
// also leave in identity case
if ( (someVector == null) ||
(indexOne < 0) || (indexOne >= size)||
(indexTwo < 0) || (indexTwo >= size)||
(in... | 6 |
public MeetingInvite getMeetingInviteByUsernameAndMeetingID(int meetingInviteID, String username){
for(MeetingInvite meetingInvite : meetingInvites){
if(meetingInviteID == meetingInvite.getMeetingID() && username.equals(meetingInvite.getUsername())) return meetingInvite;
}
return nu... | 3 |
public void removeOutlinerDocumentListener(DocumentListener l) {
outlinerDocumentListeners.remove(l);
} | 0 |
@Override
public boolean equals(Object other) {
boolean isEqual = false;
if (other == this) {
isEqual = true;
} else if (other != null && other.getClass() == this.getClass()) {
Coordinate otherCoord = (Coordinate) other;
isEqual = oth... | 5 |
public void onRoundChanged(int round, int maxRound)
{
String text = INIT_TEXT + round;
if (maxRound != 0)
text += ADDITIONAL_OF_TEXT + maxRound;
setText(text);
} | 1 |
@Test
public void test_movement() throws OutOfBoardException{
assertNotNull(pawn);
//Four direction
Direction dirDown = Direction.Down;
Direction dirUp = Direction.Up;
Direction dirRight = Direction.Right;
Direction dirLeft = Direction.Left;
when(board.getX... | 0 |
public void useIt(){
panel.player.equipment.remove(this);
switch(this.itemType){
case(1):
if(panel.player.energy <100){
int diff = (int) (100 - panel.player.energy);
if(diff > healthPts){
panel.player.energy += healthPts;
panel.actionMessages.add(new ActionMessage(panel,"Got " +healthPt... | 8 |
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (handledElements.contains(qName) && parentElement.equals(ROOT_ELEMENT)) {
currentElement = qName;
}
if (qName.equals(TRANSACTIONS_ELEMENT)) {
parentElement... | 5 |
public void capturegroup (int i, int j, int c, Node n)
// Used by capture to determine the state of the groupt at (i,j)
// Remove it, if it has no liberties and note the removals
// as actions in the current node.
{
int ii, jj;
Action a;
if (P.color(i, j) != c) return;
if ( !P.markgrouptest(i, j, 0)) // lib... | 6 |
@Override
public float contains( int x, int y ) {
if( parent.getBoundaries().contains( x, y ) ) {
return 1.f;
} else {
return 0.f;
}
} | 1 |
public Priority getPriority() {
return priority;
} | 0 |
public void checkPurchase()
{
if(BackerGS.storeVisible)
{
if(CurrencyCounter.currencyCollected < 80)
{
if(Greenfoot.mouseClicked(this))
{
NotEnoughMoney.fade = 200;
boop.play();
}
... | 8 |
private <T extends TaobaoResponse> Map<String, Object> doPost(TaobaoRequest<T> request, String session) throws ApiException {
Map<String, Object> result = new HashMap<String, Object>();
RequestParametersHolder requestHolder = new RequestParametersHolder();
TaobaoHashMap appParams = new TaobaoHashMap(request.getTe... | 8 |
public void dump(DumpSource ds) {
num.setLength(0);
txt.setLength(0);
offset = 0;
try {
int b = 0;
int column = 0;
while ((b=ds.get()) != -1) {
num.append(String.format("%02x", b & 0xff));
num.append(' ');
txt.append(Character.isLetterOrDigit((char)b) ? (char)b : '.');
if (++c... | 6 |
public boolean SendHeader() throws IOException
{
File l_fileAttribute;
PrintStream l_printStream;
Scanner l_readStream;
String l_basename;
long l_fileSize;
/*
* Check if socket and/or filename are not null
*/
if( ( up_socket == null ) ||
( up_filename == null ) )
return false;
... | 5 |
public boolean isContinuousExcludeTerminalsAttachToRoot() {
int lcorner = getLeftmostProperDescendant().getIndex();
int rcorner = getRightmostProperDescendant().getIndex();
if (lcorner == rcorner) {
return true;
}
TokenNode terminal = ((TokenStructure)getBelongsToGraph()).getTokenNode(lcorner);
whi... | 7 |
public boolean add(String key, String value) {
String ligne;
try {
while ((ligne = _br.readLine()) != null) {
int a = 0;
while (ligne.charAt(a) != '@') {
a++;
}
ligne = ligne.substring(0, a);
... | 5 |
private Vecteur getVecteur(int i) {
return new Vecteur(courante.getForme().getPoints(i).get(0) + position.get(0), courante.getForme().getPoints(i).get(1) + position.get(1));
} | 0 |
FloodFill(Canvas c, BufferedImage source, Point p, int threshold)
{
this.source = source;
this.threshold = threshold;
if (p.x < 0 || p.y < 0 || p.x >= source.getWidth() || p.y >= source.getHeight()) return;
targetRGB = source.getRGB(p.x,p.y);
floodFill(p,c);
} | 4 |
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(name);
if (stacksize > 1) {
sb.append(" [").append(stacksize).append("]");
}
if (price > 0) {
sb.append(" ");
int total = price * stacksize;
if (total > 1000000) {
sb.append(format.format(tota... | 4 |
public StopRange getRange() {
return this.Range;
} | 0 |
public int compare(Static o1, Static o2) {
if(tiledata != null && o1.getX() == o2.getX() && o1.getY() == o2.getY() && o1.getZ() == o2.getZ()){
ItemData t1 = tiledata.getItem(o1.getId());
ItemData t2 = tiledata.getItem(o2.getId());
if(t1 == null && t2 == null) return 0;
int t1b = (t1.getFlags().conta... | 8 |
public void chooseShape(Point.Double p) {
JRadioButton rectangle = new JRadioButton();
JRadioButton circle = new JRadioButton();
JPanel radiopanel = shapeRadioPanel(rectangle, circle);
rectangle.setSelected(true);
circle.setSelected(false);
int chooseShape = JOptionPane.s... | 7 |
@Override
protected void resolveCollision(GameContext g,Collidable c, float percent) {
if (isGhost)
return;
setCollisionPosition(percent);
if (c instanceof Dot) {
if (((Dot)c).isGhost)
return;
g.removals.add(this);
setDead(true);
g.removals.add((Mob)c);
((Dot)c).setDead(true);
Vector new... | 3 |
@Test
public void newBoard_verifyPiecePlacement() throws Exception {
// when
final Board board = new Board();
// then
for (int i = 0; i < 8; i++) {
assertPieceTypePlacement(board, PieceType.PAWN, i);
}
assertPieceTypePlacement(board, PieceType.ROOK, 0);
... | 1 |
public static boolean isTransition(char s1, char s2){
if ((s1=='A')&&(s2=='G')) return true;
if ((s1=='G')&&(s2=='A')) return true;
if ((s1=='C')&&(s2=='T')) return true;
if ((s1=='T')&&(s2=='C')) return true;
return false;
} | 8 |
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getSource() == orderList) {
// check if order list is empty
if (orderList.getSelectedIndex() > -1) {
// separate the text in the selected list item
String[] values = orderList.getSelectedValue().split("\\t");
// JOptionPane.showMessag... | 2 |
public int compareTo( Object obj ) {
if( obj == null ) {
return( 1 );
}
else if( obj instanceof GenKbTenantByUNameIdxKey ) {
GenKbTenantByUNameIdxKey rhs = (GenKbTenantByUNameIdxKey)obj;
if( getRequiredClusterId() < rhs.getRequiredClusterId() ) {
return( -1 );
}
else if( getRequiredClusterId() ... | 9 |
protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... | 9 |
public boolean updateLeagueHierarchyRequest(Sport sport) {
String request = null;
switch(sport) {
case NBA: case NHL:
request = "http://api.sportsdatallc.org/" + sport.getName() + "-" + access_level + sport.getVersion() + "/league/hierarchy.xml?api_key=" + sport.getKey();
Element element = send(requ... | 6 |
private void initializeView()
{
this.setOpaque(true);
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createLineBorder(Color.black, BORDER_WIDTH));
label = new JLabel("Welcome to the game hub");
Font labelFont = label.getFont();
labelFont = labelFont.deriveFont(labelFont.getStyle(), LABEL... | 7 |
private void gameUpdate() {
if (!isPaused && !gameOver) {
//TODO Do something with game state
// You can for instance set certain flags and here you would then put: if(flag) => do something
/** PLACE A BLOCK **/
if(placeBlockFlag){
//Place the block
currentSelectedBlock.activate(new ArrayList<Node... | 7 |
public void evolve() {
// Create a buffer for the new generation
Chromosome[] buffer = new Chromosome[popArr.length];
// Copy over a portion of the population unchanged, based on
// the elitism ratio.
int idx = Math.round(... | 6 |
public void updateAt(Tile tile) {
int value = 0 ;
final Element owner = tile.owner() ;
if (owner instanceof Installation) {
value = ((Installation) owner).structure().ambienceVal() ;
}
if (owner instanceof Flora) {
value = ((Flora) owner).growStage() ;
}
for (Mobile m : tile... | 5 |
private void log(String string) {
System.out.print(string);
if (++m_count % 40 == 0) {
System.out.println("");
}
} | 1 |
@Override
public void rodarJogo(){
if (JOptionPane.showConfirmDialog(null, "\nUsar midia física?\n","Iniciando...",JOptionPane.YES_NO_OPTION) == 0 ){
this.jogoRodando = JOptionPane.showInputDialog(null,"\nInforme qual o jogo a executar\n","Iniciando...",JOptionPane.INFORMATION_MESSAGE);... | 5 |
public boolean isAccepted() {
return false;
} | 0 |
private String prepareGet(Response data) throws Exception {
if(data == null)
return "";
StringBuffer sb = new StringBuffer();
Map<String, String> params = data.toMap();
for(Entry<String, String> s : params.entrySet()) {
sb.append('&');
sb.append(URLEncoder.encode(s.getKey(), ENCODE) + "=" + URLEnco... | 2 |
public Instruction getInstruction(int currState) {
return fsm.get(currState);
} | 0 |
public static void main(String[] args) {
// TODO Auto-generated method stub
long temp = 1;
boolean flag = true;
for(int i=1;i<=20; i++)
temp=temp*i;
long lcm =temp;
System.out.println(temp);
for(long j = 1 ; j <lcm; j++)
{
for(long k=1; k <= 20; k++)
{
if(j%k != 0)
{
flag = false;
break;
}
flag = true;
}... | 5 |
public void use(BattleFunction iface, PokeInstance user, PokeInstance target, Move move) {
if (this.target == Target.target) {
if (target.battleStatus.flags[8] && levels < 0)
return;
target.battleStatus.modify(stat, levels);
if (levels > 0) {
iface.print(target.getName() + "'s " + stat.name() + " has... | 7 |
private static String[] tempFSA(String[] input) {
char[] transitions = {' ', ',', '.', '?'};
int numberOfTransitions = transitions.length;
String[] output = new String[input.length*input.length*numberOfTransitions];
int counter = 0;
int internalCounters[] = new int[input.length];... | 4 |
public Cell findByCellValue(String value) {
for(Cell c : cells) {
if(value.equals(c.getCellValue())) {
return c;
}
}
return null;
} | 2 |
public Music(Animation anim) {
super(anim);
} | 0 |
boolean safe(int r, int c, int n, int[] occ) {
for (int i = 0; i <= r; ++i) {
if(occ[i] == c || Math.abs(occ[i]+i)==Math.abs(r+c) || occ[i]-i==c-r) {
return false;
}
}
return true;
} | 4 |
@Override
public void run(Player interact, Entity on, InteractionType type) {
if(type != InteractionType.DAMAGE) return;
int range = 2;
if(interact.isSneaking()) range = 5;
for(Entity e : on.getNearbyEntities(range, range, range)){
if(e instanceof LivingEntity){
LivingEntity le = (LivingEntity) e;... | 6 |
public void cleanup() {
final Iterator iter = clean.iterator();
while (iter.hasNext()) {
final Node node = (Node) iter.next();
node.cleanup();
}
} | 1 |
public EventServlet() {
super();
// TODO Auto-generated constructor stub
} | 0 |
private boolean untar(File fileToUntar) throws FileNotFoundException, IOException {
boolean fileUntarred = false;
String untarLocation = fileToUntar.getAbsolutePath();
TarArchiveInputStream tarStream = new TarArchiveInputStream(new FileInputStream(fileToUntar));
BufferedReader bufferedTa... | 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 DiscountCode)) {
return false;
}
DiscountCode other = (DiscountCode) object;
if ((this.discountCode == null && ... | 5 |
public void mouseDragged(MouseEvent e ) {
if( fGrowBase != null ) {
Point loc = fComponent.getLocationOnScreen();
int width = Math.max(2, loc.x+e.getX() - fGrowBase.x);
int height= Math.max(2, loc.y+e.getY() - fGrowBase.y);
if( e.isShiftDown() && fImage!=null ) {
float imgWidth = fImage.getWidth(this... | 6 |
public String reverseWords(String s) {
String[] list = s.split(" ");
String result = "";
for(int i = list.length-1 ;i >= 0 ;i--){
if(!list[i].equals("") )
result = result+ list[i]+" ";
}
if(result.length() > 0)
return result.substring(0,re... | 3 |
public void initTransitionSystem(GuideUserHistory history) throws MaltChainedException {
this.actionContainers = history.getActionContainerArray();
if (actionContainers.length < 1) {
throw new ParsingException("Problem when initialize the history (sequence of actions). There are no action containers. ");
}
i... | 7 |
public Parameter getLiblinearParameters() throws MaltChainedException {
Parameter param = new Parameter(SolverType.MCSVM_CS, 0.1, 0.1);
String type = liblinearOptions.get("s");
if (type.equals("0")) {
param.setSolverType(SolverType.L2R_LR);
} else if (type.equals("1")) {
param.setSolverType(SolverType.... | 9 |
private void situationalInfluenceUpdate()
{
//array to hold each stakeholder's numerator value
double[] stakeholderNumerators = new double[Stakeholders.size()];
double stakeholderDenominator = 0;
//tally up each stakeholder's list of relationships
for (int i = 0; i < Stake... | 5 |
public void testFactory_FromCalendarFields() throws Exception {
GregorianCalendar cal = new GregorianCalendar(1970, 1, 3, 4, 5, 6);
cal.set(Calendar.MILLISECOND, 7);
TimeOfDay expected = new TimeOfDay(4, 5, 6, 7);
assertEquals(expected, TimeOfDay.fromCalendarFields(cal));
try {
... | 1 |
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
int f = 0;
d: do {
int s = scan.nextInt();
if (s == 0)
break d;
int[][] m = new int[s][s];
for (int i = 0; i < m.length; i++)
for (int j = 0; j < m.length; j++)
m[i][j... | 5 |
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.