text stringlengths 14 410k | label int32 0 9 |
|---|---|
private JSONObject getBookInfo(String bookId)
{
JSONObject ourBook = new JSONObject();
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbc:sqlserver://localhost;user=sa;password=nopw");
... | 5 |
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new FileReader("comehome.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("comehome.out")));
// set default graph distances
for(int i=0; i<52; i++) {
for(int j=0; j<52; j++) {
gr... | 9 |
public void put(CacheableNode cacheableNode, long key) {
try {
if (capacity == 0) {
CacheableNode node = recent.popFront();
node.unlink();
node.unlinkSub();
if (node == emptyNode) {
CacheableNode empty = recent.popFront();
empty.unlink();
empty.unlinkSub();
}
} else {
capa... | 3 |
protected void incrementAge()
{
setAge(getAge() + 1);
if(getAge() > getMaxAge()) {
setDead();
}
} | 1 |
private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... | 8 |
public boolean _setSpriteImage(URL spriteSourceImageURL)
{
if(spriteSourceImageURL != null)
{
sprite._setSpriteImage(spriteSourceImageURL);
return true;
}
else
{
return false; // Couldn't update sprite. Probably invalid sprite given.
}
} | 1 |
public String selectSupplyGood(){
int numRnd = rndSupplyNum;
if (GamePanel.numFuel <= 0){
numRnd = (int)(3 * Math.random());
}
if (numRnd == 0){
supplyName = " fuel";
selectNumSupply(GamePanel.numFuel);
}
else if (numRnd == 1){
supplyName = " food";
select... | 7 |
private boolean powerUpAndReset(boolean isRepeat)
{
//Service.WriteLog("Зашла в powerUpAndReset");
if (this.poll(true))
{
this.ack();
if (this.reset())
{
//Service.WriteLog("крути верти 200 раз");
for (int i=0; i<200; i++)
... | 6 |
private String readLine(BufferedReader commandReader) {
String commandLine = null;
do
try {
commandLine = commandReader.readLine();
this.log.info("Read one command line" + commandLine);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
this.log.info("Read on... | 2 |
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception
{
Channel ch = e.getChannel();
Throwable cause = e.getCause();
if(cause instanceof TooLongFrameException)
{
sendErrorResponse(ctx, BAD_REQUEST);
... | 2 |
* @param itemoid The ObjectID of the dropped item.
* @param dropperoid The OID of the dropper.
* @param ownerid The ID of the drop owner.
* @param dropfrom Where to drop from.
* @param dropto Where the drop lands.
* @param mod ?
* @param mesos Is the drop mesos?
* @return The item dro... | 5 |
public static void cycle() {
indexCrossedPageBoundary = false;
checkInterrupts();
// Save bank/pc values for display later
int bank = pbr.getValue();
int addr = pc.getValue();
// Get the current opcode
int opcode = Core.mem.read(Size.BYTE, pbr.getValue(), pc.getValue());
pc.add(1);
// Get ... | 6 |
public Tile getTile(int x, int y) {
if (x < 0 || x >= getWidth())
return Tile.VOID;
if (y < 0 || y >= getHeight())
return Tile.VOID;
return map[x][y];
} | 4 |
public Object getBindingForVar(final CycVariable var) {
for (final Binding binding : getBindings()) {
if (binding.getVariable().equals(var)) {
return binding.getValue();
}
}
return null;
} | 2 |
public void writePresentAbsenceDataForR( File file) throws Exception
{
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
for( int x=0; x < getSampleNames().size(); x++)
writer.write( getSampleNames().get(x) + (x < getSampleNames().size()-1 ? "\t" : "\n") );
for( int y=0; y < getOtuNames(... | 6 |
public FloatElement[] getSortedSimilarWordsByDelta(String word) throws Exception{
int index = model1.index(word);
FloatElement[] similarWords = new FloatElement[model1.sizeOfVocabulary];
//float invalid = -10;
for (int i=0; i<model1.sizeOfVocabulary; i++){
float pmi1 = 0;
float pmi2 = 0;
floa... | 9 |
@Override
public double observe() {
double observed = 0;
for (int i = 0; i < n; i++) {
observed += bern.observe();
}
return observed;
} | 1 |
InjectorClassLoader(final InjectorPluginLoader loader, final ClassLoader parent, File file) throws InvalidPluginException, MalformedURLException {
super(new URL[] { file.toURI().toURL() }, parent);
Validate.notNull(loader, "Loader cannot be null");
this.loader = loader;... | 5 |
@Override
public List<ParsedColumn<?>> parse(RecordProvider recordProvider, ColumnSplitter columnSplitter, List<ColumnParser<?>> columnParserList) {
String record;
while ((record = recordProvider.next()) != null) {
List<String> columns = columnSplitter.split(record);
for (Col... | 8 |
public GuiElButtonDropdown(Gui gui, GuiElPanel panel, Vector2f pos, Vector2f size, String text) {
super(gui,panel,pos,size,text);
final GuiElButtonDropdown me = this;
dropdown = new GuiElButton(gui,panel,new Vector2f(pos.x+size.x-size.y,pos.y),new Vector2f(size.y,size.y),null){
protected GuiElButtonDropdown... | 8 |
public void letsGo() throws UnlandedRobotException, UndefinedRoadbookException, InsufficientChargeException, LandSensorDefaillance, InaccessibleCoordinate {
if (roadBook == null) throw new UndefinedRoadbookException();
while (roadBook.hasInstruction()) {
Instruction nextInstruction = roadBoo... | 6 |
private void clearSpace() throws IOException {
int c = in.peek();
while (Character.isWhitespace(c)) {
in.read();
c = in.peek();
}
} | 1 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Reply reply = (Reply) o;
if (id != reply.id) return false;
if (text != null ? !text.equals(reply.text) : reply.text != null) return false;
... | 8 |
public boolean equals( Object obj )
{
if ( obj instanceof Row )
{
Row r = (Row)obj;
if ( r.versions.equals(versions) && r.cells.size()==cells.size() )
{
for ( int i=0;i<cells.size();i++ )
{
FragList fl1 = cells.g... | 5 |
public void setTray(Tray tray) {
this.tray = tray;
if (tray != null) {
tray.addState(this);
}
} | 1 |
public QuickUnion(int N) {
this.id = new int[N];
for(int i = 0; i < N; i++) {
this.id[i] = i;
}
} | 1 |
public Member getMember() {
return member;
} | 0 |
public XMLParser(String fileName){
super();
File schemaFile;
Schema schema;
Source xmlFile = new StreamSource(new File(fileName));
SchemaFactory schemaFactory = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFile = new File("bin/schema.xsd");
try {
//load the sc... | 3 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... | 7 |
public void bootstrap() {
this.pool = Executors.newCachedThreadPool();
try {
this.server = new ServerSocket(port);
log.info("server start listening : "+port);
mainThread = new Thread(new Runnable() {
@Override
public void run() {
... | 3 |
public String getType()
{
return type;
} | 0 |
@Test
public void testCannonStatus() {
for(int i = 0; i < Tower.CannonStatus.values().length; ++i) {
if(tower.getStatus() == CannonStatus.READYING) {
assertTrue(tower.isCannonReadyToFire());
} else if(tower.getStatus() == CannonStatus.WAITING) {
assertTrue(tower.isCannonReadyToSearch());
} else if(t... | 4 |
private static boolean validateAdditionalOptions() {
if (timeout > 0 && sysTimeout > 0) {
return false;
}
return true;
} | 2 |
private void createToolBars() {
final IActionBars bars = getViewSite().getActionBars();
final IToolBarManager toolBarManager = bars.getToolBarManager();
if (this.startGruntTaskAction != null) {
toolBarManager.add(startGruntTaskAction);
}
if (this.stopGruntTaskAction != null) {
toolBarManager.add(this.s... | 3 |
public int compare(Atom atoma, Atom atomb){
if (atoma.getType().equals(SUFFIX_TYPE_VAL) && !atomb.getType().equals(SUFFIX_TYPE_VAL)){//suffix atoms go to the back
return 1;
}
if (atomb.getType().equals(SUFFIX_TYPE_VAL) && !atoma.getType().equals(SUFFIX_TYPE_VAL)){
return -1;
}
... | 9 |
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] A = new int[n];
for(int i=0;i<n;i++){
A[i]=in.nextInt();
}
A = heapSort(A);
print(A);
} | 1 |
@Column(name = "PEP_MOA_TIPO")
@Id
public BigInteger getPepMoaTipo() {
return pepMoaTipo;
} | 0 |
public int[] iterativ(int anz){
int[] ergebnis = new int[anz];
if(anz>=0){
ergebnis[0]=0;
}
if(anz>=1){
ergebnis[1]=1;
}
if(anz>1){
for(int i = anz-2;i>0;i--){
ergebnis[anz-(i)]=ergebnis[anz-i-1]+ergebnis[anz-i-2];
}
}
return ergebnis;
} | 4 |
public static void draw(Percolation perc, int N) {
StdDraw.clear();
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.setXscale(0, N);
StdDraw.setYscale(0, N);
StdDraw.filledSquare(N/2.0, N/2.0, N/2.0);
// draw N-by-N grid
int opened = 0;
for (int row = 1; row ... | 5 |
protected int getSmallestFlowDecay(World var1, int var2, int var3, int var4, int var5) {
int var6 = this.getFlowDecay(var1, var2, var3, var4);
if (var6 < 0) {
return var5;
} else {
if (var6 == 0) {
++this.numAdjacentSources;
}
if (... | 5 |
@Override
public ReceivedData receive() {
newBuffer();
ReceivedData out = new ReceivedData();
// TODO Auto-generated method stub
if(socket != null && is != null){
try {
int len = is.read(buffer);
if(len != -1){
out.data = Arrays.copyOf(buffer,buffer.length);
out.length = len;
ou... | 4 |
public Location getSpawn() {
if(spawn == null) {
return null;
}
return spawn.getLocation();
} | 1 |
public void moverPacman(int Direccion) {
if (!gano && !perdio) {
Coords ini = new Coords(pacman.getI(), pacman.getJ(), '.');
mVillPos[ini.getI()][ini.getJ()].set('.');
pacman = Simulador.moverPacman(Direccion, X);
int dismLife = 100/numLifes;
char nextItem = mVillPos[pacman.g... | 9 |
private void setPlayerScoreCompatibliblity() {
for (Player player : plugin.getServer().getOnlinePlayers()) {
Scoreboard playerScoreboard = player.getScoreboard();
if (playerScoreboard != null && playerScoreboard != plugin.pingScoreboard) {
plugin.pingScoreboard = player.getScoreboard();
if (plugin.pingSc... | 4 |
public double computeNetAssetValue() throws InterruptedException, ExecutionException {
final int numberOfCores = Runtime.getRuntime().availableProcessors();
final double blockingCoefficient = 0.9;
final int poolSize = (int) (numberOfCores / (1 - blockingCoefficient));
final List<Callable<Double>> partio... | 1 |
protected void unsingAllByThis(MOB mob, MOB invoker)
{
if(mob!=null)
for(int a=mob.numEffects()-1;a>=0;a--)
{
final Ability A=mob.fetchEffect(a);
if((A instanceof Song)
&&(!A.ID().equals(ID()))
&&((invoker==null)||(A.invoker()==null)||(A.invoker()==invoker)))
((Song)A).unsingMe(mob,invoker... | 7 |
@SuppressWarnings("rawtypes")
public static SingleColumnComparator createIntegerComparator(NumberName numberName, boolean ascending, String defaultString) throws Exception
{
final String type="integer";
if (ascending)
{
if (defaultString.equals(""))
{
return new SingleColumnComparato... | 5 |
public void updateCoordinates() {
if (curDirec != nxtDirec) {
turn = true;
}
if (!turn) {
handleCoordinates();
} else {
turn = false;
}
curDirec = nxtDirec;
} | 2 |
public static void FillSubGraph (LinkedList<Node> nodeList, ArrayList<Node> subGraph) {
for (int i = 0; i < subGraph.size (); i++) {
Node current = subGraph.get (i);
Node[] pred = current.GetPred ();
Node[] succ = current.GetSucc ();
current.SetVisited (true);
for (int j = 0; j < pred.length; j++) {
... | 9 |
public String getType() {
return type;
} | 0 |
private List<Track> crearTrackList(List<String> inGdbList) {
List<Track> innerTrackList = new LinkedList();
for (String archivoGdb : inGdbList) {
Track pista = fillTrack(archivoGdb);
if (pista.isFilled()) {
innerTrackList.add(pista);
... | 2 |
public int GetCurrentInputBufferUsingTheBus(int busNumber)
{
return currentInputBufferUsingTheBus[busNumber];
} | 0 |
private static SessionFactory buildSessionFactory() {
try {
// Create the SessionFactory from hibernate.cfg.xml
return new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory c... | 1 |
public static void roveImgPrint(){
rover = head;
while(rover!=null){
System.out.println(rover.img);
rover = rover.next;
}
} | 1 |
private static void beInteractive() throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line;
do {
line = in.readLine();
if (line.startsWith("pub"))
publish(line.substring(4));
if (line.startsWith("sub"))
subscribe(line.substring(4));
if (line.... | 5 |
private static void createAndFillHuffmanTree(int[] header) throws IOException
{
huffmanTree = new GradProjectDataStruct();
for(int i = 0; i < header.length; i++)
if(header[i] != 0)
huffmanTree.insert(new Node(header[i], i));
huffmanTree.createHuffTree();
huffmanTree.fillHuffTab... | 2 |
public boolean find(String keyword){
boolean ok = false;
String toLowerCase = keyword.toLowerCase();
try {
BufferedReader bufferedReader = new BufferedReader (new FileReader (id + ".txt"));
//Buscar si existe una palabra
String line;
... | 5 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Estado other = (Estado) obj;
if (this.idEstado != other.idEstado && (this.idEstado == null || !this.idEst... | 5 |
public void keyPressed(KeyEvent event) {
Object s = event.getSource();
if (s instanceof JTextField && (JTextField)s == userEntry) {
if (event.getKeyCode() == KeyEvent.VK_ENTER) {
endDialog();
}
} else if (s instanceof JPasswordField &&
(JPasswordField)s == passwdEntry) {
... | 6 |
private void requestNewPwd() {
boolean result = false;
String username = forgotPwdPanel.getUsername();
String email = forgotPwdPanel.getEmail();
if (email.equals("") && username.equals(""))
forgotPwdPanel.setStatusText("Användarnamn eller epost-adress måste anges!");
else if (!email.equals("") && !username... | 9 |
@Override
public IautosSellerInfo getModel() {
if (null == newSeller) {
newSeller = new IautosSellerInfo();
}
return newSeller;
} | 1 |
public java.io.Reader getReader() throws java.io.IOException
{
if (inBuf == 0 && nextCharInd >= maxNextCharInd)
return inputStream;
char[] tmp = null, toPush;
int cnt = 0;
if (inBuf != 0)
{
tmp = new char[2 * inBuf];
for (int i = 0; i < inBuf; i++)
if (b... | 9 |
@Override
public void execute(double t) {
double[] v = new double[output.getDim()];
Arrays.fill(v, 1);
Matrix y = new ColumnMatrix(v);
for (InputConnector ic : inputs) {
if (ic != null && ic.isConnected() && ic.getSource() != null) {
y = y.arrayTimes(ic.getInput());
}
}
try {
output.setOutput(... | 5 |
public static void addPlayer(Player p){
warnLevel.put(p, 0.0);
} | 0 |
@Override
public
void startSocket() {
try {
socket = new Socket(address, port);
socket.setSoTimeout(300); // Set Timeout 300ms
} catch (UnknownHostException e) {
System.err.println("Don't know about host: "
+ address);
System.err.println("DataSocket Server answer: " + e.getMessage());
} cat... | 2 |
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ignore) {
}
// Load favourites
try {
favouriteList.load();
} catch (FileNotFoundException ignore) {
... | 3 |
private JSONObject getExtendedFeed(JSONArray discoFeed, HttpServletRequest request) {
JSONObject json = new JSONObject();
String lastIdp = "";
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
String name = cookie.... | 5 |
public Node getKthNode(Node headNode, int k){
if(headNode==null)
return null;
int posFromStart = 0;
Node node = headNode;
while(node!=null){
if(posFromStart==k)
break;
posFromStart++;
node = node.getNextNode();
}
Node currNode = headNode;
Node kNode = node;
while(kNode... | 4 |
private void drawList(Graphics2D g2d, TreeMap<Integer, String> list){
for(Map.Entry<Integer, String> mp : list.entrySet()){
drawnString(g2d, mp.getKey(), mp.getValue());
}
} | 1 |
protected void sendRaw(String message) {
if (bot == null || bot.getWriter() == null) return;
try {
bot.getWriter().append(message + "\r\n");
bot.getWriter().flush();
}
catch (IOException e) {
}
} | 3 |
private void init(){
// 根据配置信息创建连接池
String countStr = Config.getStr(POP_COUNT);
if(MyStringUtil.isBlank(countStr)){
this.count = 0;
}else{
this.count = Integer.valueOf(countStr);
}
this.drivers = new ArrayList<Driver>(this.count);
// 读取数据库连接池配置信息
if(this.count <= 0){// 单个数据库链接池配置
DbPool... | 3 |
public byte[] preHash(String username, String password) {
try {
// Hash the password with the user id (a constant salt)
MessageDigest md = MessageDigest.getInstance("SHA-256");
String seed = username.toLowerCase() + password;
byte[] bytes = seed.getBytes("UTF-8");
// Do some key stretching to slow ... | 2 |
public static byte[] encrypt(String message, String keyText) {
final byte[] initialKeyBytes = keyText.getBytes();
final byte[] keyBytes=new byte[24];
for(int i=0; i<24; i++){
if (i<initialKeyBytes.length){
keyBytes[i]=initialKeyBytes[i];
}
el... | 9 |
private int number(StringBuilder token, int i) throws BadNumberException, BadCharacterException
{
if(i < expr.length )
{
if(isDigit(expr[i]))
{
token.append(expr[i]);
return number(token, ++i);
}
else if (expr[i] == '.')
{
if(((i+1) < expr.length && isDigit(expr[i+1])))
{
token.... | 7 |
public static void main(String[] args) {
CycSOAPService cycSOAPService = new CycSOAPService();
try {
CycList query = new CycList();
query.add(CycObjectFactory.makeCycSymbol("+"));
query.add(new Integer(1));
query.add(new Integer(1));
Log.current.println("binary query=" + query... | 1 |
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://... | 6 |
@Override
public List<Integer> getRandomNumbers(int amount, int maxRange) {
if (amount < 1 || maxRange < 1) {
throw new IllegalArgumentException("Amount or maxRange can't be less then 1!");
}
Random random = new Random();
List<Integer> targetList = new ArrayList<Intege... | 3 |
public void setInstances(Instances newins) {
m_attribIndex = 0;
m_as = null;
m_data = newins;
if(m_colorAttrib!=null) {
m_colorAttrib.removeAllItems();
m_colorAttrib.addItem("No class");
for(int i=0; i<m_data.numAttributes(); i++) {
String type = "";
switch (m_data.attribute(i).type(... | 9 |
private void drawReadyGo( Graphics g, ImageObserver imgObserver ) {
List< Integer > pos = _model.getReadyGoPos();
int x = ( _model.isGo() ) ? pos.get( 2 ) : pos.get( 0 );
int y = ( _model.isGo() ) ? pos.get( 3 ) : pos.get( 1 );
Image img = ( _model.isGo() ) ? _model.getGo() : _model.getReady();
g.dra... | 3 |
public VueMenu getVue() {
return vue;
} | 0 |
public void fire(int targetX, int targetY) {
if(weapon.isFireReady()) weapon.shoot(targetX, targetY);
} | 1 |
public List<String> getDistinctProducers(){
Connection conn = null;
PreparedStatement st = null;
List<String> producers = new ArrayList<String>();
try {
conn = OracleDAOFactory.createConnection();
st = conn.prepareStatement(GET_DISTINCT_PRODUCERS);
ResultSet row = st.executeQuery();
while(row.next()... | 6 |
public static void main(String[] args) {
Scanner words;
HashSet<String> dict = new HashSet<String>();
Scanner userFile;
try {
words = new Scanner(new File("words.txt"));
while (words.hasNext()) {
String word = words.... | 8 |
public static HashSet<String> getKvFiles(String dir) throws IOException {
HashSet<String> returnSet = new HashSet<>();
Matcher fileMatch = KvPattern.matcher(dir);
Path init = Paths.get(dir);
if (Files.exists(init)){
if (Files.isDirectory(init)){
Itera... | 6 |
static boolean check(int a, int b, int l) {
if ((b - a + 1) % l != 0)
return false;
int pos = 0;
for (int i = a + l; i <= b; i++) {
if (w[a + pos] != w[i])
return false;
pos = (pos + 1) % l;
}
return true;
} | 3 |
public boolean isPause() {
return type == PAUSE;
} | 0 |
public static State[] getClosure(State state, Automaton automaton) {
List list = new ArrayList();
list.add(state);
for (int i = 0; i < list.size(); i++) {
state = (State) list.get(i);
Transition transitions[] = automaton.getTransitionsFromState(state);
for (int k = 0; k < transitions.length; k++) {
T... | 4 |
public java.awt.Component getTableCellEditorComponent(
javax.swing.JTable table, Object value, boolean isSelected,
int row, int column) {
if (table.getName() != null && table.getName().equals("MashTable")) {
// Check to see if we have a row and column for the sparge type
if (column == 1) {
if (row ... | 9 |
private Street createStreet() throws StorageReaderException {
String name = null;
try {
name = nextString();
int[] color = new int[3];
for(int i = 0; i < color.length; i++) {
color[i] = nextInt();
}
int price = nextInt();
int[] income = new int[7];
for(int i = 0; i < income.length; i++) {
... | 4 |
@Test
public void subtractTest() {
for (int i = 0; i < TESTS; i++) {
double x1 = rand.nextInt();
double y1 = rand.nextInt();
double x2 = rand.nextInt();
double y2 = rand.nextInt();
Vector v1 = new Vector(x1, y1);
Vector v2 = new Vector(x2, y2);
Vector res = new Vector(x1 - x2, y1 - y2);
asser... | 1 |
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 static String strToXMLKeySafe(String str) {
if (str == null) return "";
if (Functions.is_numeric(str) == true) {
str = 'a' + str;
} else if (Functions.is_numeric(Functions.substr(str,0,1)) == true) { // End of if (is_numeric(str))
str = str.replaceAll("/^(\\d*)/","");
} // End of elseif (is_numeric... | 3 |
public void hit() {
deck.hit(player);
info.update(deck);
if (player.getHand().size() >= 5) {
hitButton.setEnabled(false);
}
if (player.checkBust()) {
hitButton.setEnabled(false);
JOptionPane.showMessageDialog(this, "Bust!! No money collected.");
stand();
}
doubleButton.setEnabled(false);
} | 2 |
@Override
public void modifiedStateChanged(DocumentEvent e) {} | 0 |
public HashMap<Text, Double> calculateCosineSimilarity(ArrayList<Text> textCollection, String Query){
CosineSimilarity cosim = new CosineSimilarity();
Text QueryText = new Text(Query);
ArrayList<String> QueryTokens = tokenize(QueryText);
HashMap<String, Double> TfIdfQuery = new HashMap<String, Double>();
Ma... | 7 |
public final static boolean fightAvailable(int retry) {
for (int i = retry; i > 0; i--) {
if (i != retry) {
Control.sleep(600);
Output.println(" - versuche erneut", 1);
}
try {
// HTTP parameters stores header etc.
HttpParams params = new BasicHttpParams();
params.setParameter("http.pro... | 5 |
public void reduce(Text key, Iterator<Text> values,
OutputCollector<Text, Text> output, Reporter reporter)
throws IOException {
try {
TreeMap<String, Integer> keywords = new TreeMap<String, Integer>();
TreeMap<String, Integer> urls = new TreeMap<String, Integer>(... | 8 |
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
CourseRec rec = courseModel.getFilteredCourses().get(rowIndex);
switch (columnIndex) {
// This is used to get the whole object
case -1:
return rec;
case 0:
return rec.getStatus();
case 1:
return (rec.hasDateless() ? "?" ... | 6 |
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // FIRST_NAME
return FIRST_NAME;
case 2: // LAST_NAME
return LAST_NAME;
case 3: // STATUS
return STATUS;
case 4: // ID
return ID;
default:
return ... | 4 |
@Override
public Boolean[] segment(Utterance utterance, boolean training, boolean trace) {
// Get info about the utterance. Since the segmentation is a copy,
// don't worry about modifying it
Boolean[] segmentation = utterance.getBoundariesCopy();
String[] units = utterance.getUnits();
Boolean[] stresses = u... | 6 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.