text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void pivot(int p, int q) {
// everything but row p and column q
for (int i = 0; i <= M; i++)
for (int j = 0; j <= M + N; j++)
if (i != p && j != q) a[i][j] -= a[p][j] * a[i][q] / a[p][q];
// zero out column q
for (int i = 0; i <= M; i++)
... | 8 |
public final void update(double dt) {
if (!isTerminated()) {
elapsedTime += dt;
doUpdate(dt);
if (cancelled) {
afterExecutionCancelled();
} else if (isTerminated()) {
afterExecutionCompleted();
getScreen().updateSprites();
if (getFacade().isGameFinished(getWorld())) {
getScreen().game... | 4 |
public InputStream getInputStream(String zipPath) throws IOException
{
Path path = fileSystem.getPath(zipPath);
if(Files.exists(path))
{
return Files.newInputStream(path);
}
return null;
} | 1 |
static final void method1885(int i, int i_0_, int i_1_, int i_2_, int i_3_,
float[] fs, int i_4_, float f, int i_5_,
int i_6_, float f_7_, float[] fs_8_) {
try {
i_4_ -= i_5_;
i_0_ -= i;
anInt3175++;
i_3_ -= i_6_;
float f_9_ = fs_8_[2] * (float) i_0_ + (fs_8_[1] * (float) i_4_
... | 7 |
public static String convert(String fromType, String toType, String num) {
String result = "Error";
int number = 0;
try {
switch (fromType) {
case "-h": // Hexadecimal
number = Integer.parseInt(num, 16);
break;
case "-d": // Decimal
number = Integer.parseInt(num);
break;
case "-o": // ... | 9 |
public OrderByIterator(Iterable<T> source, Comparator<T> comparator)
{
_list = new ArrayList<T>();
for(T item : source)
{
_list.add(item);
}
this._comparer = comparator;
} | 1 |
private void processQueues() throws SectionMapException {
KeyWeakReference ref;
while ((ref = (KeyWeakReference) refQueue.poll()) != null) {
hashMap.remove(ref.getKey());
}
long expiredTime = System.currentTimeMillis() - 30000;
SectionLink link;
while ((link = sectionQueue.peekFirst()) != null && link.ge... | 5 |
public void Action(String destination, String message, boolean autothrow) throws Exception
{
final char actionchar = 0x01;
try
{
Writer.write("PRIVMSG " + destination + " :ACTION" + actionchar + " " + message + " " + actionchar + "\r\n");
Writer.flush();
}
... | 2 |
public static String fromJulian( long Jd ) // Julian date to string
{
long l = Jd + 68569;
long n = ( 4 * l ) / 146097;
l = l - ( 146097 * n + 3 ) / 4;
long i = ( 4000 * ( l + 1 ) ) / 1461001;
l = l - ( 1461 * i ) / 4 + 31;
long j = ( 80 * l ) / 2447;
int d = (int) (l - ( 2447 * j ) / 80);
l = j / 11;
int m ... | 2 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TSalesman other = (TSalesman) obj;
if (!Objects.equals(this.salesIdScy, other.salesIdScy)) {
... | 3 |
public ChatServer () throws IOException {
server = new Server() {
protected Connection newConnection () {
// By providing our own connection implementation, we can store per
// connection state without a connection ID to state look up.
return new ChatConnection();
}
};
// For consistency, the c... | 9 |
public void onEnable()
{
/* -------------- VARIABLE INITIALIZATION -------------- */
plugin = this;
/* -------------------- LISENERS ----------------------- */
signlisener = new SignLisener(this, log);
/* ------------------- PERMISSIONS --------------------- */
if(this.getServer().getPluginManager().... | 1 |
private void stepForward() {
// TODO Auto-generated method stub
treePanel.setAnswer(myCurrentAnswerNode);
treePanel.repaint();
if (myCurrentAnswerNode.getDerivation().equals(myTarget))
{
myStepAction.setEnabled(false);
return;
}
ParseNode node=(ParseNode) myQueue.removeFirst();
String deriv=no... | 2 |
public void setWinner() throws IOException {
String winner;
if (player1Points > player2Points) {
winner = "1";
} else if (player2Points > player1Points) {
winner = "2";
} else {
winner = "TIE";
}
SocketHandler socketHandler1 = null;
SocketHandler socketHandler2 = null;
iter = clientLists.entr... | 7 |
@Test
@SuppressWarnings("unchecked")
public void testAbstractFactory() {
ServiceFactory.putService(PersistenceService.class, new PersistenceServiceImpl<BeerEntity>());
PersistenceService<BeerEntity> retrievedService = ServiceFactory.getService(PersistenceService.class);
assertTrue(retrie... | 0 |
private static void locateLinuxFonts(File file) {
if (!file.exists()) {
System.err.println("Unable to open: " + file.getAbsolutePath());
return;
}
try {
InputStream in = new FileInputStream(file);
BufferedReader reader = new BufferedReader(new In... | 8 |
public ArrayList<TreeNode> getTips() {
ArrayList<TreeNode> children = new ArrayList<TreeNode>();
Stack<TreeNode> nodes = new Stack<TreeNode>();
nodes.push((TreeNode) this);
while (nodes.isEmpty() == false) {
TreeNode jt = nodes.pop();
for (int i = 0; i < jt.getChildCount(); i++) {
nodes.push(jt.getChi... | 3 |
private static void reflectionAppend(
Object lhs,
Object rhs,
Class clazz,
EqualsBuilder builder,
boolean useTransients,
String[] excludeFields) {
Field[] fields = clazz.getDeclaredFields();
List excludedFieldList = excludeFields != null ? Arrays.asList(ex... | 9 |
public void handleResetButton(){
if(aTimer.isRunning()){
aTimer.stop();
}
aTuringMachine.getInput().clear();
aTuringMachine.getInput().add("Blank Symbol");
simulationView.getPrintError().setText("");
for(int i = 0; i < 31; i++){
if((inputView.getIn... | 4 |
private static void cleanup(List<Difference> diffs) {
Difference last = null;
for (int i = 0; i < diffs.size(); i++) {
Difference diff = diffs.get(i);
if (last != null) {
if (diff.getType() == Difference.ADD && last.getType() == Difference.DELETE ||
... | 8 |
public void calculateUptime(String port) {
if (Functions.isNumeric(port)) {
int portValue = Integer.valueOf(port);
Server s = getServer(portValue);
if (s != null) {
if (portValue >= this.min_port && portValue < this.max_port)
sendMessage(cfg_data.irc_channel, s.port + " has been running for " + Func... | 4 |
public void normalizeSubGoalWeights() {
float sumWeights = 0f;
Iterator<Goal> git = getSubGoalIterator();
while (git!=null && git.hasNext()) {
Goal g = git.next();
sumWeights += g.getWeight();
}
//allow for a small rounding or other error margin before n... | 7 |
@Override
public Intersection findBestMove(Board board) {
GameTreeNode root = GameTreeNode.getInstance(board);
GameTree tree = GameTree.getInstance(root);
for(int iteration = 0; iteration < iterations; iteration++) {
if(invariantChecker != null) {
invariantChecker.treeSize(tree.nodes.size());
}
... | 3 |
public GetAccountResponse getGetAccountResponse() {
return getAccountResponse;
} | 0 |
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
float Gross;
System.out.print("Gross Salary: ");
Gross = keyboard.nextFloat();
int Exemptions;
System.out.print("Number of Exemptions: ");
Exemptions = keyboard.nextInt();
float Interest;
System.out.print("Interest... | 7 |
static private double calculatePairwiseDistance(int taxon1, int taxon2) {
double[] total = new double [4];
double[] transversions = new double [4];
for( Pattern pattern : alignment.getPatterns() ) {
State state1 = pattern.getState(taxon1);
State state2 = pattern.getStat... | 7 |
public static void main(String[] args)
{
GraphProperties GP = null;
Graph G = null;
try
{
G = new Graph(new In(args[0]));
GP = new GraphProperties(G);
}
catch (Exception e)
{
System.out.println(e);
System.exit(1);
}
System.out.println(args[0] + "\n" + G.toString());
for (int v = 0; v <... | 2 |
public void zoneEventOccurred(String eventZone, int eventType) {
if((eventType == ZoneEvents.MOVEMENT || eventType == ZoneEvents.ENTER )&& eventZone.equals("sectionNav")){
if(Debug.gui)
System.out.println(eventZone);
if(triggerShimmyIn());
else if(triggerShimmyOut());
else{
if(Debug.gui)
Sys... | 7 |
boolean setField(String fieldName, JsonReader reader) throws IOException {
if (fieldName.equals("Name")) {
name = reader.nextString();
} else if (fieldName.equals("X")) {
x = reader.nextInt();
} else if (fieldName.equals("Y")) {
y = reader.nextInt();
} else if (fieldName.equals("LastX"... | 9 |
public static void main(String[] args) throws java.io.IOException {
if (args.length != 8) {
System.out.println("Usage: Experiment <instance_list> <num_topics> <num_itns> <print_interval> <save_state_interval> <symmetric> <optimize> <output_dir>");
System.exit(1);
}
int index = 0;
String i... | 8 |
public float getWeight() {
return weight;
} | 0 |
public void update() {
int xa = 0, ya = 0;
if (anim < 7500) {
anim++;
} else {
anim = 0;
}
if(input.up) ya--;
if(input.down) ya++;
if(input.left) xa--;
if(input.right) xa++;
if(xa != 0 || ya != 0) {
move(xa, ya);
walking = true;
} else {
walking = false;
}
} | 7 |
public static FacilityCategoryEnumeration fromValue(String v) {
for (FacilityCategoryEnumeration c: FacilityCategoryEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} | 2 |
public void setAlias(String alias)
{
alias = alias.trim();
if ( alias.isEmpty() ) {
throw new RuntimeException( "'alias' should not be empty" );
}
this.alias = alias;
} | 1 |
public void setSolUsuario(String solUsuario) {
this.solUsuario = solUsuario;
} | 0 |
private static JavaMailSenderImpl getMailSender() throws MessagingException {
String password = "chao123jing";//PropertyManager.getInstance().getDbProperty(PropertyManager.DB_EMAIL_PASSWORD, true);
String username = "52673406@qq.com";//PropertyManager.getInstance().getDbProperty(PropertyManager.DB_EMAIL_USERNAME, t... | 0 |
private void selectOption(int option) {
if (allowClick) {
game.jukeBox.play(game.jukeBox.tracks.buttonClick);
if (option == 0) {
if (Bootstrap.MUTE) {
options[0] = "On";
Bootstrap.MUTE = false;
} else {
options[0] = "Off";
Bootstrap.MUTE = true;
}
Bootstrap.MUTECHANGE = 1;
... | 8 |
public void paint(java.awt.Graphics g) {
java.awt.Graphics2D g2d = (java.awt.Graphics2D) g.create();
String text = getText();
java.awt.Dimension size = getSize();
java.awt.Insets ins = getInsets();
java.awt.FontMetrics fm = g2d.getFontMetrics(getFont());
int h = fm.stri... | 7 |
private void loadAllProjects(){//requires components and QC stuff
try {
ResultSet dbAllProjects = null;
Statement statement;
statement = connection.createStatement();
dbAllProjects = statement.executeQuery( "SELECT Project.projectID, Project.projectName, Project.r... | 5 |
public int compareTo(Contact contact) {
if (taxi1 < contact.taxi1) return -1;
if (taxi1 > contact.taxi1) return 1;
if (taxi2 < contact.taxi2) return -1;
if (taxi2 > contact.taxi2) return 1;
if (start < contact.start) return -1;
if (start > contact.start) return 1;
... | 8 |
private void loadBorrowedBooksTable() {
DefaultTableModel dft = (DefaultTableModel) jTable1.getModel();
dft.setRowCount(0);
try {
ResultSet rs = DB.myConnection().createStatement().executeQuery("select * from borrowedbooks order by BorrowedID ASC");
while (rs.next()) {
... | 4 |
public String[] decompile(int[] data) {
StringBuilder builder = new StringBuilder();
for(int i = 0; i < data.length; i++) {
MCSInstruction cmdInstruction = instructions.get(data[i]);
switch(cmdInstruction.getArgLen()) {
case 0:
builder.append(cmdInstruction.getCommandName()+"\n");
break;
case 1:... | 6 |
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 remove_polypoint(int p) {
if (type!=TYPE_POLY || poly.npoints<=3) return;
Polygon pnew = new Polygon();
for (int i=0; i<poly.npoints; i++)
if (i!=p-1)
pnew.addPoint(poly.xpoints[i], poly.ypoints[i]);
poly=pnew;
} | 4 |
* @param filename
* @param ifexists
* @param environment
*/
public static void saveModule(Module module, String filename, String ifexists, Environment environment) {
{ boolean existsP = Stella.probeFileP(filename);
if ((!existsP) ||
Stella.stringEqualP(ifexists, "REPLACE")) {
}
... | 8 |
private void addSensorEx2(){
Sensor input = new Sensor();
input.setUnity("s");
input.setAddDate(new Date(System.currentTimeMillis()));
input.setLowBattery(false);
input.setStatementFrequency(1322);
input.setSamplingFrequency(1050);
input.setGpsLocation(-0.12712, 2.07222);
input.setName("Sensor_Graph");
... | 2 |
private void showChange() {
if (bodyPos.getChildren().contains(hboxChange)) {
return;
}
bodyPos.getChildren().add(1, hboxChange);
} | 1 |
private void addStats() {
this.setAgility(this.agility + 10);
this.setDexterity(this.dexterity + 10);
this.setIntelligence(this.intelligence + 10);
this.setStrength(this.strength + 10);
this.setVitality(this.vitality + 10);
this.setLuck(this.luck + 1);
} | 0 |
private CucaDiagramFileMakerResult createFileInternal(OutputStream os, List<String> dotStrings,
FileFormatOption fileFormatOption) throws IOException, InterruptedException {
if (diagram.getUmlDiagramType() == UmlDiagramType.STATE
|| diagram.getUmlDiagramType() == UmlDiagramType.ACTIVITY) {
new CucaDiagramSi... | 9 |
@Override
public void endSetup(Attributes atts) {
super.endSetup(atts);
} | 0 |
public ArrayList<Object> scanInput() {
Scanner scanner = new Scanner(System.in);
input = scanner.nextLine();
scanner.close();
if (input.contains("Neuer K-Raum")) {
ArrayList<Object> liste = new ArrayList<Object>();
liste.add("Add");
liste.add(legeKo... | 8 |
public static void closeStatement(Statement stmt) {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException ex) {
LOGGER.trace("关闭JDBC Statement失败", ex);
} catch (Throwable ex) {
// We don't trust the JDBC driver: It might throw
// RuntimeException or Error.
LOGGER.trace("关闭JDBC Sta... | 3 |
public void replace_field_from_memory( int i )
{
if(isReadOnly()) return;
try { fdbf.seek( recordpos() + Field[i].fpos ); } catch (IOException e) {}
replacefielddata(i);
update_key();
getfieldsValues();
} | 2 |
public String getClassInfo(int index) {
ClassInfo c = (ClassInfo)getItem(index);
if (c == null)
return null;
else
return Descriptor.toJavaName(getUtf8Info(c.name));
} | 1 |
public void testSaveOsobu() {
Osoba o=new Osoba();
o.setImePrezime("Alen Kopic");
Date datumRodjenja=new Date(1992,10,21);
o.setDatumRodjenja(datumRodjenja);
o.setAdresa("Vitkovac 166");
DBManager.saveOsobu(o);
List<Osoba>osobe=DBManager.dajOsobe();
Boolean tacno=false;
for... | 5 |
private void setupGui() {
setTitle("Update Available!");
setModal(true);
setSize(451, 87);
setResizable(false);
setUndecorated(true);
close.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
... | 5 |
void constructDefLab(){
defLab = new int[DIM*DIM][4];
for (int i=0;i<DIM*DIM;i++){
defLab[i][NORD] = -1;
defLab[i][SUD] = -1;
defLab[i][EST] = -1;
defLab[i][OUEST] = -1;
}
for (int i=0;i<ouvertures.size();i++){
if (ouvertures.get(i).s2.num-ouvertures.get(i).s1.num==1){
defLab[ouvertures.get... | 4 |
public char nextClean() throws JSONException {
for (;;) {
char c = this.next();
if (c == 0 || c > ' ') {
return c;
}
}
} | 3 |
public Event(HashMap<String, String> hint) throws IllegalArgumentException {
final SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
// Must throw errors if this is not an expected date format
formatter.setLenient(false);
this.eventName = hint.get("eventName");
this.venueId = hint.g... | 3 |
@Override
public Long validate(String fieldName, String value) throws ValidationException {
if (value == null) {
return null;
}
try {
return Long.parseLong(value);
} catch (NumberFormatException e) {
throw new ValidationException(fieldName, value, "not a valid long", e);
}
} | 2 |
public void singleOut(StringBuilder sb1, StringBuilder sb2)
throws IOException {
tableWrite(Prop.single_Head, sb1, sb2); // レコードはあるのでテーブルを書く
/* レコード出力 */
for (int i = 0; i < record[1][0].length; i++) {
sb2.append("<tr><td class=\"genre\">")
.append(record[1][2][i])
.append("</td><td class=\"year\"... | 2 |
public void parse() {
parseIndex = 0;
//Split into words
parsingWords = originalString.split(" ");
//The first word is the first word
boolean firstWordInSentence = true;
//A flag for the ending word in a sentence
boolean endingWord = false;
//Currently bui... | 8 |
static void gameloop() {
int i = 1;
do {
round(i);
i++;
} while (askContinue());
} | 1 |
public Song getLightSong(Song currentSong, String userId) {
Song lightSong = new Song(currentSong.getSongId(),
currentSong.getTitle(), currentSong.getArtist(),
currentSong.getAlbum(),currentSong.getOwnerId(), currentSong.getTags(),
currentSong.getRightsByCategory... | 6 |
protected boolean isThisKey(String str) {
boolean result = false;
if (str != null) {
int eqIndex = str.indexOf("=");
result = (str.startsWith("-") && str.substring(1, 2).equals(shortKey()))
|| (str.startsWith("--") && str.substring(2, eqIndex == -1?str.length():eqIndex).equals(fullKey()))... | 5 |
public byte getByte(Object key) {
Number n = get(key);
if (n == null) {
return (byte) 0;
}
return n.byteValue();
} | 1 |
@Override
public double[] updatePlanes(ArrayList<Plane> planes, int round, double[] bearings) {
logger.info(round + " "+ planes.get(1).getLocation());
for(int i = 0; i < planes.size(); i++) {
if (planes.get(i).getLocation().distance(planes.get(i).getDestination())<=2) {
} else if(dynamicPlanes.contains(i) &&... | 9 |
public void tick() {
if (LAND.size()<maxSize) {
population+=1+population*owner.growthRate/100;
if (population>LAND.size()*owner.populationDensity) {
expand();
}
}
if (population>maxPopulation)
population=maxPopulation;
} | 3 |
public ClassRegistry(String s, String as[], String s1)
{
super(as.length);
version = s;
classesToRegister = as;
baseClassName = s1;
Class class1 = null;
try
{
class1 = Class.forName(s1);
}
catch(ClassNotFoundException classnotfounde... | 8 |
public void go()
{
frame = new Frame("Complex Layout !");
b1 = new Button("b1");
b2 = new Button("b2");
frame.add(b1,BorderLayout.WEST);
frame.add(b2,BorderLayout.CENTER);
panel = new Panel(); //默认为FlowLayout
b3 = new Button("b3");
b4 = new Button("b4");
panel.add(b3);
panel.add(b4)... | 0 |
public static List<String> expandWithThesaurus(String node)
throws JSONException {
List<String> resultsList = new ArrayList<String>();
List<String> expandedNodes = new ArrayList<String>();
List<String> expandedTerms = new ArrayList<String>();
List<String> narrower = searchNarrower(node);
List<String> toExp... | 4 |
@EventHandler
public void onPluginMessage(PluginMessageEvent event){
if (event.getTag().equals("BTProxy") && event.getSender() instanceof Server) {
ByteArrayInputStream stream = new ByteArrayInputStream(event.getData());
DataInputStream input = new DataInputStream(stream);
// Important message debugging (c... | 8 |
public void printList() {
System.out.println("print adjacency list size here : " + Canvas.coordListSize);
for (int i=0; i<Canvas.coordListSize; i++) {
System.out.print(i + " ");
for (int j=0; j<adj[i].size(); j++) {
System.out.print(adj[i].get(j) + " ");
... | 2 |
public int compareTo(Card card) {
return (convertRank() - card.convertRank());
} | 0 |
public static TableModel fromCSP(CSProperties p, final int dim) {
List<String> dims = keysByMeta(p, "role", "dimension");
if (dims.isEmpty()) {
return null;
}
for (String d : dims) {
if (Integer.parseInt(p.get(d).toString()) == dim) {
final List<St... | 5 |
@RequestMapping(value = "/save", method = RequestMethod.POST)
public ModelAndView save(@ModelAttribute("teamForm") Teams teamForm) {
List<Team> userInfo = teamForm.getTeamsInfo();
String playerInfo;
String userEnteredPlayerName = null;
int startIndex = 0, endIndex = 0;
List<playerUserInformation> playerInfo... | 6 |
public static void main(String[] args) {
char again;
int n;
double determinant;
do{
print("Enter the dimension of the matrix: ");
n = scan.nextInt();
double[][] matrix = new double[n][n];
print("\nEnter the matrix data:\n");
input(matrix);
determinant = det(matrix);
print("\nThe determinant... | 2 |
private boolean jj_3R_368() {
if (jj_scan_token(LB)) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3R_460()) {
jj_scanpos = xsp;
if (jj_3R_461()) {
jj_scanpos = xsp;
if (jj_3R_462()) {
jj_scanpos = xsp;
if (jj_3R_463()) return true;
}
}
}
while (true) {
x... | 8 |
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 fe... | 6 |
@Override
public void run() {
try {
InputStream input = clientSocket.getInputStream();
OutputStream output = clientSocket.getOutputStream();
byte[] requestData = new byte[8192];
for (int i = 0; i < 8192; i++) {
int inByte = input.read();
if (inByte == 10) { // LF (ASCII = 10) signifies end of... | 8 |
public byte[] getRange(int from,int to) {
if((from < 0)||(to > this.index))
throw new IndexOutOfBoundsException("AutoAllocatingByteBuffer.get() called for invalid buffer range");
return Arrays.copyOfRange(buf, from, to);
} | 2 |
@SuppressWarnings({ "unchecked", "unused" })
@ApiMethod(name = "listMessages")
public CollectionResponse<MessageData> listMessages(
@Nullable @Named("cursor") String cursorString,
@Nullable @Named("limit") Integer limit) {
EntityManager mgr = null;
Cursor cursor = null;
List<MessageData> ... | 5 |
public static void connecJambtoDoor(CABot3Net objRec){
int jambOffset = 2;
int doorOffset = 3;
int netSize =objRec.getInputSize();
int cols = objRec.getCols();
int row;
int toRow;
int jambIndex;
int doorIndex;
double weight = 0.9;
for(int neuron=0; neuron<netSize; neuron++){
... | 7 |
public CtrlPraticiens getCtrl() {
return ctrlP;
} | 0 |
public PrimitiveStructure getPrimitiveChild( boolean strict ) {
if( strict && getChildren().isEmpty() ) {
throw new RuntimeException(getType() + " float data not specified.");
}
if( strict && getChildren().size() > 1 ) {
throw new RuntimeException(getType() + " has t... | 6 |
public void actualiza() {
//Determina el tiempo que ha transcurrido desde que el Applet inicio su ejecución
long tiempoTranscurrido = System.currentTimeMillis() - tiempoActual;
//Guarda el tiempo actual
tiempoActual += tiempoTranscurrido;
if (canasta.getMoveLeft()) {
... | 4 |
public int getColumnIndex(String columnVariableName){
for(Class<?> c=classOfData; c!=null ; c=c.getSuperclass()) {
for(Field f : c.getDeclaredFields()) {
f.setAccessible(true);
Column column = f.getAnnotation(Column.class);
if(column!=null && f.getNam... | 5 |
public void gatherData() {
data = new HashMap<UnitType, Map<Location, Integer>>();
unitCount = new TypeCountMap<UnitType>();
for (Unit unit : getMyPlayer().getUnits()) {
UnitType type = unit.getType();
unitCount.incrementCount(type, 1);
Map<Location, Integer... | 7 |
public void paramFileProcess(){
try {
BufferedReader stream = getFileToRead(fileSet.getParamFile().toString());
String line;
while((line = stream.readLine())!=null){//reading everything line by line
char[] charLine = line.toCharArray();
for(int i =0;i<charLine.length;i++){
if(charLine[i]=='#' ... | 9 |
private void compute_new_v()
{
// p is fully initialized from x1
//float[] p = _p;
// pp is fully initialized from p
//float[] pp = _pp;
//float[] new_v = _new_v;
//float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure 3-A.2 in ISO DIS 11172-3
//float[] p = new float[16];
//float... | 1 |
List<Integer> getRow1(int rowIndex) {
List<Integer> res = new ArrayList<>();
if(rowIndex<=0){
res.add(1);
return res;
}
Integer[] arr = new Integer[rowIndex+1];
int i, j;
for(i=1, arr[0]=1; i<=rowIndex;++i) {
if(arr[i]==null){
arr[i] = 0;
}
for (j = i; j > 0; --j) {
System.out.println... | 4 |
private void printTime(double time) {
System.out.println("Average time taken: " + time + " ms");
} | 0 |
@Override
public Position<T> root() throws EmptyTreeException {
if (root == null)
throw new EmptyTreeException("Empty tree");
return root;
} | 1 |
public Query<T> take(int count)
{
return new Query<T>(new TakeIterable(this._source, count));
} | 0 |
public ErrorHandler getErrorHandler() {
if(errorHandler==null)
errorHandler = createErrorHandler();
return errorHandler;
} | 1 |
public List<GrupoDTO> getAllGrupos(String semestre){
List<GrupoDTO> grupos = new ArrayList<GrupoDTO>();
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
con = EscolarConnectionFactory
.getInstance().getConnection();
String sql = "select id_grupo, clave, descripcion ... | 6 |
public static boolean isSatisfied(int[][] grid, int i, int j, int threshold)
{
int solidarity = 0;
//Sets Upper and Lower Bounds for the area around our given point
int iLB = i - 1;
int iUB = i + 1;
int jLB = j - 1;
int jUB = j + 1;
//Account... | 8 |
public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) {
if (item instanceof ToolItem) {
ToolItem tool = (ToolItem) item;
if (tool.type == ToolType.shovel) {
if (player.payStamina(4 - tool.level)) {
level.setTile(xt, yt, Tile.dirt, 0);
return true;
}
}... | 3 |
@Override
public void actionPerformed(ActionEvent e) {
Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard()
.getContents(null);
String text = new String();
if ((t != null) && (t.isDataFlavorSupported(DataFlavor.stringFlavor))) {
try {
text = (String) t.getTransferData(DataFlavor.stringFla... | 4 |
public static void main(String[] args){
Scanner keyboard = new Scanner(System.in);
int button;
button = keyboard.nextInt();
switch(button){
case 1: System.out.println("cola is served");
break;
case 2: System.out.println("lemonade is served"+',');
break;
case 3: System.out.println("water is serv... | 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.