method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
642b3c18-6bc5-453e-a2db-c85e09aaed13 | 3 | @Override
public void onServerStatusChanged() {
ServerStatusController.ServerStatus serverStatus = ServerStatusController.getServerStatus();
switch (serverStatus) {
case AVAILABLE:
TestInfo testInfo = BmTestManager.getInstance().getTestInfo();
TestInfoCon... |
80e73dff-154c-4cb0-bc93-824acf168d3d | 0 | public BodyPart(int upgradeCount, UpgradeType type, String name){
this.upgrades = new Upgrade[upgradeCount];
this.type = type;
this.name = name;
} |
a881a28d-7f46-477e-a075-5b60c5e09e93 | 1 | public void testSetWeekOfWeekyear_int2() {
MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8);
try {
test.setWeekOfWeekyear(53);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals("2002-06-09T05:06:07.008+01:00", test.toString());
} |
b80fe390-3b78-45d8-a1a9-00b7d21f23a3 | 2 | @Override
public void onEnable(){
plugin=this;
pointsplugin = new BAPointsPluginManager(this);
string = new StringManager();
if(user==null){
user = new BAUserManager(this);
}
new BukkitRunnable() {
@Override
public void run() {
user.load();
}
}.runTaskLater(plugin, 5);
... |
0daa5c96-70fb-4a39-9598-2e41922c56ba | 7 | private boolean isClassBox(String owner) {
if (!owner.startsWith("java/lang/")) {
return false;
}
String className = owner.substring("java/lang/".length());
return (className.equals("Integer") ||
className.equals("Double") ||
className.equals("Long"... |
226e0fd3-7548-4246-b240-5df3f1600fdb | 0 | public static void main(String[] args) {
new ConcurrentNAV().timeAndComputeValue();
} |
ca0173d8-f8ae-43d0-a262-9783e1be1c97 | 8 | private int findChromosomeID( BPTreeNode thisNode, String chromKey){
int chromID = -1; // until found
// search down the tree recursively starting with the root node
if(thisNode.isLeaf())
{
int nLeaves = thisNode.getItemCount();
for(int index = 0; index < nLeave... |
f221efea-9c4a-4e5c-b44a-851a01aecc90 | 2 | public Trail(Thing body, int length, int freq) {
// Initialize a path
this.path = new Vector3D[length];
this.body = body;
this.freq = freq;
for (int i = 0; i < path.length; i++) {
path[i] = body.position.clone();
if (body.parent != null) {
path[i].subtract(body.parent.position);
}
}
} |
fdc50a1d-8e78-4077-806a-22ac6707a4eb | 3 | private boolean HLIDGenerationTest(Object obj, CycAccess cyc) {
try {
String cmd = "(compact-hl-external-id-string "
+ DefaultCycObject.stringApiValue(obj) + ")";
String cycId = cyc.converseString(cmd);
String apiId = null;
if (obj instanceof String) {
apiId = CompactHL... |
79b6c23d-5daa-4e54-8bfb-518d143b2118 | 4 | public static int getIdByIndex(int index) {
int id = -1;
if (index >= 0 && index < ChartData.getSize()) {
for (Integer itemId : data.keySet()) {
if (index == 0) {
id = itemId;
break;
}
index--;
}
}
return id;
} |
9f0ddd55-8a10-46ee-ba3f-ce75dfd28ba3 | 4 | public void add(Component e) {
if (selectedOC != null)
selectedOC.setSelected(false);
selectedOC = null;
if (enteredIC != null)
enteredIC.setSelected(false);
enteredIC = null;
if (e instanceof Stub) {
if (stubs.size() < 4)
stubs.add((Stub) e);
else {
JOptionPane.showMessageDialog(null,
... |
cb3a81b6-8d79-436e-beeb-b6958b08dc6a | 0 | public void SetPriority(int priority)
{
//set the priority of the person for the stop
this.priority = priority;
} |
3eaebd08-ca52-4068-a1b5-4aeb03901ce0 | 0 | protected Element createTransitionElement(Document document,
Transition transition) {
Element te = super.createTransitionElement(document, transition);
FSATransition t = (FSATransition) transition;
// Add what the label is.
te.appendChild(createElement(document, TRANSITION_READ_NAME, null, t
.getLabel())... |
2a370fc0-1d56-4af0-9dc4-643f4e391bfe | 2 | @Override
public String toString() {
String func = retType + " " + name + "(";
int i;
if (parameters.size() > 0) {
for (i = 0; i < parameters.size() - 1; i++) {
func = func + parameters.get(i) + ", ";
}
func = func + parameters.get(i) + ");";
} else {
func = func + ");";
}
return func;
} |
43f02da2-9a8a-4889-beda-b6fb23f666d8 | 6 | public void validate(Evento evento){
if(evento == null || evento.equals("")){
throw new SaveException("Evento não pode ser vazio.");
} else if (evento.getNome() == null || evento.getNome().equals("")){
throw new SaveException("Nome do evento não pode ser vazio.");
} else ... |
c43790c0-e39d-467e-9dee-027bbc5dfa39 | 3 | public int posMax()
{
int MaxValue; //trakcs the maximum value
int MaxValPos = -1; //tracks the position of the maximum value
if(IntValues.length > 0) //if the sequence is nonempty
{
MaxValue = IntValues[0]; //initialize the max value as first value
MaxValPos = 0; //initialize the positi... |
e0def507-f719-4adb-ae08-f556199490ee | 6 | @Override
public final void run() { //Run to clean up any memory leaks we may cause by holding dead tasks
if (tasks.isEmpty()) {
return; // skip cleaning if there are no tasks
}
Iterator<Task> taskItr = tasks.keySet().iterator();
while (taskItr.has... |
eb52321e-c3a1-4713-b40e-baacc62d966d | 2 | public String getAltsStr() {
if (alts == null) return "";
String altsStr = "";
for (String alt : alts)
altsStr += alt + " ";
return altsStr.trim().replace(' ', ',');
} |
53fe4a5e-b29c-4c2e-b925-239cdda9aa53 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final AbstractEntity other = (AbstractEntity) obj;
if (!Objects.equals(this.getUuid(), other.getUuid())) {
... |
aedea65f-e68c-4fd5-84a8-fff5a4563828 | 0 | public String getToDate() {
return toDate;
} |
b9ab9885-8abc-4854-bb3f-45cfc6cce126 | 7 | @SuppressWarnings("unchecked")
private T back()
{
boolean back_left = true, back_right = true;
Comparable<T> lprev = null, rprev = null;
while (true)
{
if (back_left)
if (!left.hasPrev())
return null;
else
lprev = (Comparable<T>)left.prev();
if (back_right)
if (!right.hasPrev()... |
295c53e8-9f06-4fa8-b512-663ed8d45b1a | 1 | public void setSearch(ArrayList<Product> p) {
reset();
if (p.size() > 0) {
panel.setVisible(true);
btnSil.setVisible(true);
btnGuncelle.setVisible(true);
Product p2 = p.get(0);
textField_1.setText(p2.getpId() + "");
textField_2.setText(p2.getpName());
textField_3.setText(p2.getAmount() + "")... |
9bbedbb7-3665-49e7-bc87-0a5169ec75d4 | 7 | public static TobiiEventMap loadTobiiEvent3(File file) throws IOException {
CSVReader reader = new CSVReader(new FileReader(file), '\t');
String[] line;
// Get header data for this file
TobiiHeader header = readHeader(reader);
TobiiEventMap eventMap = new TobiiEventMap(header);
// Work our way dow... |
e5ead41d-2abd-4482-ac5d-3043b672ce08 | 5 | @Override
public Response handle(JsonElement data) {
Response res;
Fingerprint fprint = GsonFactory.getGsonInstance().fromJson(data, Fingerprint.class);
if (fprint.getLocation() != null && ((Location)fprint.getLocation()).getId() != null && ((Location)fprint.getLocation()).getId().intValue() != -1) {
Locat... |
de91861e-4865-4e0f-a553-9cac5189c9d4 | 2 | public void suivant(){
if (indiceRapportVisiteCourant == lesRapportsVisites.size()-1) {
indiceRapportVisiteCourant = 0;
} else {
indiceRapportVisiteCourant = indiceRapportVisiteCourant + 1;
}
DefaultTableModel model = (DefaultTableModel) this.vue.getjTableOffre().... |
94f4b7c4-5f50-4c70-83f4-d5fd72ed3fc0 | 3 | public Nodo predecessor(Nodo nodo){
if(nodo.getLeft() == null){
return maximo(nodo.getLeft());
}
else{
Nodo nodoAux = pai(root, nodo.getKey());
while(nodoAux != null && nodoAux.getLeft() == nodo){
nodo = nodoAux;
nodoAux = pai(r... |
e336b407-442e-444d-9213-15f0eba712c9 | 1 | private static int charAt(String s, int d) {
if (d < s.length()) return s.charAt(d);
else return -1;
} |
5a26626b-5fdd-45fa-b681-03caeb29d52c | 6 | private final Class348_Sub19_Sub1 method310(int i, int i_5_, byte i_6_,
int[] is) {
anInt375++;
int i_7_ = i ^ (0xfff0 & i_5_ << -2102985404 | i_5_ >>> -313218292);
i_7_ |= i_5_ << 1075063824;
int i_8_ = -113 / ((i_6_ - 16) / 34);
long l = (long) i_7_ ^ 0x100000000L;
Class348_Sub19_Sub1 class348_sub19_sub1
... |
af7b6c27-74b7-4d5e-856e-73cab9d2c4b9 | 4 | private void rotate()
{
//orient++;
if (orient%4==0)
{
litPositions=new int[][]
{{0,1,0},
{1,1,1},
{0,0,0}};
}
if (orient%4==1)
{
litPositions=new int[][]
{{0,1,0},
{0,1,1},
{0,1,0}};
}
if (orient%4==2)
{
litPositions=new int[][]
... |
33da423b-7eb9-419c-b12a-af8d28bc77c2 | 4 | private BackupPeriod getBackupPeriod() {
BackupPeriod backupPeriod = BackupPeriod.DISABLED; // Set backupPeriod to default: DISABLED.
String backupPeriodString = Controller.getProperty(ApplicationProperties.BACKUP_PERIOD);
boolean backupPeriodNull = false;
if (backupPeriodString != null && !"".equals(backupP... |
0ceac0a8-71fb-4d41-a9f2-a90eeb473381 | 7 | public String toString() {
String retStr = "\n-----------------------------------------\n";
retStr += " ";
for (int i = 1; i < 10; i ++) {
retStr += i + " ";
if (i % 3 == 0) {
retStr += " ";
}
}
for (int i = 0; i < 9; i++) {
if ( i % 3 == 0) {
retStr += "\n --------------------------... |
76121b7d-5883-4d27-8051-34a708a71b0e | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if((msg.targetMinor()==CMMsg.TYP_ENTER)
&&(msg.target()==this))
{
final MOB mob=msg.source();
if((mob.location()!=null)&&(mob.location().roomID().length()>0))
{
int... |
0f9618fd-ccf3-4679-b07b-ccc8a996676b | 5 | public static Pair<String> splitFirst(String str, String out)
{
if (str == null || "".equals(str))
{
return null;
}
if (str.length() < out.length())
{
return null;
}
if (str.equalsIgnoreCase(out))
{
return new Pair<String>("", "");
}
int ind = str.indexOf(out);
if (ind == -1)... |
e03caaa3-4d1a-40d9-9702-b38782c0a4a0 | 6 | public double matchAtFrom(int i, int j) {
while(j < children.length) {
double cur;
if (children[j].optional) {
PartMatcher incl, excl;
Regex.GroupMap inclGroups,... |
65bc0046-fcaf-407f-a696-28ccfd196230 | 5 | public void resolveConflict(Transaction me, Transaction other) {
long transferred = 0;
ContentionManager otherManager = other.getContentionManager();
for (int attempts = 0; ; attempts++) {
long otherPriority = otherManager.getPriority();
long delta = otherPriority - priority;
if (delta < 0... |
d3118637-f992-4dc0-88d2-2859b271619a | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just intimidated the enemy!");
return random.nextInt((int) agility) * 4;
}
return 0;
} |
91ba104b-631c-4106-9757-3c674f169aee | 0 | @Override
public String getCalle() {
return super.getCalle();
} |
671d77ac-b56a-4a67-80ac-99ad5e7accad | 9 | public BufferedImage HistogramSpecification(ImageClass im2){ // Especificacion del histograma con otra imagen de muestra
int[] imhisto = this.getAcumulativeValues();
int[] imhisto2 = im2.getAcumulativeValues();
double []imh1 = new double[256];
double []imh2 = new double[256];
... |
703ec5d6-7bbd-4808-b670-7e34a2fd059f | 8 | @Override
public void run() {
try {
// Opening the socket
socket = new DatagramSocket(serverUDPPort);
/* Registering to the Registry Server */
registerRegistryServer();
getOtherServers();
// Listen to articles and pings
byte buffer[] = new byte[1024];
DatagramPacket pkg = new Datagr... |
21b54a24-46d3-47f3-98cd-85fbf47ed326 | 3 | public void paint(Graphics g)
{
if (fm == null) {
this.font = mcd.getFont();
this.fm = mcd.getFontMetrics(font);
}
updateSize();
Graphics2D g2d = (Graphics2D) g;
g2d.setFont(font);
RoundRectangle2D r = new RoundRectangle2D.Double(getX(), getY... |
49987473-8d1e-4832-8427-3f701a4c8f4f | 5 | @Override
public Object getValueAt(int row, int col) {
if (col == 0) {
if (panel.isCellEditable(row)) {
return TEXT_DELETE;
} else {
return "";
}
} else if (col == 1) {
boolean isReadOnly = ((Boolean) readOnly.get(row)).booleanValue();
if (isReadOnly) {
return OutlineEditableIndicator.IC... |
b9155e56-a1e9-4207-a40a-b09775806ddb | 2 | public FieldVisitor visitField(
final int access,
final String name,
final String desc,
final String signature,
final Object value)
{
StringBuffer sb = new StringBuffer();
appendAccess(access | ACCESS_FIELD, sb);
AttributesImpl att = new AttributesImp... |
c001786a-4dd2-4386-96d9-f4dc9bf858e6 | 2 | public static boolean registerObject(ChunkyObject object) {
HashMap<String, ChunkyObject> ids = OBJECTS.get(object.getType());
if (ids == null) {
ids = new HashMap<String, ChunkyObject>();
OBJECTS.put(object.getType(), ids);
}
if (ids.containsKey(object.getId())) ... |
6c3d99ff-703a-4d9c-bfb6-febbb319af12 | 8 | public void reduce(Text key, Iterable<Text> values, Context context)
throws IOException, InterruptedException {
edits.clear();
langCounts.clear();
for (Text str : values) {
try {
edits.add(new JSONObject(str.toString()));
} catch (JSONException e) {
logger.error("Error parsing JSON from mapper... |
e4d5a9af-c4df-4ec7-941a-366cec83fa23 | 7 | public static Keyword uSignumSpecialist(ControlFrame frame, Keyword lastmove) {
{ Proposition proposition = frame.proposition;
Stella_Object mainarg = (proposition.arguments.theArray)[0];
Stella_Object mainargvalue = Logic.argumentBoundTo(mainarg);
DimNumberLogicWrapper mainargdim = ((mainargvalue... |
bc61cc1b-b013-46cf-87d4-2bdb10319af6 | 6 | public void backToMenu() {
int reply = JOptionPane.showConfirmDialog(null, "Would you like to return to the Main Menu?");
if(reply == JOptionPane.YES_OPTION) {
timer.stop();
reply = JOptionPane.showConfirmDialog(null, "Would you like to save your progress before quiting?");
if(reply == JOptionPane.YES_OPTI... |
4309075c-947b-4257-b833-b1659919629e | 0 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
System.out.println("==end Element");
} |
e0c5c5d2-b2ad-4bdc-a733-d3bd4a6cb99a | 0 | @Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Car");
sb.append("{carPhysics=").append(carPhysics);
sb.append('}');
return sb.toString();
} |
03374046-2523-44cf-ab71-9c25c6c9495c | 3 | private void doUpdate() {
//check so everything is ok
if (!Validate.tfEmpty(tfBenamning)) {
if (Validate.notOverSize(taBeskrivning) && Validate.notOverSize(tfBenamning)) {
updateKompetens();
PanelHelper.cleanPanel(PanelHelper.getMainFrame().getMfRight());
... |
9a62d664-1d39-4cbc-9e5d-7e0c6dfed431 | 4 | @Override
public void cook() {
Iterator<IFoodMaterial> iFoodMaterialIterator = foodMaterials.iterator();
while (iFoodMaterialIterator.hasNext()) {
IFoodMaterial foodMaterial = iFoodMaterialIterator.next();
if ("牛肉".equals(foodMaterial.getName())) {
foodMateria... |
2e7aa7ac-659a-48f1-b760-7f9cabff3ff1 | 3 | private int pickFruit(int [] platter)
{
// generate a prefix sum
int[] prefixsum = new int[NUM_FRUITS];
prefixsum[0] = platter[0];
for (int i = 1; i != NUM_FRUITS; ++i)
prefixsum[i] = prefixsum[i-1] + platter[i];
int currentFruitCount = prefixsum[NUM_FRUITS-1];
... |
61268e8f-b2b1-49fe-8487-a0858c1010d3 | 1 | private boolean addImportFormat(String formatName, OpenFileFormat format) {
if (isNameUnique(formatName, importerNames)) {
format.setName(formatName);
importerNames.add(formatName);
importers.add(format);
// Also add it to the list of formats stored in the preferences
Preferences.FILE_FORMATS_IMPOR... |
e72a7a91-5f0e-4584-b9e1-8f149802d643 | 3 | public Cell selectCellCoord(int x, int y) {
for (Cell tempCell : cells) {
if (tempCell.x == x && tempCell.y == y) return tempCell;
}
return null;
} |
bf7f93b9-1724-4619-94c6-734d1c085034 | 3 | private boolean jj_3_2()
{
if (jj_scan_token(LEFTB)) return true;
if (jj_3R_9()) return true;
if (jj_scan_token(RIGHTB)) return true;
return false;
} |
c5ff9c2c-e927-4878-a5ed-6cfc4bf9f618 | 3 | private List<Cluster> getResultingClusters(Map<Node, Color> nodeClusterMapping)
{
Map<Color,List<Node>> clusters = new HashMap<Color, List<Node>>();
for(Map.Entry<Node, Color> nodesCluster : nodeClusterMapping.entrySet()) {
List<Node> clusterNodes = new ArrayList<Node>();
Col... |
d8391c92-954d-450d-9b7c-fef37e42aab9 | 1 | public static void finish(String message) {
try {
after = System.currentTimeMillis();
String output = "Completed " + message + NEWLINE;
console.append(output);
console.append("Operation took: " + (after - before)/1000.0 + " seconds." +... |
f3aed21f-dcd8-4d67-914e-c27b5220680c | 2 | protected DirectoryFileFilter(String baseDir, String excludeDirs)
{
exclusionList = new ArrayList();
StringTokenizer st = new StringTokenizer(excludeDirs, ",");
while (st.hasMoreTokens())
{
String token = st.nextToken().trim();
if (token.equals("."))
{
exclusionList.add(baseDir);
}... |
e8d27134-957d-4b23-bd99-22fe3fb485e1 | 2 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((browser == null) ? 0 : browser.hashCode());
result = prime * result + id;
result = prime * result
+ ((operatingSystem == null) ? 0 : operatingSystem.hashCode());
return result;
} |
a654b491-c01f-4965-90f0-5a5e94152ba5 | 2 | public Matrix4f mul(Matrix4f r) {
Matrix4f res = new Matrix4f();
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
// @formatter:off
res.set(i, j, m[i][0] * r.get(0, j) +
m[i][1] * r.get(1, j) +
m[i][2] * r.get(2, j) +
m[i][3] * r.get(3, j));
// @formatter:on
}
... |
4d8cc433-fd72-40df-89e0-5b45b0c12b5b | 7 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Piece other = (Piece) obj;
if (color == null) {
if (other.color != null) {
return false;
}
}
else if ... |
b9cc6b93-1629-4b39-ae54-495e4e862a08 | 1 | public java.security.cert.X509Certificate[] getAcceptedIssuers() {
java.security.cert.X509Certificate[] chain = null;
try {
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
KeyStore tks = KeyStore.getInstance("JKS");
tks.load(this.getClas... |
2e76e956-64f4-4ae2-a867-0fc0a1508fac | 7 | final void method645(Component component) {
javax.sound.sampled.Mixer.Info ainfo[] = AudioSystem.getMixerInfo();
if (ainfo != null) {
javax.sound.sampled.Mixer.Info ainfo1[] = ainfo;
for (int i = 0; ainfo1.length > i; i++) {
javax.sound.sampled.Mixer.Info info = a... |
49cf17e1-ada9-4d25-a112-5657e00a9da8 | 5 | public AbstractAction getKeyListener(final String move) {
return new AbstractAction() {
private static final long serialVersionUID = 1L;
public void actionPerformed(ActionEvent evt) {
Coordinate newLocation = null;
if (move.toUpperCase().equals("UP")){
newLocation = game.getPlayerLocation().getNort... |
1932a71f-53fb-43d8-9dd7-91f081ae7b99 | 5 | public void update(){
checkKeys();
if(score >= highScore){
highScore = score;
}
for(int row = 0; row < ROWS; row++){
for(int col = 0; col < COLS; col++){
Tile current = board[row][col];
if(current == null) continue;
current.update();
resetPosition(current, row, col);
if(current.g... |
1ef5f5ba-54fa-4771-a1a5-8d91c1eb705b | 8 | static final void method3324(AbstractToolkit var_ha, byte i, long l) {
do {
try {
Class122.anInt1803 = 0;
FileIndexTracker.anInt4797 = Class313.totalParticals;
Class318_Sub1_Sub5.currentParticles = 0;
anInt7120++;
Class313.totalParticals = 0;
long l_1_ = Class62.getCurrentTimeMillis();
Class318_Sub1... |
dca62014-2cff-435b-901a-d3e8eb71f202 | 2 | @Override
public ArrayList<Secteur> getAll() throws DaoException {
ArrayList<Secteur> result = new ArrayList<Secteur>();
ResultSet rs;
// préparer la requête
String requete = "SELECT * FROM SECTEUR";
try {
PreparedStatement ps = Jdbc.getInstance().getConnexion().p... |
91575285-bf5d-44e4-b6b7-7cc51c02772c | 2 | public EditItemInventory(String prodName, String code, double price, int stock, final int id) {
setTitle("Edit Item");
setBounds(500, 500, 400, 150);
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0};
gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0,... |
d621c536-3c44-41f8-a74a-c6424f2f1283 | 1 | public void setHealth(int healt) {
if(health <= 0){
this.die();
}
this.health = healt;
} |
12784a92-0e45-4f23-b343-8b601b36dee8 | 3 | public HashMap<String, Epoque> getAllEpoques() {
List listeEpoquesXML = racine.getChildren("epoque");
HashMap<String, Epoque> listeEpoques = new HashMap();
Iterator i = listeEpoquesXML.iterator();
while (i.hasNext()) {
Epoque ep = new Epoque();
... |
c8f9f7e5-3067-49b9-938f-97618fb8e28f | 7 | public void enumerate() {
effectiveCounter = 0;
feasibleCounter = 0;
int j = -1;
do {
if (j >= 0) {
cuts[j]--;
}
long unused = stockLength;
int k = -1;
for (int i = 0; i < cuts.length; i++) {
if... |
3891c7df-ec25-468b-9012-17667e4f6c24 | 8 | static ContentType interleave(ContentType t1, ContentType t2) {
if (t1.isA(ZERO_OR_MORE_ELEMENT_CLASS) && t2.isA(ZERO_OR_MORE_ELEMENT_CLASS))
return INTERLEAVE_ZERO_OR_MORE_ELEMENT_CLASS;
if (((t1.isA(MIXED_MODEL) || t1 == TEXT) && t2.isA(ZERO_OR_MORE_ELEMENT_CLASS))
|| t1.isA(ZERO_OR_MORE_ELEMENT... |
aec71dc5-6b4d-4e2d-ba38-1e180d4a8294 | 1 | public void moveTo(Vector2 toTile) {
IPathFinder pathFinder = new AStarPathFinder(World.getWorld().getLayerMap());
Path path = pathFinder.getShortestPath(getGridPosition(), toTile);
this.considered = ((AStarPathFinder)pathFinder).considered;
this.usedPath = ((AStarPathFinder)pathFinder).thePath;
if(path != nu... |
928e673b-7431-43b7-a207-cfeaeafb752e | 3 | private static boolean handlePossibleMove(Board b, ArrayList<Move> moves, Move m, int opponentColor) {
try {
if (b.spaceHasOpponent(m.end, opponentColor)) {
moves.add(m);
return false;
} else if (b.spaceIsEmpty(m.end)) {
moves.add(m);
return true;
}
return false;
} catch (IndexOutOfBound... |
58c18306-5458-44d5-a493-4b595f1fc2b3 | 3 | private int getParamNumberInCommand(String command) {
int result = 0;
if (command == null) return result;
for (int i = 0; i < command.length(); i++) {
if (command.substring(i,i+1).equalsIgnoreCase("?")) result++;
}
return result;
} |
14e914c6-90cb-445b-b69d-cddeea685482 | 1 | private void setFitness() {
for(int i = 0; i < numberOfParticles; i++){
double currentfitness = objectiveFunction.CalculateFitness(position[i]);
fitness.put(i, currentfitness);
}
} |
39204fdd-dfdb-4c77-b814-3ca547a6a4a3 | 1 | public boolean end() {
return this.eof && !this.usePrevious;
} |
46bfb00e-8712-4aec-84b8-ae1ee4ba7a94 | 8 | public /*@pure@*/ boolean checkInstance(Instance instance) {
if (instance.numAttributes() != numAttributes()) {
return false;
}
for (int i = 0; i < numAttributes(); i++) {
if (instance.isMissing(i)) {
continue;
} else if (attribute(i).isNominal() ||
attribute(i).isString()) {
if (!(U... |
66dbcbd6-6139-482b-b6ba-78e30a72a48d | 2 | public static String applyRelativePath(String path, String relativePath) {
int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR);
if (separatorIndex != -1) {
String newPath = path.substring(0, separatorIndex);
if (!relativePath.startsWith(FOLDER_SEPARATOR)) {
newPath += FOLDER_SEPARATOR;
}
return ... |
94a3eacd-40e8-4c9a-bd18-4478d1db46f5 | 4 | public void paintComponent(Graphics g) {
switch(status) {
case 1:
paintBackgroundAndStuff(g);
break;
case 2:
paintBackgroundAndStuff(g);
drawContinueArrow(g, image.getWidth() - 200, image.getHeight() - 110);
break;
case 3:
paintBackgroundAndStuff(g);
drawOldTutorial(g, this.getSi... |
b0b81920-69eb-48c4-a797-9b2744abcc88 | 8 | public void render(Graphics g){
g.setColor(Color.BLACK);
g.setFont(JudokaComponent.bigFont);
JudokaComponent.drawTextBox(170, 160, 350, 35, g);
g.drawImage(JudokaComponent.judokaMatte, 640, 120, 160, 240, null);
g.setColor(Color.BLACK);
g.drawString(name, 175, 187);
if(timer % 60 < 30 && selectedIt... |
6b08ea9b-c41c-4af1-bc5e-8109ef3d0926 | 4 | public Element appendAt(String parentPath, String prefix, String name, Map<String, String> namespaces) throws Exception {
Element output = null;
Node parent = Utilities.selectSingleNode(this.doc, parentPath, this.namespaces);
String uri = null;
if(!Utilities.isNullOrWhitespace(prefix) && namespaces != nul... |
d0fa05bf-a469-4f73-aa60-d565460cde3b | 4 | public void setUserRoleField(String nodeName,String content) {
if (nodeName.equals("roleid")) setRoleId(Long.parseLong(content));
if (nodeName.equals("name")) setName(content);
if (nodeName.equals("shortname")) setShortName(content);
if (nodeName.equals("sortorder")) setSortOrder(Integer.parseInt(conten... |
d2c07949-b398-49fe-bb72-45f0f6defcf9 | 3 | public Class<?> getColumnClass(int n) {
if (columnClasses == null)
throw new IllegalStateException("columnClasses not set");
int max = columnClasses.length;
if (n>=max)
throw new ArrayIndexOutOfBoundsException(
"columnClasses has " + max + " elements; you asked for " + max);
return columnClasses[n];
} |
15fd8aa5-6c91-49b0-a385-72609f0a40b2 | 2 | public int getGeometryIndex(int stake) {
RoadGeometry toFind = geometry.get(0);
for (RoadGeometry section : stakes.keySet()) {
if (stakes.get(section).contains(stake)) {
toFind = section;
break;
}
}
return geometry.indexOf(toFind);
} |
8fce3e4a-91e9-4d4e-a6d0-d8cf554b1cf0 | 4 | @Override
public boolean isDead()
{
// The handler is dead if it was killed
if (this.killed)
return true;
// or if autodeath is on and it's empty (but has had an object in it previously)
if (this.autodeath)
{
// Removes dead handleds to be sure
removeDeadHandleds();
if (this.started && th... |
73f18f0b-56e6-499c-b942-317345232f0c | 4 | @Test
public void testSave1() {
Session session=null;
Transaction tx = null;
User user=null;
try{
session=sessionFactory.openSession();
tx= session.beginTransaction();
user=new User();
user.setAge(26);
user.setName("刘江龙");
user.setCreateTime(new Date());
user.setExpireTime(new Date());
... |
db2f7d4b-f5e5-4061-b49f-555b038f210b | 1 | private void setUpGUI() {
// add split pane to application frame
this.add(share);
southPanel.setPreferredSize(new Dimension(500,500));
southPanel.setLayout(new BorderLayout());
southPanel.add(textScroll, BorderLayout.CENTER);
if (controllsOption != null)
southPanel.add(controllsOption, BorderLayout.PAGE_... |
f110cb1d-4d61-4dbb-ab8b-bf0005ee547d | 4 | public static void main(String[] args) {
ProxyFactory factory = new ProxyFactory();
factory.setInterfaces(new Class[] { TestInterface.class });
factory.setFilter(new MethodFilter() {
@Override
public boolean isHandled(Method m) {
if (m.getName().equals("doTest")) {
return true;
}
return fa... |
f45080cc-e3eb-4930-824a-0b3dd3046a9e | 1 | public List<PosSolicitud> getSolicitudesNuevasFromPos(int idPos){
try {
return getHibernateTemplate().find(
"from PosSolicitud where solEstado = 'X' and solPosId = ? ", idPos);
} catch (DataAccessException e) {
e.printStackTrace();
return new Array... |
aca2e0d8-de2f-43d1-bf76-498c7313629b | 2 | public void mousePressed(MouseEvent e)
{
java.awt.Point point = e.getPoint();
if (table.getSelectedRowCount() == 0
|| !table.isRowSelected(table.rowAtPoint(point)))
table.changeSelection(table.rowAtPoint(point), 0, false, false);
} |
efff6d68-dce0-4631-a239-8f9f03f7e536 | 3 | public void refreshList () {
if ((rosterTableModel == null) || (MainWindow.rosterDB == null))
return;
rosterTable.removeAll();
for (Roster r: MainWindow.rosterDB.getRosters()) {
rosterTable.add( r);
}
rosterTable.changeSelection(0, 0, false, false);
rosterTableModel.fireTableDataChanged();
} |
37bc7246-4133-4637-863f-c110042a0852 | 2 | private void doViewAllCYs(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String pageNum = StringUtil.toString(request.getParameter("pageNum"));
if("".equals(pageNum)) {
pageNum = "1";
}
try {
Pager<ChengYuan> page... |
3fbf3a80-5831-4078-8abd-37ea3f4ff0a3 | 5 | protected void loadSamples(String samples) {
if (verbose) Timer.showStdErr("Loaded GTEx experiments from file " + samples);
if (!Gpr.canRead(samples)) throw new RuntimeException("Cannot find samples file '" + samples + "'");
experiments = new HashMap<String, GtexExperiment>();
LineFileIterator lfi = new LineF... |
f59a4cc7-bff4-4f96-a82a-eb559f64e051 | 9 | public static void minimizeInsertions(List<Insertion> insertions, List<Deletion> deletions, Map<String, String> relabelings) {
List<Insertion> insertionsToRemove = new ArrayList<Insertion>();
List<Deletion> deletionsToRemove = new ArrayList<Deletion>();
Map<String, String> parentToInserted = new HashMap<String... |
964f4232-57a1-43b3-890f-a7313a30199d | 7 | public void deleteSubscribedCategories(int studentid){
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
try{
String sql="DELETE FROM student_category_mapping WHERE s_id=(?)";
con=ConnectionPool.getConnectionFromPool();
ps=con.prepareStatement(sql);
ps.setInt(1, studentid);
ps.ex... |
a0e5f249-611e-4dd6-ad19-fd42ba557694 | 8 | private PolizaElectronica actualizarConBase(PolizaElectronica pol) {
for (int i = 1; i < base.length; i++) {
String poliza = base[i][colNumPolBase - 1];
// Si coinciden las polizas
if (poliza.equals(pol.getNumPol())) {
String rutaDoc = base[i][colRutaDoc - 1];
System.out.println("POliza = "+pol.get... |
651c3b79-6ee7-4d54-a568-ae01184b2673 | 6 | public Object getValueAt(int row, int col) {
if (col==bytesPerRow) {
// Get ascii dump of entire row
int pos = editor.cellToOffset(row, 0);
if (pos==-1) { // A cleared row (from deletions)
return "";
}
int count = doc.read(pos, bitBuf);
for (int i=0; i<count; i++) {
char ch = (char)bitBuf[i... |
9ea3d76f-93c4-4085-9194-195e5898fa83 | 9 | public void validate() throws XPathException {
name = typeCheck("name", name);
select = typeCheck("select", select);
int countChildren = 0;
NodeInfo firstChild = null;
AxisIterator kids = iterateAxis(Axis.CHILD);
while (true) {
NodeInfo child = (NodeInfo)kids.... |
8c6c1260-2ef1-41a7-942c-1200544a30a3 | 9 | public Location getAdjacentLocation(int direction)
{
// reduce mod 360 and round to closest multiple of 45
int adjustedDirection = (direction + HALF_RIGHT / 2) % FULL_CIRCLE;
if (adjustedDirection < 0)
adjustedDirection += FULL_CIRCLE;
adjustedDirection = (adjustedDirect... |
6663265f-a098-4aa5-814a-26f9967de25f | 5 | public void drawChar(char ch)
{
Font font = new Font("monospaced", 0, 16);
GlyphVector gv = font.createGlyphVector(new FontRenderContext(null, false, true), ""+ch);
Shape shape = gv.getOutline();
PathIterator pi = shape.getPathIterator(null, 0.1D);
double[] coords = new double[6];
GLUtessella... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.